1.安装
yum install subversion
1
2
2.查看版本号
svnserve –version
1
2
3.创建svn版本库目录
mkdir -p /var/svn/svnrepos
1
2
4.创建版本库
svnadmin create /var/svn/svnrepos
1
2
5.执行上面命令后 目录内生成多个文件及文件夹,进入conf文件夹内
6.编辑passwd文件,在后面添加
jean = 123
1
2
7.编辑authz文件,在后面添加
[/]
jean=rw
意思是对版本库根目录有读写操作
1
2
3
4
8.编辑svnserve.conf文件把下面几个注释打开
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /var/svn/svnrepos # 认证空间名,版本库所在目录
9.启动svn版本库
svnserve -d -r /var/svn/svnrepos
1
2
10.在Windows上测试
注意点:
1.url内填写的路径是 svn://host(ip)/
然后看这条命令 svnserve -d -r /var/svn/svnrepos
如果这条命令你写到了项目名称也就是仓库名称 地址就是svn://host(ip)/
如果你是这样写svnserve -d -r /var/svn/
那么地址就是svn://host(ip)/svnrepos
2.如果连接失败解决办法
用systemctl检查服务器的防火墙配置:
firewall-cmd –list-all
如果没有telnet服务和3690端口,进行下面的命令
firewall-cmd –permanent –add-service=telnet
firewall-cmd –permanent –add-port=3690/tcp
firewall-cmd –reload
配制
svnserver.conf中主要放开对以下的注释,注意每行左边没有空格。
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
1
2
3
4
passwd,创建用户及密码
[users]
admin=admin
zs=zs
li=li
cyq=cyq
cxx=cxx
lh=lh
mg=mg
hy=hy
wz=wz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
authz,权限配置
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]
[/]
表示admin有读写的权限
admin=rw
*=r表示其他人只能读
*=r
此处注意是/BHPP/BHPPB,和创建的文件结构对应,如果不对应会造成只有根目录中
的配置有效,其他的提示权限不够的错误
[/BHPP/BHPPB]
admin=rw
*=r
[/BHPP/BHPPH]
admin=rw
*=r
[/BHPP/BHPPB/frame]
admin=rw
ls=rw
*=r
[/BHPP/BHPPB/docmngt]
admin=rw
ls=rw
*=r
[/BHPP/BHPPB/fwebcommon]
admin=rw
ls=rw
*=r
[/BHPP/BHPPB/bcommon]
admin=rw
ls=rw
*=r
[/BHPP/BHPP/BHPPB/rsserver]
admin=rw
cyq=rw
*=r
[/BHPP/BHPPB/cmeramngt]
admin=rw
cxx=rw
*=r
[/BHPP/BHPPB/hrmngt]
admin=rw
mg=rw
*=r
[/BHPP/BHPPB/finmngt]
admin=rw
lh=rw
*=r
[/BHPP/BHPPB/assembly]
admin=rw
zs=rw
*=r