標籤:
搭建SVN服務,有效管理代碼,以下三步可以快速搞定。
1、安裝
#yum install subversion
判斷是否安裝成功
#subversion -v
svnserve, version 1.6.11 (r934486)
出現上面的提示,說明安裝成功。
如果提示如下:-bash: subversion: command not found
經過尋找發現:
[[email protected]]# svnserve --versionsvnserve, version 1.6.11 (r934486)
compiled Apr 11 2013, 16:13:51
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
有了SVN軟體後還需要建立SVN庫。
#mkdir /opt/svn/repos
#svnadmin create /opt/svn/repos
執行上面的命令後,自動在repos下建立多個檔案, 分別是conf, db,format,hooks, locks, README.txt。
2、配置
上面的操作很簡單,幾個命令就搞定, 下面的操作也不難。
進入上面產生的檔案夾conf下,進行配置, 有以下幾個檔案authz, passwd, svnserve.conf
其中authz 是許可權控制,可以設定哪些使用者可以訪問哪些目錄, passwd是設定使用者和密碼的, svnserve是設定svn相關的操作。
2.1先設定passwd
[users]
# harry = harryssecret
# sally = sallyssecret
hello=123
使用者名稱=密碼
這樣我們就建立了hello使用者, 123密碼
2.2 再設定許可權authz
[/]
hello= rw
意思是hello使用者對所有的目錄有讀寫權限,當然也可以限定。
如果是自己用,就直接是讀寫吧。
2.3最後設定snvserv.conf
anon-access = none # 使非授權使用者無法訪問
auth-access = write # 使授權使用者有寫入權限
password-db = passwd
authz-db = authz # 存取控制檔案
realm = /opt/svn/repos # 認證命名空間,subversion會在認證提示裡顯示,並且作為憑證緩衝的關鍵字。
採用預設配置. 以上語句都必須頂格寫, 左側不能留空格, 否則會出錯.
好了,通過以上配置,你的svn就可以了。
3、串連
啟動svn: svnserve -d -r /opt/svn/repos
如果已經有svn在運行,可以換一個連接埠運行
svnserve -d -r /opt/svn/repos --listen-port 3391
這樣同一台伺服器可以運行多個svnserver
好了,啟動成功後,就可以使用了。
建議採用TortoiseSVN, 串連地址為: svn://13x.19x.10x.11x:3690
串連後可以上傳本地的檔案,有效管理你的代碼。
svn checkout svn://13x.19x.10x.11x:3690
在home目錄下checkout
Centos搭建SVN伺服器三步曲