123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848 |
- #!/bin/bash
- export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- clear
- printf "
- #######################################################################
- # OneinStack for CentOS/RadHat 6+ Debian 7+ and Ubuntu 12+ #
- # For more information please visit https://oneinstack.com #
- #######################################################################
- "
- sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
- . ./versions.txt
- . ./options.conf
- . ./include/color.sh
- . ./include/check_os.sh
- . ./include/check_dir.sh
- . ./include/download.sh
- . ./include/get_char.sh
- [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
- mkdir -p $wwwroot_dir/default $wwwlogs_dir
- [ -d /data ] && chmod 755 /data
- if [ -e "/etc/ssh/sshd_config" ]; then
- [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && now_ssh_port=22 || now_ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'`
- while :; do echo
- read -p "Please input SSH port(Default: $now_ssh_port): " ssh_port
- [ -z "$ssh_port" ] && ssh_port=$now_ssh_port
- if [ $ssh_port -eq 22 >/dev/null 2>&1 -o $ssh_port -gt 1024 >/dev/null 2>&1 -a $ssh_port -lt 65535 >/dev/null 2>&1 ]; then
- break
- else
- echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}"
- fi
- done
- if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$ssh_port" != '22' ]; then
- sed -i "s@^#Port.*@&\nPort $ssh_port@" /etc/ssh/sshd_config
- elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ]; then
- sed -i "s@^Port.*@Port $ssh_port@" /etc/ssh/sshd_config
- fi
- fi
- while :; do echo
- read -p "Do you want to enable iptables? [y/n]: " iptables_yn
- if [[ ! $iptables_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install Web server? [y/n]: " web_yn
- if [[ ! $web_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- if [ "$web_yn" == 'y' ]; then
-
- while :; do echo
- echo 'Please select Nginx server:'
- echo -e "\t${CMSG}1${CEND}. Install Nginx"
- echo -e "\t${CMSG}2${CEND}. Install Tengine"
- echo -e "\t${CMSG}3${CEND}. Install OpenResty"
- echo -e "\t${CMSG}4${CEND}. Do not install"
- read -p "Please input a number:(Default 1 press Enter) " nginx_ver
- [ -z "$nginx_ver" ] && nginx_ver=1
- if [[ ! $nginx_ver =~ ^[1-4]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~4${CEND}"
- else
- [ "$nginx_ver" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; nginx_ver=Other; }
- [ "$nginx_ver" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; nginx_ver=Other; }
- [ "$nginx_ver" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; nginx_ver=Other; }
- break
- fi
- done
-
- while :; do echo
- echo 'Please select Apache server:'
- echo -e "\t${CMSG}1${CEND}. Install Apache-2.4"
- echo -e "\t${CMSG}2${CEND}. Install Apache-2.2"
- echo -e "\t${CMSG}3${CEND}. Do not install"
- read -p "Please input a number:(Default 3 press Enter) " apache_ver
- [ -z "$apache_ver" ] && apache_ver=3
- if [[ ! $apache_ver =~ ^[1-3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~3${CEND}"
- else
- [ "$apache_ver" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; apache_ver=Other; }
- break
- fi
- done
-
- while :; do echo
- echo 'Please select tomcat server:'
- echo -e "\t${CMSG}1${CEND}. Install Tomcat-8"
- echo -e "\t${CMSG}2${CEND}. Install Tomcat-7"
- echo -e "\t${CMSG}3${CEND}. Install Tomcat-6"
- echo -e "\t${CMSG}4${CEND}. Do not install"
- read -p "Please input a number:(Default 4 press Enter) " tomcat_ver
- [ -z "$tomcat_ver" ] && tomcat_ver=4
- if [[ ! $tomcat_ver =~ ^[1-4]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~4${CEND}"
- else
- [ "$tomcat_ver" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; tomcat_ver=Other; }
- if [ "$tomcat_ver" == '1' ]; then
- while :; do echo
- echo 'Please select JDK version:'
- echo -e "\t${CMSG}1${CEND}. Install JDK-1.8"
- echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
- read -p "Please input a number:(Default 2 press Enter) " jdk_version
- [ -z "$jdk_version" ] && jdk_version=2
- if [[ ! $jdk_version =~ ^[1-2]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~2${CEND}"
- else
- break
- fi
- done
- elif [ "$tomcat_ver" == '2' ]; then
- while :; do echo
- echo 'Please select JDK version:'
- echo -e "\t${CMSG}1${CEND}. Install JDK-1.8"
- echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
- echo -e "\t${CMSG}3${CEND}. Install JDK-1.6"
- read -p "Please input a number:(Default 2 press Enter) " jdk_version
- [ -z "$jdk_version" ] && jdk_version=2
- if [[ ! $jdk_version =~ ^[1-3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~3${CEND}"
- else
- break
- fi
- done
- elif [ "$tomcat_ver" == '3' ]; then
- while :; do echo
- echo 'Please select JDK version:'
- echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
- echo -e "\t${CMSG}3${CEND}. Install JDK-1.6"
- read -p "Please input a number:(Default 2 press Enter) " jdk_version
- [ -z "$jdk_version" ] && jdk_version=2
- if [[ ! $jdk_version =~ ^[2-3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 2~3${CEND}"
- else
- break
- fi
- done
- fi
- break
- fi
- done
- fi
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install Database? [y/n]: " db_yn
- if [[ ! $db_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- if [ "$db_yn" == 'y' ]; then
- [ -d "$db_install_dir/support-files" -a -e "${pgsql_install_dir}/bin/psql" -a -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}Database already installed! ${CEND}"; db_yn=Other; break; }
- while :; do echo
- echo 'Please select a version of the Database:'
- echo -e "\t${CMSG} 1${CEND}. Install MySQL-5.7"
- echo -e "\t${CMSG} 2${CEND}. Install MySQL-5.6"
- echo -e "\t${CMSG} 3${CEND}. Install MySQL-5.5"
- echo -e "\t${CMSG} 4${CEND}. Install MariaDB-10.2"
- echo -e "\t${CMSG} 5${CEND}. Install MariaDB-10.1"
- echo -e "\t${CMSG} 6${CEND}. Install MariaDB-10.0"
- echo -e "\t${CMSG} 7${CEND}. Install MariaDB-5.5"
- echo -e "\t${CMSG} 8${CEND}. Install Percona-5.7"
- echo -e "\t${CMSG} 9${CEND}. Install Percona-5.6"
- echo -e "\t${CMSG}10${CEND}. Install Percona-5.5"
- echo -e "\t${CMSG}11${CEND}. Install AliSQL-5.6"
- echo -e "\t${CMSG}12${CEND}. Install PostgreSQL"
- echo -e "\t${CMSG}13${CEND}. Install MongoDB"
- read -p "Please input a number:(Default 2 press Enter) " db_ver
- [ -z "$db_ver" ] && db_ver=2
- [ "$db_ver" == '13' -a "$OS_BIT" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
- if [[ "${db_ver}" =~ ^[1-9]$|^1[0-3]$ ]]; then
- while :; do
- if [ "$db_ver" == '12' ]; then
- read -p "Please input the postgres password of database: " dbrootpwd
- else
- read -p "Please input the root password of database: " dbrootpwd
- fi
- [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
- if (( ${#dbrootpwd} >= 5 )); then
- if [ "$db_ver" == '12' ]; then
- sed -i "s+^dbpostgrespwd.*+dbpostgrespwd='$dbrootpwd'+" ./options.conf
- dbpostgrespwd="$dbrootpwd"
- elif [ "$db_ver" == '13' ]; then
- sed -i "s+^dbmongopwd.*+dbmongopwd='$dbrootpwd'+" ./options.conf
- dbmongopwd="$dbrootpwd"
- else
- sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf
- fi
- break
- else
- echo "${CWARNING}password least 5 characters! ${CEND}"
- fi
- done
-
- if [[ "${db_ver}" =~ ^[1-9]$|^10$ ]]; then
- while :; do echo
- echo "Please choose installation of the database:"
- echo -e "\t${CMSG}1${CEND}. Install database from binary package."
- echo -e "\t${CMSG}2${CEND}. Install database from source package."
- read -p "Please input a number:(Default 1 press Enter) " dbinstallmethod
- [ -z "$dbinstallmethod" ] && dbinstallmethod=1
- if [[ ! $dbinstallmethod =~ ^[1-2]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~2${CEND}"
- else
- break
- fi
- done
- fi
- break
- else
- echo "${CWARNING}input error! Please only input number 1~13${CEND}"
- fi
- done
- fi
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install PHP? [y/n]: " php_yn
- if [[ ! $php_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- if [ "$php_yn" == 'y' ]; then
- [ -e "$php_install_dir/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; php_yn=Other; break; }
- while :; do echo
- echo 'Please select a version of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install php-5.3"
- echo -e "\t${CMSG}2${CEND}. Install php-5.4"
- echo -e "\t${CMSG}3${CEND}. Install php-5.5"
- echo -e "\t${CMSG}4${CEND}. Install php-5.6"
- echo -e "\t${CMSG}5${CEND}. Install php-7.0"
- echo -e "\t${CMSG}6${CEND}. Install php-7.1"
- echo -e "\t${CMSG}7${CEND}. Install php-7.2"
- read -p "Please input a number:(Default 5 press Enter) " php_ver
- [ -z "$php_ver" ] && php_ver=5
- if [[ ! $php_ver =~ ^[1-7]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~7${CEND}"
- else
- while :; do echo
- read -p "Do you want to install opcode cache of the PHP? [y/n]: " php_cache_yn
- if [[ ! $php_cache_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- if [ "$php_cache_yn" == 'y' ]; then
- if [ $php_ver == 1 ]; then
- while :; do
- echo 'Please select a opcode cache of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
- echo -e "\t${CMSG}2${CEND}. Install XCache"
- echo -e "\t${CMSG}3${CEND}. Install APCU"
- echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9"
- read -p "Please input a number:(Default 1 press Enter) " php_cache
- [ -z "$php_cache" ] && php_cache=1
- if [[ ! $php_cache =~ ^[1-4]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~4${CEND}"
- else
- break
- fi
- done
- fi
- if [ $php_ver == 2 ]; then
- while :; do
- echo 'Please select a opcode cache of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
- echo -e "\t${CMSG}2${CEND}. Install XCache"
- echo -e "\t${CMSG}3${CEND}. Install APCU"
- echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev"
- read -p "Please input a number:(Default 1 press Enter) " php_cache
- [ -z "$php_cache" ] && php_cache=1
- if [[ ! $php_cache =~ ^[1-4]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~4${CEND}"
- else
- break
- fi
- done
- fi
- if [ $php_ver == 3 ]; then
- while :; do
- echo 'Please select a opcode cache of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
- echo -e "\t${CMSG}2${CEND}. Install XCache"
- echo -e "\t${CMSG}3${CEND}. Install APCU"
- read -p "Please input a number:(Default 1 press Enter) " php_cache
- [ -z "$php_cache" ] && php_cache=1
- if [[ ! $php_cache =~ ^[1-3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~3${CEND}"
- else
- break
- fi
- done
- fi
- if [ $php_ver == 4 ]; then
- while :; do
- echo 'Please select a opcode cache of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
- echo -e "\t${CMSG}2${CEND}. Install XCache"
- echo -e "\t${CMSG}3${CEND}. Install APCU"
- read -p "Please input a number:(Default 1 press Enter) " php_cache
- [ -z "$php_cache" ] && php_cache=1
- if [[ ! $php_cache =~ ^[1-3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~3${CEND}"
- else
- break
- fi
- done
- fi
- if [[ $php_ver =~ ^[5-6]$ ]]; then
- while :; do
- echo 'Please select a opcode cache of the PHP:'
- echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
- echo -e "\t${CMSG}3${CEND}. Install APCU"
- read -p "Please input a number:(Default 1 press Enter) " php_cache
- [ -z "$php_cache" ] && php_cache=1
- if [[ ! $php_cache =~ ^[1,3]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1,3${CEND}"
- else
- break
- fi
- done
- fi
- [ $php_ver == 7 ] && php_cache=1
- fi
- break
- fi
- done
- if [ "$php_cache" == '2' ]; then
- while :; do
- read -p "Please input xcache admin password: " xcache_admin_pass
- (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}"
- done
- fi
- if [[ $php_ver =~ ^[1-4]$ ]] && [ "$php_cache" != '1' -a "${armplatform}" != "y" ]; then
- while :; do echo
- read -p "Do you want to install ZendGuardLoader? [y/n]: " zendguardloader_yn
- if [[ ! $zendguardloader_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- fi
-
- if [ "${TARGET_ARCH}" != "arm64" ]; then
- while :; do echo
- read -p "Do you want to install ionCube? [y/n]: " ioncube_yn
- if [[ ! $ioncube_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- fi
-
- while :; do echo
- read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " magick_yn
- if [[ ! $magick_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- if [ "$magick_yn" == 'y' ]; then
- while :; do
- echo 'Please select ImageMagick or GraphicsMagick:'
- echo -e "\t${CMSG}1${CEND}. Install ImageMagick"
- echo -e "\t${CMSG}2${CEND}. Install GraphicsMagick"
- read -p "Please input a number:(Default 1 press Enter) " magick
- [ -z "$magick" ] && magick=1
- if [[ ! $magick =~ ^[1-2]$ ]]; then
- echo "${CWARNING}input error! Please only input number 1~2${CEND}"
- else
- break
- fi
- done
- fi
- break
- fi
- done
- fi
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install Pure-FTPd? [y/n]: " ftp_yn
- if [[ ! $ftp_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- [ "$ftp_yn" == 'y' -a -e "$pureftpd_install_dir/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; ftp_yn=Other; }
- break
- fi
- done
- if [[ $php_ver =~ ^[1-7]$ ]] || [ -e "$php_install_dir/bin/phpize" ]; then
- while :; do echo
- read -p "Do you want to install phpMyAdmin? [y/n]: " phpmyadmin_yn
- if [[ ! $phpmyadmin_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- [ "$phpmyadmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpmyadmin_yn=Other; }
- break
- fi
- done
- fi
- while :; do echo
- read -p "Do you want to install redis? [y/n]: " redis_yn
- if [[ ! $redis_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install memcached? [y/n]: " memcached_yn
- if [[ ! $memcached_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- while :; do echo
- read -p "Do you want to install HHVM? [y/n]: " hhvm_yn
- if [[ ! $hhvm_yn =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- if [ "$hhvm_yn" == 'y' ]; then
- [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; hhvm_yn=Other; break; }
- if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then
- break
- else
- echo
- echo "${CWARNING}HHVM only support CentOS6.5+ 64bit, CentOS7 64bit! ${CEND}"
- echo "Press Ctrl+c to cancel or Press any key to continue..."
- char=`get_char`
- hhvm_yn=Other
- fi
- fi
- break
- fi
- done
- IPADDR=`./include/get_ipaddr.py`
- PUBLIC_IPADDR=`./include/get_public_ipaddr.py`
- IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR`
- IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'`
- [ -e "/usr/local/bin/openssl" ] && rm -rf /usr/local/bin/openssl
- [ -e "/usr/local/include/openssl" ] && rm -rf /usr/local/include/openssl
- . ./include/check_sw.sh
- case "${OS}" in
- "CentOS")
- installDepsCentOS 2>&1 | tee ${oneinstack_dir}/install.log
- ;;
- "Debian")
- installDepsDebian 2>&1 | tee ${oneinstack_dir}/install.log
- ;;
- "Ubuntu")
- installDepsUbuntu 2>&1 | tee ${oneinstack_dir}/install.log
- ;;
- esac
- startTime=`date +%s`
- . ./include/memory.sh
- case "${OS}" in
- "CentOS")
- . include/init_CentOS.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
- [ -n "$(gcc --version | head -n1 | grep '4\.1\.')" ] && export CC="gcc44" CXX="g++44"
- ;;
- "Debian")
- . include/init_Debian.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- "Ubuntu")
- . include/init_Ubuntu.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- esac
- . ./include/check_download.sh
- downloadDepsSrc=1
- checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
- installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log
- if [[ $nginx_ver =~ ^[1-3]$ ]] || [ "$db_yn" == 'y' ]; then
- . include/jemalloc.sh
- Install_Jemalloc | tee -a $oneinstack_dir/install.log
- fi
- . ./include/openssl.sh
- if [[ $tomcat_ver =~ ^[1-3]$ ]] || [[ $apache_ver =~ ^[1-2]$ ]] || [[ $php_ver =~ ^[1-7]$ ]]; then
- Install_openSSL102 | tee -a $oneinstack_dir/install.log
- fi
- case "${db_ver}" in
- 1)
- if [ "${dbinstallmethod}" == "2" ]; then
- . include/boost.sh
- installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- . include/mysql-5.7.sh
- Install_MySQL57 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 2)
- . include/mysql-5.6.sh
- Install_MySQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/mysql-5.5.sh
- Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 4)
- if [ "${dbinstallmethod}" == "2" ]; then
- . include/boost.sh
- installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- . include/mariadb-10.2.sh
- Install_MariaDB102 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 5)
- if [ "${dbinstallmethod}" == "2" ]; then
- . include/boost.sh
- installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- . include/mariadb-10.1.sh
- Install_MariaDB101 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 6)
- . include/mariadb-10.0.sh
- Install_MariaDB100 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 7)
- . include/mariadb-5.5.sh
- Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 8)
- if [ "${dbinstallmethod}" == "2" ]; then
- . include/boost.sh
- installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- . include/percona-5.7.sh
- Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 9)
- . include/percona-5.6.sh
- Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 10)
- . include/percona-5.5.sh
- Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 11)
- . include/alisql-5.6.sh
- Install_AliSQL56 2>&1 | tee -a $oneinstack_dir/install.log
- ;;
- 12)
- . include/postgresql.sh
- Install_PostgreSQL 2>&1 | tee -a $oneinstack_dir/install.log
- ;;
- 13)
- . include/mongodb.sh
- Install_MongoDB 2>&1 | tee -a $oneinstack_dir/install.log
- ;;
- esac
- if [ "$apache_ver" == '1' ]; then
- . include/apache-2.4.sh
- Install_Apache24 2>&1 | tee -a $oneinstack_dir/install.log
- elif [ "$apache_ver" == '2' ]; then
- . include/apache-2.2.sh
- Install_Apache22 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- case "${php_ver}" in
- 1)
- . include/php-5.3.sh
- Install_PHP53 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 2)
- . include/php-5.4.sh
- Install_PHP54 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/php-5.5.sh
- Install_PHP55 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 4)
- . include/php-5.6.sh
- Install_PHP56 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 5)
- . include/php-7.0.sh
- Install_PHP70 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 6)
- . include/php-7.1.sh
- Install_PHP71 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 7)
- . include/php-7.2.sh
- Install_PHP72 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- esac
- if [ "${db_ver}" == '12' -a -e "${php_install_dir}/bin/phpize" ]; then
- . include/pecl_pgsql.sh
- Install_pecl-pgsql 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- if [ "${db_ver}" == '13' -a -e "${php_install_dir}/bin/phpize" ]; then
- . include/pecl_mongodb.sh
- Install_pecl-mongodb 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- if [ "$magick" == '1' ]; then
- . include/ImageMagick.sh
- [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick 2>&1 | tee -a $oneinstack_dir/install.log
- [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a $oneinstack_dir/install.log
- elif [ "$magick" == '2' ]; then
- . include/GraphicsMagick.sh
- [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick 2>&1 | tee -a $oneinstack_dir/install.log
- [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- if [ "$ioncube_yn" == 'y' ]; then
- . include/ioncube.sh
- Install_ionCube 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- case "${php_cache}" in
- 1)
- if [[ "${php_ver}" =~ ^[1,2]$ ]]; then
- . include/zendopcache.sh
- Install_ZendOPcache 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- ;;
- 2)
- . include/xcache.sh
- Install_XCache 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/apcu.sh
- Install_APCU 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 4)
- if [[ "${php_ver}" =~ ^[1,2]$ ]]; then
- . include/eaccelerator.sh
- Install_eAccelerator 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- ;;
- esac
- if [ "$zendguardloader_yn" == 'y' ]; then
- . include/ZendGuardLoader.sh
- Install_ZendGuardLoader 2>&1 | tee -a $oneinstack_dir/install.log
- fi
- case "${nginx_ver}" in
- 1)
- . include/nginx.sh
- Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 2)
- . include/tengine.sh
- Install_Tengine 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/openresty.sh
- Install_OpenResty 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- esac
- case "${jdk_version}" in
- 1)
- . include/jdk-1.8.sh
- Install-JDK18 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 2)
- . include/jdk-1.7.sh
- Install-JDK17 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/jdk-1.6.sh
- Install-JDK16 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- esac
- case "${tomcat_ver}" in
- 1)
- . include/tomcat-8.sh
- Install_Tomcat8 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 2)
- . include/tomcat-7.sh
- Install_Tomcat7 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- 3)
- . include/tomcat-6.sh
- Install_Tomcat6 2>&1 | tee -a ${oneinstack_dir}/install.log
- ;;
- esac
- if [ "${ftp_yn}" == 'y' ]; then
- . include/pureftpd.sh
- Install_PureFTPd 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- if [ "${phpmyadmin_yn}" == 'y' ]; then
- . include/phpmyadmin.sh
- Install_phpMyAdmin 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- if [ "${redis_yn}" == 'y' ]; then
- . include/redis.sh
- [ ! -d "${redis_install_dir}" ] && Install_redis-server 2>&1 | tee -a ${oneinstack_dir}/install.log
- [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/redis.so" ] && Install_php-redis 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- if [ "${memcached_yn}" == 'y' ]; then
- . include/memcached.sh
- [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
- [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcache.so" ] && Install_php-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
- [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcached.so" ] && Install_php-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- if [ ! -e "${wwwroot_dir}/default/index.html" -a "${web_yn}" == 'y' ]; then
- . include/demo.sh
- DEMO 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- . include/check_dir.sh
- if [ "${hhvm_yn}" == 'y' ]; then
- . include/hhvm_CentOS.sh
- Install_hhvm_CentOS 2>&1 | tee -a ${oneinstack_dir}/install.log
- fi
- [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
- [ -d "${db_install_dir}/support-files" -a -z "$(ps -ef | grep -v grep | grep mysql)" ] && /etc/init.d/mysqld start
- endTime=`date +%s`
- ((installTime=($endTime-$startTime)/60))
- echo "####################Congratulations########################"
- echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
- [ "${web_yn}" == 'y' -a "${nginx_ver}" != '4' -a "${apache_ver}" == '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
- [ "${web_yn}" == 'y' -a "${nginx_ver}" != '4' -a "${apache_ver}" != '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
- [ "${web_yn}" == 'y' -a "${nginx_ver}" == '4' -a "${apache_ver}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
- [[ "${tomcat_ver}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
- [[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
- [[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
- [[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
- [[ "${db_ver}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
- [ "${db_ver}" == '12' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
- [ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
- [ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
- [ "${db_ver}" == '12' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
- [ "${db_ver}" == '13' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
- [ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
- [ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
- [ "${db_ver}" == '13' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
- [ "${php_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}"
- [ "${php_cache}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
- [ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"
- [ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache user:")${CMSG}admin${CEND}"
- [ "${php_cache}" == '2' ] && echo "$(printf "%-32s" "xcache password:")${CMSG}${xcache_admin_pass}${CEND}"
- [ "${php_cache}" == '3' ] && echo "$(printf "%-32s" "APC Control Panel URL:")${CMSG}http://${IPADDR}/apc.php${CEND}"
- [ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator Control Panel URL:")${CMSG}http://${IPADDR}/control.php${CEND}"
- [ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator user:")${CMSG}admin${CEND}"
- [ "${php_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator password:")${CMSG}eAccelerator${CEND}"
- [ "${ftp_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Pure-FTPd install dir:")${CMSG}${pureftpd_install_dir}${CEND}"
- [ "${ftp_yn}" == 'y' ] && echo "$(printf "%-32s" "Create FTP virtual script:")${CMSG}./pureftpd_vhost.sh${CEND}"
- [ "${phpmyadmin_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "phpMyAdmin dir:")${CMSG}${wwwroot_dir}/default/phpMyAdmin${CEND}"
- [ "${phpmyadmin_yn}" == 'y' ] && echo "$(printf "%-32s" "phpMyAdmin Control Panel URL:")${CMSG}http://${IPADDR}/phpMyAdmin${CEND}"
- [ "${redis_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "redis install dir:")${CMSG}${redis_install_dir}${CEND}"
- [ "${memcached_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "memcached install dir:")${CMSG}${memcached_install_dir}${CEND}"
- [ "${web_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Index URL:")${CMSG}http://${IPADDR}/${CEND}"
- while :; do echo
- echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}"
- read -p "Do you want to restart OS ? [y/n]: " restart_yn
- if [[ ! "${restart_yn}" =~ ^[y,n]$ ]]; then
- echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
- else
- break
- fi
- done
- [ "${restart_yn}" == 'y' ] && reboot
|