CentOS 7搭建SVN服務器

安裝步驟如下:

1、yum install subversion

2、查看安裝版本 svnserve --version

   

3、創建SVN版本庫目錄 mkdir -p /var/svn/svnrepos

4、創建版本庫  svnadmin create /var/svn/svnrepos

   執行了這個命令之後會在/var/svn/svnrepos目錄下生成如下這些文件

   

5、進入conf目錄(該svn版本庫配置文件)cd conf/
   authz文件是權限控制文件
   passwd是帳號密碼文件
   svnserve.conf SVN服務配置文件

6、設置帳號密碼 vi passwd
   在[users]塊中添加用戶和密碼,格式:帳號=密碼,如janus=123456

   

7、設置權限 vi authz
   在末尾添加如下代碼:

  1. [/]  
  2. janus = rw

### 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]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe


# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r


[/]
janus = rw

   

   意思是版本庫的根目錄quwenzhe對其有讀寫權限

8、修改svnserve.conf文件  vi svnserve.conf
   打開下面的幾個註釋:
   anon-access = read #匿名用戶可讀
   auth-access = write #授權用戶可寫
   password-db = passwd #使用哪個文件作爲賬號文件
   authz-db = authz #使用哪個文件作爲權限文件
   realm = /var/svn/svnrepos # 認證空間名,版本庫所在目錄

   

9、啓動svn版本庫  svnserve -d -r /var/svn/svnrepos

    停止可以使用以下命令

[root@localhost conf]# ps aux |grep svn
root       7637  0.0  0.0 164236   904 ?        Ss   10:34   0:00 svnserve -d -r /var/svn/svnrepos
root       7674  0.0  0.0 114712   976 pts/2    R+   10:42   0:00 grep --color=auto svn
[root@localhost conf]# kill -9 7637


10、在windows上測試

   輸入SVN地址,如下圖:

   

   輸入用戶名、密碼即可

   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章