-
安裝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
服務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 // 啓動