Subversion 1.4.3 + Apache 2.2.4 for Linux 安装

经过几天努力,终于把Subversion + Apache在Linux上安装成功,能顺利地通过http协议和svn协议访问版本库了,这里和大家分享。

安装环境:
OS: RedHat AdvanceServer 4 Update 4

需要软件:
SVN: Subversion 1.4.3
HTTPD: Apache Httpd 2.2.4
APR: Apache Apr 1.2.8
APU: Apache Apr-Util 1.2.8

1. 下载源代码:
到各自的官方网站下载相应的源代码的tar.gz包,解包后准备编译安装:

2. 编译源代码:
按下面的顺序编译源代码:
(1) Apache Apr
# cd apr-1.2.8
# ./configure --prefix=/usr/local/apr
# make
# make install

(2) Apache Apr-Util
# cd apr-util-1.2.8
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install

(3) Apache Httpd
# cd httpd-2.2.4
# ./configure --prefix=/usr/local/apache2 --enable-dav --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install

(4) Subversion
# cd subversion-1.4.3
# ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache2/bin/apxs
# make
# make install

以上的编译通常情况都能顺利编译成功,得到相应的可执行程序。

检查WebDav for SVN 模块:
# cd /usr/local/apache2/modules
检查 mod_dav_svn.so 和 mod_authz_svn.so,如果上述第2步编译成功,这两个模块应该可以看到。

3. 创建svn用户:
# groupadd svn
# useradd -g svn svn
以后代码库的创建维护等,都用这个帐户来操作。

4. 创建版本库:
以svn用户登录

准备环境变量:
$ SVN_HOME=/usr/local/subversion
$ export SVN_HOME
$ PATH=$PATH:$SVN_HOME/bin
$ export PATH

上述命令创建了版本库sandbox,用于测试:
$ svnadmin create --fs-type fsfs sandbox

还可以再创建工程的版本库:
$ svnadmin create --fs-type fsfs projects

创建启动Subversion的脚本:
$ echo '/usr/local/subversion/bin/svnserve -d -r /home/svn/' > startup.sh
$ chmod +x startup.sh
$ ./startup.sh

将启动脚本放置到开机自动启动脚本中:
以root身份修改文件:/etc/rc.d/rc.local,添加以下文字:
su -c /home/svn/startup.sh svn

5. 配置Apache Httpd
# cd /usr/local/apache2/conf
# vi httpd.conf

加载WebDav for SVN模块: 

None.gif #
None.gif# Dynamic Shared Object (DSO) Support
None.gif#
None.gif# To be able to use the functionality of a module which was built 
as  a DSO you
None.gif# have to place corresponding `LoadModule
'  lines at this location so the
None.gif
# directives contained  in  it are actually available _before_ they are used.
None.gif# Statically compiled modules (those listed by `httpd 
- l ' ) do not need
None.gif
# to be loaded here.
None.gif#
None.gif# Example:
None.gif# LoadModule foo_module modules
/ mod_foo.so
None.gifLoadModule dav_svn_module     modules
/ mod_dav_svn.so
None.gifLoadModule authz_svn_module   modules
/ mod_authz_svn.so

添加最后两行(默认编译后,configure会自动加上):
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so


修改启动httpd的默认用户:

None.gif #
None.gif# If you wish httpd to run 
as  a different user or group, you must run
None.gif# httpd 
as  root initially and it will  switch .  
None.gif#
None.gif# User
/ Group: The name (or #number) of the user / group to run httpd  as .
None.gif# It 
is  usually good practice to create a dedicated user and group  for
None.gif# running httpd, 
as  with most system services.
None.gif#
None.gif#User daemon
None.gif#Group daemon
None.gifUser svn
None.gifGroup svn
None.gif
</ IfModule >
None.gif

将执行httpd的用户和组设为svn,这样做是为了让httpd进程能访问版本库的数据。


在Apache Http Server里配置虚拟主机:
将httpd.conf中的虚拟主机的注释去掉,然后编辑/usr/local/apache2/conf/extra/httpd-vhost.conf。

None.gif
None.gif# Virtual hosts
None.gifInclude conf
/ extra / httpd - vhosts.conf
None.gif

添加虚拟主机svn.yourcompany.com,当然,这个主机名需要使用你自己的域名。
# vi /usr/local/apache2/conf/extra/httpd-vhost.conf

None.gif
None.gif
< VirtualHost  * : 80 >
None.gif    ServerAdmin webmaster@svn.yourcompany.com
None.gif    ServerName svn.yourcompany.com
None.gif    ErrorLog logs
/ svn.yourcompany.com - error_log
None.gif    CustomLog logs
/ svn.yourcompany.com - access_log common
None.gif    
< Location  />
None.gif       DAV svn
None.gif       SVNListParentPath on
None.gif       SVNParentPath 
/ home / svn
None.gif    
</ Location >
None.gif
</ VirtualHost >

 

 这样配置的目的是可以使用 http://svn.yourcompany.com/sandboxhttp://svn.yourcompany.com/projects 这样的URL来供各种客户端通过http协议访问该版本库中的文件。

6. 用户认证和授权
用户认证是为了验证访问SVN的用户身份,授权是为了约束用户的权限,约束用户读写每个目录或文件的权限,请参阅SVN相关的文档。通过http协议的认证和通过svn协议的认证略有不同,需要注意。

转载于:https://www.cnblogs.com/kylindai/archive/2007/03/19/680128.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值