Browse Source

Add MySQL8.0

lj2007331@gmail.com 7 years ago
parent
commit
27e88d6e01

+ 5 - 0
include/boost.sh

@@ -28,3 +28,8 @@ installBoost() {
   fi
   fi
   popd
   popd
 }
 }
+
+installBoostold() {
+  boost_ver=${boost_oldver}
+  installBoost
+}

+ 51 - 13
include/check_download.sh

@@ -104,7 +104,8 @@ checkDownload() {
   fi
   fi
 
 
   if [ "${db_yn}" == 'y' ]; then
   if [ "${db_yn}" == 'y' ]; then
-    if [[ "${db_option}" =~ ^[1,4,8]$ ]] && [ "${dbinstallmethod}" == "2" ]; then
+    if [[ "${db_option}" =~ ^[1,2,5,6,9]$ ]] && [ "${dbinstallmethod}" == "2" ]; then
+      [[ "${db_option}" =~ ^[2,5,6,9]$ ]] && boost_ver=${boost_oldver} 
       echo "Download boost..."
       echo "Download boost..."
       [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_ver}
       [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_ver}
       boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1}')_$(echo ${boost_ver} | awk -F. '{print $2}')_$(echo ${boost_ver} | awk -F. '{print $3}')
       boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1}')_$(echo ${boost_ver} | awk -F. '{print $2}')_$(echo ${boost_ver} | awk -F. '{print $3}')
@@ -113,6 +114,43 @@ checkDownload() {
 
 
     case "${db_option}" in
     case "${db_option}" in
       1)
       1)
+        # MySQL 8.0 
+        if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
+          DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0
+          DOWN_ADDR_MYSQL_BK=http://mirrors.huaweicloud.com/repository/toolkit/mysql/Downloads/MySQL-8.0
+          DOWN_ADDR_MYSQL_BK2=http://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0
+        else
+          DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-8.0
+          DOWN_ADDR_MYSQL_BK=http://mysql.he.net/Downloads/MySQL-8.0
+        fi
+
+        if [ "${dbinstallmethod}" == '1' ]; then
+          echo "Download MySQL 8.0 binary package..."
+          FILE_NAME=mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+        elif [ "${dbinstallmethod}" == '2' ]; then
+          echo "Download MySQL 8.0 source package..."
+          FILE_NAME=mysql-${mysql80_ver}.tar.gz
+        fi
+        # start download
+        src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME} && Download_src
+        src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 && Download_src
+        # verifying download
+        MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
+        [ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
+        tryDlCount=0
+        while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do
+          wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1
+          let "tryDlCount++"
+          [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
+        done
+        if [ "${tryDlCount}" == '6' ]; then
+          echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
+          kill -9 $$
+        else
+          echo "[${CMSG}${FILE_NAME}${CEND}] found."
+        fi
+        ;;
+      2)
         # MySQL 5.7
         # MySQL 5.7
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7
@@ -149,7 +187,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      2)
+      3)
         # MySQL 5.6
         # MySQL 5.6
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6
@@ -186,7 +224,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      3)
+      4)
         # MySQL 5.5
         # MySQL 5.5
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
         if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.5
           DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.5
@@ -224,7 +262,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      4)
+      5)
         # MariaDB 10.2
         # MariaDB 10.2
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.2 binary package..."
           echo "Download MariaDB 10.2 binary package..."
@@ -264,7 +302,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      5)
+      6)
         # MariaDB 10.1
         # MariaDB 10.1
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.1 binary package..."
           echo "Download MariaDB 10.1 binary package..."
@@ -304,7 +342,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      6)
+      7)
         # MariaDB 10.0
         # MariaDB 10.0
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.0 binary package..."
           echo "Download MariaDB 10.0 binary package..."
@@ -344,7 +382,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      7)
+      8)
         # MariaDB 5.5
         # MariaDB 5.5
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 5.5 binary package..."
           echo "Download MariaDB 5.5 binary package..."
@@ -384,7 +422,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      8)
+      9)
         # Precona 5.7
         # Precona 5.7
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.7 binary package..."
           echo "Download Percona 5.7 binary package..."
@@ -418,7 +456,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      9)
+      10)
         # Precona 5.6
         # Precona 5.6
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.6 binary package..."
           echo "Download Percona 5.6 binary package..."
@@ -453,7 +491,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      10)
+      11)
         # Percona 5.5
         # Percona 5.5
         if [ "${dbinstallmethod}" == '1' ]; then
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.5 binary package..."
           echo "Download Percona 5.5 binary package..."
@@ -488,7 +526,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      11)
+      12)
         # AliSQL 5.6
         # AliSQL 5.6
         DOWN_ADDR_ALISQL=$mirrorLink
         DOWN_ADDR_ALISQL=$mirrorLink
         echo "Download AliSQL 5.6 source package..."
         echo "Download AliSQL 5.6 source package..."
@@ -501,7 +539,7 @@ checkDownload() {
           [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${ALISQL_TAR_MD5}" ] && break || continue
           [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${ALISQL_TAR_MD5}" ] && break || continue
         done
         done
         ;;
         ;;
-      12)
+      13)
         # PostgreSQL
         # PostgreSQL
         echo "Download PostgreSQL source package..."
         echo "Download PostgreSQL source package..."
         FILE_NAME=postgresql-${pgsql_ver}.tar.gz
         FILE_NAME=postgresql-${pgsql_ver}.tar.gz
@@ -529,7 +567,7 @@ checkDownload() {
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
           echo "[${CMSG}${FILE_NAME}${CEND}] found."
         fi
         fi
         ;;
         ;;
-      13)
+      14)
         # MongoDB
         # MongoDB
         echo "Download MongoDB binary package..."
         echo "Download MongoDB binary package..."
         FILE_NAME=mongodb-linux-${SYS_BIT_b}-${mongodb_ver}.tgz
         FILE_NAME=mongodb-linux-${SYS_BIT_b}-${mongodb_ver}.tgz

+ 0 - 1
include/mariadb-10.0.sh

@@ -54,7 +54,6 @@ Install_MariaDB100() {
     fi
     fi
   else
   else
     rm -rf ${mariadb_install_dir}
     rm -rf ${mariadb_install_dir}
-    rm -rf mariadb-${mariadb100_ver}
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 0 - 1
include/mariadb-10.1.sh

@@ -54,7 +54,6 @@ Install_MariaDB101() {
     fi
     fi
   else
   else
     rm -rf ${mariadb_install_dir}
     rm -rf ${mariadb_install_dir}
-    rm -rf mariadb-${mariadb101_ver}
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 0 - 1
include/mariadb-10.2.sh

@@ -54,7 +54,6 @@ Install_MariaDB102() {
     fi
     fi
   else
   else
     rm -rf ${mariadb_install_dir}
     rm -rf ${mariadb_install_dir}
-    rm -rf mariadb-${mariadb102_ver}
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 0 - 1
include/mariadb-5.5.sh

@@ -56,7 +56,6 @@ Install_MariaDB55() {
     fi
     fi
   else
   else
     rm -rf ${mariadb_install_dir}
     rm -rf ${mariadb_install_dir}
-    rm -rf mariadb-${mariadb55_ver}
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 1 - 1
include/mongodb.sh

@@ -66,7 +66,7 @@ EOF
     echo "${CSUCCESS}MongoDB installed successfully! ${CEND}"
     echo "${CSUCCESS}MongoDB installed successfully! ${CEND}"
     rm -rf mongodb-linux-${SYS_BIT_b}-${mongodb_ver}
     rm -rf mongodb-linux-${SYS_BIT_b}-${mongodb_ver}
   else
   else
-    rm -rf ${mongo_install_dir} ${mongo_data_dir} mongodb-linux-${SYS_BIT_b}-${mongodb_ver}
+    rm -rf ${mongo_install_dir} ${mongo_data_dir}
     echo "${CFAILURE}MongoDB install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MongoDB install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 1 - 2
include/mysql-5.5.sh

@@ -56,7 +56,6 @@ Install_MySQL55() {
     fi
     fi
   else
   else
     rm -rf ${mysql_install_dir}
     rm -rf ${mysql_install_dir}
-    rm -rf mysql-${mysql55_ver}
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi
@@ -215,7 +214,7 @@ EOF
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
-  [ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
+  [ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 2
include/mysql-5.6.sh

@@ -54,7 +54,6 @@ Install_MySQL56() {
     fi
     fi
   else
   else
     rm -rf ${mysql_install_dir}
     rm -rf ${mysql_install_dir}
-    rm -rf mysql-${mysql56_ver}
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi
@@ -214,7 +213,7 @@ EOF
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
-  [ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
+  [ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 2
include/mysql-5.7.sh

@@ -54,7 +54,6 @@ Install_MySQL57() {
     fi
     fi
   else
   else
     rm -rf ${mysql_install_dir}
     rm -rf ${mysql_install_dir}
-    rm -rf mysql-${mysql57_ver}
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi
@@ -211,7 +210,7 @@ EOF
   ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
   ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
-  [ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
+  [ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 8 - 15
include/mysql-8.0.sh

@@ -19,7 +19,6 @@ Install_MySQL80() {
   if [ "${dbinstallmethod}" == "1" ]; then
   if [ "${dbinstallmethod}" == "1" ]; then
     tar xzf mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
     tar xzf mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
     mv mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
     mv mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
-    sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
   elif [ "${dbinstallmethod}" == "2" ]; then
   elif [ "${dbinstallmethod}" == "2" ]; then
     tar xzf mysql-${mysql80_ver}.tar.gz
     tar xzf mysql-${mysql80_ver}.tar.gz
@@ -37,14 +36,14 @@ Install_MySQL80() {
     -DENABLED_LOCAL_INFILE=1 \
     -DENABLED_LOCAL_INFILE=1 \
     -DDEFAULT_CHARSET=utf8mb4 \
     -DDEFAULT_CHARSET=utf8mb4 \
     -DDEFAULT_COLLATION=utf8mb4_general_ci \
     -DDEFAULT_COLLATION=utf8mb4_general_ci \
-    -DEXTRA_CHARSETS=all \
-    -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
+    -DEXTRA_CHARSETS=all
     make -j ${THREAD}
     make -j ${THREAD}
     make install
     make install
     popd
     popd
   fi
   fi
 
 
   if [ -d "${mysql_install_dir}/support-files" ]; then
   if [ -d "${mysql_install_dir}/support-files" ]; then
+    sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
     sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
     echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
     echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
     if [ "${dbinstallmethod}" == "1" ]; then
     if [ "${dbinstallmethod}" == "1" ]; then
@@ -54,7 +53,6 @@ Install_MySQL80() {
     fi
     fi
   else
   else
     rm -rf ${mysql_install_dir}
     rm -rf ${mysql_install_dir}
-    rm -rf mysql-${mysql80_ver}
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi
@@ -113,15 +111,11 @@ key_buffer_size = 4M
 
 
 thread_cache_size = 8
 thread_cache_size = 8
 
 
-query_cache_type = 1
-query_cache_size = 8M
-query_cache_limit = 2M
-
 ft_min_word_len = 4
 ft_min_word_len = 4
 
 
 log_bin = mysql-bin
 log_bin = mysql-bin
 binlog_format = mixed
 binlog_format = mixed
-expire_logs_days = 7
+binlog_expire_logs_seconds = 604800
 
 
 log_error = ${mysql_data_dir}/mysql-error.log
 log_error = ${mysql_data_dir}/mysql-error.log
 slow_query_log = 1
 slow_query_log = 1
@@ -173,7 +167,6 @@ EOF
   sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
-    sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
@@ -181,7 +174,6 @@ EOF
     sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
     sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
   elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
   elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
     sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
-    sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
@@ -189,7 +181,6 @@ EOF
     sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
     sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
   elif [ ${Mem} -gt 3500 ]; then
   elif [ ${Mem} -gt 3500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
     sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
-    sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
     sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
     sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
     sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
@@ -207,11 +198,13 @@ EOF
   [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
   [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   . /etc/profile
 
 
-  ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
-  ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
+  ${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "create user root@'127.0.0.1' identified by \"${dbrootpwd}\";"
+  ${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'127.0.0.1' with grant option;"
+  ${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'localhost' with grant option;"
+  ${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "alter user root@'localhost' identified by \"${dbrootpwd}\";"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
-  [ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
+  [ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 0 - 1
include/percona-5.5.sh

@@ -57,7 +57,6 @@ Install_Percona55() {
     fi
     fi
   else
   else
     rm -rf ${percona_install_dir}
     rm -rf ${percona_install_dir}
-    rm -rf percona-server-${percona55_ver}
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 0 - 1
include/percona-5.6.sh

@@ -56,7 +56,6 @@ Install_Percona56() {
     fi
     fi
   else
   else
     rm -rf ${percona_install_dir}
     rm -rf ${percona_install_dir}
-    rm -rf percona-server-${percona56_ver}
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 0 - 1
include/percona-5.7.sh

@@ -56,7 +56,6 @@ Install_Percona57() {
     fi
     fi
   else
   else
     rm -rf ${percona_install_dir}
     rm -rf ${percona_install_dir}
-    rm -rf percona-server-${percona57_ver}
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 1 - 1
include/postgresql.sh

@@ -42,7 +42,7 @@ Install_PostgreSQL() {
     echo "${CSUCCESS}PostgreSQL installed successfully! ${CEND}"
     echo "${CSUCCESS}PostgreSQL installed successfully! ${CEND}"
     rm -rf postgresql-${pgsql_ver}
     rm -rf postgresql-${pgsql_ver}
   else
   else
-    rm -rf ${pgsql_install_dir} ${pgsql_data_dir} postgresql-${pgsql_ver}
+    rm -rf ${pgsql_install_dir} ${pgsql_data_dir}
     echo "${CFAILURE}PostgreSQL install failed, Please contact the author! ${CEND}"
     echo "${CFAILURE}PostgreSQL install failed, Please contact the author! ${CEND}"
     kill -9 $$
     kill -9 $$
   fi
   fi

+ 42 - 39
include/upgrade_db.sh

@@ -12,18 +12,18 @@ Upgrade_DB() {
   pushd ${oneinstack_dir}/src > /dev/null
   pushd ${oneinstack_dir}/src > /dev/null
   [ ! -e "${db_install_dir}/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1
   [ ! -e "${db_install_dir}/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1
   OLD_db_ver_tmp=`${db_install_dir}/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'`
   OLD_db_ver_tmp=`${db_install_dir}/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'`
-  DB_tmp=`echo $OLD_db_ver_tmp | awk -F'-' '{print $2}'`
-  if [ "$DB_tmp" == 'MariaDB' ]; then
-    [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f
+  DB_tmp=`echo ${OLD_db_ver_tmp} | awk -F'-' '{print $2}'`
+  if [ "${DB_tmp}" == 'MariaDB' ]; then
+    [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f
     DB=MariaDB
     DB=MariaDB
-    OLD_db_ver=`echo $OLD_db_ver_tmp | awk -F'-' '{print $1}'`
-  elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ]; then
+    OLD_db_ver=`echo ${OLD_db_ver_tmp} | awk -F'-' '{print $1}'`
+  elif [ -n "${DB_tmp}" -a "${DB_tmp}" != 'MariaDB' ]; then
     DB=Percona
     DB=Percona
-    OLD_db_ver=$OLD_db_ver_tmp
+    OLD_db_ver=${OLD_db_ver_tmp}
   else
   else
-    [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads
+    [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads
     DB=MySQL
     DB=MySQL
-    OLD_db_ver=$OLD_db_ver_tmp
+    OLD_db_ver=${OLD_db_ver_tmp}
   fi
   fi
 
 
   #backup
   #backup
@@ -36,7 +36,7 @@ Upgrade_DB() {
       read -p "Please input the root password of database: " NEW_dbrootpwd
       read -p "Please input the root password of database: " NEW_dbrootpwd
       ${db_install_dir}/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
       ${db_install_dir}/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
       if [ $? -eq 0 ]; then
       if [ $? -eq 0 ]; then
-        dbrootpwd=$NEW_dbrootpwd
+        dbrootpwd=${NEW_dbrootpwd}
         sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf
         sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf
         break
         break
       else
       else
@@ -52,23 +52,23 @@ Upgrade_DB() {
 
 
   #upgrade
   #upgrade
   echo
   echo
-  echo "Current $DB Version: ${CMSG}$OLD_db_ver${CEND}"
+  echo "Current $DB Version: ${CMSG}${OLD_db_ver}${CEND}"
   while :; do echo
   while :; do echo
-    read -p "Please input upgrade $DB Version(example: $OLD_db_ver): " NEW_db_ver
-    if [ `echo $NEW_db_ver | awk -F. '{print $1"."$2}'` == `echo $OLD_db_ver | awk -F. '{print $1"."$2}'` ]; then
+    read -p "Please input upgrade $DB Version(example: ${OLD_db_ver}): " NEW_db_ver
+    if [ `echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'` == `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` ]; then
       if [ "$DB" == 'MariaDB' ]; then
       if [ "$DB" == 'MariaDB' ]; then
         DB_name=mariadb-${NEW_db_ver}-${GLIBC_FLAG}-${SYS_BIT_b}
         DB_name=mariadb-${NEW_db_ver}-${GLIBC_FLAG}-${SYS_BIT_b}
-        DB_URL=$DOWN_ADDR/mariadb-${NEW_db_ver}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/$DB_name.tar.gz
+        DB_URL=${DOWN_ADDR}/mariadb-${NEW_db_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/${DB_name}.tar.gz
       elif [ "$DB" == 'Percona' ]; then
       elif [ "$DB" == 'Percona' ]; then
-        DB_name=percona-server-$NEW_db_ver
-        DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz
+        DB_name=percona-server-${NEW_db_ver}
+        DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/${DB_name}.tar.gz
       elif [ "$DB" == 'MySQL' ]; then
       elif [ "$DB" == 'MySQL' ]; then
         DB_name=mysql-${NEW_db_ver}-linux-glibc2.12-${SYS_BIT_b}
         DB_name=mysql-${NEW_db_ver}-linux-glibc2.12-${SYS_BIT_b}
-        DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz
+        DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_name}.tar.gz
       fi
       fi
-        [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1
-        if [ -e "$DB_name.tar.gz" ]; then
-          echo "Download [${CMSG}$DB_name.tar.gz${CEND}] successfully! "
+        [ ! -e "${DB_name}.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1
+        if [ -e "${DB_name}.tar.gz" ]; then
+          echo "Download [${CMSG}${DB_name}.tar.gz${CEND}] successfully! "
         else
         else
           echo "${CWARNING}$DB version does not exist! ${CEND}"
           echo "${CWARNING}$DB version does not exist! ${CEND}"
         fi
         fi
@@ -78,8 +78,8 @@ Upgrade_DB() {
     fi
     fi
   done
   done
 
 
-  if [ -e "$DB_name.tar.gz" ]; then
-    echo "[${CMSG}$DB_name.tar.gz${CEND}] found"
+  if [ -e "${DB_name}.tar.gz" ]; then
+    echo "[${CMSG}${DB_name}.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
     char=`get_char`
     if [ "$DB" == 'MariaDB' ]; then
     if [ "$DB" == 'MariaDB' ]; then
@@ -87,7 +87,7 @@ Upgrade_DB() {
       mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir}
       mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir}
-      tar xzf $DB_name.tar.gz
+      tar xzf ${DB_name}.tar.gz
       [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
       [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
       mv mariadb-${NEW_db_ver}-*-${SYS_BIT_b}/* ${mariadb_install_dir}
       mv mariadb-${NEW_db_ver}-*-${SYS_BIT_b}/* ${mariadb_install_dir}
       sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
       sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
@@ -98,12 +98,12 @@ Upgrade_DB() {
       service mysqld restart
       service mysqld restart
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
-      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_db_ver${CEND} to ${CMSG}$NEW_db_ver${CEND}"
+      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
     elif [ "$DB" == 'Percona' ]; then
     elif [ "$DB" == 'Percona' ]; then
-      tar xzf $DB_name.tar.gz
-      pushd $DB_name
+      tar xzf ${DB_name}.tar.gz
+      pushd ${DB_name}
       make clean
       make clean
-      if [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.5' ]; then
+      if [ "`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`" == '5.5' ]; then
         cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
         cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
         -DMYSQL_DATADIR=${percona_data_dir} \
         -DMYSQL_DATADIR=${percona_data_dir} \
         -DSYSCONFDIR=/etc \
         -DSYSCONFDIR=/etc \
@@ -143,7 +143,7 @@ Upgrade_DB() {
       mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir}
       mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir}
       make install
       make install
       popd
       popd
-      if [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.7' ]; then
+      if [ "`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`" == '5.7' ]; then
         ${percona_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
         ${percona_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
       else
       else
         ${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
         ${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
@@ -154,28 +154,31 @@ Upgrade_DB() {
       service mysqld restart
       service mysqld restart
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
-      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_db_ver${CEND} to ${CMSG}$NEW_db_ver${CEND}"
+      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
     elif [ "$DB" == 'MySQL' ]; then
     elif [ "$DB" == 'MySQL' ]; then
-      tar xzf $DB_name.tar.gz
+      tar xzf ${DB_name}.tar.gz
       service mysqld stop
       service mysqld stop
       mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
-      [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir
+      [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
       mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
       mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
-      mv $DB_name/* $mysql_install_dir/
-      sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe
+      mv ${DB_name}/* ${mysql_install_dir}/
+      sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
       sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
       sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
-      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=${mysql_data_dir}
-      [ "`echo $NEW_db_ver | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=${mysql_data_dir}
+      if [[ "`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`" =~ ^5.[5-6]$ ]]; then
+        ${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
+      else
+        ${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
+      fi
 
 
       chown mysql.mysql -R ${mysql_data_dir}
       chown mysql.mysql -R ${mysql_data_dir}
-      [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
+      [ -e "${mysql_install_dir}/my.cnf" ] && rm -rf ${mysql_install_dir}/my.cnf
       service mysqld start
       service mysqld start
-      $mysql_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
+      ${mysql_install_dir}/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
       service mysqld restart
       service mysqld restart
-      $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
-      $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
-      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_db_ver${CEND} to ${CMSG}$NEW_db_ver${CEND}"
+      ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
+      ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
+      [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
     fi
     fi
   fi
   fi
 }
 }

+ 72 - 62
install.sh

@@ -39,13 +39,13 @@ dbinstallmethod=1
 
 
 version() {
 version() {
   echo "version: 1.7"
   echo "version: 1.7"
-  echo "updated date: 2018-04-02"
+  echo "updated date: 2018-04-20"
 }
 }
 
 
 showhelp() {
 showhelp() {
   version
   version
   echo "Usage: $0  command ...[parameters]....
   echo "Usage: $0  command ...[parameters]....
-  --help, -h                  Show this help message, More: https://oneinstack.com/autoinstall
+  --help, -h                  Show this help message, More: https://oneinstack.com/auto
   --version, -v               Show version info
   --version, -v               Show version info
   --nginx_option [1-3]        Install Nginx server version
   --nginx_option [1-3]        Install Nginx server version
   --apache_option [1-2]       Install Apache server version
   --apache_option [1-2]       Install Apache server version
@@ -54,7 +54,7 @@ showhelp() {
   --php_extensions [ext name] Install PHP extension, include zendguardloader,ioncube,imagick,gmagick
   --php_extensions [ext name] Install PHP extension, include zendguardloader,ioncube,imagick,gmagick
   --tomcat_option [1-4]       Install Tomcat version
   --tomcat_option [1-4]       Install Tomcat version
   --jdk_option [1-4]          Install JDK version
   --jdk_option [1-4]          Install JDK version
-  --db_option [1-13]          Install DB version
+  --db_option [1-14]          Install DB version
   --dbinstallmethod [1-2]     DB install method, default: 1 binary install
   --dbinstallmethod [1-2]     DB install method, default: 1 binary install
   --dbrootpwd [password]      DB super password
   --dbrootpwd [password]      DB super password
   --pureftpd                  Install Pure-Ftpd
   --pureftpd                  Install Pure-Ftpd
@@ -124,14 +124,14 @@ while :; do
     --db_option)
     --db_option)
       db_option=$2; shift 2
       db_option=$2; shift 2
       db_yn=y
       db_yn=y
-      if [[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]]; then
+      if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
         [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; }
         [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; }
-      elif [ "${db_option}" == '12' ]; then
-        [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; }
       elif [ "${db_option}" == '13' ]; then
       elif [ "${db_option}" == '13' ]; then
+        [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; }
+      elif [ "${db_option}" == '14' ]; then
         [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; }
         [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; }
       else
       else
-        echo "${CWARNING}db_option input error! Please only input number 1~13${CEND}"
+        echo "${CWARNING}db_option input error! Please only input number 1~14${CEND}"
         exit 1
         exit 1
       fi
       fi
       ;;
       ;;
@@ -342,35 +342,36 @@ if [ ${ARG_NUM} == 0 ]; then
       if [ "${db_yn}" == 'y' ]; then
       if [ "${db_yn}" == 'y' ]; then
         while :; do echo
         while :; do echo
           echo 'Please select a version of the Database:'
           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"
+          echo -e "\t${CMSG} 1${CEND}. Install MySQL-8.0"
+          echo -e "\t${CMSG} 2${CEND}. Install MySQL-5.7"
+          echo -e "\t${CMSG} 3${CEND}. Install MySQL-5.6"
+          echo -e "\t${CMSG} 4${CEND}. Install MySQL-5.5"
+          echo -e "\t${CMSG} 5${CEND}. Install MariaDB-10.2"
+          echo -e "\t${CMSG} 6${CEND}. Install MariaDB-10.1"
+          echo -e "\t${CMSG} 7${CEND}. Install MariaDB-10.0"
+          echo -e "\t${CMSG} 8${CEND}. Install MariaDB-5.5"
+          echo -e "\t${CMSG} 9${CEND}. Install Percona-5.7"
+          echo -e "\t${CMSG}10${CEND}. Install Percona-5.6"
+          echo -e "\t${CMSG}11${CEND}. Install Percona-5.5"
+          echo -e "\t${CMSG}12${CEND}. Install AliSQL-5.6"
+          echo -e "\t${CMSG}13${CEND}. Install PostgreSQL"
+          echo -e "\t${CMSG}14${CEND}. Install MongoDB"
           read -p "Please input a number:(Default 2 press Enter) " db_option
           read -p "Please input a number:(Default 2 press Enter) " db_option
           [ -z "${db_option}" ] && db_option=2
           [ -z "${db_option}" ] && db_option=2
-          [ "${db_option}" == '13' -a "$OS_BIT" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
-          if [[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]]; then
-            if [ "${db_option}" == '12' ]; then
+          [ "${db_option}" == '14' -a "${OS_BIT}" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
+          if [[ "${db_option}" =~ ^[1-9]$|^1[0-4]$ ]]; then
+            if [ "${db_option}" == '13' ]; then
               [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; break; }
               [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; break; }
-            elif [ "${db_option}" == '13' ]; then
+            elif [ "${db_option}" == '14' ]; then
               [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; break; }
               [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; break; }
             else
             else
               [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; break; }
               [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; break; }
             fi
             fi
             while :; do
             while :; do
-              if [ "${db_option}" == '12' ]; then
+              if [ "${db_option}" == '13' ]; then
                 read -p "Please input the postgres password of PostgreSQL(default: ${dbpostgrespwd}): " dbpwd
                 read -p "Please input the postgres password of PostgreSQL(default: ${dbpostgrespwd}): " dbpwd
                 [ -z "${dbpwd}" ] && dbpwd=${dbpostgrespwd}
                 [ -z "${dbpwd}" ] && dbpwd=${dbpostgrespwd}
-              elif [ "${db_option}" == '13' ]; then
+              elif [ "${db_option}" == '14' ]; then
                 read -p "Please input the root password of MongoDB(default: ${dbmongopwd}): " dbpwd
                 read -p "Please input the root password of MongoDB(default: ${dbmongopwd}): " dbpwd
                 [ -z "${dbpwd}" ] && dbpwd=${dbmongopwd}
                 [ -z "${dbpwd}" ] && dbpwd=${dbmongopwd}
               else
               else
@@ -379,9 +380,9 @@ if [ ${ARG_NUM} == 0 ]; then
               fi
               fi
               [ -n "`echo ${dbpwd} | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
               [ -n "`echo ${dbpwd} | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
               if (( ${#dbpwd} >= 5 )); then
               if (( ${#dbpwd} >= 5 )); then
-                if [ "${db_option}" == '12' ]; then
+                if [ "${db_option}" == '13' ]; then
                   dbpostgrespwd=${dbpwd}
                   dbpostgrespwd=${dbpwd}
-                elif [ "${db_option}" == '13' ]; then
+                elif [ "${db_option}" == '14' ]; then
                   dbmongopwd=${dbpwd}
                   dbmongopwd=${dbpwd}
                 else
                 else
                   dbrootpwd=${dbpwd}
                   dbrootpwd=${dbpwd}
@@ -392,7 +393,7 @@ if [ ${ARG_NUM} == 0 ]; then
               fi
               fi
             done
             done
             # choose install methods
             # choose install methods
-            if [[ "${db_option}" =~ ^[1-9]$|^10$ ]]; then
+            if [[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]]; then
               while :; do echo
               while :; do echo
                 echo "Please choose installation of the database:"
                 echo "Please choose installation of the database:"
                 echo -e "\t${CMSG}1${CEND}. Install database from binary package."
                 echo -e "\t${CMSG}1${CEND}. Install database from binary package."
@@ -408,7 +409,7 @@ if [ ${ARG_NUM} == 0 ]; then
             fi
             fi
             break
             break
           else
           else
-            echo "${CWARNING}input error! Please only input number 1~13${CEND}"
+            echo "${CWARNING}input error! Please only input number 1~14${CEND}"
           fi
           fi
         done
         done
       fi
       fi
@@ -637,7 +638,7 @@ if [ ${ARG_NUM} == 0 ]; then
     else
     else
       if [ "${hhvm_yn}" == 'y' ]; then
       if [ "${hhvm_yn}" == 'y' ]; then
         [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; hhvm_yn=Other; break; }
         [ -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
+        if [ "${OS}" == 'CentOS' -a "${OS_BIT}" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then
           break
           break
         else
         else
           echo
           echo
@@ -661,7 +662,7 @@ IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'`
 # Check download source packages
 # Check download source packages
 . ./include/check_download.sh
 . ./include/check_download.sh
 downloadDepsSrc=1
 downloadDepsSrc=1
-[ "$OS" == 'CentOS' ] && yum -y -q install wget
+[ "${OS}" == 'CentOS' ] && yum -y -q install wget
 [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] &&  apt -y -q install wget
 [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] &&  apt -y -q install wget
 checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
 checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
 
 
@@ -712,70 +713,79 @@ fi
 # Database
 # Database
 case "${db_option}" in
 case "${db_option}" in
   1)
   1)
+    [ "${OS}" == 'CentOS' -a ${CentOS_ver} != '7' ] && dbinstallmethod=1
     if [ "${dbinstallmethod}" == "2" ]; then
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       . include/boost.sh
       installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
       installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
     fi
+    . include/mysql-8.0.sh
+    Install_MySQL80 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
+  2)
+    if [ "${dbinstallmethod}" == "2" ]; then
+      . include/boost.sh
+      installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
+    fi
     . include/mysql-5.7.sh
     . include/mysql-5.7.sh
     Install_MySQL57 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MySQL57 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  2)
+  3)
     . include/mysql-5.6.sh
     . include/mysql-5.6.sh
     Install_MySQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MySQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  3)
+  4)
     . include/mysql-5.5.sh
     . include/mysql-5.5.sh
     Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  4)
+  5)
     if [ "${dbinstallmethod}" == "2" ]; then
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       . include/boost.sh
-      installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
+      installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
     fi
     . include/mariadb-10.2.sh
     . include/mariadb-10.2.sh
     Install_MariaDB102 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MariaDB102 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  5)
+  6)
     if [ "${dbinstallmethod}" == "2" ]; then
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       . include/boost.sh
-      installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
+      installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
     fi
     . include/mariadb-10.1.sh
     . include/mariadb-10.1.sh
     Install_MariaDB101 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MariaDB101 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  6)
+  7)
     . include/mariadb-10.0.sh
     . include/mariadb-10.0.sh
     Install_MariaDB100 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MariaDB100 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  7)
+  8)
     . include/mariadb-5.5.sh
     . include/mariadb-5.5.sh
     Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  8)
+  9)
     if [ "${dbinstallmethod}" == "2" ]; then
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       . include/boost.sh
-      installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log
+      installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
     fi
     fi
     . include/percona-5.7.sh
     . include/percona-5.7.sh
     Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  9)
+  10)
     . include/percona-5.6.sh
     . include/percona-5.6.sh
     Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  10)
+  11)
     . include/percona-5.5.sh
     . include/percona-5.5.sh
     Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  11)
+  12)
     . include/alisql-5.6.sh
     . include/alisql-5.6.sh
     Install_AliSQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_AliSQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  12)
+  13)
     . include/postgresql.sh
     . include/postgresql.sh
     Install_PostgreSQL 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_PostgreSQL 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
-  13)
+  14)
     . include/mongodb.sh
     . include/mongodb.sh
     Install_MongoDB 2>&1 | tee -a ${oneinstack_dir}/install.log
     Install_MongoDB 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
     ;;
@@ -823,13 +833,13 @@ case "${php_option}" in
 esac
 esac
 
 
 # pecl_pgsql
 # pecl_pgsql
-if [ "${db_option}" == '12' -a -e "${php_install_dir}/bin/phpize" ]; then
+if [ "${db_option}" == '13' -a -e "${php_install_dir}/bin/phpize" ]; then
   . include/pecl_pgsql.sh
   . include/pecl_pgsql.sh
   Install_pecl-pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
   Install_pecl-pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 fi
 
 
 # pecl_mongodb
 # pecl_mongodb
-if [ "${db_option}" == '13' -a -e "${php_install_dir}/bin/phpize" ]; then
+if [ "${db_option}" == '14' -a -e "${php_install_dir}/bin/phpize" ]; then
   . include/pecl_mongodb.sh
   . include/pecl_mongodb.sh
   Install_pecl-mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
   Install_pecl-mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 fi
@@ -973,7 +983,7 @@ fi
 . include/check_dir.sh
 . include/check_dir.sh
 
 
 # HHVM
 # HHVM
-if [ "${hhvm_yn}" == 'y' ] && [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then
+if [ "${hhvm_yn}" == 'y' ] && [ "${OS}" == 'CentOS' -a "${OS_BIT}" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then
   . include/hhvm_CentOS.sh
   . include/hhvm_CentOS.sh
   Install_hhvm_CentOS 2>&1 | tee -a ${oneinstack_dir}/install.log
   Install_hhvm_CentOS 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 fi
@@ -988,18 +998,18 @@ echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
 [ "${web_yn}" == 'y' ] && [[ "${nginx_option}" =~ ^[1-3]$ ]] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
 [ "${web_yn}" == 'y' ] && [[ "${nginx_option}" =~ ^[1-3]$ ]] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
 [ "${web_yn}" == 'y' ] && [[ "${apache_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
 [ "${web_yn}" == 'y' ] && [[ "${apache_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
 [[ "${tomcat_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
 [[ "${tomcat_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
-[ "${db_option}" == '12' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
-[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
-[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
-[ "${db_option}" == '12' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
-[ "${db_option}" == '13' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
+[ "${db_option}" == '13' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
+[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
+[ "${db_option}" == '14' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
+[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
+[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
+[ "${db_option}" == '14' ] && 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_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}"
 [ "${php_yn}" == 'y' -a "${phpcache_option}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
 [ "${php_yn}" == 'y' -a "${phpcache_option}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
 [ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"
 [ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"

+ 12 - 24
uninstall.sh

@@ -80,17 +80,16 @@ Print_web() {
 }
 }
 
 
 Uninstall_Web() {
 Uninstall_Web() {
-  [ -d "${nginx_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${nginx_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${nginx_install_dir}/sbin:@@" /etc/profile; }
-  [ -d "${tengine_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${tengine_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${tengine_install_dir}/sbin:@@" /etc/profile; }
-  [ -d "${openresty_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${openresty_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${openresty_install_dir}/nginx/sbin:@@" /etc/profile; }
-  [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; }
-  [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; }
+  [ -d "${nginx_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${nginx_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${nginx_install_dir}/sbin:@@" /etc/profile; echo "${CMSG}Nginx uninstall completed! ${CEND}"; }
+  [ -d "${tengine_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${tengine_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${tengine_install_dir}/sbin:@@" /etc/profile; echo "${CMSG}Tengine uninstall completed! ${CEND}"; }
+  [ -d "${openresty_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${openresty_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${openresty_install_dir}/nginx/sbin:@@" /etc/profile; echo "${CMSG}OpenResty uninstall completed! ${CEND}"; }
+  [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; echo "${CMSG}Apache uninstall completed! ${CEND}"; }
+  [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; echo "${CMSG}Tomcat uninstall completed! ${CEND}"; }
   [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; }
   [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; }
   [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)}
   [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)}
   sed -i 's@^website_name=.*@website_name=@' ./options.conf
   sed -i 's@^website_name=.*@website_name=@' ./options.conf
   sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf
   sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf
   sed -i 's@^remote_bankup_yn=.*@remote_bankup_yn=n@' ./options.conf
   sed -i 's@^remote_bankup_yn=.*@remote_bankup_yn=n@' ./options.conf
-  echo "${CMSG}Web uninstall completed! ${CEND}"
 }
 }
 
 
 Print_MySQL() {
 Print_MySQL() {
@@ -120,8 +119,6 @@ Uninstall_MySQL() {
     sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf
     sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf
     sed -i "s@${db_install_dir}/bin:@@" /etc/profile
     sed -i "s@${db_install_dir}/bin:@@" /etc/profile
     echo "${CMSG}MySQL uninstall completed! ${CEND}"
     echo "${CMSG}MySQL uninstall completed! ${CEND}"
-  else
-    echo "${CWARNING}MySQL already uninstalled! ${CEND}"
   fi
   fi
 }
 }
 
 
@@ -136,8 +133,6 @@ Uninstall_PostgreSQL() {
     sed -i 's@^dbpostgrespwd=.*@dbpostgrespwd=@' ./options.conf
     sed -i 's@^dbpostgrespwd=.*@dbpostgrespwd=@' ./options.conf
     sed -i "s@${pgsql_install_dir}/bin:@@" /etc/profile
     sed -i "s@${pgsql_install_dir}/bin:@@" /etc/profile
     echo "${CMSG}PostgreSQL uninstall completed! ${CEND}"
     echo "${CMSG}PostgreSQL uninstall completed! ${CEND}"
-  else
-    echo "${CWARNING}PostgreSQL already uninstalled! ${CEND}"
   fi
   fi
 }
 }
 
 
@@ -153,8 +148,6 @@ Uninstall_MongoDB() {
     sed -i 's@^dbmongopwd=.*@dbmongopwd=@' ./options.conf
     sed -i 's@^dbmongopwd=.*@dbmongopwd=@' ./options.conf
     sed -i "s@${mongo_install_dir}/bin:@@" /etc/profile
     sed -i "s@${mongo_install_dir}/bin:@@" /etc/profile
     echo "${CMSG}MongoDB uninstall completed! ${CEND}"
     echo "${CMSG}MongoDB uninstall completed! ${CEND}"
-  else
-    echo "${CWARNING}MongoDB already uninstalled! ${CEND}"
   fi
   fi
 }
 }
 
 
@@ -167,13 +160,12 @@ Print_PHP() {
 }
 }
 
 
 Uninstall_PHP() {
 Uninstall_PHP() {
-  [ -e "${php_install_dir}/bin/phpize" -a -e "${php_install_dir}/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf ${php_install_dir} /etc/init.d/php-fpm; }
-  [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && rm -rf ${php_install_dir}
+  [ -e "${php_install_dir}/bin/phpize" -a -e "${php_install_dir}/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf ${php_install_dir} /etc/init.d/php-fpm; echo "${CMSG}PHP uninstall completed! ${CEND}"; }
+  [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && { rm -rf ${php_install_dir}; echo "${CMSG}PHP uninstall completed! ${CEND}"; }
   [ -e "${imagick_install_dir}" ] && rm -rf ${imagick_install_dir}
   [ -e "${imagick_install_dir}" ] && rm -rf ${imagick_install_dir}
   [ -e "${gmagick_install_dir}" ] && rm -rf ${gmagick_install_dir}
   [ -e "${gmagick_install_dir}" ] && rm -rf ${gmagick_install_dir}
   [ -e "${curl_install_dir}" ] && rm -rf "${curl_install_dir}"
   [ -e "${curl_install_dir}" ] && rm -rf "${curl_install_dir}"
   sed -i "s@${php_install_dir}/bin:@@" /etc/profile
   sed -i "s@${php_install_dir}/bin:@@" /etc/profile
-  echo "${CMSG}PHP uninstall completed! ${CEND}"
 }
 }
 
 
 Print_HHVM() {
 Print_HHVM() {
@@ -186,8 +178,7 @@ Print_HHVM() {
 
 
 Uninstall_HHVM() {
 Uninstall_HHVM() {
   [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; }
   [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; }
-  [ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; }
-  echo "${CMSG}HHVM uninstall completed! ${CEND}"
+  [ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; echo "${CMSG}HHVM uninstall completed! ${CEND}"; }
 }
 }
 
 
 Print_PureFtpd() {
 Print_PureFtpd() {
@@ -196,8 +187,7 @@ Print_PureFtpd() {
 }
 }
 
 
 Uninstall_PureFtpd() {
 Uninstall_PureFtpd() {
-  [ -e "${pureftpd_install_dir}" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf ${pureftpd_install_dir} /etc/init.d/pureftpd; }
-  echo "${CMSG}Pureftpd uninstall completed! ${CEND}"
+  [ -e "${pureftpd_install_dir}" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf ${pureftpd_install_dir} /etc/init.d/pureftpd; echo "${CMSG}Pureftpd uninstall completed! ${CEND}"; }
 }
 }
 
 
 Print_Redis() {
 Print_Redis() {
@@ -206,9 +196,8 @@ Print_Redis() {
 }
 }
 
 
 Uninstall_Redis() {
 Uninstall_Redis() {
-  [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; }
-  [ -e "${php_install_dir}/etc/php.d/05-redis.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-redis.ini
-  echo "${CMSG}Redis uninstall completed! ${CEND}"
+  [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; echo "${CMSG}Redis uninstall completed! ${CEND}"; }
+  [ -e "${php_install_dir}/etc/php.d/05-redis.ini" ] && { rm -rf ${php_install_dir}/etc/php.d/05-redis.ini; echo "${CMSG}Pecl_redis uninstall completed! ${CEND}"; }
 }
 }
 
 
 Print_Memcached() {
 Print_Memcached() {
@@ -218,10 +207,9 @@ Print_Memcached() {
 }
 }
 
 
 Uninstall_Memcached() {
 Uninstall_Memcached() {
-  [ -e "${memcached_install_dir}" ] && { service memcached stop > /dev/null 2>&1; rm -rf ${memcached_install_dir} /etc/init.d/memcached /usr/bin/memcached; }
+  [ -e "${memcached_install_dir}" ] && { service memcached stop > /dev/null 2>&1; rm -rf ${memcached_install_dir} /etc/init.d/memcached /usr/bin/memcached; echo "${CMSG}Memcached uninstall completed! ${CEND}"; }
   [ -e "${php_install_dir}/etc/php.d/05-memcache.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcache.ini
   [ -e "${php_install_dir}/etc/php.d/05-memcache.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcache.ini
   [ -e "${php_install_dir}/etc/php.d/05-memcached.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcached.ini
   [ -e "${php_install_dir}/etc/php.d/05-memcached.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcached.ini
-  echo "${CMSG}Memcached uninstall completed! ${CEND}"
 }
 }
 
 
 Print_openssl() {
 Print_openssl() {

+ 2 - 1
versions.txt

@@ -100,7 +100,8 @@ phpmyadmin_oldver=4.4.15.10
 jemalloc_ver=5.0.1
 jemalloc_ver=5.0.1
 
 
 # boost
 # boost
-boost_ver=1.59.0
+boost_ver=1.66.0
+boost_oldver=1.59.0
 
 
 # Others
 # Others
 libevent_ver=2.0.22-stable
 libevent_ver=2.0.22-stable