云服務器:阿里云CentOS7.3 64
svn版本控制在各大公司還是占主導地位的渴杆,也有很多實用gitlab搭建佛点;后續(xù)也會寫一篇gitlab的搭建恃疯。今天主要以yum方式安裝svn熙揍。
一订咸、yum安裝svn
[root@sihan ~]# yum install -y subversion
[root@sihan ~]# 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.
二虎谢、創(chuàng)建SVN版本庫及版本庫目錄
[root@sihan ~]# mkdir -p /usr/svn/repo
[root@sihan ~]# svnadmin create /usr/svn/repo
三盟榴、修改svn的配置文件
需要注意的是配置文件都需要頂行,前面不能有空格婴噩,不然會報錯的擎场。
[root@sihan ~]# vim /usr/svn/repo/conf/svnserve.conf
#匿名用戶沒有權限
anon-access = none
#授權用戶可寫(包含可讀)
auth-access = write
#使用哪個文件作為賬號文件
password-db = passwd
#使用哪個文件作為權限文件
authz-db = authz
#認證空間名,版本庫所在目錄
realm = /usr/svn/repo
四几莽、設置svn的賬號密碼
[root@sihan ~]# vim /usr/svn/repo/conf/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]
test= 123456
五迅办、設置svn的賬號權限
[root@sihan ~]# vim /usr/svn/repo/conf/authz
在末尾添加如下代碼,表示test用戶擁有更目錄的讀寫權限
[/]
test=rw
六章蚣、啟動svn版本庫
-d 表示svnserve.exe 將會作為一個服務程序運行在后臺
-r表示把/usr/svn/repo目錄作為根目錄
[root@sihan ~]# svnserve -d -r /usr/svn/repo --listen-port=3690
注意:這里啟用了3690作為svn版本庫的端口站欺,一般新服務器是沒有對此端口開放的,所以需要自行上云提供商后臺配置安全組規(guī)則纤垂,開放3690端口矾策。