首页 > 代码库 > 实战搭建 apache + svn 服务
实战搭建 apache + svn 服务
SVN 作为版本控制软件是非常优秀的免费软件,现在想通过http://.. 访问,本文介绍一下搭建。
1.系统环境
[root@rsync ~]# uname -r
2.6.32-642.6.1.el6.x86_64
[root@rsync ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
系统IP:10.89.1.32
2.实战搭建
#安装所需要的软件
[root@svn ~]# yum install subversion httpd mod_dav_svn -y
[root@svn ~]# mkdir /var/repos -p
[root@svn ~]# cd /var/repos/
[root@svn repos]# ls
#创建项目文件目录 wolveszf.com 和 kjcat.com
[root@svn repos]# svnadmin create /var/repos/wolveszf.com
[root@svn repos]# svnadmin create /var/repos/kjcat.com
[root@svn repos]# ls
kjcat.com wolveszf.com
[root@svn repos]# cd kjcat.com/
[root@svn kjcat.com]# ls
conf db format hooks locks README.txt
#修改访问权限
[root@svn kjcat.com]#chown apache:apache /var/repos -R
[root@svn kjcat.com]# chmod 777 /var/repos -R
#启动svn服务
[root@svn kjcat.com]# svnserve -d -r /var/repos
#检查svn服务是否启动
[root@svn kjcat.com]# netstat -antup |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1250/svnserve
[root@rsync kjcat.com]# cd /etc/httpd/conf.d/
#创建密码和授权登录文件
[root@svn conf.d]# mkdir -p /home/svn
[root@svn conf.d]# touch /home/svn/passwd
[root@svn conf.d]# touch /home/svn/auth
#编辑配置文件,编辑前保存备份
[root@svn conf.d]# cp subversion.conf subversion.conf.ori
[root@svn conf.d]# vi /etc/httpd/conf.d/subversion.conf
#按大写G到最后,删除注释
#<Location /repos>
# DAV svn
# SVNParentPath /var/www/svn
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
# AuthType Basic
# AuthName "Authorization Realm"
# AuthUserFile /path/to/passwdfile
# Require valid-user
# </LimitExcept>
#</Location>
---------------------------------------------------
#修改为:
<Location /svn>
DAV svn
SVNParentPath /var/repos
AuthType Basic
AuthName "SVN of Septwolves"
AuthUserFile /home/svn/passwd
AuthzSVNAccessFile /home/svn/auth
Require valid-user
</Location>
#重启apache 服务
[root@svn conf.d]#service httpd restart
#创建登录用户和密码
[root@rsync conf.d]# htpasswd -c /home/svn/passwd admin
New password:
Re-type new password:
Adding password for user admin
[root@rsync conf.d]# htpasswd /home/svn/passwd tree
New password:
Re-type new password:
Adding password for user tree
[root@rsync conf.d]# htpasswd /home/svn/passwd bob
New password:
Re-type new password:
Adding password for user bob
[root@rsync ~]# cat /home/svn/passwd
admin:lif8Y7KgCGDJc
tree:QoxoMU8cBG9zY
bob:SRhDLBBbuM0UM
#配置登录用户的权限
[root@rsync ~]# vi /home/svn/auth
[/]
admin = rw
[kjcat.com:/]
tree = rw
[wolveszf.com:/]
bob = rw
3.实战测试
浏览器输入:http://10.89.1.32/svn/kjcat.com/
本文出自 “知识改变命运” 博客,请务必保留此出处http://ahtornado.blog.51cto.com/4826737/1868155
实战搭建 apache + svn 服务