centos7安裝配置管理SVN
1、安裝svn
# yum install subversion
# svnserve --version
svnserve, version 1.7.14 (r1542130)
compiled Jun 9 2014, 18:54:44
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.
2、建立目錄及庫
建立svn資源庫目錄
# mkdir -p /svn/svnrepos
建立svn資源庫
# svnadmin create /svn/svnrepos
3、修改配置檔案
# cd /svn/svnrepos
# ll
total 16
drwxr-xr-x 2 root root 51 Nov 7 15:15 conf
drwxr-sr-x 6 root root 4096 Nov 7 15:15 db
-r--r--r-- 1 root root 2 Nov 7 15:15 format
drwxr-xr-x 2 root root 4096 Nov 7 15:15 hooks
drwxr-xr-x 2 root root 39 Nov 7 15:15 locks
-rw-r--r-- 1 root root 229 Nov 7 15:15 README.txt
# cd conf/
有下面配置檔案
# ll
total 12
-rw-r--r-- 1 root root 1080 Nov 7 15:15 authz
-rw-r--r-- 1 root root 309 Nov 7 15:15 passwd
-rw-r--r-- 1 root root 3090 Nov 7 15:15 svnserve.conf
authz檔案是許可權控制檔案
passwd是帳號密碼檔案
svnserve.conf SVN服務配置檔案
備份配置檔案
# cp svnserve.conf svnserve.conf.bak
編輯服務配置檔案,開啟相應註釋
# vi svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
含義依次為:
非鑑權使用者沒有許可權
鑑權使用者有寫許可權
指定使用者名稱口令檔名
指定許可權配置檔名
新增admin賬戶和密碼
# vi passwd
[users]
admin=admin
為admin賬戶配置根的讀寫許可權
# vi authz
[groups]
[/]
admin = rw
4、啟動服務檢視狀態
啟動服務
# svnserve -d -r /svn/svnrepos
檢視程序
# ps -ef | grep svn | grep -v grep
root 6563 1 0 15:28 ? 00:00:00 svnserve -d -r /svn/svnrepos
檢視埠
# netstat -an | grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
5、訪問svn
使用tortoiseSVN進行訪問,地址svn://192.168.1.177/svnrepos
賬戶admin,密碼admin,就是passwd檔案裡寫入的使用者名稱和密碼。
6、進一步探索
殺掉程序
# killall svnserve
刪除資源庫
# rm -rf /svn/svnrepos
# svnadmin create /svn/repositoryA
# vi /svn/repositoryA/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = /svn/repositoryA/conf/passwd
authz-db = /svn/repositoryA/conf/authz
realm = repositoryA
# vi /svn/repositoryA/conf/passwd
[users]
user1 = user1pw
user2 = user2pw
user3 = user3pw
user4 = user4pw
# vi /svn/repositoryA/conf/authz
[groups]
team1 = user1,user2
team2 = user3,user4
[/]
@team1 = rw
[/]
@team2 = r
* =
# svnserve -d -r /svn/repositoryA
svn://192.168.1.177/repositoryA
測試:
本地建立檔案,右鍵檔案--TortoiseSVN--Import
輸入url地址:svn://192.168.1.177/repositoryA
輸入user3和user4,發現上傳失敗
輸入user1和user2,上傳成功
點選 開始--TortoiseSVN Repository Brower
輸入url地址:svn://192.168.1.177/repositoryA
發現四個使用者都可以訪問,檢視上傳的檔案,這是因為user3和user4許可權為只讀。
依照之前的操作新增一個版本庫repositoryB
這裡需要注意的是預設svn對應的埠為3690,所以另外新增版本庫也需要指定不一樣的埠
# svnserve -d -r /svn/repositoryB --listen-port 3691
url地址:svn://192.168.1.177:3691/repositoryB
參考:
https://blog.csdn.net/RobertoHuang/article/details/55504260
https://www.cnblogs.com/chaichuan/p/3758173.html
https://blog.csdn.net/u011280484/article/details/50499534
https://baijiahao.baidu.com/s?id=1587378965903945354&wfr=spider&for=pc