ubuntu svn

1.下载必要软件

sudo apt-get install subversion
sudo apt-get install apache2
sudo apt-get install libapache2-svn

2.设置组

sudo addgroup subversion
sudo usermod -G subversion -a www-data

3.创建文件夹

mkdir ~/svn
cd ~/svn

4. 创建库

sudo svnadmin create logs
chown -R testusergroup:subversion logs
sudo chmod -R g+rws logs

5. 配置用户testusr

htpasswd -c ~/dav_svn.passwd testusr
sudo mv ~/dav_svn.passwd /etc/subversion


6. 创建权限文件

dav_svn.authz 

[groups]
administrator=admin,testusr

[logs:/]
@administrator=rw
sudo mv ~/dav_svn.authz /etc/subversion

7. 修改apache2配置/etc/apache2/ports.conf

#NameVirtualHost *:80
Listen 3690 # 端口设置

<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

8. 配置apache2的svn插件,创建配置文件/etc/apache2/mods-available/dav_svn.conf

<Location /svn>

# Uncomment this to enable the repository
DAV svn

# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.

# 仓库根路劲配置

SVNParentPath /home/svn

# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.

# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"

# 授权文件

AuthUserFile /etc/subversion/dav_svn.passwd

# To enable authorization via mod_authz_svn
AuthzSVNAccessFile /etc/subversion/dav_svn.authz

# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>

</Location>

 

 

测试:

http://<ip>:3690/svn/logs
user: testusr
passwd:****











posted on 2012-01-10 13:22  leaving  阅读(528)  评论(0编辑  收藏  举报