1.檢查是否已安裝
如果要卸載舊版本:
2.安裝
[root@localhost ~]# cd /etc/httpd/modules;ls|grep svn
mod_authz_svn.so
mod_dav_svn.so
如果沒有需要安裝mod_dav_svn
#yum -y install mod_dav_svn(我裝了)
3.檢查是否安裝成功
如果成功會輸出版本號
4.創建倉庫目錄
例如:
ll
7、配置代碼庫
進入上面生成的文件夾conf下,進行配置
cd /var/www/svn/repos/conf
7.1用戶密碼passwd配置
vim passwd
passwd文件的內容如下:
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
test = 123456789 ##新增用戶的用戶名和密碼
7.2權限控制authz配置
vi authz
目的是設置哪些用戶可以訪問哪些目錄,authz文件的內容如下:
### This file is an example authorization file for svnserve. ### Its format is identical to that of mod_authz_svn authorization ### files. ### As shown below each section defines authorizations for the path and ### (optional) repository specified by the section name. ### The authorizations follow. An authorization line can refer to: ### - a single user, ### - a group of users defined in a special [groups] section, ### - an alias defined in a special [aliases] section, ### - all authenticated users, using the '$authenticated' token, ### - only anonymous users, using the '$anonymous' token, ### - anyone, using the '*' wildcard. ### ### A match can be inverted by prefixing the rule with '~'. Rules can ### grant read ('r') access, read-write ('rw') access, or no access ### (''). [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r [/] test = rw 設置[/]代表根目錄下所有的資源
7.3服務svnserve.conf配置
vi svnserve.conf
svnserve.conf文件的內容如下:
[general] #匿名訪問的權限,可以是read,write,none,默認為read anon-access=none #使授權用戶有寫權限 auth-access=write #密碼數據庫的路徑 password-db=passwd #訪問控制文件 authz-db=authz #認證命名空間,subversion會在認證提示里顯示,並且作為憑證緩存的關鍵字 realm=/var/www/svn/repos
防火牆 開放svn端口默認是3690端口
啟動svn服務
svnserve -d -r /opt/svn/repositories
8、查看SVN進程
ps -ef|grep svn|grep -v grep
返回
root 20850 1 0 Jul24 ? 00:00:00 svnserve -d -r /opt/svn/repositories
9、查看SVN監聽的端口
netstat -ln |grep 3690
10、停止啟動SVN
killall svnserve #停止
svnserve -d -r /opt/svn/repositories #啟動
首先:編寫一個啟動腳本svn_startup.sh,我放在/root/svn_startup.sh
/usr/bin/svnserve -d -r /home/svn/
絕對路徑怎么查?
這里還有可能碰到一個問題,如果你在windows下建立和編寫的腳本,拿到linux下,用vi或者vim修改后可能會無法執行,這是文件格式的問題
輸入:set ff 回車
如果顯示的結果不是fileformat=unix
再次輸入
set ff=unix
就OK了
然后修改該腳本的執行權限
或者萬能的
chmod 777 svn_startup.sh
最后:加入自動運行
在末尾添加腳本的路徑,如:
/root/svn_startup.sh
現在,你可以重啟一下試試了。 不懂得怎么確認成功?敗給你了
目前最流行的svn客戶端非TortoiseSVN莫屬
下載安裝
客戶端連接地址:svn://公網或內網的IP地址,有時候需要添加端口號
用戶名/密碼: test/123456789 ##要和之前設置的用戶名和密碼匹配
注意:
默認端口為3690,如果該端口被占用,或者需要修改端口,使用下面語句
svnserve -d -r /opt/svn/repositories --listen-port 3691