#!/bin/sh
soft_path=/soft/tooltar_path=/usr/local/srcapr_dir=/usr/local/src/apr-1.5.2 apr_util_dir=$tar_path/apr-util-1.5.4 httpd_dir=$tar_path/httpd-2.4.16svn_dir=$tar_path/subversion-1.9.1pcre_dir=$tar_path/pcre-8.36sqlite_dir=$tar_path/sqlite-autoconf-3081101scons_dir=$tar_path/scons-2.4.0serf_dir=$tar_path/serf-1.3.8soft_dir=/applicationlog=/tmp/installIP=`ifconfig eth0 |awk -F "[ :]+" 'NR==2 {print $4}'`RETVAL=0function check () { if [ $RETVAL -eq 0 ];then echo "is ok" else echo "is error" exit 1fi}#################################### yum install ###################################echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ yum install gcc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"/etc/init.d/iptables stopchecksed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/configyum install gcc* openssl-devel zlib zlib-devel qlite httpd-tools -ytest -d /application && echo " /application directory exists" || mkdir /application -p mkdir /tmp/install -pmkdir /soft/tool -p #################################### svn+httpd ####################################echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ install svn+httpd ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" sleep 3cd $soft_pathtar xf apr-1.5.2.tar.gz -C $tar_path tar xf apr-util-1.5.4.tar.gz -C $tar_pathtar xf httpd-2.4.16.tar.gz -C $tar_pathtar xf subversion-1.9.1.tar.gz -C $tar_pathtar xf pcre-8.36.tar.gz -C $tar_pathtar xf scons-2.4.0.tar.gz -C $tar_pathtar jxf serf-1.3.8.tar.bz2 -C $tar_pathunzip sqlite-amalgamation-3071501.zip -d /usr/local/src/subversion-1.9.1mv /usr/local/src/subversion-1.9.1/sqlite-amalgamation-3071501 /usr/local/src/subversion-1.9.1/sqlite-amalgamation################################### install pcre ###################################sleep 3echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ pcre in install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $pcre_dir./configure --prefix=$soft_dir/pcre && make && make install ################################### install apr ###################################sleep 3echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ apr install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $apr_dir ./configure --prefix=$soft_dir/apr && make && make install################################### instal arp-util ################################sleep 3echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ arp-util install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $apr_util_dir./configure --prefix=$soft_dir/apr-util --with-apr=$soft_dir/apr && make && make install ################################### install httpd ################################sleep 3echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ install in httpd ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $httpd_dir./configure --prefix=$soft_dir/apache2 --with-apr=$soft_dir/apr --with-apr-util=$soft_dir/apr-util \--with-apr=$soft_dir/apr --with-pcre=$soft_dir/pcre --with-apr-util=$soft_dir/apr-util --enable-rewrite \--enable-dav -enable-maintainer-mode --enable-dav-fs --enable-ssl --enable-so && make && make install sed -i 's\#ServerName www.example.com:80\ServerName $IP\g' $soft_dir/apache2/conf/httpd.conf $soft_dir/apache2/bin/apachectl -t################################### instal scons ################################echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ install in scons ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $scons_dirpython setup.py installsleep 3 ################################### instal serf ################################echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ install in serf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $serf_dirscons PREFIX=$soft_dir/serf APR=$soft_dir/apr APU=$soft_dir/apr-util OPENSSL=/usr/bin scons install################################### install svn ################################echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ install in svn ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cd $svn_dir./configure --prefix=$soft_dir/svn --with-apr=$soft_dir/apr --with-apr-util=$soft_dir/apr-util \--with-apxs=$soft_dir/apache2/bin/apxs --with-serf=$soft_dir/serf && make && make installecho "~~~~~~~~~~~~~~~~~~~~~~~~~~ httpd config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"cp -rp /application/svn/libexec/mod_authz_svn.so /application/apache2/modules/cp -rp /application/svn/libexec/mod_dav_svn.so /application/apache2/modules/echo -e "#set svnpath\n export PATH=/application/svn/bin:$PATH " >> /etc/profile. /etc/profilesed -i '/LoadModule dav_module modules/ a \LoadModule dav_svn_module modules/mod_dav_svn.so' /application/apache2/conf/httpd.confsed -i '/LoadModule dav_svn_module modules/ a \LoadModule authz_svn_module modules/mod_authz_svn.so' /application/apache2/conf/httpd.confsed -i '/httpd-vhosts.conf/ a #SVN ' /application/apache2/conf/httpd.confsed -i '/#SVN/ a Include conf/extra/httpd-svn.conf' /application/apache2/conf/httpd.confecho "<Location /svn>DAV svnSVNParentPath /svn/svndata# our access control policyAuthzSVNAccessFile /application/svn/conf/authz# only authenticated users may access the repositoryRequire valid-user# how to authenticate a userAuthType BasicAuthName Subversion repositoryAuthUserFile /application/svn/conf/passwd</Location>" >/application/apache2/conf/extra/httpd-svn.conf sed -i 's#Subversion repository#"Subversion repository"#g' /application/apache2/conf/extra/httpd-svn.conf echo "################################### svn create ################################" mkdir /svn/svndata -pmkdir /application/svn/conf svnadmin create /svn/svndata/sadoccp /svn/svndata/sadoc/conf/authz /application/svn/conf/echo "please vim authen ## htpaswd /application/svn/conf/passwd"useradd -s /sbin/nologin apache -Mchown -R apache.apache /svn/svndatased -i 's#User daemon#User apache#g' /application/apache2/conf/httpd.confsed -i 's#Group daemon#Group apache#g' /application/apache2/conf/httpd.confsed -i '/,&joe/ a admin = xing' /application/svn/conf/authz htpasswd -cbm /application/svn/conf/passwd xing passwd/application/apache2/bin/apachectl -k restartecho "[sadoc:/]@admin = rw ">>/application/svn/conf/authz echo "please open http://$IP/svn/sadoc user=xing password=passwd"svn co http://$IP/svn/sadoc --username=xing --password=passwd