1:安装svn
$sudo apt-get install subversion
2:添加svn管理用户及subversion组
$ sudo adduser svnuser
$ sudo addgroup subversion
$ sudo addgroup svnuser subversion
3:创建项目目录
$ sudo mkdir /usr/local/svn
$ cd /usr/local/svn
$ sudo mkdir repository
$ sudo chown -R root:subversion repository
$ sudo chmod -R g+rws repository
4:创建SVN文件仓库
$ sudo svnadmin create /usr/local/svn/repository
5:访问权限设置
$sudo gedit /usr/local/svn/repository/conf/svnserve.conf
把如下几行取消注释,行开头不要有空格
password-db = passwd
authz-db = authz
anon-access = read
auth-access = write
$sudo gedit /usr/local/svn/repository/conf/passwd
添加几个用户,格式为用户 = 密码,每行一个用户,如:
[users]
user1 = passwd1
user2 = passwd2
user3 = passwd3
$sudo gedit /usr/local/svn/repository/conf/authz
修改用户所属组和权限,名字用逗号隔开
[groups]
admin = user1,user2
test = user3
[/]
@admin=rw
*=r
修改一些文件的读写权限,以免svn读写操作时失败
$sudo chown -R root:subversion /usr/local/svn/
$sudo chmod -R g+rws /usr/local/svn/
$sudo chown username:group -R /usr/local/svn/repository/db/
$sudo chmod 777 -R /usr/local/svn/repository/db/
6:启动svn服务
$svnserve -d -r /usr/local/svn
7:svn操作
$svn checkout svn://192.168.80.85/repository --username user1 --password 123456 /usr/local/code