CentOS 7 安装SVN并整合HTTP访问
Posted 陌上归人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7 安装SVN并整合HTTP访问相关的知识,希望对你有一定的参考价值。
#!/bin/bash
## -------------------------------------------------
## 安装svn并整合http访问
## -------------------------------------------------
echo -e "\033[1;36m安装apache\033[0m"
cd /data/software
yum install expat expat-devel
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.2.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.0.tar.gz
wget http://mirrors.shuosc.org/apache/httpd/httpd-2.4.27.tar.gz
tar xvf apr-1.6.2.tar.gz
tar xvf apr-util-1.6.0.tar.gz
tar xvf httpd-2.4.27.tar.gz
/bin/cp -rf apr-1.6.2 httpd-2.4.27/srclib/apr
/bin/cp -rf apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
cd httpd-2.4.27
./configure --prefix=/opt/apache --enable-so --enable-dav --enable-dav-fs --enable-maintainer-mode --with-included-apr --enable-rewrite --enable-ssl --enable-proxy --enable-proxy-http
# --enable-so 开启动态库支持,svn要求apache必须启用so
# --enable-dav --enable-dav-fs 是支持svn认证使用的
# --enable-maintainer-mode 开启调试模式
# --with-included-apr 使用内置的apr
# --enable-rewrite 开启rewrite
# --enable-ssl 开启SSL
# --enable-proxy 开启proxy支持
# --enable-proxy-http 开启proxy http支持
make
make install
echo -e "\033[1;36m安装subversion\033[0m"
cd /data/software
wget http://www.sqlite.org/2017/sqlite-amalgamation-3200100.zip
wget http://mirrors.shuosc.org/apache/subversion/subversion-1.9.7.tar.gz
tar xvf subversion-1.9.7.tar.gz
unzip sqlite-amalgamation-3200100.zip
/bin/cp -rf sqlite-amalgamation-3200100 subversion-1.9.7/sqlite-amalgamation
cd subversion-1.9.7
./configure --prefix=/opt/subversion --with-apxs=/opt/apache/bin/apxs --with-apr=/opt/apache/bin/apr-1-config --with-apr-util=/opt/apache/bin/apu-1-config
make
make install
/bin/cp -raf subversion/mod_authz_svn/.libs/mod_authz_svn.so /opt/apache/modules/
/bin/cp -raf subversion/mod_dav_svn/.libs/mod_dav_svn.so /opt/apache/modules/
echo -e "\033[1;36m整合apache和subversion\033[0m"
sed -i ‘[email protected] rewrite_module modules/[email protected] rewrite_module modules/mod_rewrite.so\nLoadModule dav_svn_module modules/mod_dav_svn.so\nLoadModule authz_svn_module modules/[email protected]‘ /opt/apache/conf/httpd.conf
cat >> /opt/apache/conf/httpd.conf << EOF
# Subversion default settings
Include conf/extra/httpd-svn.conf
EOF
cat > /opt/apache/conf/extra/httpd-svn.conf << EOF
<Location /leishen>
DAV svn
SVNListParentPath On
SVNParentPath /data/subversion
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /opt/subversion/conf/passwdfile
AuthzSVNAccessFile /opt/subversion/conf/accessfile
Require valid-user
</Location>
EOF
mkdir -p /opt/subversion/conf
##创建账户配置文件,因为是第一次创建,passwdfile文件原本不存在所以需要加-c参数,日后需要在passwdfile中追加第二个用户,去掉-c参数即可
echo -e "\033[1;36m创建第一个用户\nUSER:jinps\nPASS:jinsppasswd\033[0m"
/opt/apache/bin/htpasswd -bc /opt/subversion/conf/passwdfile jinsp jinsppasswd
echo -e "\033[1;36m创建权限树配置文件\033[0m"
cat > /opt/subversion/conf/accessfile << EOF
[groups]
manager = yunfy
ops = jinsp,bxjg
[yunwei:/]
@manager = rw
@ops = rw
* =
[yunwei:/H05]
@manager = rw
@ops = rw
* =
EOF
echo -e "\033[1;36m新增SVN仓库\033[0m"
mkdir -p /data/subversion
cd /data/subversion
/opt/subversion/bin/svnadmin create yunwei
echo -e "\033[1;36m启动apache\033[0m"
/opt/apache/bin/apachectl restart
echo -e "\033[1;36m测试使用http访问svn\033[0m"
echo -e "\033[1;32mhttp://本机公网IP/leishen/yunwei/H05\033[0m"
以上是关于CentOS 7 安装SVN并整合HTTP访问的主要内容,如果未能解决你的问题,请参考以下文章
Centos7 64bit Linux系统安装SVN 和 http访问配置
CentOS搭建SVN服务器,并通过Apache HTTP方式访问