centos7安裝部署SVN
阿新 • • 發佈:2019-02-28
int 信息 授權 num pre 賬戶 tab lar star
SVN介紹
-
SVN是個自由、開源的版本控制系統,絕大多數開源軟件都使用SVN作為代碼版本管理軟件。
-
SVN的官方網站http://subversion.apache.org/。目前SVN在開源社區中非常流行的一款版本控制軟件,它是CVS的替代產物。
SVN服務端安裝
部署規劃
系統版本 | 系統配置 | IP地址 | 端口號 | SVN版本 | SVN數據目錄 | SVN日誌目錄 | SVN配置文件目錄 |
---|---|---|---|---|---|---|---|
CentOS Linux release 7.2.1511 | 1.7.14 | /data/svndata/ | /data/logs/svn/ | /data/svndata/ztjy/conf |
安裝部署
yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql -y
創建相關目錄
創建svn數據目錄
mkdir -p /data/svndata/
新建ztjy倉庫
svnadmin create /data/svndata/ztjy
?
[root@localhost svn]$ ls -al /data/svndata/ztjy #查看創建的倉庫目錄
total 24
drwxr-xr-x. 2 root root 4096 Feb 28 18:12 conf
drwxr-sr-x. 6 root root 4096 Feb 28 18:12 db
-r--r--r--. 1 root root 2 Feb 28 18:12 format
drwxr-xr-x. 2 root root 4096 Feb 28 18:12 hooks
drwxr-xr-x. 2 root root 4096 Feb 28 18:12 locks
-rw-r--r--. 1 root root 229 Feb 28 18:12 README.txt
-
倉庫目錄說明:
hooks目錄:放置hook腳步文件的目錄
locks目錄:用來放置subversion的db鎖文件和db_logs鎖文件的目錄,用來追蹤存取文件庫的客戶端
?
format目錄:是一個文本文件,裏邊只放了一個整數,表示當前文件庫配置的版本號
?
conf目錄:是這個倉庫配置文件(倉庫用戶訪問賬戶,權限)
?
db目錄:倉庫數據目錄
修改相關配置文件
配置SVN服務的配置文件svnserver.conf
?
[root@localhost conf]# vim svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = 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 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 = ztjy ##這個是提示信息
[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run ‘svnserve --version‘ and look for a line
### reading ‘Cyrus SASL authentication is available.‘
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
?
配置訪問用戶及密碼
?
[root@localhost conf]# vim 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]
awk = abc123456 # 切記‘=‘兩邊的空格 密碼建議設置復雜密碼
sed = 123456
grep = 654321
?
配置新用戶的授權文件
?
[root@localhost conf]# vim authz
### 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]
[groups]
admin = awk,sed #創建admin組,組成員為:awk,sed
user = grep # 創建用戶組,用戶成員:grep
[ztjy:/] #賦予根權限,為了便於管理和權限的控制,可以把權限細化到版本庫中相應的目錄
@admin = rw ##授予admin組內用戶可讀可寫的權限
@user = r ## 授予user組用戶只讀的權限
* = r ##授予其他的用戶和用戶組只讀權限
?
書寫註意事項
-
[/],表示根目錄及其一下的路徑,根目錄是svnserver啟動時指定好的,上述實例中我們指定 為:/data/svndata([/]=/data/svndata).[/]就是表示對全部版本設置的權限
-
[ztjy:/],表示對版本庫ztjy設置權限;
-
[ztjy:/svnadmin],表示對版本庫ztjy中的svnadmin項目設置權限;
-
[ztjy:/svnadmin/second],表示對版本庫ztjy中的svnadmin項目的目錄設置權限;
-
權限的主體可以是用戶組,用戶或者,用戶組在前面要以@開頭,表示全部用戶
-
權限分為:r ,w, rw和null ,null空表示沒有任何權限。
-
auhtz配置文件中的每個參數,開頭不能有空格,對於組要以@開頭,用戶不需要。
啟動svn服務
/usr/bin/svnserve -d -r /data/svndata/ --listen-port 9984 --log-file /data/logs/svn/svn.log --pid-file /data/logs/svn/svn.pid &
?
centos7安裝部署SVN