1,運行yum install -y subversion 只要網絡正常的話,都能順利安裝的;
2,運行svnserve --version,如下圖所示說明安裝成功
3,創建版庫
mkdir /home/svn #我的話在home下面的svn中
svnadmin create /home/svn/test #我這裏將svn作爲所有版本庫的目錄,並創建了一個名爲test的版本庫
4.配置當前的版本庫
創建版本庫後,在當前版本庫目錄中會生成下面的文件,其中我們關心的是配置文件。
說明:
(1)svnserve.conf: svn服務綜合配置文件。
(2)passwd: 用戶名口令文件。
(3)authz: 權限配置文件。
[users]
# harry = harryssecret
# sally = sallyssecret
repouser0 = user0passwd
rock=rockpasswd
其中對應的是 用戶名=密碼 ,其中等號兩邊的空格不是必須的。
4,修改authz文件
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
team0=erpouser0 #將上面創建的分成兩個組
team1=rock
# [/foo/bar]
# harry = rw
# &joe = r #上面的別名定義在這裏實現 &在這裏理解爲指針就很容易了
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[repo0:/]
@team0=r
@team1=rw
# 第一個小組只有讀取的權限,第二個小組有讀寫的權限
# 單個版本庫的權限配置在這個文件中實現
5,修改svnserve.conf
[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 #密碼文件爲當前目錄下的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 #驗證文件爲當前目錄下的authz
備註:
-
anon-access = none #沒有登錄的用戶不能訪問
-
auth-access = write #登錄的用戶可以寫入
-
password-db = passwd #密碼文件爲當前目錄下的passwd
-
-
authz-db = authz #驗證文件爲當前目錄下的authz
-
6. 停止和啓動svn
svnserve -d -r /var/svn/
關閉 <pre name="code" class="html">ps -aux |grep svn
kill -9 進程id
8,導入與導入工程
$ mkdir MyProject
$ mkdir MyProject/trunk
$ mkdir MyProject/branches
$ mkdir MyProject/tags
svn import MyProject svn://192.168.1.109/repo0/MyProject -m "first import project"
</pre><pre name="code" class="html">導出 <pre name="code" class="html">svn co svn://192.168.1.109/repo0/MyProject
配置防火牆端口
[root@zck conf]# vi /etc/sysconfig/iptables
添加以下內容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
保存後重啓防火牆
[root@zck conf]# service iptables restart
查看SVN進程
[root@zck conf]# ps -ef|grep svn|grep -v grep
root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /home/svn/test
檢測SVN 端口
[root@zck conf]# netstat -ln |grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
停止重啓SVN
[root@zck password]# killall svnserve //停止
[root@zck password]# svnserve -d -r /opt/svn/test // 啓動