📄 Viewing: mojo.install
#!/bin/bash
newuser=$1
pver=$2
pever=${pver:-7}
CPUS=4
test -h /opt/include || ln -s /usr/include /opt/include
test -h /opt/lib || ln -s /usr/lib64 /opt/lib
#yum -ty install gdbm-devel bison byacc libtool flex autoconf automake freetype2-devel curl-devel libjpeg-devel libjpeg libpng libpng-devel libpng10-devel libpng10 libxml2 libxml2-devel openssl-devel.x86_64 freetype-devel.x86_64 libmcrypt-devel.x86_64 libmcrypt.x86_64 mcrypt.x86_64 mysql-devel.x86_64libxslt.x86_64 libxslt-devel.x86_64
#yum -y remove httpd httpd-devel php php-mysql apr
cd /usr/src/
#wget -O /usr/src/php.config.status fs01.mojohost.com/files/php/php.config.status && chmod 755 /usr/src/php.config.status
#wget -O /usr/src/httpd.config.status fs01.mojohost.com/files/php/httpd.config.status && chmod 755 /usr/src/httpd.config.status
wget fs01.mojohost.com/files/php/php-latest-${pver}.tgz
wget fs01.mojohost.com/files/php/httpd-latest.tgz
wget fs01.mojohost.com/files/php/modsecurity-latest.tgz
phplatest="$(tar ztf php-latest-${pver}.tgz |head -1|tr -d '/')"
phplatesttb="${phplatest}.tar.gz"
/bin/mv php-latest-${pver}.tgz $phplatesttb
httplatest="$(tar ztf httpd-latest.tgz |head -1|tr -d '/')"
httplatesttb="${httplatest}.tar.gz"
/bin/mv httpd-latest.tgz $httplatesttb
msalatest="$(tar ztf modsecurity-latest.tgz |head -1|tr -d '/')"
msalatesttb="${msalatest}.tar.gz"
/bin/mv modsecurity-latest.tgz $msalatesttb
tar zxf $httplatesttb
tar zxf $phplatesttb
tar zxf $msalatesttb
cd /usr/src/$httplatest
make clean 2>/dev/null
../httpd.config.status && echo "$(date +%Y_%m_%d_%H_%M_%S) - config apache" >> /usr/src/mojo.install.log
if [ "`grep "config apache" /usr/src/mojo.install.log`" ];then
make -sj9 2>/dev/null && echo "$(date +%Y_%m_%d_%H_%M_%S) - make apache" >> /usr/src/mojo.install.log
fi
if [ "`grep "make apache" /usr/src/mojo.install.log`" ];then
make install && echo "$(date +%Y_%m_%d_%H_%M_%S) - install apache" >> /usr/src/mojo.install.log
fi
/sbin/ldconfig
/bin/mv /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
/bin/cp /root/setup/httpd.conf /etc/httpd/conf/httpd.conf
/bin/cp /root/setup/httpd-mpm.conf /etc/httpd/conf/extra/httpd-mpm.conf
/bin/cp /root/setup/httpd /etc/rc.d/init.d/httpd
cd /usr/src/$phplatest
if [ $pver == "7" ];then
sed -i 's/with-mysql=\/opt/with-mysqli/' /usr/src/php.config.status
fi
make clean 2>/dev/null
../php.config.status && echo "$(date +%Y_%m_%d_%H_%M_%S) - config php" >> /usr/src/mojo.install.log
if [ "`grep "config php" /usr/src/mojo.install.log`" ];then
make -sj9 2>/dev/null && echo "$(date +%Y_%m_%d_%H_%M_%S) - make php" >> /usr/src/mojo.install.log
fi
if [ "`grep "make php" /usr/src/mojo.install.log`" ];then
make install && echo "$(date +%Y_%m_%d_%H_%M_%S) - install php" >> /usr/src/mojo.install.log
fi
/bin/cp /usr/src/$phplatest/php.ini-production /usr/local/lib/php.ini
This should be ok to remove
#wget -O /etc/init.d/httpd fs01.mojohost.com/files/php/httpd.init
#chmod 755 /etc/init.d/httpd
chkconfig httpd on
rm -rf /home/httpd/html/index.html*
echo "`hostname -s`" > /home/httpd/html/index.html
cd /usr/src/
opc=$(find /usr/local/lib/php/extensions/ -name "opcache.so")
mv ${opc} ${opc}.original
if [ $pver == "5" ];then
wget -O - http://fs01.mojohost.com/files/php/php-56-ioncube-zend.tgz|tar -Pzxf -
wget -O - http://fs01.mojohost.com/files/php/ioncube_loaders_lin_x86-64.tar.gz|tar - zxf -C /usr/local/
ioc=ioncube_loader_lin_5.6.so
fi
if [ $pver == "7" ];then
sed -i '/php5_module/d' /etc/httpd/conf/httpd.conf
wget -O - http://fs01.mojohost.com/files/php/ioncube_loaders_lin_x86-64.tar.gz|tar zxf - -C /usr/local/
ioc=ioncube_loader_lin_7.2.so
fi
echo "
zend_extension= /usr/local/ioncube/${ioc}
zend_extension=/usr/local/Zend/lib/ZendGuardLoader/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0" >> /usr/local/lib/php.ini
mv /usr/local/lib/php.ini /usr/local/Zend/etc/ && ln -s /usr/local/Zend/etc/php.ini /usr/local/lib/php.ini
if [ $pver == "7" ];then
sed -i '/ZendGuardLoader/d' /usr/local/Zend/etc/php.ini
fi
#wget https://github.com/SpiderLabs/ModSecurity/releases/download/v2.9.1/modsecurity-2.9.1.tar.gz
###wget http://www.modsecurity.org/download/modsecurity-2.9.1.tar.gz
#tar zxf modsecurity-2.7.0.tar.gz
/bin/cp -a /var/www/bui* /home/httpd/. -R
/bin/cp --backup /usr/bin/libtool /home/httpd/build/libtool
#cd /usr/src/$msalatest/;./configure
#make -sj4 && make install && apxs -e -a apache2/mod_security2.la && chmod 755 /usr/lib/apache/mod_security2.so
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
/bin/cp -a /root/setup/conf.d /etc/httpd/
##include client.conf in /etc/httpd/conf/client.conf and touch the file
echo -e "\nInclude /etc/httpd/conf/${newuser}.conf\n" >> /etc/httpd/conf/httpd.conf
touch /etc/httpd/conf/${newuser}.conf
touch /etc/httpd/conf/${newuser}.conf.lan
mkdir -p /etc/httpd/nginx/conf
touch /etc/httpd/nginx/conf/vhost.conf
perl -pi -e 's~;date.timezone =~date.timezone = America/New_York~s' /usr/local/Zend/etc/php.ini
#greg added php logging
/bin/touch /var/log/php_mail.log;/bin/chmod 666 /var/log/php_mail.log;
wget -O /etc/logrotate.d/phpmail fs01.mojohost.com/files/phpmail.logrotate
mlog_ln=$(grep -n '^;mail.log' /usr/local/Zend/etc/php.ini 2>/dev/null|tail -1|cut -d: -f1)
mlog_ln=${mlog_ln:-99999}
if [ $mlog_ln -eq 99999 ]
then
echo -e "\n\n$(date) - setup did not find correct mail.log entry during php install, please report to provisioning" >> /etc/motd
else
sed -i "$mlog_ln d" /usr/local/Zend/etc/php.ini
sed -i "$mlog_ln a mail.log = /var/log/php_mail.log" /usr/local/Zend/etc/php.ini
fi
chown -R nobody.nobody /etc/httpd/asl/data
pecl channel-update pecl.php.net
printf "\n" | pecl -q install mcrypt-1.0.1
🌑 DarkStealth — WP Plugin Edition