1.更新软件资源包
apt-get update
//安装SVN
apt-get install subversion
//查看是否安装成功
svnserve --version
root@777-Rev-1-0:/home/777# svnserve --version
svnserve,版本 1.9.7 (r1800392)
编译于 Mar 28 2018,08:49:13 在 x86_64-pc-linux-gnu
Copyright (C) 2017 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/
下列版本库后端(FS) 模块可用:
* fs_fs : 模块与文本文件(FSFS)版本库一起工作。
* fs_x : Module for working with an experimental (FSX) repository.
* fs_base : 模块只能操作BDB版本库。
Cyrus SASL 认证可用。
2.创建SVN版本库
//进入存放版本的文件夹
cd /usr
//创建SVN文件夹
mkdir svn
cd /svn
//创建仓库并授权
mkdir repository
sudo chmod -R 777 /usr/svn/repository
svnadmin create /usr/svn/repository
cd repository
sudo chmod -R 777 /usr/svn/repository/db
3.修改配置文件
vim /usr/svn/repository/svnserver
### 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 // ===>任何人不可读不可写,read 为只读
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
### directory containing this file. The specified path may be a
4.保存后设置密码文件
vim /usr/svn/repository/authz
### 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
aaa = 1111 //权限文件 ===>用户名:密码
bbb = 2222
5.保存后设置权限文件
### 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]
group = bbb //===>用户名
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
//查看部分仓库rw可读可写,:/sqfwDoc为目录名
[repository:/sqfwDoc]
@group = rw
#* = r
#
#
#超级用户
admin = aaa
@admin = rw
#* = r
6.保存测试
//启动SVN服务
sudo svnserve -d -r /usr/svn/
//查看是否启动成功
ps aux | grep svnserve
//关闭SVN
killall svnserve
7.远程连接
//svn连接默认端口是3690
svn://192.168.1.100:3690/repository