1:查看linux是否已经安装svn服务
[[email protected] ~]# rpm -qa subversion
subversion-1.6.11-15.el6_7.x86_64
2:安装svn
#yum install subversion
3:卸载svn
#yum remove subversion
4:查看svn相关信息
[[email protected] ~]# svnserve --version
svnserve, version 1.6.11 (r934486)
compiled Aug 17 2015, 08:37:43
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.
5:代码库创建
#创建SVN根目录
[[email protected] ~]# mkdir -p /opt/svn
#创建代码资源库
[[email protected] ~]# svnadmin create /opt/svn/repo
执行上面的命令后,自动建立repo测试库,查看/opt/svn/repo 文件夹,发现包含了conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经建立。
6:配置代码库
[[email protected] ~]# cd /opt/svn/repo/conf
[[email protected] conf]# vim passwd
编辑svn用户和密码
[users]
# harry = harryssecret
# sally = sallyssecret
liu = 123456
7:配置控制权限
[[email protected] conf]# vi authz
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
#分组名=分组下的用户,用逗号隔开
coder = liu
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
#表示对repo版本库下的所有资源设置权限
[repository:/opt/svn/repo]
#coder分组下的用户有读写代码的权限
@coder = rw
8:启动SVN
#指定代码库
svnserve -d -r /opt/svn/repo
#查看SVN进程
[[email protected] ~]# ps -ef | grep svn
root 1937 1 0 17:28 ? 00:00:00 svnserve -d -r /opt/svn/zhilang
root 2379 2301 0 18:34 pts/3 00:00:00 grep svn