一、检查系统是否已经安装若是安装就卸载apache
rpm -qa subversion
yum remove subversion
二、安装vim
yum install subversion
三、创建SVN库dom
mkdir -p /home/svn/repos svnadmin create /home/svn/repos
执行上面的命令后,自动创建repositories库,查看/home/svn/repos 文件夹发现包含了conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经创建。 四、进入/home/svn/repos/上面生成的文件夹下,进行配置 authz文件配置 目的是设置哪些用户能够访问哪些目录,向authz文件追加如下内容tcp
[/] afa4j = rw abs = rw
passwd文件配置 是添加用户名和密码文件,修改以下svn
[users] # harry = harryssecret # sally = sallyssecret afa4j = afa4j abs = abs123
svnserve.conf 文件配置 配置访问权限测试
[general] anon-access = none auth-access = write password-db = passwd authz-db = authz realm = /home/svn/repos
五、启动svnui
/etc/init.d/svnserve start
六、检查进程和监听端口this
ps -ef |grep svn |grep -v grep root 23580 1 0 20:10 ? 00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid netstat -antlp |grep :3690 tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 23580/svnserve
七、修改默认端口为20016 打开rest
vim /etc/init.d/svnserve args="--daemon --pid-file=${pidfile} $OPTIONS --listen-port 20016"
找到这一行添加 --listen-port 20016
保存 八、重启code
service svnserve restart ps -ef |grep svn |grep -v grep root 23580 1 0 20:10 ? 00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid --listen-port 20016 netstat -antlp |grep :20016 tcp 0 0 0.0.0.0:20016 0.0.0.0:* LISTEN 23580/svnserve
九、TortoiseSVN客户端链接测试 版本库URL svn://xxx.xxx.xxx:20016/home/svn/repos 弹出对话框输入前面添加的用户名密码
十、SVN开启apache支持
root@ UAT测试环境 @mc1.domain.com:yum install httpd mod_dav_svn root@ UAT测试环境 @mc1.domain.com:/home/svn/project#rpm -ql mod_dav_svn /etc/httpd/conf.d/subversion.conf /usr/lib64/httpd/modules/mod_authz_svn.so /usr/lib64/httpd/modules/mod_dav_svn.so root@ UAT测试环境 @mc1.domain.com:/home/svn/project#htpasswd /home/svn/project/password kcw New password: Re-type new password: Adding password for user kcw root@ UAT测试环境 @mc1.domain.com:/home/svn/project#cat /etc/httpd/conf.d/subversion.conf LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so # # Example configuration to enable HTTP access for a directory # containing Subversion repositories, "/var/www/svn". Each repository # must be both: # # a) readable and writable by the 'apache' user, and # # b) labelled with the 'httpd_sys_content_t' context if using # SELinux # # # To create a new repository "http://localhost/repos/stuff" using # this configuration, run as root: # # # cd /var/www/svn # # svnadmin create stuff # # chown -R apache.apache stuff # # chcon -R -t httpd_sys_content_t stuff # #<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 /home/svn/project SVNPath /home/svn/project SVNListParentPath on AuthType Basic AuthName "Musingtec SVN Authorization" AuthUserFile /home/svn/project/password # Limit write permission to list of valid users. # <LimitExcept GET PROPFIND OPTIONS REPORT> # Require SSL connection for password protection. # SSLRequireSSL Require valid-user #</LimitExcept> </Location>
重启apache后以http://IP/svn如图
这里说明以下
SVNParentPath:支持多个具有相同父目录的Subversion版本库。 SVNPath:只支持一个父目录的Subversion版本库
SVNPath /svn/repository/project1 #若是你想对每一个项目单独配置,使用该项
SVNParentPath /svn/repository #设定一个根,全部项目均放在此目录下
而且, 若是设置为SVNParentPath .....,当访问 http://localhost/XXXX时,即便也是要求输入验证,但会提示forbidden错误页. 必须接着输入 http://localhost/xxxx/project1..
转自 http://blog.163.com/litianyichuanqi@126/blog/static/115979441201231701630864/ apache2 里面的svn配置 <Location /svn/repository> DAV svn SVNPath /svn/repository #SVNParentPath /svn/repository #SVNListParentPath on
AuthType Basic #(链接类型设置 基本验证) AuthName "Hello welcome to here"
AuthUserFile /svn/repository/conf/passwd
AuthzSVNAccessFile /svn/repository/conf/authz #(此处修改成访问版本库权限的文件) Require valid-user #("Require valid-user"告诉apache在authfile中全部的用户均可以访问。 </Location>
[groups] Admin=usr1 #/*这个表示admin群组里的成员 user1,user2 #Develop=u1, u2
#/*这个表示Develop群组里的成员 u1,u2 [repository:/] #/*这表示,仓库www的根目录下的访问权限 user1 = rw #/www仓库user1用户具备读和写权限 user2 = r #/ www仓库userl用户具只有读权限 #@develop=rw
#/*这表示 群 develop的成员都具备读写权限 [/] #/*这个表示在全部仓库的根目录下