lj2007331 8 anni fa
parent
commit
264406564e

+ 1 - 1
addons.sh

@@ -132,7 +132,7 @@ EOF
   if [ -e "/root/.local/share/letsencrypt/bin/letsencrypt" ] && certbot-auto -h | grep '\-\-standalone' > /dev/null ; then
   if [ -e "/root/.local/share/letsencrypt/bin/letsencrypt" ] && certbot-auto -h | grep '\-\-standalone' > /dev/null ; then
     echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}"
     echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}"
   else
   else
-    echo; echo "${CSUCCESS}Let's Encrypt client install failed, Please install again! ${CEND}"
+    echo; echo "${CFAILURE}Let's Encrypt client install failed, Please install again! ${CEND}"
   fi
   fi
 }
 }
 
 

+ 209 - 0
include/alisql-5.6.sh

@@ -0,0 +1,209 @@
+#!/bin/bash
+# Author:  yeho <lj2007331 AT gmail.com>
+# BLOG:  https://blog.linuxeye.com
+#
+# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+#
+# Project home page:
+#       https://oneinstack.com
+#       https://github.com/lj2007331/oneinstack
+
+Install_AliSQL-5-6() {
+  pushd ${oneinstack_dir}/src
+
+  id -u mysql >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
+
+  [ ! -d "${alisql_install_dir}" ] && mkdir -p ${alisql_install_dir}
+  mkdir -p ${alisql_data_dir};chown mysql.mysql -R ${alisql_data_dir}
+
+  tar xvf alisql-${alisql_5_6_version}.tar.gz
+  pushd alisql-${alisql_5_6_version}
+  cmake . -DCMAKE_INSTALL_PREFIX=${alisql_install_dir} \
+  -DMYSQL_DATADIR=${alisql_data_dir} \
+  -DSYSCONFDIR=/etc \
+  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
+  -DWITH_PARTITION_STORAGE_ENGINE=1 \
+  -DWITH_FEDERATED_STORAGE_ENGINE=1 \
+  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
+  -DWITH_MYISAM_STORAGE_ENGINE=1 \
+  -DWITH_EMBEDDED_SERVER=1 \
+  -DENABLE_DTRACE=0 \
+  -DENABLED_LOCAL_INFILE=1 \
+  -DDEFAULT_CHARSET=utf8mb4 \
+  -DDEFAULT_COLLATION=utf8mb4_general_ci \
+  -DEXTRA_CHARSETS=all
+  make -j ${THREAD}
+  make install
+  popd
+
+  if [ -d "${alisql_install_dir}/support-files" ]; then
+    echo "${CSUCCESS}AliSQL installed successfully! ${CEND}"
+    rm -rf alisql-${alisql_5_6_version}
+  else
+    rm -rf ${alisql_install_dir}
+    rm -rf alisql-${alisql_5_6_version}
+    echo "${CFAILURE}AliSQL install failed, Please contact the author! ${CEND}"
+    kill -9 $$
+  fi
+
+  /bin/cp ${alisql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
+  sed -i "s@^basedir=.*@basedir=${alisql_install_dir}@" /etc/init.d/mysqld
+  sed -i "s@^datadir=.*@datadir=${alisql_data_dir}@" /etc/init.d/mysqld
+  chmod +x /etc/init.d/mysqld
+  [ "${OS}" == "CentOS" ] && { chkconfig --add mysqld; chkconfig mysqld on; }
+  [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
+  popd
+
+  # my.cnf
+  [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
+  cat > /etc/my.cnf << EOF
+[client]
+port = 3306
+socket = /tmp/mysql.sock
+default-character-set = utf8mb4
+
+[mysql]
+prompt="AliSQL [\\d]> "
+no-auto-rehash
+
+[mysqld]
+port = 3306
+socket = /tmp/mysql.sock
+
+basedir = ${alisql_install_dir}
+datadir = ${alisql_data_dir}
+pid-file = ${alisql_data_dir}/mysql.pid
+user = mysql
+bind-address = 0.0.0.0
+server-id = 1
+
+init-connect = 'SET NAMES utf8mb4'
+character-set-server = utf8mb4
+
+skip-name-resolve
+#skip-networking
+back_log = 300
+
+max_connections = 1000
+max_connect_errors = 6000
+open_files_limit = 65535
+table_open_cache = 128
+max_allowed_packet = 500M
+binlog_cache_size = 1M
+max_heap_table_size = 8M
+tmp_table_size = 16M
+
+read_buffer_size = 2M
+read_rnd_buffer_size = 8M
+sort_buffer_size = 8M
+join_buffer_size = 8M
+key_buffer_size = 4M
+
+thread_cache_size = 8
+
+query_cache_type = 1
+query_cache_size = 8M
+query_cache_limit = 2M
+
+ft_min_word_len = 4
+
+log_bin = mysql-bin
+binlog_format = mixed
+expire_logs_days = 7
+
+log_error = ${alisql_data_dir}/mysql-error.log
+slow_query_log = 1
+long_query_time = 1
+slow_query_log_file = ${alisql_data_dir}/mysql-slow.log
+
+performance_schema = 0
+explicit_defaults_for_timestamp
+
+#lower_case_table_names = 1
+
+skip-external-locking
+
+default_storage_engine = InnoDB
+innodb_file_per_table = 1
+innodb_open_files = 500
+innodb_buffer_pool_size = 64M
+innodb_write_io_threads = 4
+innodb_read_io_threads = 4
+innodb_thread_concurrency = 0
+innodb_purge_threads = 1
+innodb_flush_log_at_trx_commit = 2
+innodb_log_buffer_size = 2M
+innodb_log_file_size = 32M
+innodb_log_files_in_group = 3
+innodb_max_dirty_pages_pct = 90
+innodb_lock_wait_timeout = 120
+
+bulk_insert_buffer_size = 8M
+myisam_sort_buffer_size = 8M
+myisam_max_sort_file_size = 10G
+myisam_repair_threads = 1
+
+interactive_timeout = 28800
+wait_timeout = 28800
+
+[mysqldump]
+quick
+max_allowed_packet = 500M
+
+[myisamchk]
+key_buffer_size = 8M
+sort_buffer_size = 8M
+read_buffer = 4M
+write_buffer = 4M
+EOF
+
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  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@^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@^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@^tmp_table_size.*@tmp_table_size = 32M@' /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
+    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@^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@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
+    sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
+  elif [ ${Mem} -gt 3500 ]; then
+    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@^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@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
+    sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
+  fi
+
+  ${alisql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${alisql_install_dir} --datadir=${alisql_data_dir}
+
+  chown mysql.mysql -R ${alisql_data_dir}
+  [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk}
+  service mysqld start
+  [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${alisql_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${alisql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${alisql_install_dir}/bin:\1@" /etc/profile
+  . /etc/profile
+
+  ${alisql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
+  ${alisql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
+  ${alisql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';"
+  ${alisql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
+  ${alisql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
+  ${alisql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
+  ${alisql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
+  [ -e "${alisql_install_dir}/my.cnf" ] && rm -rf ${alisql_install_dir}/my.cnf
+  echo "${alisql_install_dir}/lib" > /etc/ld.so.conf.d/alisql.conf
+  ldconfig
+  service mysqld stop
+}

+ 1 - 0
include/check_dir.sh

@@ -12,6 +12,7 @@
 [ -d "$mysql_install_dir/support-files" ] && { db_install_dir=$mysql_install_dir; db_data_dir=$mysql_data_dir; }
 [ -d "$mysql_install_dir/support-files" ] && { db_install_dir=$mysql_install_dir; db_data_dir=$mysql_data_dir; }
 [ -d "$mariadb_install_dir/support-files" ] && { db_install_dir=$mariadb_install_dir; db_data_dir=$mariadb_data_dir; }
 [ -d "$mariadb_install_dir/support-files" ] && { db_install_dir=$mariadb_install_dir; db_data_dir=$mariadb_data_dir; }
 [ -d "$percona_install_dir/support-files" ] && { db_install_dir=$percona_install_dir; db_data_dir=$percona_data_dir; }
 [ -d "$percona_install_dir/support-files" ] && { db_install_dir=$percona_install_dir; db_data_dir=$percona_data_dir; }
+[ -d "$alisql_install_dir/support-files" ] && { db_install_dir=$alisql_install_dir; db_data_dir=$alisql_data_dir; }
 
 
 # check Nginx dir
 # check Nginx dir
 [ -e "$nginx_install_dir/sbin/nginx" ] && web_install_dir=$nginx_install_dir
 [ -e "$nginx_install_dir/sbin/nginx" ] && web_install_dir=$nginx_install_dir

+ 15 - 1
include/check_download.sh

@@ -152,7 +152,7 @@ checkDownload() {
         echo "Download  MySQL 5.6 binary package..."
         echo "Download  MySQL 5.6 binary package..."
         FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
         FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
       elif [ "${dbInstallMethods}" == "2" ]; then
       elif [ "${dbInstallMethods}" == "2" ]; then
-        echo "Download MySQL 5.5 source package..."
+        echo "Download MySQL 5.6 source package..."
         FILE_NAME=mysql-${mysql_5_6_version}.tar.gz
         FILE_NAME=mysql-${mysql_5_6_version}.tar.gz
       fi
       fi
       wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME}
       wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME}
@@ -423,6 +423,20 @@ checkDownload() {
         echo "[${CMSG}${FILE_NAME}${CEND}] found."
         echo "[${CMSG}${FILE_NAME}${CEND}] found."
       fi
       fi
     fi
     fi
+
+    if [ "${DB_version}" == "10" ]; then
+      # alisql 5.6
+      DOWN_ADDR_ALISQL=$mirrorLink
+      echo "Download AliSQL 5.6 source package..."
+      FILE_NAME=alisql-${alisql_5_6_version}.tar.gz
+      wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_ALISQL}/${FILE_NAME}
+      wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_ALISQL}/${FILE_NAME}.md5
+      ALISQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
+      while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${ALISQL_TAR_MD5}" ];do
+        wget -4c --no-check-certificate ${DOWN_ADDR_ALISQL}/${FILE_NAME};sleep 1
+        [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${ALISQL_TAR_MD5}" ] && break || continue
+      done
+    fi
   fi
   fi
   # PHP
   # PHP
   if [ "${PHP_yn}" == "y" ]; then
   if [ "${PHP_yn}" == "y" ]; then

+ 1 - 1
include/mariadb-10.0.sh

@@ -219,7 +219,7 @@ EOF
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 1
include/mariadb-10.1.sh

@@ -219,7 +219,7 @@ EOF
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 1
include/mariadb-5.5.sh

@@ -225,7 +225,7 @@ EOF
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 1
include/mysql-5.5.sh

@@ -226,7 +226,7 @@ EOF
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${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}*.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 -rf ${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

+ 1 - 1
include/mysql-5.6.sh

@@ -224,7 +224,7 @@ EOF
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${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}*.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 -rf ${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

+ 1 - 1
include/mysql-5.7.sh

@@ -221,7 +221,7 @@ EOF
   ${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@'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 -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}*.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 -rf ${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

+ 1 - 1
include/percona-5.5.sh

@@ -229,7 +229,7 @@ EOF
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 1
include/percona-5.6.sh

@@ -226,7 +226,7 @@ EOF
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf
   ldconfig
   ldconfig
   service mysqld stop
   service mysqld stop

+ 1 - 1
include/percona-5.7.sh

@@ -222,7 +222,7 @@ EOF
   ${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
   ${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
   ${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
   ${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
   ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
-  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+  rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
   [ -e "${percona_install_dir}/my.cnf" ] && rm -rf ${percona_install_dir}/my.cnf
   [ -e "${percona_install_dir}/my.cnf" ] && rm -rf ${percona_install_dir}/my.cnf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf
   ldconfig
   ldconfig

+ 21 - 15
install.sh

@@ -175,10 +175,11 @@ while :; do echo
         echo -e "\t${CMSG}7${CEND}. Install Percona-5.7"
         echo -e "\t${CMSG}7${CEND}. Install Percona-5.7"
         echo -e "\t${CMSG}8${CEND}. Install Percona-5.6"
         echo -e "\t${CMSG}8${CEND}. Install Percona-5.6"
         echo -e "\t${CMSG}9${CEND}. Install Percona-5.5"
         echo -e "\t${CMSG}9${CEND}. Install Percona-5.5"
+        echo -e "\t${CMSG}0${CEND}. Install AliSQL-5.6"
         read -p "Please input a number:(Default 2 press Enter) " DB_version
         read -p "Please input a number:(Default 2 press Enter) " DB_version
         [ -z "$DB_version" ] && DB_version=2
         [ -z "$DB_version" ] && DB_version=2
-        if [[ ! $DB_version =~ ^[1-9]$ ]]; then
-          echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6,7,8,9${CEND}"
+        if [[ ! $DB_version =~ ^[0-9]$ ]]; then
+          echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6,7,8,9,0${CEND}"
         else
         else
           while :; do
           while :; do
             read -p "Please input the root password of database: " dbrootpwd
             read -p "Please input the root password of database: " dbrootpwd
@@ -186,18 +187,20 @@ while :; do echo
             (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}"
             (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}"
           done
           done
           # choose install methods
           # choose install methods
-          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) " dbInstallMethods
-            [ -z "$dbInstallMethods" ] && dbInstallMethods=1
-            if [[ ! $dbInstallMethods =~ ^[1-2]$ ]]; then
-              echo "${CWARNING}input error! Please only input number 1,2${CEND}"
-            else
-              break
-            fi
-          done
+          if [[ $DB_version =~ ^[1-9]$ ]]; 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) " dbInstallMethods
+              [ -z "$dbInstallMethods" ] && dbInstallMethods=1
+              if [[ ! $dbInstallMethods =~ ^[1-2]$ ]]; then
+                echo "${CWARNING}input error! Please only input number 1,2${CEND}"
+              else
+                break
+              fi
+            done
+          fi
           break
           break
         fi
         fi
       done
       done
@@ -418,7 +421,7 @@ while :; do echo
 done
 done
 
 
 # check jemalloc or tcmalloc
 # check jemalloc or tcmalloc
-if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ]; then
+if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '0' ]; then
   while :; do echo
   while :; do echo
     read -p "Do you want to use jemalloc or tcmalloc optimize Database and Web server? [y/n]: " je_tc_malloc_yn
     read -p "Do you want to use jemalloc or tcmalloc optimize Database and Web server? [y/n]: " je_tc_malloc_yn
     if [[ ! $je_tc_malloc_yn =~ ^[y,n]$ ]]; then
     if [[ ! $je_tc_malloc_yn =~ ^[y,n]$ ]]; then
@@ -540,6 +543,9 @@ elif [ "$DB_version" == '8' ]; then
 elif [ "$DB_version" == '9' ]; then
 elif [ "$DB_version" == '9' ]; then
   . include/percona-5.5.sh
   . include/percona-5.5.sh
   Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log
   Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log
+elif [ "$DB_version" == '0' ]; then
+  . include/alisql-5.6.sh
+  Install_AliSQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log
 fi
 fi
 
 
 # Apache
 # Apache

+ 2 - 0
options.conf

@@ -14,6 +14,7 @@ tomcat_install_dir=/usr/local/tomcat
 mysql_install_dir=/usr/local/mysql
 mysql_install_dir=/usr/local/mysql
 mariadb_install_dir=/usr/local/mariadb
 mariadb_install_dir=/usr/local/mariadb
 percona_install_dir=/usr/local/percona
 percona_install_dir=/usr/local/percona
+alisql_install_dir=/usr/local/alisql
 
 
 php_install_dir=/usr/local/php
 php_install_dir=/usr/local/php
 
 
@@ -28,6 +29,7 @@ redis_install_dir=/usr/local/redis
 mysql_data_dir=/data/mysql
 mysql_data_dir=/data/mysql
 mariadb_data_dir=/data/mariadb
 mariadb_data_dir=/data/mariadb
 percona_data_dir=/data/percona
 percona_data_dir=/data/percona
+alisql_data_dir=/data/alisql
 
 
 # web directory, you can customize
 # web directory, you can customize
 wwwroot_dir=/data/wwwroot
 wwwroot_dir=/data/wwwroot

+ 2 - 0
versions.txt

@@ -28,6 +28,8 @@ percona_5_7_version=5.7.15-9
 percona_5_6_version=5.6.33-79.0
 percona_5_6_version=5.6.33-79.0
 percona_5_5_version=5.5.52-38.3
 percona_5_5_version=5.5.52-38.3
 
 
+alisql_5_6_version=5.6.32-1
+
 # JDK
 # JDK
 jdk_8_version=1.8.0_112
 jdk_8_version=1.8.0_112
 jdk_7_version=1.7.0_80
 jdk_7_version=1.7.0_80