Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux教程 >> Linux下安裝配置SVN獨立服務器svnserve

Linux下安裝配置SVN獨立服務器svnserve

日期:2017/2/7 14:36:34      編輯:Linux教程
 

svn服務器有兩種運行方式:獨立服務器svnserve和借助apache作為apache的一個模塊,以webdav/deltav協議通訊。

svn存儲版本數據有兩種方式:BDB和FSFS。BDB方式在服務器中斷時,可能鎖住數據。FSFS方式更安全些,兼容性好。

 

一.安裝subversion

# wget http://subversion.tigris.org/downloads/subversion-1.6.13.tar.gz

# wget http://subversion.tigris.org/downloads/subversion-deps-1.6.13.tar.gz

# tar -xzvf subversion-1.6.13.tar.gz -C ../software/

# tar -xzvf subversion-deps-1.6.13.tar.gz -C ../software/

# cd ../software/subversion-1.6.13/

# ./configure --prefix=/usr/local/subversion-1.6.13

# make clean

# make

# make install

# ./svnserve --version

svnserve, version 1.6.13 (r1002816)

compiled Jun 1 2011, 10:19:12

 

Copyright (C) 2000-2009 CollabNet.

Subversion is open source software, see http://subversion.tigris.org/

This product includes software developed by CollabNet (http://www.Collab.Net/).

 

The following repository back-end (FS) modules are available:

 

* fs_fs : Module for working with a plain file (FSFS) repository.

 

Cyrus SASL authentication is available.

輸出以上信息說明安裝成功。

 

二.建立庫文件

1.創建文件夾

# mkdir -p /www/svn/repository

2.創建版本庫並指定數據存儲模式為FSFS

# ./svnadmin create --fs-type fsfs /www/svn/repository/

# ls /www/svn/repository/

conf db format hooks locks README.txt

3.創建項目臨時目錄

# mkdir -p /www/svn/tmp/{trunk,tags,branches}

4.復制項目文件到trunk目錄下

# cp -r nginx /www/svn/tmp/trunk/

5.導入所需管理的項目到版本庫repository中

# ./svn import /www/svn/tmp/ file:///www/svn/repository/ -m "first import"

-m 標識操作的注釋

/ww/svn/tmp/trunk/nginx 項目文件的位置

file:///www/svn/repository 創建的軟件倉庫

Adding /www/svn/tmp/trunk/nginx/client_body_temp

Adding /www/svn/tmp/trunk/nginx/uwsgi_temp

Adding /www/svn/tmp/trunk/nginx/logs

Adding /www/svn/tmp/trunk/nginx/logs/access.log

Adding /www/svn/tmp/trunk/nginx/logs/error.log

Adding /www/svn/tmp/trunk/nginx/html

Adding /www/svn/tmp/trunk/nginx/html/50x.html

Adding /www/svn/tmp/trunk/nginx/html/index.html

Adding /www/svn/tmp/trunk/nginx/fastcgi_temp

Adding /www/svn/tmp/trunk/nginx/conf

Adding /www/svn/tmp/trunk/nginx/conf/uwsgi_params

Adding /www/svn/tmp/trunk/nginx/conf/fastcgi_params

Adding /www/svn/tmp/trunk/nginx/conf/uwsgi_params.default

Adding /www/svn/tmp/trunk/nginx/conf/fastcgi.conf

Adding /www/svn/tmp/trunk/nginx/conf/fastcgi_params.default

Adding /www/svn/tmp/trunk/nginx/conf/fastcgi.conf.default

Adding /www/svn/tmp/trunk/nginx/conf/nginx.conf

Adding /www/svn/tmp/trunk/nginx/conf/scgi_params

Adding /www/svn/tmp/trunk/nginx/conf/win-utf

Adding /www/svn/tmp/trunk/nginx/conf/nginx.conf.default

Adding /www/svn/tmp/trunk/nginx/conf/mime.types

Adding /www/svn/tmp/trunk/nginx/conf/scgi_params.default

Adding /www/svn/tmp/trunk/nginx/conf/mime.types.default

Adding /www/svn/tmp/trunk/nginx/conf/koi-win

Adding /www/svn/tmp/trunk/nginx/conf/koi-utf

Adding /www/svn/tmp/trunk/nginx/proxy_temp

Adding /www/svn/tmp/trunk/nginx/scgi_temp

Adding /www/svn/tmp/trunk/nginx/sbin

Adding (bin) /www/svn/tmp/trunk/nginx/sbin/nginx

 

Committed revision 1.

 

6.檢查是否導入成功

# ./svn list --verbose file:///www/svn/repository/

1 root Jun 01 10:48 ./

1 root Jun 01 10:48 client_body_temp/

1 root Jun 01 10:48 conf/

1 root Jun 01 10:48 fastcgi_temp/

1 root Jun 01 10:48 html/

1 root Jun 01 10:48 logs/

1 root Jun 01 10:48 proxy_temp/

1 root Jun 01 10:48 sbin/

1 root Jun 01 10:48 scgi_temp/

1 root Jun 01 10:48 uwsgi_temp/

 

7.修改版本庫文件的權限

# chmod 770 repository

# chmod -R g+w repository

 

三.用戶管理

1.修改版本庫的配置文件

# vim /www/svn/repository/conf/svnserve.conf

[general]

anon-access = read

auth-access = write

password-db = passwd

authz-db = authz

realm = repository

[sasl]

 

2.修改允許訪問版本庫的用戶文件

# vim /www/svn/repository/conf/passwd

文件格式如下所示:

[users] //不可省略

username1=password1

username2=password2 //每個用戶一行

新建用戶列表

xuhh = xuhh@766

 

3.修改用戶訪問版本庫的權限

# vim /www/svn/repository/conf/authz

注意:權限配置文件中出現的用戶名必須在passwd文件中有定義過,對權限配置文件authz的修改會立即生效。

文件格式如下所示:

用戶組格式:

[groups]

user_group_name=username1,username2 //用戶間以逗號分割

Copyright © Windows教程網 All Rights Reserved