標籤:
檢查已安裝版本
#檢查是否安裝了低版本的SVN
[[email protected] /]# rpm -qa subversion
#卸載舊版本SVN
[[email protected] modules]# yum remove subversion
#wget http://mirror.centos.org/centos/5/os/i386/CentOS/subversion-javahl-1.6.11-12.el5_10.i386.rpm
# yum install subversion-javahl
# svnserve --version
程式碼程式庫建立
SVN軟體安裝完成後還需要建立SVN庫
# mkdir -p /opt/svn/repo
# svnadmin create /opt/svn/repo
執行上面的命令後,自動建立repo測試庫,查看/opt/svn/repo 檔案夾發現包含了conf, db,format,hooks, locks, README.txt等檔案,說明一個SVN庫已經建立。
配置程式碼程式庫
進入上面產生的檔案夾conf下,進行配置
cd /opt/svn/repo/conf
使用者密碼passwd配置
#cd /opt/svn/repos/conf
#vi passwd
修改passwd為以下內容:
[users]
# harry = harryssecret
# sally = sallyssecret
user1=123456
使用者名稱=密碼
這樣我們就建立了user1使用者, 123456密碼
以上語句都必須頂格寫, 左側不能留空格, 否則會出錯.
許可權控制authz配置
# vi + authz
目的是設定哪些使用者可以訪問哪些目錄,向authz檔案追加以下內容:
#設定[/]代表根目錄下所有的資源
[/] 或者寫成[repl:/]
hello = rw
意思是hello使用者對repo測試庫下所有的目錄有讀寫權限,當然也可以限定。
如果是自己用,就直接是讀寫吧。
以上語句都必須頂格寫, 左側不能留空格, 否則會出錯.
服務svnserve.conf配置
#vi svnserve.conf
追加以下內容:
[general]
#匿名訪問的許可權,可以是read,write,none,預設為read
anon-access=none
#使授權使用者有寫入權限
auth-access=write
#密碼資料庫的路徑
password-db=passwd
#存取控制檔案
authz-db=authz
#認證命名空間,subversion會在認證提示裡顯示,並且作為憑證緩衝的關鍵字
realm=/opt/svn/repo
以上語句都必須頂格寫, 左側不能留空格, 否則會出錯.
修改服務檔案:
#vi /etc/init.d/svnserve
args="--daemon --pid-file=${pidfile} $OPTIONS"加入"-d -r /opt/svn "
args="-d -r /opt/svn --daemon --pid-file=${pidfile} $OPTIONS"
配置防火牆連接埠
# vi /etc/sysconfig/iptables
添加以下內容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
儲存後重啟防火牆
# service iptables restart
啟動伺服器:
#service svnserve start
查看SVN進程
[[email protected] conf]# ps -ef|grep svn|grep -v grep
root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /opt/svn/repo
檢測SVN 連接埠
[[email protected] conf]# netstat -ln |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
停止重啟SVN
[[email protected] password]# killall svnserve //停止
[[email protected] password]# svnserve -d -r /opt/svn // 啟動
測試
SVN服務已經啟動,使用用戶端測試連接。
用戶端串連地址:svn://192.168.1.9
使用者名稱/密碼: user1/123456
測試建立檔案夾等操作。
CentOS 5.5安裝SVN(Subversion)