centos下面搭建svn服務器詳細流程

1.安裝svn服務器

先使用svnserve --version命令查看有沒有安裝svn服務器。linux

能夠看到已經安裝了,若是沒有安裝使用以下命令安裝:windows

yum install -y subversion

2.建立svn版本庫

mkdir /home/svn #我這裏把版本庫放在了home目錄下的svn文件夾,方便管理  

svnadmin create /home/svn/repo0 #我這裏將svn做爲全部版本庫的目錄,並建立了一個名爲repo0的版本庫倉庫

3.配置這個建立的版本庫

進入剛纔的建立的這個版本庫的conf目錄來配置這個repo0的版本庫,能夠看獲得有三個文件緩存

authz:              權限控制,哪些用戶能夠訪問哪些文件服務器

passed:           設置用戶和密碼的less

svnserve.conf: 設置svn相關的操做ide

  2.1先設置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

xiajun=123456
lisi=12

這樣咱們就創建了xiajun用戶, 123456密碼  ,lisi用戶,12密碼svn


   2.2 再設置權限authz

###  - 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

team0=xiajun
team1=lisi

#xiajun在team0組
#lisi在team1組


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



# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
#
[repo0:/]
@team0=rw
@team1=r
# 第一個小組有讀寫的權限,第二個小組只有讀取的權限



2.3最後設定snvserv.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 = read   #沒有登陸的用戶不能訪問
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   
### 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 =/home/svn/repo0  # 認證命名空間,subversion會在認證提示裏顯示,而且做爲憑證緩存的關鍵字。

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

採用默認配置. 以上語句都必須頂格寫, 左側不能留空格, 不然會出錯.ui


好了,經過以上配置,你的svn就能夠了。this

3.啓動svn服務器

啓動svnserve -d -r /home/svn/repo0

能夠看獲得該版本庫的svn服務器已經啓動了。spa

 

4. 導入工程(仍是在linux下面)

$ 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"

注意必定要導入工程到這個版本庫裏,repo0只是一個倉庫,倉庫裏面要放項目

5.檢出工程

建議在windows下采用TortoiseSVN, 鏈接地址爲: svn://your server address (若是指定端口須要添加端口  :端口號)

svn://172.16.81.106/repo0/myproject

能夠看獲得已經檢出了

後面使用svn上傳,修改,刪除均可以使用TortoiseSVN操做,比較簡單。

相關文章
相關標籤/搜索