1.系統(tǒng)環(huán)境:
Linux ningmi 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
2. Apt-get安裝subversion:
root@ningmi: apt-get install subversion -y
3.檢測是否安裝成功:
root@ningmi:/application/svndata# svnversion --version
svnversion, version 1.8.8 (r1568071)
4. 配置并啟動SVN:
建立svn版本庫數(shù)據(jù)存儲根目錄(svndata)及用戶咬最,密碼權(quán)限目錄(svnpasswd)
root@ningmi: mkdir -p /application/svndata
root@ningmi: mkdir -p /application/svnpasswd
5.啟動SVN服務指定服務的SVN根目錄:
root@ningmi: svnserve -d -r /application/svndata/
6.查看SVN進程:
root@ningmi: ps -ef|grep svn
root? ? ? 2579? ? ? 1? 0 09:32 ?? ? ? ? 00:00:00 svnserve -d -r
/application/svndata/
root? ? ? 2586? 2487? 0 09:35 pts/0? ? 00:00:00 grep --color=auto svn
7.查看SVN端口:
root@ningmi: netstat -lntup|grep 3690
tcp? ? ? ? 0? ? ? 0 0.0.0.0:3690? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN
2579/svnserve
到此,SVN服務端安裝完畢迹缀,以下為服務端的配置:
8.建立項目版本庫:
創(chuàng)建一個新的subsersion項目testquyundong.com,其實類似testquyundong.com這樣
的項目可以創(chuàng)建多個每個項目對應不同的代碼,以此為例:
root@ningmi: svnadmin create /application/svndata/testquyundong.com
root@ningmi: ls -ld /application/svndata/testquyundong.com/
drwxr-xr-x 6 root root 80 Apr? 9 09:53
/application/svndata/testquyundong.com/
9.調(diào)整SVN配置文件及權(quán)限文件:
1)配置允許用戶ningmi讀寫:
root@ningmi: cd? /application/svndata/testquyundong.com/conf/
[root@YII conf]# cp svnserve.conf svnserve.conf.ori
2)修改配置文件
sed -i ’s/# anon-access = read / anon-access = none /’ svnserve.conf
sed -i ’s/# auth-access = write / auth-access = write /’ svnserve.conf
sed -i ’s%# password-db = passwd % password-db =
/application/svnpasswd/passwd%’ svnserve.conf
sed -i ’s%# authz-db? =? authz % authz-db? =
/application/svnpasswd/authz%’ svnserve.conf
10.檢查:
[root@YII conf]# diff svnserve.conf svnserve.conf.ori
19,20c19,20
<? anon-access = none
<? auth-access = write
---
> # anon-access = read
> # auth-access = write
27c27
<? password-db = /application/svnpasswd/passwd
---
> # password-db = passwd
34c34
<? authz-db = /application/svnpasswd/authz
---
> # authz-db = authz
11.把密碼認證文件模板考到相關(guān)目錄,并設置只有root才能看:
[root@YII conf]# cp passwd? authz /application/svnpasswd/
[root@YII conf]# cd /application/svnpasswd/
[[root@YII svnpasswd]# chmod 700 authz passwd
[root@YII svnpasswd]# ll
total 8
-rwx------ 1 root root 1080 Apr? 9 10:20 authz
-rwx------ 1 root root? 309 Apr? 9 10:20 passwd
12.編輯passwd添加用戶ningmi:
[users]
# harry = harryssecret
# sally = sallyssecret
ningmi = 888888
hejianping = 111111
提示:
1)等號前為SVN賬號揽惹,等號后為SVN密碼剂桥,密碼是明文坎炼,注意密碼權(quán)限止喷。
2) 更改svnserve.conf時胰蝠,需要重啟svn,更改authz,passwd文件時不需要重啟亩码。
Kill –USR1 `cat /application/svndata/svn.pid`
Svnserve –d –r /application/svndata/ --pid-
file=/application/svndata/svn.pid
13.配置authz文件:
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[testquyundong.com:/]
ningmi = wr? ? #讀寫權(quán)限
hejianping = r? #只讀權(quán)限
[<項目庫>:/項目/目錄]
@<用戶組名> = <權(quán)限>
<用戶名> = <權(quán)限>
14. 重啟服務:
[root@YII svnpasswd]# pkill svnserve
[root@YII svnpasswd]# ps -ef|grep svn
root? ? ? 2916? 2487? 0 10:47 pts/0? ? 00:00:00 grep --color=auto svn
[root@YII svnpasswd]# svnserve -d -r /application/svndata/
[root@YII svnpasswd]# ps -ef|grep svn
root? ? ? 2918? ? ? 1? 0 10:47 ?? ? ? ? 00:00:00 svnserve -d -r
/application/svndata/
root? ? ? 2920? 2487? 0 10:47 pts/0? ? 00:00:00 grep --color=auto svn
至此服務端配置完成东羹。