1:安裝過程,這裏採用了yum的方式安裝,編譯的話有點麻煩。shell
[root@localhost data]# yum install subversion
執行如下的命令:less
svn --version
若是顯示svn
svn, version 1.6.11 (r934486)
之類的信息,那麼表明安裝成功了。
ui
二、創建版本庫this
首先咱們創建一個文件夾來專門存放svn項目,以下
code
[root@localhost data]# mkdir /data
咱們使用命令創建兩個項目:orm
[root@localhost data]# svnadmin create /data/onethink [root@localhost data]# svnadmin create /data/p2
此時會在文件夾/data/下面生成兩個項目onethink和p2,目錄結構以下:ci
drwxr-xr-x. 6 root root 4096 May 23 22:10 onethink drwxr-xr-x. 6 root root 4096 May 24 01:06 p2
每一個項目的目錄結構以下:it
drwxr-xr-x. 2 root root 4096 May 24 01:15 conf drwxr-sr-x. 6 root root 4096 May 24 01:24 db -r--r--r--. 1 root root 2 May 24 01:06 format drwxr-xr-x. 2 root root 4096 May 24 01:06 hooks drwxr-xr-x. 2 root root 4096 May 24 01:06 locks -rw-r--r--. 1 root root 229 May 24 01:06 README.txt
其中 conf 文件夾中的三個文件爲svn的配置文件,包括:io
-rw-r--r--. 1 root root 1093 May 7 06:41 authz -rw-r--r--. 1 root root 320 May 7 06:39 passwd -rw-r--r--. 1 root root 2259 May 7 06:43 svnserve.conf
其中authz爲權限文件,passwd爲用戶驗證文件,svnserve.conf爲項目配置文件。爲了方便咱們把authz passwd這兩個文件獨立開來,成爲每一個項目的公用權限和驗證文件。咱們把它們放在/data/conf目錄下。
此時的目錄結構以下:
drwxr-xr-x. 2 root root 4096 May 24 01:26 conf drwxr-xr-x. 6 root root 4096 May 23 22:10 onethink drwxr-xr-x. 6 root root 4096 May 24 01:06 p2
[root@localhost data]# ll conf onethink/ p2/ conf: total 8 -rw-r--r--. 1 root root 1031 May 24 01:24 authz -rw-r--r--. 1 root root 338 May 23 22:08 passwd onethink/: total 24 drwxr-xr-x. 2 root root 4096 May 23 22:56 conf drwxr-sr-x. 6 root root 4096 May 24 01:18 db -r--r--r--. 1 root root 2 May 23 21:50 format drwxr-xr-x. 2 root root 4096 May 23 21:50 hooks drwxr-xr-x. 2 root root 4096 May 23 21:50 locks -rw-r--r--. 1 root root 229 May 23 21:50 README.txt p2/: total 24 drwxr-xr-x. 2 root root 4096 May 24 01:15 conf drwxr-sr-x. 6 root root 4096 May 24 01:24 db -r--r--r--. 1 root root 2 May 24 01:06 format drwxr-xr-x. 2 root root 4096 May 24 01:06 hooks drwxr-xr-x. 2 root root 4096 May 24 01:06 locks -rw-r--r--. 1 root root 229 May 24 01:06 README.txt
接下來咱們配置用戶名及密碼
打開/data/conf/passwd文件,增長兩個用戶
[root@localhost conf]# cat 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] # harry = harryssecret # sally = sallyssecret tttt = 111111 #用戶1 tttt2 = 111111 #用戶2
接着咱們設置項目onethink和p2下面的conf/svnserve.conf文件,令到它能夠使用公共的/data/conf/passwd及/data/conf/authz
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 = /data/conf/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 = /data/conf/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 = p2 //貌似這個叫什麼來着?
配置好後,咱們還須要配置/data/conf/authz權限管理文件
[groups] g1 = tttt #用戶組1 g2 = tttt2 #用戶組2 [onethink:/] #onethink項目的權限設置 @g1 = rw #onethink項目組,用戶組1是有讀寫的 @g2 = #onethink項目組,用戶組2是沒有任何權限的 [p2:/] #p2項目組的權限,同上 @g2= rw [p2:/txt] #配置p2項目下的txt文件夾的權限,這裏用戶組2是沒有權限的 @g2=
配置好後,咱們啓動svn服務
[root@localhost conf]# svnserve -d -r /data/
這時咱們在window環境下就能夠使用軟件來訪問了,兩個項目的訪問地址分別爲
svn://192.168.110.129/p2
svn://192.168.110.129/onethink