安裝說明
系統(tǒng)環(huán)境:CentOS-6.5 64位
安裝方式:yum install (源碼安裝容易產(chǎn)生版本兼容的問題)
安裝軟件:系統(tǒng)自動(dòng)下載SVN軟件
檢查已安裝版本
#檢查是否安裝了低版本的SVN
[root@localhost /]# rpm -qa subversion
如果沒有其他顯示。說明沒有安裝過偎窘『铰蓿可以忽略卸載就不SVN
#卸載舊版本SVN
[root@localhost modules]# yum remove subversion
安裝SVN
[root@localhost modules]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql
輸入Y姓蜂。然后就進(jìn)行下載安裝了冗锁。
出現(xiàn):
說明 install 已經(jīng)OK了
確認(rèn)已安裝了svn模塊
[root@localhost /]# cd /etc/httpd/modules
[root@localhost modules]# ls | grep svn
mod_authz_svn.so
mod_dav_svn.so
如下圖:
驗(yàn)證安裝
檢驗(yàn)已經(jīng)安裝的SVN版本信息
[root@localhost modules]# svnserve --version
代碼庫創(chuàng)建
SVN軟件安裝完成后還需要建立SVN庫
[root@localhost modules]# mkdir -p /opt/svn/repositories
[root@localhost modules]# svnadmin create /opt/svn/repositories
執(zhí)行上面的命令后,自動(dòng)建立repositories庫旗们,查看/opt/svn/repositories 文件夾發(fā)現(xiàn)包含了conf, db,format,hooks, locks, README.txt等文件亲配,說明一個(gè)SVN庫已經(jīng)建立。
如下圖:
配置代碼庫
進(jìn)入上面生成的文件夾conf下谁帕,進(jìn)行配置
[root@localhost modules]# cd /opt/svn/repositories/conf
用戶密碼passwd配置
[root@localhost password]# cd /opt/svn/repositories/conf
[root@admin conf]# vi + passwd
修改passwd為以下內(nèi)容:
[users]
# harry = harryssecret
# sally = sallyssecret
kaigejava=123456
權(quán)限控制authz配置
[root@admin conf]# vi + authz
目的是設(shè)置哪些用戶可以訪問哪些目錄峡继,向authz文件追加以下內(nèi)容:
#設(shè)置[/]代表根目錄下所有的資源
[/]
kaigejava=rw
服務(wù)svnserve.conf配置
[root@admin conf]# vi + svnserve.conf
追加以下內(nèi)容:
[general]
#匿名訪問的權(quán)限,可以是read,write,none,默認(rèn)為read
anon-access=none
#使授權(quán)用戶有寫權(quán)限
auth-access=write
#密碼數(shù)據(jù)庫的路徑
password-db=passwd
#訪問控制文件
authz-db=authz
#認(rèn)證命名空間匈挖,subversion會(huì)在認(rèn)證提示里顯示碾牌,并且作為憑證緩存的關(guān)鍵字
realm=/opt/svn/repositories
配置防火墻端口
[root@localhost conf]# vi /etc/sysconfig/iptables
添加以下內(nèi)容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
保存后重啟防火墻
[root@localhost conf]# service iptables restart
啟動(dòng)SVN
svnserve -d -r /opt/svn/repositories
查看SVN進(jìn)程
[root@localhost conf]# ps -ef|grep svn|grep -v grep
root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /opt/svn/repositories
檢測(cè)SVN 端口
[root@localhost conf]# netstat -ln |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
停止重啟SVN
[root@localhost password]# killall svnserve //停止
[root@localhost password]# svnserve -d -r /opt/svn/repositories // 啟動(dòng)
測(cè)試
SVN服務(wù)已經(jīng)啟動(dòng),使用客戶端測(cè)試連接儡循。
客戶端連接地址:svn://192.168.15.231
用戶名/密碼:kaigejava/123456
測(cè)試創(chuàng)建文件夾等操作舶吗。
歡迎關(guān)注凱哥微信公眾號(hào):凱哥Java