FreeBSD - FreeBSD8.2下搭建Subversion

        freebsd搭建svn有幾種方法,可以將svn單獨啓動,也可以通過apache啓動,apache方式的我試了很多次都沒有安裝好,就只有使用svn自帶的服務啓動方式了,下面是綜合網上資料自己試驗成功的步驟(以下都是在root權限下)。

1,ports方式安裝subversion

cd /usr/ports/devel/subversion             //進入ports的svn所在目錄

make install clean                                  //安裝命令,會自動下載並安裝svn,網上有的說需要添加一些參數,因爲沒有用到apache模塊,就不用那些參數了

2,創建倉庫根目錄和測試倉庫

選擇一個位置作爲svn倉庫根目錄,這裏我用/usr/svn作爲倉庫根目錄,此處根目錄意思就是裏面會存放很多倉庫文件,一般一個項目就是一個倉庫

mkdir /usr/svn

創建好根目錄後創建實際的倉庫

svnadmin create /usr/svn/project1         //project1是倉庫名,可以換別的名字

3配置權限

在每個倉庫都會有conf文件夾,裏面包含了配置文件passwd(用戶密碼),authz(用戶和用戶組權限),svnserve.conf(倉庫配置文件),自己給的解釋,大概能懂就行

a、增加一個用戶,打開passwd文件,加入一個用戶名與密碼:如
[users]
# harry = harryssecret
# sally = sallyssecret
test = test                     //這裏加入一個test用戶,並且密碼是test

b、修改用戶權限:
打開authz文件,配置如下:(只要修改groups節點)
[groups]
admin = test                //這裏表示有一個admin用戶組,這個用戶組中用一個叫test的用戶
[/]                                    //這裏是特別需要注意,svnserve -r -d /usr/svn/, 如果啓動時指定的是 -r -d /usr/svn/project1   這裏就要 用 [/project1] 

@admin = rw                //表示admin組中的用戶都有讀寫權限
* = r
# [repository:/baz/fuz]

c、修改svnserver.conf文件,配置如下:
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 #指寫權限分配文件

4,啓動服務

svn默認啓動的是IPV6的,所以在啓動時需要加一些參數:

svnserve -d -r /usr/svn/--listen-host=0.0.0.0 --listen-port=3690           //-d好像是在後臺運行  -r是倉庫的目錄或根目錄
這樣就可以了。

關閉服務使用:killall svnserve


發佈了21 篇原創文章 · 獲贊 8 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章