-
安装SVN
[root@localhost modules]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql
-
确认已安装了svn模块
[root@localhost /]# cd /etc/httpd/modules
[root@localhost modules]# ls | grep svn
mod_authz_svn.so
mod_dav_svn.so
-
验证安装
[root@localhost modules]# svnserve --version
-
代码库创建
[root@localhost modules]# mkdir -p /home/repositories
[root@localhost modules]# svnadmin create /home/repositories
-
配置代码库
进入上面生成的文件夹conf下,进行配置
[root@localhost modules]# cd /home/repositories/conf
-
用户密码passwd配置
[root@admin conf]# vi + passwd - [users]
# harry = harryssecret
# sally = sallyssecret
gaoxiang=123456 -
权限控制authz配置
[root@admin conf]# vi + authz
目的是设置哪些用户可以访问哪些目录,向authz文件追加以下内容:
#设置[/]代表根目录下所有的资源
[/]
gaoxiang=rw
[/]
gaoxiang=rw
9.
服务svnserve.conf配置
[root@admin conf]# vi + svnserve.conf
[general]
#匿名访问的权限,可以是read,write,none,默认为read
anon-access=none
#使授权用户有写权限
auth-access=write
#密码数据库的路径
password-db=passwd
#访问控制文件
authz-db=authz
#认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字
realm=/home/repositories
配置防火墙(嫌麻烦的同学可以直接关闭防火墙)
[root@localhost conf]# vi /etc/sysconfig/iptables
添加以下内容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
保存后重启防火墙
[root@localhost conf]# service iptables restart
启动SVN
svnserve -d -r /opt/svn/repositories
停止重启SVN
[root@localhost password]# killall svnserve //停止
[root@localhost password]# svnserve -d -r /opt/svn/repositories // 启动