1、服务器版本和安装软件

服务器版本:Redhat Enterprise 5.5 32bit

安装软件:

apr-1.3.12.tar.gz

apr-util-1.3.12.tar.gz

httpd-2.2.9.tar.gz

sqlite-amalgamation-3.7.3.tar

subversion-1.6.17.tar.bz2

subversion-deps-1.6.17.tar.bz2

2、安装

检查操作系统httpd包安装情况

rpm -qa |grephttpd


卸载系统自带的httpd

rpm -ehttpd-2.2.3-22.el5 –nodeps


安装apr-1.3.12

tar zxvfapr-1.3.12.tar.gz

cd apr-1.3.12

./configure

make

make install


安装apr-util

tar zxvfapr-util-1.3.12.tar.gz

cd apr-util-1.3.12

./configure –with-apr=/usr/local/apr

make

make install


安装 apache

tar zxvfhttpd-2.2.9.tar.gz

cd httpd-2.2.9

./configure–prefix=/usr/local/apache2 -enable-dav -enable-so -enable-ssl-enable-maintainer-mode -enable-rewrite–with-apr=/usr/local/apr/bin/apr-1-config–with-apr-util=/usr/local/apr/bin/apu-1-config

make

make install


vi/usr/local/apache2/conf/httpd.conf  将ServerAdmin you@example.com没注释的加注释, 将#ServerName localhost:80注释去掉,如果localhost位置是其它请改回localhost

重新执行/usr/local/apache2/bin/apachectl start


通过浏览器访问http://localhost:80,如果页面显示“It works!”,即表示apache已安装并启动成功


停掉apache

/usr/local/apache2/bin/apachectlstop


安装subversion

tar jxvfsubversion-1.6.17.tar.bz2

cdsubversion-1.6.17

./configure–prefix=/usr/local/subversion –with-apxs=/usr/local/apache2/bin/apxs–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr –with-ssl–with-zlib=/usr/local/lib –without-berkeley-db –enable-maintainer-mode

make

make install


如果编译过程中出现configure: error: Subversion requires SQLite,按以下步骤进行后再继续进行上一步操作。


tar zxvfsqlite-amalgamation-3.7.3.tar.gz

mkdir -p/u01/subversion/subversion-1.6.17

cd sqllit-3.7.3

cp sqlite3.c/u01/subversion/subversion-1.6.17/sqlite-amalgamation/sqlite3.c  (路径根据实际目录地址修改)


配置apache,启用SVN

cat/usr/local/apache2/conf/httpd.conf | grep svn

显示以下信息则为正确安装成功:

LoadModuledav_svn_module modules/mod_dav_svn.so

LoadModuleauthz_svn_module modules/mod_authz_svn.so


建立仓库

mkdir -p/home/svnroot/repository

cd/usr/local/subversion/bin

./svnadmin create/home/svnroot/repository/file   file为项目名


#./svn import/boot file:///home/svnroot/repository/file -m “boot”  假设我们以前的项目文件在/boot目录下,现在导入到file库里


chown -Rapache:apache /home/svnroot/repository


配置http服务器

/usr/local/apache2/bin/apachectlstart    然后在浏览器里输入http://运行apache的ip地址出现It Works,表示成功。


更改apache2的配置文件”/usr/local/apache2/conf/httpd.conf”在文件末尾添加如下内容:


<Location/svn>

DAV svn

SVNParentPath/home/svnroot/repository/

AuthzSVNAccessFile/home/svnroot/repository/authz.conf

AuthType Basic

AuthName”SubVersion”

AuthUserFile/home/svnroot/repository/valid-user

Require valid-user

</Location>


修改

User apache

Group apache


使用”/usr/local/apache2/bin/apachectlrestart”重启apache服务器,通过浏览器访问”http://ip/svn/file”,如果提示输入用户名、密码的话,配置成功。


生成valid-user文件

cd/usr/local/apache2/bin

./htpasswd -c/home/svnroot/repository/valid-user ddimcn


会提示输入密码,这个密码以后就是访问http时的用户口令。

如果要继续添加用户,去掉-c 选项,使用:


./htpasswd/home/svnroot/repository/valid-user york


配置用户访问SVN的权限


vi/home/svnroot/repository/authz.conf


[file:/]

ddimcn = rw



重启apache服务器

/usr/local/apache2/bin/apachectlrestart


在浏览器里输入http://ip/svn/file