1、安装Apache
[root@puppet ~]# yum install -y httpd httpd-devel [root@puppet ~]# service httpd start [root@puppet ~]# chkconfig httpd on
2、配置SVN账号
[root@puppet ~]# /usr/bin/htpasswd -bc /etc/svn_passwd puppet 123456 #首次添加账号 [root@puppet ~]# /usr/bin/htpasswd -bm /etc/svn_passwd test 123456 #再次添加账号
3、配置虚拟主机
[root@puppet ~]# vi /etc/httpd/conf.d/subversion.conf LoadModule dav_svn_module /usr/lib64/httpd/modules/mod_dav_svn.so LoadModule authz_svn_module /usr/lib64/httpd/modules/mod_authz_svn.so Listen 8080 <VirtualHost *:8080> <Location /svn> DAV svn SVNPath /usr/local/svn/puppet AuthType Basic AuthName "Subversion repository" AuthUserFile /etc/svn_passwd Require valid-user AuthzSVNAccessFile /etc/svn_access </Location> </VirtualHost>
4、重启服务
[root@puppet ~]# service httpd restart
5、开放端口
[root@puppet ~]# netstat -lant|grep 8080 tcp 0 0 :::8080 :::* LISTEN [root@puppet ~]# iptables -I INPUT -p tcp --dport 8080 -j ACCEPT [root@puppet ~]# service iptables save
6、配置访问权限
[root@puppet ~]# vi /etc/svn_access [groups] admins=puppet [/] @admins=rw test=r *=
7、访问测试
IE访问http://10.188.1.73:8080/svn,账号puppet密码123456
[root@puppet ~]# cd /usr/local/subversion/bin [root@puppet bin]# svn list http://localhost:8080/svn
8、关闭svn进程
使用http://访问,就可以关闭SVN进程了,查看进程PID并杀死:
[root@puppet bin]# ps aux|grep svn root 26379 0.0 0.0 181140 924 ? Ss 11:15 0:00 svnserve -d -r /usr/local/svn/puppet/ [root@puppet bin]# kill -9 26379