天天看點

LINUX下的svn的一些配置

一 權限配置:

/opt/svn/rinms/conf在這個路徑下:有三個檔案 authz。Password。svnserve

Authz檔案

[aliases]

# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

例如:C=XZ  (C是XZ的别名)

[groups](這個是進行分組的)

# harry_and_sally = harry,sally(harry_and_sally是組名,harry,sally這兩個分别是組寫的人員)

# harry_sally_and_joe = harry,sally,&joe

# PLATFORM_KK=XZY,MT

# PLATFORM_Test=ZFP,WB,LX

# [/foo/bar](配置設定權限的目錄)

# [repository:/192.168.1.200](配置設定權限的版本庫下的目錄)

# harry = rw(配置設定使用者或者組的權限)

# &joe = r

# * =

# @PLATFORM_KK=rw

# @PLATFORM_Test=r

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

Password中配置使用者的密碼

[users]

# harry = harryssecret(使用者=密碼)

# sally = sallyssecret

rinms = rinms

# XZY=XZY

# MT=MT

# ZFP=ZFP

# WB=WB

# LX=LX

Svnsvice檔案:設定權限設定是否開放

### Visit http://subversion.tigris.org/ for more information.

[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

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

### 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 = My First Repository

[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

二 添加版本庫

如果沒有的話,咱們就可以按先手動建立/data/svn/目錄

htpasswd -c /data/svn/passwd.conf test

test為使用者名

2.建立資料庫

 首先要建立一個資料庫,使用svnadmin增加資料庫

 cd /usr/local/subversion/bin

     ./svnadmin create /data/svn/svnroot

3. 到svnroot目錄下檢視是否多了一些檔案,有則說明建立成功。

三 版本庫中添加項目

/opt/svn/rinms是版本庫的路徑

/root/192.168.1.200 為項目目錄路徑

1.       在已經存在的版本庫中添加項目

1.1   /root/192.168.1.200中添加項目 項目檔案夾名為test(例如:java檔案的整個工程test)

1.2   /opt/svn/rinms下建立一個檔案夾,存放test的資料(例如檔案夾名為ui_tes)

1.3   然後進行項目添加。 svn import /root/192.168.1.200/test  file:///opt/svn/

1.3rinms/ui_test/ --message "init"

1.4   出現如下資訊,項目添加成功

Adding         /root/192.168.1.200/UI/src/com/enovell/exception/MessageHelper.java

Skipped '/root/192.168.1.200/UI/src/com/enovell/exception/.svn'

Skipped '/root/192.168.1.200/UI/src/com/.svn'

Adding         /root/192.168.1.200/UI/.settings

Adding         /root/192.168.1.200/UI/.settings/org.eclipse.jdt.ui.prefs

Skipped '/root/192.168.1.200/UI/.settings/.svn'

Adding         /root/192.168.1.200/UI/.settings/org.eclipse.core.resources.prefs

Committed revision 1087.

添加項目的小測試

我們做個測試,往版本庫裡添加項目,看看svnserver是否正常工作。

$ cd /tmp

$ mkdir svntest

$ cd svntest

$ mkdir {trunk,branches,tags}

$ svn import . file:///usr/local/repository/svn/test/svntest /

--message "first test project"

Adding         trunk

Adding         branches

Adding         tags

Committed revision 1.

$ svnlook tree /usr/local/repository/svn/test

/

svntest/

  trunk/

  branches/

  tags/

$ cd ../

$ rm -rf svntest

$ svn checkout svn://localhost/test/svntest

A    svntest/trunk

A    svntest/branches

A    svntest/tags

Checked out revision 1.

OK,看來我們的svn已經能正确工作了。

繼續閱讀