標籤:
安裝說明
系統內容:CentOS-6.3 安裝方式:yum install (源碼安裝容易產生版本相容的問題) 安裝軟體:系統自動下載SVN軟體
檢查已安裝版本
#檢查是否安裝了低版本的SVN [[email protected] /]# rpm -qa subversion
#卸載舊版本SVN [[email protected] modules]# yum remove subversion
安裝SVN
[[email protected] modules]# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql
確認已安裝了svn模組
[[email protected] /]# cd /etc/httpd/modules
[[email protected] modules]# ls | grep svn
mod_authz_svn.so
mod_dav_svn.so
驗證安裝
檢驗已經安裝的SVN版本資訊 [[email protected] modules]# svnserve --version
svnserve,版本 1.6.11 (r934486) 編譯於 Jun 23 2012,00:44:03
著作權 (C) 2000-2009 CollabNet。 Subversion 是開放原始碼軟體,請參閱 http://subversion.tigris.org/ 網站。 此產品包含由 CollabNet(http://www.Collab.Net/) 開發的軟體。
下列版本庫後端(FS) 模組可用:
* fs_base : 模組只能操作BDB版本庫。 * fs_fs : 模組與文字檔(FSFS)版本庫一起工作。
Cyrus SASL 認證可用。
程式碼程式庫建立
SVN軟體安裝完成後還需要建立SVN庫
[[email protected] modules]# mkdir -p /opt/svn/repositories
[[email protected] modules]# svnadmin create /opt/svn/repositories
執行上面的命令後,自動建立repositories庫,查看/opt/svn/repositories 檔案夾發現包含了conf, db,format,hooks, locks, README.txt等檔案,說明一個SVN庫已經建立。
配置程式碼程式庫
進入上面產生的檔案夾conf下,進行配置
[[email protected] modules]# cd /opt/svn/repositories/conf
使用者密碼passwd配置
[[email protected] password]# cd /opt/svn/repositories/conf
[[email protected] conf]# vi + passwd
修改passwd為以下內容:
[users]# harry = harryssecret# sally = sallyssecretzhoulf=123456許可權控制authz配置
[[email protected] conf]# vi + authz
目的是設定哪些使用者可以訪問哪些目錄,向authz檔案追加以下內容:
#設定[/]代表根目錄下所有的資源[/]zhoulf=rw服務svnserve.conf配置
[[email protected] conf]# vi + svnserve.conf
追加以下內容:
#匿名訪問的許可權,可以是read,write,none,預設為read
anon-access=none #使授權使用者有寫入權限
auth-access=write #密碼資料庫的路徑
password-db=passwd #存取控制檔案
authz-db=authz #認證命名空間,subversion會在認證提示裡顯示,並且作為憑證緩衝的關鍵字
realm=/opt/svn/repositories
注意,此幾行配置所在行第一個字母錢不能有任何空格,否則會出現類似svnserve.conf:12: Option expected 這樣的錯誤
配置防火牆連接埠
[[email protected] conf]# vi /etc/sysconfig/iptables
添加以下內容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
儲存後重啟防火牆
[[email protected] conf]# service iptables restart
啟動SVN
svnserve -d -r /opt/svn/repositories
查看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/repositories
檢測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/repositories // 啟動
測試
SVN服務已經啟動,使用用戶端測試連接。
用戶端串連地址:svn://192.168.15.231
使用者名稱/密碼: zhoulf/123456 測試建立檔案夾等操作。
建立啟動Subversion的指令碼: #echo ‘svnserve -d -r /opt/lampp/htdocs/_svn/‘ > start_svn.sh #chmod 0777 start_svn.sh #./start_svn.sh
將啟動指令碼放置到開機自動啟動指令碼中: 以root身份修改檔案:/etc/rc.d/rc.local,添加以下文字: su -c /opt/lampp/htdocs/_svn/start_svn.sh svn
CentOS-6.3安裝配置SVN