#!/bin/bash
############################
#CREATE BY AL  at 2017/09/26
############################

path='pwd'
yum install -y bz2
####### arp 安装 #######
cd /root/software
wget http://47.90.101.26/linux/svn/apr-1.4.6.tar.gz
tar zxf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/opt/apr
make && make install

#######  apr-util 安装 #######
cd /root/software
wget http://47.90.101.26/linux/svn/apr-util-1.3.12.tar.bz2
tar jxf apr-util-1.3.12.tar.bz2
cd apr-util-1.3.12
./configure --prefix=/opt/apr-util --with-apr=/opt/apr
make && make install


echo '/opt/apr/lib' >> /etc/ld.so.conf
echo '/opt/apr-util/lib' >> /etc/ld.so.conf

ldconfig

###libxml
cd /root/software
wget http://47.90.101.26/linux/svn/libxml%2b%2b-2.8.0.tar.gz
tar zxf libxml++-2.8.0.tar.gz
cd libxml++-2.8.0
./configure
make && make install

#######  neon-安装 ####### 
cd /root/software
wget http://47.90.101.26/linux/svn/neon-0.29.6.tar.gz
tar zxf neon-0.29.6.tar.gz
cd neon-0.29.6
./configure --prefix=/opt/neon
make && make install


#######  sqlite-amalgamation 安装 #######
cd /root/software
wget http://47.90.101.26/linux/svn/neon-0.29.6.tar.gz
tar zxf sqlite-autoconf-3071401.tar.gz
cd sqlite-autoconf-3071401
./configure --prefix=/opt/sqlite
make && make install

####zlib 安装#####
 yum install -y zlib-devel

####### apache 安装 #######
cd /root/software
wget http://47.90.101.26/linux/svn/httpd-2.2.23.tar.bz2
tar jxf httpd-2.2.23.tar.bz2
cd httpd-2.2.23
./configure --prefix=/opt/apache --enable-dav --enable-rewrite --enable-so --enable-maintainer-mode --enable-mods-shared=all --with-apr=/opt/apr/bin/apr-1-config --with-apr-util=/opt/apr-util/bin/apu-1-config --enable-dav-fs --enable-dav-lock  --with-zlib        
make && make install

cd /root/software

wget http://47.90.101.26/linux/svn/httpd
wget http://47.90.101.26/linux/svn/httpd.conf
cp  -f httpd.conf  /opt/apache/conf/httpd.conf
cp -f  httpd /etc/init.d/httpd
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 345 httpd on


#######  subversion 安装 #######
yum install -y expat expat-devel

cd /root/software
wget http://47.90.101.26/linux/svn/subversion-1.6.19.tar.bz2
tar jxf subversion-1.6.19.tar.bz2
cd subversion-1.6.19
mkdir sqlite-amalgamation
cp ../sqlite-autoconf-3071401/sqlite3.c ./sqlite-amalgamation

./configure --prefix=/opt/subversion --with-apxs=/opt/apache/bin/apxs --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-neon=/opt/neon  --with-zlib=/usr/include --enable-maintainer-mode --without-berkeley-db

make && make install

groupadd svn -g 800
useradd -u 800 -g svn svnroot

mkdir /home/svnroot/repository
mkdir /home/svnroot/repository/conf
chown -R svnroot.svn /home/svnroot/repository
/opt/subversion/bin/svnadmin create --fs-type fsfs /home/svnroot/repository/bocai

chown -R svnroot.svn /home/svnroot/repository
/opt/apache/bin/htpasswd -c -m /home/svnroot/repository/conf/authfile admin
