標籤:
一、安裝Subversion
#yum install subversion 1.查看安裝時的檔案產生情況,使用 rpm -ql subversion2.卸載subversion:#yum remove subversion3.停止subversion服務:#killall svnserve
二、建立倉庫(以建立多個倉庫為例)#svnadmin create /var/svn/demo#svnadmin create /var/svn/coffeetest/var/svn/demo和/var/svn/coffeetest為所建立倉庫的路徑,理論上可以是任何目錄。這裡我取/var/svn為所有倉庫的總路徑,在目錄下面分別建立倉庫。
三、配置倉庫針對每個倉庫單獨配置,分別修改每個倉庫conf目錄下面的三個設定檔(authz、passwd、svnserve.conf)
1.修改authz檔案,這個設定檔裡面可以設定使用者組和使用者目錄許可權==============================[groups]# harry_and_sally = harry,sally# harry_sally_and_joe = harry,sally,&joe
admin = admin,user1,user2 # [/foo/bar]# harry = rw# &joe = r# * =
[/]
@admin = rw
* ===============================上面綠色部分是我配置的內容,第一行綠色的是配置一個使用者組admin 有成員admin和novalue兩個;第二行綠色的開始配置目錄許可權,設定admin組(前面加@符號)的許可權為讀寫權限,其他成員沒有許可權(* = )
2.修改passwd檔案,設定訪問當前倉庫的使用者和密碼===========================================[users]# harry = harryssecret# sally = sallyssecretadmin = 123456user1 = 123456user2 = 123456===========================================
3.修改svnserve.conf檔案,開啟許可權控制等功能找到第一個常規選項[general],把前面是一個#號的去掉#號,如下是我的demo倉庫配置內容===========================================================================[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 = none
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 = coffeetest svndata==========================================================================注意:所有的行都必須頂格,否則報錯。
四、啟動和關閉服務1.啟動服務#svnserve -d -r /var/svn --listen-host 192.168.1.16 命令中/var/svn是我所有倉庫的所在的根目錄,如果單個倉庫,可以直接寫倉庫地址即可,比如啟動demo倉庫,#svnserve -d -r /var/svn/demo --listen-host 192.168.1.16 2.停止服務#killall svnserve
五、訪問倉庫項目我們有兩個代碼倉庫/var/svn/demo 和/var/svn/test,那麼在用戶端訪問時可以用svn://192.168.1.16/demo
[轉載]centos安裝svn伺服器