1、安装 subversion
1
2
3
4
5
6
7
8
9
10
11
|
yum install subversion
#最终显示 Installed: subversion.x86_64 0:1.6.11-12.el6_6
Dependency Installed: apr.x86_64 0:1.3.9-5.el6_2 apr-util.x86_64 0:1.3.9-3.el6_0.1 libproxy.x86_64 0:0.3.0-10.el6 libproxy-bin.x86_64 0:0.3.0-10.el6 libproxy-python.x86_64 0:0.3.0-10.el6
neon.x86_64 0:0.29.3-3.el6_4 pakchois.x86_64 0:0.4-3.2.el6 perl-URI.noarch 0:1.40-2.el6
Complete! #代表安装成功 |
2、判断是否安装成功
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
svnserve --version svnserve, version 1.6 . 11 (r934486)
compiled Feb 10 2015 , 22 : 08 : 22
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.
|
3、建立SVN库。
1
2
|
[root@li538- 34 ~]# mkdir -p /opt/svn/repos
[root@li538- 34 ~]# svnadmin create /opt/svn/repos
|
执行完上面的命令后,在repos下建立conf, db,format,hooks, locks, README.txt。
4、配置svn
进入上面生成的文件夹conf下,进行配置, 有以下几个文件authz, passwd, svnserve.conf
其中authz 是权限控制,可以设置哪些用户可以访问哪些目录, passwd是设置用户和密码的, svnserve是设置svn相关的操作。
1
2
3
4
5
6
7
8
9
10
|
[root@li538-34 ~] # cd /opt/svn/repos
[root@li538-34 repos] # ll
total 24 drwxr-xr-x 2 root root 4096 Feb 24 06:31 conf drwxr-sr-x 6 root root 4096 Feb 24 06:31 db -r--r--r-- 1 root root 2 Feb 24 06:31 format
drwxr-xr-x 2 root root 4096 Feb 24 06:31 hooks drwxr-xr-x 2 root root 4096 Feb 24 06:31 locks -rw-r--r-- 1 root root 229 Feb 24 06:31 README.txt [root@li538-34 repos] #
|
进入conf打开passwd
1
2
3
4
5
6
7
|
[root@li538-34 repos] # cd conf
[root@li538-34 conf] # ll
total 12 -rw-r--r-- 1 root root 1080 Feb 24 06:31 authz -rw-r--r-- 1 root root 309 Feb 24 06:31 passwd
-rw-r--r-- 1 root root 2279 Feb 24 06:31 svnserve.conf [root@li538-34 conf] # vim passwd
|
1
2
3
4
5
|
[ users ]
# harry = harryssecret # sally = sallyssecret ningyuqiao=ningyuqiao 用户名=密码 |
打开authz,设置权限
1
2
|
[/] ningyuqiao=rw |
意思是ningyuqiao用户对所有的目录有读写权限
设定svnserv.conf
1
2
3
4
5
|
anon-access = none # 使非授权用户无法访问
auth-access = write # 使授权用户有写权限
password-db = passwd
authz-db = authz # 访问控制文件
realm = /opt/svn/repos # 认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字。
|
注意:把中文全部去掉,否则会报错。
启动svn服务
1
|
svnserve -d -r /opt/svn/repos
|
如果已经有svn在运行,可以换一个端口运行
1
|
svnserve -d -r /opt/svn/repos --listen-port 3391
|
采用TortoiseSVN, 连接地址为: svn://your server address (如果指定端口需要添加端口 :端口号)\
本文转自ning1022 51CTO博客,原文链接:http://blog.51cto.com/ning1022/1615063,如需转载请自行联系原作者