CentOS源码编译安装Apache 2.4.26 和 Apache Subversion 1.9.6 并配置基于Apache的SVN多项目库
#!/bin/bash
a=$(cat /proc/cpuinfo | grep 'model name'| wc -l)
apstable=2.4.26
yum -y install gcc make epel-release pcre-devel zlib-devel lynx openssl openssl-devel
cd ~
wget http://archive.apache.org/dist//httpd/httpd-$apstable.tar.gz
tar -zxvf httpd-$apstable.tar.gz;
cd ~
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
tar zxf apr-1.5.2.tar.gz && cp -fr ./apr-1.5.2 ./httpd-$apstable/srclib/apr
tar zxf apr-util-1.5.4.tar.gz && cp -fr ./apr-util-1.5.4 ./httpd-$apstable/srclib/apr-util
cd ~
cd httpd-$apstable;
./configure \
--prefix=/usr/local/apache \
--with-mpm=prefork \
--with-included-apr \
--with-ssl \
--with-pcre \
--enable-mime-magic \
--enable-proxy \
--enable-ssl=shared \
--enable-so \
--enable-dav \
--enable-deflate=shared \
--enable-ssl=shared \
--enable-expires=shared \
--enable-headers=shared \
--enable-rewrite=shared \
--enable-static-support \
--disable-userdir \
--enable-modules=all \
--enable-mods-shared=all
make -j$a
make install
......
......
yum -y install gcc gcc-c++ unzip
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
tar -zxvf apr-1.5.2.tar.gz;cd apr-1.5.2
cd apr-1.5.2
./configure --prefix=/usr/local/apr && make && make install
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
tar -zxvf apr-util-1.5.4.tar.gz;cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz;cd zlib-1.2.11
./configure --prefix=/usr/local/zlib && make && make install
wget http://apache.cs.utah.edu/subversion/subversion-1.9.6.tar.gz
tar -zxvf subversion-1.9.6.tar.gz;cd subversion-1.9.6
./get-deps.sh
单独使用
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib && make && make install
配合apache使用
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib -enable-mod-activation --with-apache-libexecdir=/usr/local/apache/modules --with-apxs=/usr/local/apache/bin/apxs --without-berkeley-db && make && make install
多项目配置
mkdir -p /var/www/svn #创建SVN目录
/usr/local/svn/bin/svnadmin create /var/www/svn/repos #创建repos版本库
/usr/local/svn/bin/svnadmin create /var/www/svn/android #创建android版本库
/usr/local/svn/bin/svnadmin create /var/www/svn/web #创建web版本库
/usr/local/apache/bin/htpasswd -c -b /var/www/svn/passwd admin 123456 #第一次创建文件和创建用户
/usr/local/apache/bin/htpasswd -b /var/www/svn/passwd admin2 123456 #添加用户
www.zhangfangzhou.cn
vi /var/www/svn/authz
[groups]
all = admin,rouser
[/]
admin2 = rw
@all = r
vi /usr/local/apache/conf/httpd.conf 默认 Subrsion 安装成功后会自动加上
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
DAV svn
SVNListParentPath on
SVNParentPath /var/www/svn
AuthzSVNAccessFile /var/www/svn/authz
AuthType Basic
AuthName "www.zhangfangzhou.cn SVN"
AuthUserFile /var/www/svn/passwd
Require valid-user
赋予权限
chown -R apache.apache /var/www/svn
chown -R apache.apache /usr/local/apache
重启服务
service httpd restart
/usr/local/apache/conf/httpd.conf: Cannot load modules/mod_dav_svn.so into server:
出现这个原因是因为没有加载#LoadModule dav_module modules/mod_dav.so