服务器配置
名称 | 配置 |
---|---|
centos | 7.5-1804 |
svn版本 | 1.7.14 |
内存 | 8G |
磁盘 | 1T |
检查环境
检查是否已经安装过svn了
[root@svngit ~]# svnserve --version
svnserve, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/
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.
看来CentOS7.5已自带了SVN服务了
…
上述检查的命令也可以用以下这条指令
[root@svngit ~]# rpm -qa | grep subversion
subversion-libs-1.7.14-14.el7.x86_64
subversion-1.7.14-14.el7.x86_64
如果安装
如果没有安装的话,直接使用以下方式安装
yum -y install subversion
安装后再使用svnserve --version
查看版本信息
接下来创建版本库目录和版本库
[root@svngit ~]# mkdir -p /var/svn/svnrepos
[root@svngit ~]# cd /var/svn/svnrepos/
[root@svngit svnrepos]# svnadmin create /var/svn/svnrepos/zim
[root@svngit svnrepos]# ll
total 0
drwxr-xr-x. 6 root root 86 Sep 8 17:55 zim
进入zim目录,查看目录结构
[root@svngit zim]# ll
total 8
drwxr-xr-x. 2 root root 54 Sep 8 17:55 conf
drwxr-sr-x. 6 root root 233 Sep 8 17:55 db
-r--r--r--. 1 root root 2 Sep 8 17:55 format
drwxr-xr-x. 2 root root 231 Sep 8 17:55 hooks
drwxr-xr-x. 2 root root 41 Sep 8 17:55 locks
-rw-r--r--. 1 root root 229 Sep 8 17:55 README.txt
修改配置
进入版本库/conf
目录内
# 用户的读写权限等
-rw-r--r--. 1 root root 1080 Sep 8 17:55 authz
# 用户的账号和密码信息
-rw-r--r--. 1 root root 309 Sep 8 17:55 passwd
# SVN服务器相关配置
-rw-r--r--. 1 root root 3090 Sep 8 17:55 svnserve.conf
其中,svnserver.conf
配置
[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
realm = /var/svn/svnrepos
passwd文件中增加用户密码信息
[users]
# harry = harryssecret
# sally = sallyssecret
zhangsan = zhangsan
lisi = lisi
wangwu = wangwu
在authz文件中配置上述用户的分组情况和操作权限
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
group1 = zhangsan,lisi
group2 = wangwu
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
# 根目录
[/]
@group1 = rw
@group2 = r
启动服务
[root@svngit conf]# svnserve -d -r /var/svn/svnrepos
[root@svngit conf]# ps -aux | grep svn
root 26099 0.0 0.0 180716 804 ? Ss 13:46 0:00 svnserve -d -r /var/svn/svnrepos
开启防火墙
SVN端口默认为3690,若Linux开启了防火墙,需开启默认端口
开启端口:firewall-cmd --zone=public --add-port=3690/tcp --permanent
重启防火墙:firewall-cmd --reload
[root@svngit conf]# netstat -antp | grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 26099/svnserve
[root@svngit conf]# firewall-cmd --zone=public --add-port=3690/tcp --permanent
success
[root@svngit conf]# firewall-cmd --reload
success
tortoise测试
在Checkout的目录内创建测试文件和文件夹
还没有配置用户名和密码
之后再次提交可提交成功,使用wangwu的用户,则失败,因为wangwu配置时没有配置写权限。
文件不显示状态图标
如下,也不知道各个文件的状态是什么
解决办法:
找到下载的安装包,双击运行,到如下步骤时,点击中间的repair,修复一下,修复完小图标就显示出来了。