#!/bin/bash
## -------------------------------------------------
# # Install SVN and consolidate HTTP access
## -------------------------------------------------
Echo-e "\033[1;36m Installation 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 turn on Dynamic library support, SVN requires Apache to enable the so
#--enable-dav--ENABLE-DAV-FS is supported for SVN authentication
#--enable-maintainer-mode turn on debug mode
#--WITH-INCLUDED-APR using the built-in APR
#--enable-rewrite Open Rewrite
#--enable-ssl Turn on SSL
#--enable-proxy Open proxy support
#--enable-proxy-http open proxy HTTP Support
Make
Make install
Echo-e "\033[1;36m Installation 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 integrated Apache and 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
# #创建账户配置文件, because it was created for the first time, the Passwdfile file does not exist so you need to add the-c parameter, you need to append the second user in the Passwdfile, remove the-c parameter
Echo-e "\033[1;36m Create first user \nuser:jinps\npass:jinsppasswd\033[0m"
/opt/apache/bin/htpasswd-bc/opt/subversion/conf/passwdfile JINSP jinsppasswd
Echo-e "\033[1;36m Create permission Tree profile \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 added svn repository \033[0m"
Mkdir-p/data/subversion
Cd/data/subversion
/opt/subversion/bin/svnadmin Create Yunwei
Echo-e "\033[1;36m start apache\033[0m"
/opt/apache/bin/apachectl restart
ECHO-E "\033[1;36m test using HTTP access svn\033[0m"
Echo-e "\033[1;32mhttp://native public network ip/leishen/yunwei/h05\033[0m"
CentOS 7 installs SVN and consolidates HTTP access