Untitled diff

Created Diff never expires
#!/bin/sh
#!/bin/sh
ZONEINFO=Etc/UTC # Set Timezone
ZONEINFO=Etc/UTC # Set Timezone
NGINX_IPV='n' #NGINX IPV6 compile support for unattended mode only
NGINX_IPV='n' #NGINX IPV6 compile support for unattended mode only
USEEDITOR='nano' # choice between nano or vim text editors for cmd shortcuts
USEEDITOR='nano' # choice between nano or vim text editors for cmd shortcuts
CUSTOMSERVERNAME='y'
CUSTOMSERVERNAME='y'
CUSTOMSERVERSTRING='nginx centminmod'
CUSTOMSERVERSTRING='nginx centminmod'
PHPFPMCONFDIR='/usr/local/nginx/conf/phpfpmd'
PHPFPMCONFDIR='/usr/local/nginx/conf/phpfpmd'
UNATTENDED='y' # please leave at 'y' for best compatibility as at .07 release
UNATTENDED='y' # please leave at 'y' for best compatibility as at .07 release
CMVERSION_CHECK='n'
CMVERSION_CHECK='n'
#####################################################
#####################################################
DT=`date +"%d%m%y-%H%M%S"`
DT=`date +"%d%m%y-%H%M%S"`
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MINORVER='07'
SCRIPT_MINORVER='07'
SCRIPT_VERSION="${SCRIPT_MAJORVER}-eva2000.${SCRIPT_MINORVER}"
SCRIPT_VERSION="${SCRIPT_MAJORVER}-eva2000.${SCRIPT_MINORVER}"
SCRIPT_DATE='30/06/2014'
SCRIPT_DATE='30/06/2014'
SCRIPT_AUTHOR='eva2000 (vbtechsupport.com)'
SCRIPT_AUTHOR='eva2000 (vbtechsupport.com)'
SCRIPT_MODIFICATION_AUTHOR='eva2000 (vbtechsupport.com)'
SCRIPT_MODIFICATION_AUTHOR='eva2000 (vbtechsupport.com)'
SCRIPT_URL='http://centminmod.com'
SCRIPT_URL='http://centminmod.com'
COPYRIGHT="Copyright 2011-2014 CentminMod.com"
COPYRIGHT="Copyright 2011-2014 CentminMod.com"
DISCLAIMER='This software is provided "as is" in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'
DISCLAIMER='This software is provided "as is" in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'
#####################################################
#####################################################
#
#
# This program is free software: you can redistribute it and/or modify it
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# Software Foundation, either version 3 of the License, or (at your option)
# any later version. See the included license.txt for futher details.
# any later version. See the included license.txt for futher details.
#
#
# PLEASE MODIFY VALUES BELOW THIS LINE ++++++++++++++++++++++++++++++++++++++
# PLEASE MODIFY VALUES BELOW THIS LINE ++++++++++++++++++++++++++++++++++++++
# Note: Please enter y for yes or n for no.
# Note: Please enter y for yes or n for no.
#####################################################
#####################################################
HN=$(uname -n)
HN=$(uname -n)
# Pre-Checks to prevent screw ups
# Pre-Checks to prevent screw ups
DIR_TMP='/svr-setup'
DIR_TMP='/svr-setup'
SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
source "inc/memcheck.inc"
source "inc/memcheck.inc"
TMPFSLIMIT=2900000
TMPFSLIMIT=2900000
if [ ! -d "$DIR_TMP" ]; then
if [ ! -d "$DIR_TMP" ]; then
if [[ "$TOTALMEM" -ge "$TMPFSLIMIT" ]]; then
if [[ "$TOTALMEM" -ge "$TMPFSLIMIT" ]]; then
TMPFSENABLED=1
TMPFSENABLED=1
RAMDISKTMPFS='y'
RAMDISKTMPFS='y'
echo "setting up $DIR_TMP on tmpfs ramdisk for initial install"
echo "setting up $DIR_TMP on tmpfs ramdisk for initial install"
mkdir -p $DIR_TMP
mkdir -p $DIR_TMP
mount -t tmpfs -o size=2200M,mode=0755 tmpfs $DIR_TMP
mount -t tmpfs -o size=2200M,mode=0755 tmpfs $DIR_TMP
df -hT
df -hT
else
else
mkdir -p $DIR_TMP
mkdir -p $DIR_TMP
fi
fi
fi
fi
if [[ -z $(cat /etc/resolv.conf) ]]; then
if [[ -z $(cat /etc/resolv.conf) ]]; then
echo ""
echo ""
echo "/etc/resolv.conf is empty. No nameserver resolvers detected !! "
echo "/etc/resolv.conf is empty. No nameserver resolvers detected !! "
echo "Please configure your /etc/resolv.conf correctly or you will not"
echo "Please configure your /etc/resolv.conf correctly or you will not"
echo "be able to use the internet or download from your server."
echo "be able to use the internet or download from your server."
echo "aborting script... please re-run centmin.sh"
echo "aborting script... please re-run centmin.sh"
echo ""
echo ""
exit
exit
fi
fi
if [ ! -f /usr/bin/wget ]; then
if [ ! -f /usr/bin/wget ]; then
echo "wget not found !! "
echo "wget not found !! "
echo "installing wget"
echo "installing wget"
yum -y -q install wget
yum -y -q install wget
echo "aborting script... please re-run centmin.sh"
echo "aborting script... please re-run centmin.sh"
exit
exit
fi
fi
if [ ! -f /usr/bin/unzip ]; then
if [ ! -f /usr/bin/unzip ]; then
yum -y -q install unzip
yum -y -q install unzip
fi
fi
if [ ! -f /usr/bin/bc ]; then
if [ ! -f /usr/bin/bc ]; then
echo "bc not found !! "
echo "bc not found !! "
echo "installing bc"
echo "installing bc"
yum -y -q install bc
yum -y -q install bc
echo "bc installed"
echo "bc installed"
echo "aborting script... "
echo "aborting script... "
echo "please re-run centmin.sh again for install"
echo "please re-run centmin.sh again for install"
exit
exit
fi
fi
if [ ! -f /usr/bin/tee ]; then
if [ ! -f /usr/bin/tee ]; then
#echo "tee not found !! "
#echo "tee not found !! "
#echo "installing tee"
#echo "installing tee"
yum -y -q install coreutils
yum -y -q install coreutils
fi
fi
if [ -f /var/cpanel/cpanel.config ]; then
if [ -f /var/cpanel/cpanel.config ]; then
echo "WHM/Cpanel detected.. centmin mod NOT compatible"
echo "WHM/Cpanel detected.. centmin mod NOT compatible"
echo "aborting script..."
echo "aborting script..."
exit
exit
fi
fi
if [ -f /etc/psa/.psa.shadow ]; then
if [ -f /etc/psa/.psa.shadow ]; then
echo "Plesk detected.. centmin mod NOT compatible"
echo "Plesk detected.. centmin mod NOT compatible"
echo "aborting script..."
echo "aborting script..."
exit
exit
fi
fi
if [ -f /etc/init.d/directadmin ]; then
if [ -f /etc/init.d/directadmin ]; then
echo "DirectAdmin detected.. centmin mod NOT compatible"
echo "DirectAdmin detected.. centmin mod NOT compatible"
echo "aborting script..."
echo "aborting script..."
exit
exit
fi
fi
TESTEDCENTOSVER='6.5'
TESTEDCENTOSVER='6.5'
CENTOSVER=`cat /etc/redhat-release | awk '{ print $3 }'`
CENTOSVER=`cat /etc/redhat-release | awk '{ print $3 }'`
if [ "$CENTOSVER" == 'release' ]; then
if [ "$CENTOSVER" == 'release' ]; then
CENTOSVER=`cat /etc/redhat-release | awk '{ print $4 }'`
CENTOSVER=`cat /etc/redhat-release | awk '{ print $4 }'`
fi
fi
if [ "$CENTOSVER" == 'Enterprise' ]; then
if [ "$CENTOSVER" == 'Enterprise' ]; then
CENTOSVER=`cat /etc/redhat-release | awk '{ print $7 }'`
CENTOSVER=`cat /etc/redhat-release | awk '{ print $7 }'`
OLS='y'
OLS='y'
fi
fi
if [ -f /proc/user_beancounters ]; then
if [ -f /proc/user_beancounters ]; then
# CPUS='1'
# CPUS='1'
# MAKETHREADS=" -j$CPUS"
# MAKETHREADS=" -j$CPUS"
# speed up make
# speed up make
CPUS=`cat "/proc/cpuinfo" | grep "processor"|wc -l`
CPUS=`cat "/proc/cpuinfo" | grep "processor"|wc -l`
CPUS=$(echo $CPUS+1 | bc)
CPUS=$(echo $CPUS+1 | bc)
MAKETHREADS=" -j$CPUS"
MAKETHREADS=" -j$CPUS"
else
else
# speed up make
# speed up make
CPUS=`cat "/proc/cpuinfo" | grep "processor"|wc -l`
CPUS=`cat "/proc/cpuinfo" | grep "processor"|wc -l`
CPUS=$(echo $CPUS+1 | bc)
CPUS=$(echo $CPUS+1 | bc)
MAKETHREADS=" -j$CPUS"
MAKETHREADS=" -j$CPUS"
fi
fi
# configure .ini directory
# configure .ini directory
CONFIGSCANBASE='/etc/centminmod'
CONFIGSCANBASE='/etc/centminmod'
CONFIGSCANDIR="${CONFIGSCANBASE}/php.d"
CONFIGSCANDIR="${CONFIGSCANBASE}/php.d"
if [ ! -d "$CONFIGSCANBASE" ]; then
if [ ! -d "$CONFIGSCANBASE" ]; then
mkdir -p $CONFIGSCANBASE
mkdir -p $CONFIGSCANBASE
fi
fi
if [ ! -d "$CONFIGSCANDIR" ]; then
if [ ! -d "$CONFIGSCANDIR" ]; then
mkdir -p $CONFIGSCANDIR
mkdir -p $CONFIGSCANDIR
if [ -d /root/centminmod/php.d/ ]; then
if [ -d /root/centminmod/php.d/ ]; then
cp -a /root/centminmod/php.d/* ${CONFIGSCANDIR}/
cp -a /root/centminmod/php.d/* ${CONFIGSCANDIR}/
fi
fi
fi
fi
# MySQL non-tmpfs based tmpdir for MySQL temp files
# MySQL non-tmpfs based tmpdir for MySQL temp files
if [ ! -d "/home/mysqltmp" ]; then
if [ ! -d "/home/mysqltmp" ]; then
mkdir -p /home/mysqltmp
mkdir -p /home/mysqltmp
chmod 1777 /home/mysqltmp
chmod 1777 /home/mysqltmp
CHOWNMYSQL=y
CHOWNMYSQL=y
fi
fi
#####################################################
#####################################################
# Enable or disable menu mode
# Enable or disable menu mode
ENABLE_MENU='y'
ENABLE_MENU='y'
#####################################################
#####################################################
# CCACHE Configuration
# CCACHE Configuration
CCACHEINSTALL='y'
CCACHEINSTALL='y'
CCACHESIZE='2G'
CCACHESIZE='2G'
# Disable installed services by default
# Disable installed services by default
# The service is still installed but disabled by default
# The service is still installed but disabled by default
# can be re-enabled with commands
# can be re-enabled with commands
# service servicename start; chkconfig servicename on
# service servicename start; chkconfig servicename on
NSD_DISABLED=n # NSD disabled by default with chkconfig off
NSD_DISABLED=n # NSD disabled by default with chkconfig off
MEMCACHED_DISABLED=n # Memcached server disabled by default via chkconfig off
MEMCACHED_DISABLED=n # Memcached server disabled by default via chkconfig off
PHP_DISABLED=n # PHP-FPM disabled by default with chkconfig off
PHP_DISABLED=n # PHP-FPM disabled by default with chkconfig off
MYSQLSERVICE_DISABLED=n # MariaDB MySQL service disabled by default with chkconfig off
MYSQLSERVICE_DISABLED=n # MariaDB MySQL service disabled by default with chkconfig off
# General Configuration
# General Configuration
NGINXUPGRADESLEEP='6'
NGINXUPGRADESLEEP='6'
NSD_INSTALL=y # Install NSD (DNS Server)
NSD_INSTALL=y # Install NSD (DNS Server)
NSD_VERSION='3.2.17' # NSD Version
NSD_VERSION='3.2.17' # NSD Version
NTP_INSTALL=y # Install Network time protocol daemon
NTP_INSTALL=y # Install Network time protocol daemon
NGINXPATCH=n # Set to y to allow 30 seconds time before Nginx configure and patching Nginx
NGINXPATCH=n # Set to y to allow 30 seconds time before Nginx configure and patching Nginx
NGINX_INSTALL=y # Install Nginx (Webserver)
NGINX_INSTALL=y # Install Nginx (Webserver)
NGINX_GEOIP=n # Nginx GEOIP module install
NGINX_GEOIP=n # Nginx GEOIP module install
NGINX_SPDY=y # Nginx SPDY support
NGINX_SPDY=y # Nginx SPDY support
NGINX_PAGESPEED=y # Install ngx_pagespeed
NGINX_PAGESPEED=y # Install ngx_pagespeed
NGINX_PAGESPEEDGITMASTER=y # Install ngx_pagespeed from official github master instead
NGINX_PAGESPEEDGITMASTER=y # Install ngx_pagespeed from official github master instead
NGXPGSPEED_VER='1.9.32.1-beta'
NGXPGSPEED_VER='1.9.32.1-beta'
NGINX_PAGESPEEDPSOL_VER='1.9.32.1'
NGINX_PAGESPEEDPSOL_VER='1.9.32.1'
NGINX_PASSENGER='n' # Install Phusion Passenger requires installing addons/passenger.sh before hand
NGINX_PASSENGER='n' # Install Phusion Passenger requires installing addons/passenger.sh before hand
NGINX_WEBDAV=y # Nginx WebDAV and nginx-dav-ext-module
NGINX_WEBDAV=y # Nginx WebDAV and nginx-dav-ext-module
NGINX_EXTWEBDAVVER='0.0.3' # nginx-dav-ext-module version
NGINX_EXTWEBDAVVER='0.0.3' # nginx-dav-ext-module version
NGINX_LIBATOMIC=y # Nginx configured with libatomic support
NGINX_LIBATOMIC=y # Nginx configured with libatomic support
NGINX_PCREJIT=y # Nginx configured with pcre & pcre-jit support
NGINX_PCREJIT=y # Nginx configured with pcre & pcre-jit support
NGINX_PCREVER='8.35' # Version of PCRE used for pcre-jit support in Nginx
NGINX_PCREVER='8.35' # Version of PCRE used for pcre-jit support in Nginx
NGINX_HEADERSMORE='0.25'
NGINX_HEADERSMORE='0.25'
NGINX_OPENRESTY=n # Agentzh's openresty Nginx modules
NGINX_OPENRESTY=n # Agentzh's openresty Nginx modules
PHP_INSTALL=y # Install PHP /w Fast Process Manager
PHP_INSTALL=y # Install PHP /w Fast Process Manager
PHPMAKETEST=n # set to y to enable make test after PHP make for diagnostic purposes
PHPMAKETEST=n # set to y to enable make test after PHP make for diagnostic purposes
PHPFINFO=n # Disable or Enable PHP File Info extension
PHPFINFO=n # Disable or Enable PHP File Info extension
PHPPCNTL=y # Disable or Enable PHP Process Control extension
PHPPCNTL=y # Disable or Enable PHP Process Control extension
PHPRECODE=n # Disable or Enable PHP Recode extension
PHPRECODE=n # Disable or Enable PHP Recode extension
PHPSNMP=y # Disable or Enable PHP SNMP extension
PHPSNMP=y # Disable or Enable PHP SNMP extension
SHORTCUTS=y # shortcuts
SHORTCUTS=y # shortcuts
########################################################
########################################################
# Choice of installing MariaDB 5.2 via RPM or via MariaDB 5.2 CentOS YUM Repo
# Choice of installing MariaDB 5.2 via RPM or via MariaDB 5.2 CentOS YUM Repo
# If MDB_YUMREPOINSTALL=y and MDB_INSTALL=n then MDB_VERONLY version
# If MDB_YUMREPOINSTALL=y and MDB_INSTALL=n then MDB_VERONLY version
# number won't have any effect in determining version of MariaDB 5.2.x to install.
# number won't have any effect in determining version of MariaDB 5.2.x to install.
# YUM Repo will install whatever is latest MariaDB 5.2.x version available via the YUM REPO
# YUM Repo will install whatever is latest MariaDB 5.2.x version available via the YUM REPO
MDB_INSTALL=n # Install via RPM MariaDB MySQL Server replacement (Not recommended for VPS with less than 256MB RAM!)
MDB_INSTALL=n # Install via RPM MariaDB MySQL Server replacement (Not recommended for VPS with less than 256MB RAM!)
MDB_YUMREPOINSTALL=y # Install MariaDB 5.5 via CentOS YUM Repo
MDB_YUMREPOINSTALL=y # Install MariaDB 5.5 via CentOS YUM Repo
# Define current MariaDB version
# Define current MariaDB version
MDB_VERONLY='5.2.14'
MDB_VERONLY='5.2.14'
MDB_BUILD='122'
MDB_BUILD='122'
MDB_VERSION="${MDB_VERONLY}-${MDB_BUILD}" # Use this version of MariaDB ${MDB_VERONLY}
MDB_VERSION="${MDB_VERONLY}-${MDB_BUILD}" # Use this version of MariaDB ${MDB_VERONLY}
# Define previous MariaDB version for proper upgrade
# Define previous MariaDB version for proper upgrade
MDB_PREVERONLY='5.2.12'
MDB_PREVERONLY='5.2.12'
MDB_PREBUILD='115'
MDB_PREBUILD='115'
MDB_PREVERSION="${MDB_PREVERONLY}-${MDB_PREBUILD}" # Use this version of MariaDB ${MDB_VERONLY}
MDB_PREVERSION="${MDB_PREVERONLY}-${MDB_PREBUILD}" # Use this version of MariaDB ${MDB_VERONLY}
########################################################
########################################################
# Optionally, if you want to install MariaDB instead of standard MySQL you can do.
# Optionally, if you want to install MariaDB instead of standard MySQL you can do.
# Set MDB_INSTALL=y and MYSQL_INSTALL=n
# Set MDB_INSTALL=y and MYSQL_INSTALL=n
MYSQL_INSTALL=n # Install official Oracle MySQL Server (MariaDB alternative recommended)
MYSQL_INSTALL=n # Install official Oracle MySQL Server (MariaDB alternative recommended)
SENDMAIL_INSTALL=n # Install Sendmail (and mailx) set to y and POSTFIX_INSTALL=n for sendmail
SENDMAIL_INSTALL=n # Install Sendmail (and mailx) set to y and POSTFIX_INSTALL=n for sendmail
POSTFIX_INSTALL=y # Install Postfix (and mailx) set to n and SENDMAIL_INSTALL=y for sendmail
POSTFIX_INSTALL=y # Install Postfix (and mailx) set to n and SENDMAIL_INSTALL=y for sendmail
# Nginx
# Nginx
NGINX_VERSION='1.7.5' # Use this version of Nginx
NGINX_VERSION='1.7.6' # Use this version of Nginx
NGINXBACKUP='y'
NGINXBACKUP='y'
NGINXDIR='/usr/local/nginx'
NGINXDIR='/usr/local/nginx'
NGINXCONFDIR="${NGINXDIR}/conf"
NGINXCONFDIR="${NGINXDIR}/conf"
NGINXBACKUPDIR='/usr/local/nginxbackup'
NGINXBACKUPDIR='/usr/local/nginxbackup'
NOSOURCEOPENSSL='y' # set to 'y' to disable OpenSSL source compile for system default YUM package setup
NOSOURCEOPENSSL='y' # set to 'y' to disable OpenSSL source compile for system default YUM package setup
OPENSSL_VERSION='1.0.1i' # Use this version of OpenSSL
OPENSSL_VERSION='1.0.1i' # Use this version of OpenSSL
# Choose whether to compile Nginx --with-google_perftools_module
# Choose whether to compile Nginx --with-google_perftools_module
# no longer used in Centmin Mod v1.2.3-eva2000.01 and higher
# no longer used in Centmin Mod v1.2.3-eva2000.01 and higher
GPERFTOOLS_SOURCEINSTALL=n
GPERFTOOLS_SOURCEINSTALL=n
LIBUNWIND_VERSION='0.99' # note google perftool specifically requies v0.99 and no other
LIBUNWIND_VERSION='0.99' # note google perftool specifically requies v0.99 and no other
GPERFTOOLS_VERSION='1.8.3' # Use this version of google-perftools
GPERFTOOLS_VERSION='1.8.3' # Use this version of google-perftools
# Choose whether to compile PCRE from source. Note PHP 5.3.8 already includes PCRE v8.12
# Choose whether to compile PCRE from source. Note PHP 5.3.8 already includes PCRE v8.12
PCRE_SOURCEINSTALL=n
PCRE_SOURCEINSTALL=n
PCRE_VERSION='8.35' # NO longer used/ignored
PCRE_VERSION='8.35' # NO longer used/ignored
# PHP and Cache/Acceleration
# PHP and Cache/Acceleration
IMAGICKPHP_VER='3.1.2' # PHP extension for imagick
IMAGICKPHP_VER='3.1.2' # PHP extension for imagick
MEMCACHED_INSTALL=y # Install Memcached
MEMCACHED_INSTALL=y # Install Memcached
LIBEVENT_VERSION='2.0.21' # Use this version of Libevent
LIBEVENT_VERSION='2.0.21' # Use this version of Libevent
MEMCACHED_VERSION='1.4.20' # Use this version of Memcached server
MEMCACHED_VERSION='1.4.20' # Use this version of Memcached server
MEMCACHE_VERSION='3.0.8' # Use this version of Memcache
MEMCACHE_VERSION='3.0.8' # Use this version of Memcache
MEMCACHEDPHP_VER='2.2.0' # Memcached PHP extension not server
MEMCACHEDPHP_VER='2.2.0' # Memcached PHP extension not server
LIBMEMCACHED_YUM='n' # switch to YUM install instead of source compile
LIBMEMCACHED_YUM='n' # switch to YUM install instead of source compile
LIBMEMCACHED_VER='1.0.18' # libmemcached version for source compile
LIBMEMCACHED_VER='1.0.18' # libmemcached version for source compile
TWEMPERF_VER='0.1.1'
TWEMPERF_VER='0.1.1'
FFMPEGVER='0.6.0'
FFMPEGVER='0.6.0'
SUHOSINVER='0.9.36'
SUHOSINVER='0.9.36'
PHP_VERSION='5.4.33' # Use this version of PHP
PHP_VERSION='5.6.1' # Use this version of PHP
PHP_MIRRORURL='http://php.net'
PHP_MIRRORURL='http://php.net'
PHPUPGRADE_MIRRORURL='http://php.net'
PHPUPGRADE_MIRRORURL='http://php.net'
XCACHE_VERSION='3.1.0' # Use this version of Xcache
XCACHE_VERSION='3.1.0' # Use this version of Xcache
APCCACHE_VERSION='3.1.13' # Use this version of APC Cache
APCCACHE_VERSION='3.1.13' # Use this version of APC Cache
IGBINARY_VERSION='1.1.1'
IGBINARY_VERSION='1.1.1'
IGBINARYGIT='y'
IGBINARYGIT='y'
ZOPCACHEDFT='n'
ZOPCACHEDFT='y'
ZOPCACHECACHE_VERSION='7.0.3'
ZOPCACHECACHE_VERSION='7.0.3'
# Python
# Python
PYTHON_VERSION='2.7.8' # Use this version of Python
PYTHON_VERSION='2.7.8' # Use this version of Python
SIEGE_VERSION='3.0.6'
SIEGE_VERSION='3.0.6'
WGETOPT='-cnv --no-dns-cache -4'
WGETOPT='-cnv --no-dns-cache -4'
###############################################################
###############################################################
# experimental custom RPM compiled packages to replace source
# experimental custom RPM compiled packages to replace source
# compiled versions for 64bit systems only
# compiled versions for 64bit systems only
FPMRPM_LIBEVENT=n
FPMRPM_LIBEVENT=n
FPMRPM_MEMCACHED=n
FPMRPM_MEMCACHED=n
CENTALTREPO_DISABLE=y
CENTALTREPO_DISABLE=y
AXIVOREPO_DISABLE=y
AXIVOREPO_DISABLE=y
###############################################################
###############################################################
MACHINE_TYPE=`uname -m` # Used to detect if OS is 64bit or not.
MACHINE_TYPE=`uname -m` # Used to detect if OS is 64bit or not.
if [ "${ARCH_OVERRIDE}" != '' ]
if [ "${ARCH_OVERRIDE}" != '' ]
then
then
ARCH=${ARCH_OVERRIDE}
ARCH=${ARCH_OVERRIDE}
else
else
if [ ${MACHINE_TYPE} == 'x86_64' ];
if [ ${MACHINE_TYPE} == 'x86_64' ];
then
then
ARCH='x86_64'
ARCH='x86_64'
MDB_ARCH='amd64'
MDB_ARCH='amd64'
else
else
ARCH='i386'
ARCH='i386'
fi
fi
fi
fi
# source "inc/mainmenu.inc"
# source "inc/mainmenu.inc"
# source "inc/mainmenu_cli.inc"
# source "inc/mainmenu_cli.inc"
# source "inc/ramdisk.inc"
# source "inc/ramdisk.inc"
source "inc/gcc.inc"
source "inc/gcc.inc"
source "inc/entropy.inc"
source "inc/entropy.inc"
source "inc/cpucount.inc"
source "inc/cpucount.inc"
source "inc/motd.inc"
source "inc/motd.inc"
source "inc/cpcheck.inc"
source "inc/cpcheck.inc"
source "inc/memcheck.inc"
source "inc/memcheck.inc"
source "inc/ccache.inc"
source "inc/ccache.inc"
source "inc/bookmark.inc"
source "inc/bookmark.inc"
source "inc/centminlogs.inc"
source "inc/centminlogs.inc"
source "inc/yumskip.inc"
source "inc/yumskip.inc"
source "inc/questions.inc"
source "inc/questions.inc"
source "inc/downloadlinks.inc"
source "inc/downloadlinks.inc"
source "inc/downloads.inc"
source "inc/downloads.inc"
source "inc/yumpriorities.inc"
source "inc/yumpriorities.inc"
source "inc/yuminstall.inc"
source "inc/yuminstall.inc"
source "inc/centoscheck.inc"
source "inc/centoscheck.inc"
source "inc/axelsetup.inc"
source "inc/axelsetup.inc"
source "inc/phpfpmdir.inc"
source "inc/phpfpmdir.inc"
source "inc/nginx_backup.inc"
source "inc/nginx_backup.inc"
source "inc/nsd_install.inc"
source "inc/nsd_install.inc"
source "inc/nsdsetup.inc"
source "inc/nsdsetup.inc"
source "inc/nsd_reinstall.inc"
source "inc/nsd_reinstall.inc"
source "inc/logrotate_nginx.inc"
source "inc/logrotate_nginx.inc"
source "inc/logrotate_phpfpm.inc"
source "inc/logrotate_phpfpm.inc"
source "inc/nginx_mimetype.inc"
source "inc/nginx_mimetype.inc"
source "inc/openssl_install.inc"
source "inc/openssl_install.inc"
source "inc/nginx_configure.inc"
source "inc/nginx_configure.inc"
source "inc/nginx_configure_openresty.inc"
source "inc/nginx_configure_openresty.inc"
source "inc/nginx_install.inc"
source "inc/nginx_install.inc"
source "inc/nginx_upgrade.inc"
source "inc/nginx_upgrade.inc"
source "inc/imagick_install.inc"
source "inc/imagick_install.inc"
source "inc/memcached_install.inc"
source "inc/memcached_install.inc"
source "inc/mysql_proclimit.inc"
source "inc/mysql_proclimit.inc"
source "inc/mysqltmp.inc"
source "inc/mysqltmp.inc"
source "inc/mariadb_install.inc"
source "inc/mariadb_install.inc"
source "inc/mysql_install.inc"
source "inc/mysql_install.inc"
source "inc/mariadb_submenu.inc"
source "inc/mariadb_submenu.inc"
source "inc/php_configure.inc"
source "inc/php_configure.inc"
source "inc/php_upgrade.inc"
source "inc/php_upgrade.inc"
source "inc/suhosin_setup.inc"
source "inc/suhosin_setup.inc"
source "inc/nginx_pagespeed.inc"
source "inc/nginx_pagespeed.inc"
source "inc/nginx_modules.inc"
source "inc/nginx_modules.inc"
source "inc/nginx_modules_openresty.inc"
source "inc/nginx_modules_openresty.inc"
source "inc/sshd.inc"
source "inc/sshd.inc"
source "inc/openvz_stack.inc"
source "inc/openvz_stack.inc"
source "inc/siegeinstall.inc"
source "inc/siegeinstall.inc"
source "inc/python_install.inc"
source "inc/python_install.inc"
source "inc/nginx_addvhost.inc"
source "inc/nginx_addvhost.inc"
source "inc/mariadb_upgrade.inc"
source "inc/mariadb_upgrade.inc"
source "inc/mariadb_upgrade53.inc"
source "inc/mariadb_upgrade53.inc"
source "inc/mariadb_upgrade55.inc"
source "inc/mariadb_upgrade55.inc"
source "inc/mariadb_upgrade10.inc"
source "inc/mariadb_upgrade10.inc"
source "inc/nginx_errorpage.inc"
source "inc/nginx_errorpage.inc"
source "inc/sendmail.inc"
source "inc/sendmail.inc"
source "inc/postfix.inc"
source "inc/postfix.inc"
source "inc/compress.inc"
source "inc/compress.inc"
source "inc/diskalert.inc"
source "inc/diskalert.inc"
source "inc/phpsededit.inc"
source "inc/phpsededit.inc"
source "inc/csfinstall.inc"
source "inc/csfinstall.inc"
source "inc/csftweaks.inc"
source "inc/csftweaks.inc"
source "inc/xcache_installask.inc"
source "inc/xcache_installask.inc"
source "inc/xcache_install.inc"
source "inc/xcache_install.inc"
source "inc/xcache_reinstall.inc"
source "inc/xcache_reinstall.inc"
source "inc/igbinary.inc"
source "inc/igbinary.inc"
source "inc/apcprotect.inc"
source "inc/apcprotect.inc"
source "inc/apcinstall.inc"
source "inc/apcinstall.inc"
source "inc/apcreinstall.inc"
source "inc/apcreinstall.inc"
source "inc/zendopcache_55ini.inc"
source "inc/zendopcache_55ini.inc"
source "inc/zendopcache_install.inc"
source "inc/zendopcache_install.inc"
source "inc/zendopcache_upgrade.inc"
source "inc/zendopcache_upgrade.inc"
source "inc/zendopcache_reinstall.inc"
source "inc/zendopcache_reinstall.inc"
source "inc/zendopcache_submenu.inc"
source "inc/zendopcache_submenu.inc"
source "inc/ffmpeginstall.inc"
source "inc/ffmpeginstall.inc"
source "inc/shortcuts_install.inc"
source "inc/shortcuts_install.inc"
source "inc/memcacheadmin.inc"
source "inc/memcacheadmin.inc"
source "inc/mysqlsecure.inc"
source "inc/mysqlsecure.inc"
source "inc/centminfinish.inc"
source "inc/centminfinish.inc"
checkcentosver
checkcentosver
mysqltmpdir
mysqltmpdir
if [ ! -f /etc/centminmod-release ];then
if [ ! -f /etc/centminmod-release ];then
echo "$SCRIPT_VERSION" > /etc/centminmod-release
echo "$SCRIPT_VERSION" > /etc/centminmod-release
else
else
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-release)" ]]; then
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-release)" ]]; then
echo "$SCRIPT_VERSION" > /etc/centminmod-release
echo "$SCRIPT_VERSION" > /etc/centminmod-release
fi
fi
fi
fi
if [ -f /etc/centminmod-versionlog ];then
if [ -f /etc/centminmod-versionlog ];then
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-versionlog)" ]]; then
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-versionlog)" ]]; then
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
fi
fi
else
else
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
fi
fi
###############################################################
###############################################################
# The default is stable, you can change this to development if you wish
# The default is stable, you can change this to development if you wish
#ARCH_OVERRIDE='i386'
#ARCH_OVERRIDE='i386'
# Uncomment the above line if you are running a 32bit Paravirtulized Xen VPS
# Uncomment the above line if you are running a 32bit Paravirtulized Xen VPS
# on a 64bit host node.
# on a 64bit host node.
# YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE +++++++++++++++++++
# YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE +++++++++++++++++++
# JUST RUN chmod +x ./centmin.sh && ./centmin.sh
# JUST RUN chmod +x ./centmin.sh && ./centmin.sh
#
#
###############################################################
###############################################################
KEYPRESS_PARAM='-s -n1 -p' # Read a keypress without hitting ENTER.
KEYPRESS_PARAM='-s -n1 -p' # Read a keypress without hitting ENTER.
# -s means do not echo input.
# -s means do not echo input.
# -n means accept only N characters of input.
# -n means accept only N characters of input.
# -p means echo the following prompt before reading input
# -p means echo the following prompt before reading input
ASKCMD="read $KEYPRESS_PARAM "
ASKCMD="read $KEYPRESS_PARAM "
# MACHINE_TYPE=`uname -m` # Used to detect if OS is 64bit or not.
# MACHINE_TYPE=`uname -m` # Used to detect if OS is 64bit or not.
CUR_DIR=`pwd` # Get current directory.
CUR_DIR=`pwd` # Get current directory.
CM_INSTALLDIR=$CUR_DIR
CM_INSTALLDIR=$CUR_DIR
###############################################################
###############################################################
# FUNCTIONS
# FUNCTIONS
if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$CENTOSVER" = '6.3' || "$CENTOSVER" = '6.4' || "$CENTOSVER" = '6.5' ]]; then
if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$CENTOSVER" = '6.3' || "$CENTOSVER" = '6.4' || "$CENTOSVER" = '6.5' ]]; then
DOWNLOADAPP='axel -a'
DOWNLOADAPP='axel -a'
WGETRETRY=''
WGETRETRY=''
AXELPHPTARGZ="-o php-${PHP_VERSION}.tar.gz"
AXELPHPTARGZ="-o php-${PHP_VERSION}.tar.gz"
AXELPHPUPGRADETARGZ="-o php-${phpver}.tar.gz"
AXELPHPUPGRADETARGZ="-o php-${phpver}.tar.gz"
else
else
DOWNLOADAPP="wget ${WGETOPT} --progress=bar"
DOWNLOADAPP="wget ${WGETOPT} --progress=bar"
WGETRETRY='--tries=3'
WGETRETRY='--tries=3'
AXELPHPTARGZ=''
AXELPHPTARGZ=''
AXELPHPUPGRADETARGZ=''
AXELPHPUPGRADETARGZ=''
fi
fi
# if [ "${ARCH_OVERRIDE}" != '' ]
# if [ "${ARCH_OVERRIDE}" != '' ]
# then
# then
# ARCH=${ARCH_OVERRIDE}
# ARCH=${ARCH_OVERRIDE}
# else
# else
# if [ ${MACHINE_TYPE} == 'x86_64' ];
# if [ ${MACHINE_TYPE} == 'x86_64' ];
# then
# then
# ARCH='x86_64'
# ARCH='x86_64'
# MDB_ARCH='amd64'
# MDB_ARCH='amd64'
# else
# else
# ARCH='i386'
# ARCH='i386'
# fi
# fi
# fi
# fi
ASK () {
ASK () {
keystroke=''
keystroke=''
while [[ "$keystroke" != [yYnN] ]]
while [[ "$keystroke" != [yYnN] ]]
do
do
$ASKCMD "$1" keystroke
$ASKCMD "$1" keystroke
echo "$keystroke";
echo "$keystroke";
done
done
key=$(echo $keystroke)
key=$(echo $keystroke)
}
}
# Setup Colours
# Setup Colours
black='\E[30;40m'
black='\E[30;40m'
red='\E[31;40m'
red='\E[31;40m'
green='\E[32;40m'
green='\E[32;40m'
yellow='\E[33;40m'
yellow='\E[33;40m'
blue='\E[34;40m'
blue='\E[34;40m'
magenta='\E[35;40m'
magenta='\E[35;40m'
cyan='\E[36;40m'
cyan='\E[36;40m'
white='\E[37;40m'
white='\E[37;40m'
boldblack='\E[1;30;40m'
boldblack='\E[1;30;40m'
boldred='\E[1;31;40m'
boldred='\E[1;31;40m'
boldgreen='\E[1;32;40m'
boldgreen='\E[1;32;40m'
boldyellow='\E[1;33;40m'
boldyellow='\E[1;33;40m'
boldblue='\E[1;34;40m'
boldblue='\E[1;34;40m'
boldmagenta='\E[1;35;40m'
boldmagenta='\E[1;35;40m'
boldcyan='\E[1;36;40m'
boldcyan='\E[1;36;40m'
boldwhite='\E[1;37;40m'
boldwhite='\E[1;37;40m'
Reset="tput sgr0" # Reset text attributes to normal
Reset="tput sgr0" # Reset text attributes to normal
#+ without clearing screen.
#+ without clearing screen.
cecho () # Coloured-echo.
cecho () # Coloured-echo.
# Argument $1 = message
# Argument $1 = message
# Argument $2 = color
# Argument $2 = color
{
{
message=$1
message=$1
color=$2
color=$2
echo -e "$color$message" ; $Reset
echo -e "$color$message" ; $Reset
return
return
}
}
###
###
unsetramdisk() {
unsetramdisk() {
if [[ "$RAMDISKTMPFS" = [yY] && "$TMPFSENABLED" = '1' ]]; then
if [[ "$RAMDISKTMPFS" = [yY] && "$TMPFSENABLED" = '1' ]]; then
echo
echo
cecho "unmount $DIR_TMP tmpfs ramdisk & copy back to disk" $boldyellow
cecho "unmount $DIR_TMP tmpfs ramdisk & copy back to disk" $boldyellow
mkdir -p ${DIR_TMP}_disk
mkdir -p ${DIR_TMP}_disk
\cp -R ${DIR_TMP}/* ${DIR_TMP}_disk
\cp -R ${DIR_TMP}/* ${DIR_TMP}_disk
# ls -lah ${DIR_TMP}_disk
# ls -lah ${DIR_TMP}_disk
diff -qr ${DIR_TMP} ${DIR_TMP}_disk
diff -qr ${DIR_TMP} ${DIR_TMP}_disk
/etc/init.d/nginx stop
/etc/init.d/nginx stop
/etc/init.d/php-fpm stop
/etc/init.d/php-fpm stop
/etc/init.d/memcached stop
/etc/init.d/memcached stop
sleep 5
sleep 5
# lsof | grep /svr-setup
# lsof | grep /svr-setup
umount -l ${DIR_TMP}
umount -l ${DIR_TMP}
/etc/init.d/nginx start
/etc/init.d/nginx start
/etc/init.d/php-fpm start
/etc/init.d/php-fpm start
/etc/init.d/memcached start
/etc/init.d/memcached start
\cp -R ${DIR_TMP}_disk/* ${DIR_TMP}
\cp -R ${DIR_TMP}_disk/* ${DIR_TMP}
# ls -lahrt ${DIR_TMP}
# ls -lahrt ${DIR_TMP}
df -hT
df -hT
cecho "unmounted $DIR_TMP tmpfs ramdisk" $boldyellow
cecho "unmounted $DIR_TMP tmpfs ramdisk" $boldyellow
fi
fi
}
}
###
###
function funct_centmininstall {
function funct_centmininstall {
#check centmin install previously
#check centmin install previously
run_once() {
run_once() {
# If OpenVZ user add user/group 500 - else various folders and devices will end up with an odd user/group name for some reason
# If OpenVZ user add user/group 500 - else various folders and devices will end up with an odd user/group name for some reason
if [ -f /proc/user_beancounters ];
if [ -f /proc/user_beancounters ];
then
then
groupadd 500
groupadd 500
useradd -g 500 -s /sbin/nologin -M 500
useradd -g 500 -s /sbin/nologin -M 500
fi
fi
#ASK "Would you like to update any pre-installed software? (Recommended) [y/n] "
#ASK "Would you like to update any pre-installed software? (Recommended) [y/n] "
#if [[ "$key" = [yY] ]];
#if [[ "$key" = [yY] ]];
#then
#then
# echo "Let's do that then..."
# echo "Let's do that then..."
# yum${CACHESKIP} -q clean all
# yum${CACHESKIP} -q clean all
# yum${CACHESKIP} -y update glibc\*
# yum${CACHESKIP} -y update glibc\*
# yum${CACHESKIP} -y update yum\* rpm\* python\*
# yum${CACHESKIP} -y update yum\* rpm\* python\*
# yum${CACHESKIP} -q clean all
# yum${CACHESKIP} -q clean all
# yum${CACHESKIP} -y update
# yum${CACHESKIP} -y update
#fi
#fi
if [ ${ARCH} == 'x86_64' ];
if [ ${ARCH} == 'x86_64' ];
then
then
if [ "$UNATTENDED" == 'n' ]; then
if [ "$UNATTENDED" == 'n' ]; then
ASK "Would you like to exclude installation of 32bit Yum packages? (Recommended for 64bit CentOS) [y/n] "
ASK "Would you like to exclude installation of 32bit Yum packages? (Recommended for 64bit CentOS) [y/n] "
else
else
key='y'
key='y'
fi #unattended
fi #unattended
if [[ "$key" = [yY] ]];
if [[ "$key" = [yY] ]];
then
then
mv /etc/yum.conf /etc/yum.bak
mv /etc/yum.conf /etc/yum.bak
cp $CUR_DIR/config/yum/yum.conf /etc/yum.conf
cp $CUR_DIR/config/yum/yum.conf /etc/yum.conf
echo "Your origional yum configuration has been backed up to /etc/yum.bak"
echo "Your origional yum configuration has been backed up to /etc/yum.bak"
else
else
rm -rf $CUR_DIR/config/yum
rm -rf $CUR_DIR/config/yum
fi
fi
fi
fi
if [ "$UNATTENDED" == 'n' ]; then
if [ "$UNATTENDED" == 'n' ]; then
ASK "Would you like to secure /tmp and /var/tmp? (Highly recommended) [y/n] "
ASK "Would you like to secure /tmp and /var/tmp? (Highly recommended) [y/n] "
else
else
key='y'
key='y'
fi #unattended
fi #unattended
if [[ "$key" = [yY] ]];
if [[ "$key" = [yY] ]];
then
then
echo "Centmin Mod secure /tmp completed # `date`" > ${DIR_TMP}/securedtmp.log
echo "Centmin Mod secure /tmp completed # `date`" > ${DIR_TMP}/securedtmp.log
echo "*************************************************"
echo "*************************************************"
cecho "* Secured /tmp and /var/tmp" $boldgreen
cecho "* Secured /tmp and /var/tmp" $boldgreen
echo "*************************************************"
echo "*************************************************"
rm -rf /tmp
rm -rf /tmp
mkdir /tmp
mkdir /tmp
mount -t tmpfs -o rw,noexec,nosuid tmpfs /tmp
mount -t tmpfs -o rw,noexec,nosuid tmpfs /tmp
chmod 1777 /tmp
chmod 1777 /tmp
echo "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" >> /etc/fstab
echo "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" >> /etc/fstab
rm -rf /var/tmp
rm -rf /var/tmp
ln -s /tmp /var/tmp
ln -s /tmp /var/tmp
fi
fi
#questions
#questions
#yuminstall
#yuminstall
if [ "$UNATTENDED" == 'n' ]; then
if [ "$UNATTENDED" == 'n' ]; then
ASK "Would you like to set the server localtime? [y/n] "
ASK "Would you like to set the server localtime? [y/n] "
else
else
key='y'
key='y'
fi #unattended
fi #unattended
if [[ "$key" = [yY] ]];
if [[ "$key" = [yY] ]];
then
then
echo "*************************************************"
echo "*************************************************"
cecho "* Setting preferred localtime for VPS" $boldgreen
cecho "* Setting preferred localtime for VPS" $boldgreen
echo "*************************************************"
echo "*************************************************"
rm -f /etc/localtime
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/$ZONEINFO /etc/localtime
ln -s /usr/share/zoneinfo/$ZONEINFO /etc/localtime
echo "Current date & time for the zone you selected is:"
echo "Current date & time for the zone you selected is:"
date
date
fi
fi
}
}
# END FUNCTIONS
# END FUNCTIONS
################################################################
################################################################
# SCRIPT START
# SCRIPT START
#
#
clear
clear
cecho "**********************************************************************" $boldyellow
cecho "**********************************************************************" $boldyellow
cecho "* Centmin, an nginx, MariaDB/MySQL, PHP & DNS Install script for CentOS" $boldgreen
cecho "* Centmin, an nginx, MariaDB/MySQL, PHP & DNS Install script for CentOS" $boldgreen
cecho "* Version: $SCRIPT_VERSION - Date: $SCRIPT_DATE" $boldgreen
cecho "* Version: $SCRIPT_VERSION - Date: $SCRIPT_DATE" $boldgreen
cecho "* $COPYRIGHT $SCRIPT_MODIFICATION_AUTHOR" $boldgreen
cecho "* $COPYRIGHT $SCRIPT_MODIFICATION_AUTHOR" $boldgreen
cecho "**********************************************************************" $boldyellow
cecho "**********************************************************************" $boldyellow
echo " "
echo " "
cecho "This software comes with no warranty of any kind. You are free to use" $boldyellow
cecho "This software comes with no warranty of any kind. You are free to use" $boldyellow
cecho "it for both personal and commercial use as licensed under the GPL." $boldyellow
cecho "it for both personal and commercial use as licensed under the GPL." $boldyellow
echo " "
echo " "
cecho "Please read the included readme.txt before using this script." $boldmagenta
cecho "Please read the included readme.txt before using this script." $boldmagenta
echo " "
echo " "
if [ "$UNATTENDED" == 'n' ]; then
if [ "$UNATTENDED" == 'n' ]; then
ASK "Would you like to continue? [y/n] "
ASK "Would you like to continue? [y/n] "
if [[ "$key" = [nN] ]];
if [[ "$key" = [nN] ]];
then
then
exit 0
exit 0
fi
fi
fi #unattended
fi #unattended
# Set LIBDIR
# Set LIBDIR
if [ ${ARCH} == 'x86_64' ];
if [ ${ARCH} == 'x86_64' ];
then
then
LIBDIR='lib64'
LIBDIR='lib64'
else
else
LIBDIR='lib'
LIBDIR='lib'
fi
fi
#DIR_TMP="/svr-setup"
#DIR_TMP="/svr-setup"
#if [ -a "$DIR_TMP" ];
#if [ -a "$DIR_TMP" ];
#then
#then
# ASK "It seems that you have run this script before, would you like to start from after setting the timezone? [y/n] "
# ASK "It seems that you have run this script before, would you like to start from after setting the timezone? [y/n] "
# if [[ "$key" = [nN] ]];
# if [[ "$key" = [nN] ]];
# then
# then
# run_once
# run_once
# fi
# fi
#else
#else
# mkdir $DIR_TMP
# mkdir $DIR_TMP
# run_once
# run_once
#fi
#fi
if [ ! -f "${DIR_TMP}/securedtmp.log" ]; then
if [ ! -f "${DIR_TMP}/securedtmp.log" ]; then
run_once
run_once
fi
fi
if [ -f /proc/user_beancounters ];
if [ -f /proc/user_beancounters ];
then
then
cecho "OpenVZ system detected, NTP not installed" $boldgreen
cecho "OpenVZ system detected, NTP not installed" $boldgreen
else
else
if [[ "$NTP_INSTALL" = [yY] ]];
if [[ "$NTP_INSTALL" = [yY] ]];
then
then
echo "*************************************************"
echo "*************************************************"
cecho "* Installing NTP (and syncing time)" $boldgreen
cecho "* Installing NTP (and syncing time)" $boldgreen
echo "*************************************************"
echo "*************************************************"
yum${CACHESKIP} -y install ntp
yum${CACHESKIP} -y install ntp
chkconfig --levels 235 ntpd on
chkconfig --levels 235 ntpd on
ntpdate pool.ntp.org
ntpdate pool.ntp.org
echo "The date/time is now:"
echo "The date/time is now:"
date
date
echo "If this is correct, then everything is working properly"
echo "If this is correct, then everything is working properly"
echo "*************************************************"
echo "*************************************************"
cecho "* NTP installed" $boldgreen
cecho "* NTP installed" $boldgreen
echo "*************************************************"
echo "*************************************************"
fi
fi
fi
fi
ngxinstallmain
ngxinstallmain
mariadbinstallfunct
mariadbinstallfunct
mysqlinstallfunct
mysqlinstallfunct
if [[ "$PHP_INSTALL" = [yY] ]];
if [[ "$PHP_INSTALL" = [yY] ]];
then
then
echo "*************************************************"
echo "*************************************************"
cecho "* Installing PHP" $boldgreen
cecho "* Installing PHP" $boldgreen
echo "*************************************************"
echo "*************************************************"
funct_centos6check
funct_centos6check
export PHP_AUTOCONF=/usr/bin/autoconf
export PHP_AUTOCONF=/usr/bin/autoconf
export PHP_AUTOHEADER=/usr/bin/autoheader
export PHP_AUTOHEADER=/usr/bin/autoheader
cd $DIR_TMP
cd $DIR_TMP
if [ "$(rpm -qa | grep php*)" ]; then
if [ "$(rpm -qa | grep php*)" ]; then
# IMPORTANT Erase any PHP installations first, otherwise conflicts may arise
# IMPORTANT Erase any PHP installations first, otherwise conflicts may arise
echo "yum -y erase php*"
echo "yum -y erase php*"
yum${CACHESKIP} -y erase php*
yum${CACHESKIP} -y erase php*
fi
fi
#download php tarball
#download php tarball
#tar xzvf php-${PHP_VERSION}.tar.gz
#tar xzvf php-${PHP_VERSION}.tar.gz
cd php-${PHP_VERSION}
cd php-${PHP_VERSION}
./buildconf --force
./buildconf --force
mkdir fpm-build && cd fpm-build
mkdir fpm-build && cd fpm-build
mkdir -p /usr/${LIBDIR}/mysql
mkdir -p /usr/${LIBDIR}/mysql
ln -s /usr/${LIBDIR}/libmysqlclient.so /usr/${LIBDIR}/mysql/libmysqlclient.so
ln -s /usr/${LIBDIR}/libmysqlclient.so /usr/${LIBDIR}/mysql/libmysqlclient.so
funct_phpconfigure
funct_phpconfigure
cd ../
cd ../
#######################################################
#######################################################
# check to see if centmin custom php.ini already in place
# check to see if centmin custom php.ini already in place
CUSTOMPHPINICHECK=`grep 'realpath_cache_size = 1024k' /usr/local/lib/php.ini 2>/dev/null`
CUSTOMPHPINICHECK=`grep 'realpath_cache_size = 1024k' /usr/local/lib/php.ini 2>/dev/null`
if [[ -z $CUSTOMPHPINICHECK ]]; then
if [[ -z $CUSTOMPHPINICHECK ]]; then
cp -f php.ini-production /usr/local/lib/php.ini
cp -f php.ini-production /usr/local/lib/php.ini
chmod 644 /usr/local/lib/php.ini
chmod 644 /usr/local/lib/php.ini
phpsededit
phpsededit
fi # check to see if centmin custom php.ini already in place
fi # check to see if centmin custom php.ini already in place
echo
echo
#read -ep "Does this server have less than <=2048MB of memory installed ? [y/n]: " lessphpmem
#read -ep "Does this server have less than <=2048MB of memory installed ? [y/n]: " lessphpmem
#echo
#echo
#echo
#echo
if [[ "$lessphpmem" = [yY] ]]; then
if [[ "$lessphpmem" = [yY] ]]; then
echo $lessphpmem
echo $lessphpmem
echo -e "\nCopying php-fpm-min.conf /usr/local/etc/php-fpm.conf\n"
echo -e "\nCopying php-fpm-min.conf /usr/local/etc/php-fpm.conf\n"
cp $CUR_DIR/config/php-fpm/php-fpm-min.conf /usr/local/etc/php-fpm.conf
cp $CUR_DIR/config/php-fpm/php-fpm-min.conf /usr/local/etc/php-fpm.conf
else
else
echo $lessphpmem
echo $lessphpmem
echo -e "\nCopying php-fpm.conf /usr/local/etc/php-fpm.conf\n"
echo -e "\nCopying php-fpm.conf /usr/local/etc/php-fpm.conf\n"
cp $CUR_DIR/config/php-fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
cp $CUR_DIR/config/php-fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
fi
fi
cp $CUR_DIR/init/php-fpm /etc/init.d/php-fpm
cp $CUR_DIR/init/php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
mkdir -p /var/run/php-fpm
mkdir -p /var/run/php-fpm
touch /var/run/php-fpm/php-fpm.pid
touch /var/run/php-fpm/php-fpm.pid
chown nginx:nginx /var/run/php-fpm
chown nginx:nginx /var/run/php-fpm
chown root:root /var/run/php-fpm/php-fpm.pid
chown root:root /var/run/php-fpm/php-fpm.pid
mkdir /var/log/php-fpm/
mkdir /var/log/php-fpm/
touch /var/log/php-fpm/www-error.log
touch /var/log/php-fpm/www-error.log
touch /var/log/php-fpm/www-php.error.log
touch /var/log/php-fpm/www-php.error.log
chmod 0666 /var/log/php-fpm/www-error.log
chmod 0666 /var/log/php-fpm/www-error.log
chmod 0666 /var/log/php-fpm/www-php.error.log
chmod 0666 /var/log/php-fpm/www-php.error.log
fpmconfdir
fpmconfdir
#chown -R root:nginx /var/lib/php/session/
#chown -R root:nginx /var/lib/php/session/
chkconfig --levels 235 php-fpm on
chkconfig --levels 235 php-fpm on
#/etc/init.d/php-fpm restart 2>/dev/null
#/etc/init.d/php-fpm restart 2>/dev/null
# /etc/init.d/php-fpm force-quit
# /etc/init.d/php-fpm force-quit
/etc/init.d/php-fpm start
/etc/init.d/php-fpm start
if [[ `grep exclude /etc/yum.con
if [[ `grep exclude /etc/yum.conf