RHEL6.4下搭建apache和subversion(SVN)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RHEL6.4下搭建apache和subversion(SVN)相关的知识,希望对你有一定的参考价值。
1、说明
rhel6.4系统下搭建apache+svn
2、实现
1)在服务器上安装配置SVN服务;
2)SVN服务支持svnserve独立服务模式访问;
3)SVN服务支持Apache的http模式访问。
3、安装svn服务器
[[email protected] ~]# yum install -y subversion [[email protected] ~]# rpm -qa|grep subversion subversion-1.6.11-15.el6_7.x86_64
4、安装apache服务器
[[email protected] ~]# yum install -y httpd [[email protected] ~]# rpm -qa|grep http httpd-2.2.15-56.el6.centos.3.x86_64
5、配置SVN版本库
[[email protected] ~]# mkdir /svn [[email protected] ~]# svnadmin create /svn/reed [[email protected] ~]# cd /svn/reed/ [[email protected] reed]# ll total 24 drwxr-xr-x 2 root root 4096 Apr 6 05:09 conf drwxr-sr-x 6 root root 4096 Apr 6 05:09 db -r--r--r-- 1 root root 2 Apr 6 05:09 format drwxr-xr-x 2 root root 4096 Apr 6 05:09 hooks drwxr-xr-x 2 root root 4096 Apr 6 05:09 locks -rw-r--r-- 1 root root 229 Apr 6 05:09 README.txt
6、用户密码passwd配置
[[email protected] reed]# cd conf/ [[email protected] conf]# ll total 12 -rw-r--r-- 1 root root 1080 Apr 6 05:09 authz -rw-r--r-- 1 root root 309 Apr 6 05:09 passwd -rw-r--r-- 1 root root 2279 Apr 6 05:09 svnserve.conf [[email protected] conf]# vim passwd [[email protected] conf]# grep ‘^[^#]‘ passwd [users] admin=123 reed=123 deer=123
7、权限控制authz配置
[[email protected] conf]# vim authz [[email protected] conf]# grep ‘^[^#]‘ authz [aliases] [groups] [/] *=r admin=rw [/public] *=rw [/reed] admin=rw reed=rw *= [/deer] admin=rw deer=rw *=
8、服务svnserve.conf配置
[[email protected] conf]# vim svnserve.conf [[email protected] conf]# grep ‘^[^#]‘ svnserve.conf [general] anon-access = none #禁止匿名访问,设置为none。默认为read,参数:read,write,none password-db = passwd authz-db = authz realm = /svn/reed #每个SVN项目的认证名,会在认证提示里显示,建议写项目名称。 [sasl] [[email protected] conf]#
9、启动SVN服务
[[email protected] conf]# svnserve -d -r /svn
10、使用checkout导出文件
[[email protected] deer]# svn co svn://127.0.0.1/reed Authentication realm: <svn://127.0.0.1:3690> /svn/reed Password for ‘root‘: Authentication realm: <svn://127.0.0.1:3690> /svn/reed Username: deer Password for ‘deer‘: ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn://127.0.0.1:3690> /svn/reed can only be stored to disk unencrypted! You are advised to configure your system so that Subversion can store passwords encrypted, if possible. See the documentation for details. You can avoid future appearances of this warning by setting the value of the ‘store-plaintext-passwords‘ option to either ‘yes‘ or ‘no‘ in ‘/root/.subversion/servers‘. ----------------------------------------------------------------------- Store password unencrypted (yes/no)? yes A reed/deer A reed/public Checked out revision 1. [[email protected] reed]# ls deer public [[email protected] reed]# svn up . A public/restartsvn.sh Updated to revision 2. [[email protected] reed]#
11、配置svn支持http访问
通过 Http 协议访问版本库是 Subversion 的亮点之一。使用 Http 协议意味着只需要打开浏览器,输入 URL 即可轻松的浏览整个版本库。灵活通常带来复杂性,Http 方式相对于 svnserve 方式来说需要更多的配置。
由于 Subversion 需要版本化的控制,因此标准的 Http 协议不能满足需求。要让 Apache 与 Subversion 协同工作,需要使用 WebDAV(Web 分布式创作和版本控制)。WebDAV 是 HTTP 1.1 的扩展,关于 WebDAV 的规范和工作原理,可以参考 IETF RFC 2518。
为了使 Subversion 与 dav 模块通信,需要安装 mod_dav_svn 插件。
11.1、安装mod_dav_svn
[[email protected] conf]# yum install mod_dav_svn
11.2、配置subversion.conf
[[email protected] conf.d]# grep ‘^[^#]‘ subversion.conf LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /reed> DAV svn SVNPath /svn/reed AuthType Basic # 使用基本认证方式,即用户名、密码认证 AuthName "svn reed" # 在认证对话框中出现的提示信息 AuthUserFile /svn/reed/svnuser # 指定http存放用户名信息的文件路径 AuthzSVNAccessFile /svn/reed/conf/authz #AuthzSVNAccessFile 指向的是 authz 的策略文件 Satisfy Any Require valid-user # 限定只有用户输入正确的用户名和密码后才能访问该标签所指向的路径 </Location>
11.3、创建账号密码认证文件
/svn/reed/conf/authz文件是svnserve独立服务器使用的认证文件,密码没有加密,明文显示。
/svn/reed/svnuser文件是Apache的http模式使用的认证文件,密码使用MD5加密。
authz和svnuser文件中,账号密码必须设置相同。
[[email protected] conf.d]# htpasswd -c /svn/reed/svnuser admin New password: Re-type new password: Adding password for user admin [[email protected] conf.d]# htpasswd /svn/reed/svnuser reed New password: Re-type new password: Adding password for user reed [[email protected] conf.d]# htpasswd /svn/reed/svnuser deer New password: Re-type new password: Adding password for user deer
12、启动httpd服务
[[email protected] conf.d]# /etc/init.d/httpd start Starting httpd: httpd: apr_sockaddr_info_get() failed for reedoracle httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
13、测试
13.1、通过客户端访问
13.2、通过浏览器访问
本文出自 “[[email protected]卢伟开~]#rm -rf /” 博客,请务必保留此出处http://luweikai.blog.51cto.com/1705672/1913530
以上是关于RHEL6.4下搭建apache和subversion(SVN)的主要内容,如果未能解决你的问题,请参考以下文章
RHEL6.4 postfix+dovecot搭建邮件服务器
在 RHEL 6.4 上手动构建和安装 Apache 2.4.x