1.yum安装svn
yum install -y subversion
日志打印
Loaded plugins: fastestmirrorDetermining fastest mirrorsCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds') * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cnbase | 3.7 kB 00:00 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.7 MB 00:01 Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package subversion.x86_64 0:1.6.11-15.el6_7 will be installed--> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-15.el6_7.x86_64--> Processing Dependency: apr >= 1.3.0 for package: subversion-1.6.11-15.el6_7.x86_64--> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.6.11-15.el6_7.x86_64--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.6.11-15.el6_7.x86_64--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.6.11-15.el6_7.x86_64--> Running transaction check---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed---> Package neon.x86_64 0:0.29.3-3.el6_4 will be installed--> Processing Dependency: libproxy.so.0()(64bit) for package: neon-0.29.3-3.el6_4.x86_64--> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.29.3-3.el6_4.x86_64---> Package perl-URI.noarch 0:1.40-2.el6 will be installed--> Running transaction check---> Package libproxy.x86_64 0:0.3.0-10.el6 will be installed--> Processing Dependency: libproxy-python = 0.3.0-10.el6 for package: libproxy-0.3.0-10.el6.x86_64--> Processing Dependency: libproxy-bin = 0.3.0-10.el6 for package: libproxy-0.3.0-10.el6.x86_64---> Package pakchois.x86_64 0:0.4-3.2.el6 will be installed--> Running transaction check---> Package libproxy-bin.x86_64 0:0.3.0-10.el6 will be installed---> Package libproxy-python.x86_64 0:0.3.0-10.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved========================================================================================================================================================================================================= Package Arch Version Repository Size=========================================================================================================================================================================================================Installing: subversion x86_64 1.6.11-15.el6_7 base 2.3 MInstalling for dependencies: apr x86_64 1.3.9-5.el6_2 base 123 k apr-util x86_64 1.3.9-3.el6_0.1 base 87 k libproxy x86_64 0.3.0-10.el6 base 39 k libproxy-bin x86_64 0.3.0-10.el6 base 9.0 k libproxy-python x86_64 0.3.0-10.el6 base 9.1 k neon x86_64 0.29.3-3.el6_4 base 119 k pakchois x86_64 0.4-3.2.el6 base 21 k perl-URI noarch 1.40-2.el6 base 117 kTransaction Summary=========================================================================================================================================================================================================Install 9 Package(s)Total download size: 2.8 MInstalled size: 13 MDownloading Packages:(1/9): apr-1.3.9-5.el6_2.x86_64.rpm | 123 kB 00:00 (2/9): apr-util-1.3.9-3.el6_0.1.x86_64.rpm | 87 kB 00:00 (3/9): libproxy-0.3.0-10.el6.x86_64.rpm | 39 kB 00:00 (4/9): libproxy-bin-0.3.0-10.el6.x86_64.rpm | 9.0 kB 00:00 (5/9): libproxy-python-0.3.0-10.el6.x86_64.rpm | 9.1 kB 00:00 (6/9): neon-0.29.3-3.el6_4.x86_64.rpm | 119 kB 00:00 (7/9): pakchois-0.4-3.2.el6.x86_64.rpm | 21 kB 00:00 (8/9): perl-URI-1.40-2.el6.noarch.rpm | 117 kB 00:00 (9/9): subversion-1.6.11-15.el6_7.x86_64.rpm | 2.3 MB 00:00 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total 2.0 MB/s | 2.8 MB 00:01 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum.** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs Installing : libproxy-bin-0.3.0-10.el6.x86_64 1/9 Installing : libproxy-python-0.3.0-10.el6.x86_64 2/9 Installing : libproxy-0.3.0-10.el6.x86_64 3/9 Installing : apr-1.3.9-5.el6_2.x86_64 4/9 Installing : apr-util-1.3.9-3.el6_0.1.x86_64 5/9 Installing : perl-URI-1.40-2.el6.noarch 6/9 Installing : pakchois-0.4-3.2.el6.x86_64 7/9 Installing : neon-0.29.3-3.el6_4.x86_64 8/9 Installing : subversion-1.6.11-15.el6_7.x86_64 9/9 Verifying : libproxy-0.3.0-10.el6.x86_64 1/9 Verifying : libproxy-bin-0.3.0-10.el6.x86_64 2/9 Verifying : pakchois-0.4-3.2.el6.x86_64 3/9 Verifying : libproxy-python-0.3.0-10.el6.x86_64 4/9 Verifying : neon-0.29.3-3.el6_4.x86_64 5/9 Verifying : perl-URI-1.40-2.el6.noarch 6/9 Verifying : subversion-1.6.11-15.el6_7.x86_64 7/9 Verifying : apr-1.3.9-5.el6_2.x86_64 8/9 Verifying : apr-util-1.3.9-3.el6_0.1.x86_64 9/9 Installed: subversion.x86_64 0:1.6.11-15.el6_7 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.版本验证
svnserve --version
svnserve, version 1.6.11 (r934486) compiled Aug 17 2015, 08:37:43Copyright (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版本库
mkdir /usr/sunny/svnsvnadmin create /usr/sunny/svn/test
4.修改svn配置文件
创建完版本库之后会在test/conf/下生成三个配置文件:
- authz:权限配置文件
- passwd:帐号文件
- svnserve.conf:SVN服务配置文件
svnserve.conf 文件, 该文件配置项分为以下5项:
- anon-access: 控制非鉴权用户访问版本库的权限。
- auth-access: 控制鉴权用户访问版本库的权限。
- password-db: 指定用户名口令文件名。
- authz-db:指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。
- realm:指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件。
设置
[general]anon-access = noneauth-access = writepassword-db = passwdauthz-db = authz
修改passwd文件:
vim 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
sunny = 123456
zhangsan = 123456 lisi = 123456 wangwu = 123456 maliu = 123456
修改auth文件
### 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# * = radmin = sunnyteam1 = sunny,zhangsanteam2 = sunny,zhangsan,lisi,wangwu,maliu[test:/]@admin = rw@team1 = rw
例子:
[groups]#--这里把不同用户放到不同的组里面,下面在设置目录访问权限的时候,用目录来操作就可以了。admin = sunnydevteam1 = sunny,zhangsandevteam2 = sunny,lisi,wangwudevteam3 = sunny,zhangsan,lisi,wangwu,maliudocs = sunny,zhangsantraining = sunny #为所有库指定默认访问规则,所有人可以读,管理员可以写,危险分子没有任何权限 #对应目录:/usr/sunny/svn[/]* = r@admin = rwdangerman = #允许开发人员可以完全访问他们的项目版本库[project1:/]@devteam1 = rw[project2:/]@devteam2 = rw[project3:/]@devteam3 = rw[bigproject:/]@devteam1 = rw@devteam2 = rw@devteam3 = rwtrevor = rw #文档编写人员对所有的docs目录有写权限[/trunk/doc]@docs = rw #培训人员可以完全访问培训版本库[TrainingRepos:/]@training = rw
5.启动服务
svnserve -d -r /usr/sunny/svn
-d表示后台运行
-r表示svn的根目录
设置开机自动启动
#启动svn(可以把这个放到/etc/local/rc.local文件中,实现开机自启动)svnserve -d -r /usr/sunny/svn#验证是否开启成功sudo netstat -anp | grep svnserve
6.连接svn资源库
svn://192.168.2.11/test