1.系统环境:
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版本库数据存储根目录(svndata)及用户,密码权限目录(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.建立项目版本库:
创建一个新的subsersion项目testquyundong.com,其实类似testquyundong.com这样
的项目可以创建多个每个项目对应不同的代码,以此为例:
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.调整SVN配置文件及权限文件:
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.把密码认证文件模板考到相关目录,并设置只有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密码,密码是明文,注意密码权限。
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 #读写权限
hejianping = r #只读权限
[<项目库>:/项目/目录]
@<用户组名> = <权限>
<用户名> = <权限>
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
至此服务端配置完成。