配置Apache访问多个Svn库
配置Apache访问多个Svn库
系统update
yum -y update
yum -y install make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget crontabs libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libzip-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel xz expat-devel libaio-devel
安装依赖
官网:http://apr.apache.org/download.cgi
wget https://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
安装apr
tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/opt/apr #安装地址
make && make install
安装apr-util
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/opt/apr-util --with-apr=/opt/apr/
make && make install
安装zlib
官网:http://www.zlib.net/
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
make && make install
安装sqlite
官网:https://www.sqlite.org/download.html
wget https://www.sqlite.org/2020/sqlite-autoconf-3340000.tar.gz
tar -zxvf sqlite-autoconf-3220000.tar.gz
cd sqlite-autoconf-3220000
./configure
make && make install
安装Apache
官网:http://httpd.apache.org/
版本:2.4.46
wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.46.tar.gz
tar -zxvf httpd-2.4.46.tar.gz
#以下命令复制执行时,请调整当前所在目录
cp -r apr-1.7.0 ./httpd-2.4.46/srclib/apr
cp -r apr-util-1.6.1 ./httpd-2.4.46/srclib/apr-util
cd httpd-2.4.33
./configure --prefix=/opt/apache2 --with-apr=/opt/apr/bin/apr-1-config --with-apr-util=/opt/apr-util/bin/apu-1-config --enable-so --enable-dav --enable-maintainer-mode --enable-rewrite --enable-ssl --with-ssl --with-pcre --with-included-apr --with-apr-util
make && make install
安装Subversion
官网:http://subversion.apache.org/
版本:1.10.6
wget https://mirrors.tuna.tsinghua.edu.cn/apache/subversion/subversion-1.10.6.tar.gz
tar -zxvf subversion-1.10.6.tar.gz
cd subversion-1.10.6
./configure --prefix=/opt/svn --with-apxs=/opt/apache2/bin/apxs --with-apr=/opt/apr/bin/apr-1-config --with-apr-util=/opt/apr-util/bin/apu-1-config --with-zlib --enable-maintainer-mode --with-lz4=internal --with-utf8proc=internal
make && make install
#添加环境变量
export PATH=/opt/svn/bin/:$PATH
source /etc/profile
配置关联
#新增用户与组
groupadd svn
useradd -g svn svn
#将httpd访问svn依赖的模块复制到httpd的模块目录下
cp /opt/svn/libexec/mod_authz_svn.so /opt/apache2/modules/
cp /opt/svn/libexec/mod_dav_svn.so /opt/apache2/modules/
#编辑httpd的httpd.conf,设置对应的Location,以便客户端访问
vim /opt/apache2/conf/httpd.conf
#修改
User svn
Group svn
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#for svn
<Location /repos> #别名 repos
DAV svn
SVNParentPath /svn/data #在该目录内可创建多个svn库
SVNListParentPath On
SVNAutoversioning On
SVNReposName "Apache Subversion(SVN)"
AuthzSVNAccessFile /svn/conf/authz #该文件设置用户权限总控制,不必再到具体库内设置
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /svn/conf/passwd #该文件设置svn用户名及密码
Require valid-user
</Location>
#设置svn文件夹所属
chown -R svn.svn /svn
配置完成后,使用命令启动apache
/opt/apache2/bin/apachectl start
本文配置成功后,可在data目录下使用svnadmin命令创建多个svn库,然后通过http依据conf目录下的用户权限配置进行访问。
地址示例:http://host/repos/svn库名称
遇到问题
配置完成后,遇到Couldn’t open rep-cache database '/svn/data/liuuCODE/db/rep-cache.db’问题,可将svn库导出备份后,用下行命令创建新库,然后导入数据即可,原因未知,希望与大家交流破解
svnadmin create --pre-1.6-compatible base