环境:
1、ubuntu
2、apache2
3、subersion1.3
描述:
因为在内网服务器上使用svn,但只有http 80端口映射到了外网,这样就无法使用svn的3690端口访问版本控制了。本身svn有自带apache的插件来通过http访问,不过需要一定的配置。
过程:
1、安装需要的软件
sudo apt-get install apache2
sudo apt-get install subversion libapache2-svn
#额外添加一个web查看器
sudo apt-get install websvn
在此深刻体会了linux软件安装的方便,强烈推荐大家除非你使用.net,不然服务器还是使用linux好啊,省心省力。前段时间客户刚收到一封律师信,因为在win2003服务器上使用了破解的ftp软件,而在linux下有更方便的ssh可以使用。
2、接下来需要做一些配置,首先,subversion的配置,因为由apache接管了svn的用户管理,所以只需要打开svn项目的配置文件中的读写权限
#创建svn库目录
$ mkdir -p /home/linq/svn/LINQ
#生成库文件
$ sudo svnadmin create /home/linq/svn/LINQ
#将所有权授予Apache(www-data), 使之能对库文件进行读写操作:
$ sudo chown -R www-data:www-data /var/local/repos
#修改库文件LINQ底下的conf/svnserver.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
#因为不需要svn本身协议svn://,所以不需要配置authz和passwd文件
#http协议访问需要apache来进行权限控制
3、配置apache访问svn的权限
sudo vim /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 /home/qmgwh/L/SVN/LINQ

# The following allows for basic http authentication. Basic authentication
# should not be considered secure for any particularly rigorous definition of
# secure.

# to create a passwd file
# # rm -f /etc/apache2/dav_svn.passwd
# # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
# New password:
# Re-type new password:
# Adding password for user dwhedon
# #

# Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd

# Uncomment the following line to enable Authz Authentication
# AuthzSVNAccessFile /etc/apache2/dav_svn.authz

# The following three lines allow anonymous read, but make
# committers authenticate themselves.

<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>

</Location>
/etc/subversion/passwd用户存放用户名和密码,可以任意指定这个文件
sudo htpasswd2 -c /etc/subversion/passwd linq
1、ubuntu
2、apache2
3、subersion1.3
描述:
因为在内网服务器上使用svn,但只有http 80端口映射到了外网,这样就无法使用svn的3690端口访问版本控制了。本身svn有自带apache的插件来通过http访问,不过需要一定的配置。
过程:
1、安装需要的软件
sudo apt-get install apache2
sudo apt-get install subversion libapache2-svn
#额外添加一个web查看器
sudo apt-get install websvn2、接下来需要做一些配置,首先,subversion的配置,因为由apache接管了svn的用户管理,所以只需要打开svn项目的配置文件中的读写权限
#创建svn库目录
$ mkdir -p /home/linq/svn/LINQ
#生成库文件
$ sudo svnadmin create /home/linq/svn/LINQ
#将所有权授予Apache(www-data), 使之能对库文件进行读写操作:
$ sudo chown -R www-data:www-data /var/local/repos
#修改库文件LINQ底下的conf/svnserver.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
#因为不需要svn本身协议svn://,所以不需要配置authz和passwd文件
#http协议访问需要apache来进行权限控制sudo vim /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 /home/qmgwh/L/SVN/LINQ
# The following allows for basic http authentication. Basic authentication
# should not be considered secure for any particularly rigorous definition of
# secure.
# to create a passwd file
# # rm -f /etc/apache2/dav_svn.passwd
# # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
# New password:
# Re-type new password:
# Adding password for user dwhedon
# #
# Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
# Uncomment the following line to enable Authz Authentication
# AuthzSVNAccessFile /etc/apache2/dav_svn.authz
# The following three lines allow anonymous read, but make
# committers authenticate themselves.
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
sudo htpasswd2 -c /etc/subversion/passwd linq
4、重启Apache2:
# sudo /etc/init.d/apache2 restart
这时正常情况下,可以使用svn客户端(如netbean的svn插件)访问http://www.demo.com/svn
本文介绍如何在Ubuntu系统中利用Apache2配置Subversion (SVN) 的HTTP访问方式,包括所需软件安装、SVN及Apache配置步骤,适用于仅开放HTTP 80端口的内网服务器。
266

被折叠的 条评论
为什么被折叠?



