1、使用yum安装svn
yum -y install subversion
安装完后通过svn help查看是否安装成功
2、创建svn目录仓库
[root@localhost /]# cd /home
[root@localhost home]# mkdir svn
[root@localhost home]# svnadmin create /home/svn
[root@localhost home]# ls svn
conf db format hooks locks README.txt
这里我们只需要关注conf文件夹
[root@localhost home]# cd svn/conf
[root@localhost conf]# ls
authz passwd svnserve.conf
- authz 是权限控制文件
- passwd 是帐号密码文件
- svnserve.conf 是SVN服务配置文件
3、配置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
test1 = 123456
4、配置authz
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
test1=rw
[/test2]
test1=rw
[/test2/test1]
test1=r
我们看到[/]是仓库的一级目录,具有读写的权限;
test2二级目录,也是有读写的权限
test1三级目录,只有读的权限
另外设置分组:
[root@localhost conf]# vi authz
[groups]
group1 = liuxianan
group2 = test1,test2
[/]
@group1 = rw
@group2 = r
* =
5、配置svnserve.conf
[root@localhost conf]# vi svnserve.conf
打开下面的5个注释
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /home/svn # 认证空间名,版本库所在目录
6、启动svn
[root@localhost conf]# svnserve -d -r /home/svn(启动)
[root@localhost conf]#killall svnserve(停止)
上述启动命令中,-d
表示守护进程, -r
表示在后台执行。停止还可以采用杀死进程的方式:
7、客户端连接
不出意外我们就可以通过svn客户端checkout我们的仓库了