Browse Source

Add percona-5.7.sh

lj2007331 9 years ago
parent
commit
a7107d4593

+ 8 - 7
apps.conf

@@ -1,10 +1,10 @@
 # newest software version
 # Web
-nginx_version=1.9.11
+nginx_version=1.9.12
 tengine_version=2.1.1
 
-tomcat_7_version=7.0.67
-tomcat_8_version=8.0.32
+tomcat_7_version=7.0.68
+tomcat_8_version=8.0.30
 
 apache_2_version=2.2.31
 apache_4_version=2.4.18
@@ -17,10 +17,11 @@ mysql_5_7_version=5.7.11
 mysql_5_6_version=5.6.29
 mysql_5_5_version=5.5.48
 
-mariadb_10_1_version=10.1.11
-mariadb_10_0_version=10.0.23
+mariadb_10_1_version=10.1.12
+mariadb_10_0_version=10.0.24
 mariadb_5_5_version=5.5.48
 
+percona_5_7_version=5.7.10-3
 percona_5_6_version=5.6.28-76.1
 percona_5_5_version=5.5.47-37.7
 
@@ -65,7 +66,7 @@ memcache_pecl_version=3.0.8
 phpMyAdmin_version=4.4.15.4
 
 # jemalloc
-jemalloc_version=4.0.4
+jemalloc_version=4.1.0
 
 # tcmalloc
-tcmalloc_version=2.4
+tcmalloc_version=2.4.90

+ 2 - 2
config/pure-ftpd.conf

@@ -37,7 +37,7 @@ BrokenClientsCompatibility  no
 
 # Maximum number of simultaneous users
 
-MaxClientsNumber            500
+MaxClientsNumber            5000
 
 
 
@@ -49,7 +49,7 @@ Daemonize                   yes
 
 # Maximum number of sim clients with the same IP address
 
-MaxClientsPerIP             50
+MaxClientsPerIP             500
 
 
 

+ 2 - 2
config/server.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE server-xml [
-<!ENTITY localhost-vhost SYSTEM "file:///usr/local/tomcat/conf/vhost/localhost.xml">
+<!ENTITY vhost-localhost SYSTEM "file:///usr/local/tomcat/conf/vhost/localhost.xml">
 ]>
 <Server port="8006" shutdown="SHUTDOWN">
   <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
@@ -36,7 +36,7 @@
         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                resourceName="UserDatabase"/>
       </Realm>
-      &localhost-vhost;
+      &vhost-localhost;
     </Engine>
   </Service>
 </Server>

+ 1 - 1
include/GraphicsMagick.sh

@@ -14,7 +14,7 @@ src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/$
 
 tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz 
 cd GraphicsMagick-$GraphicsMagick_version
-./configure --enable-shared --prefix=/usr/local/graphicsmagick
+./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
 make && make install
 cd ..
 rm -rf GraphicsMagick-$GraphicsMagick_version

+ 1 - 1
include/ImageMagick.sh

@@ -14,7 +14,7 @@ src_url=http://downloads.sourceforge.net/project/imagemagick/old-sources/6.x/6.8
 
 tar xzf ImageMagick-$ImageMagick_version.tar.gz
 cd ImageMagick-$ImageMagick_version
-./configure --prefix=/usr/local/imagemagick
+./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
 make && make install
 cd ..
 rm -rf ImageMagick-$ImageMagick_version

+ 2 - 1
include/get_ipaddr_state.py

@@ -1,7 +1,8 @@
 #!/usr/bin/env python
 #coding:utf-8
 try:
-    import sys,urllib2
+    import sys,urllib2,socket
+    socket.setdefaulttimeout(10)
     apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] 
     content = urllib2.urlopen(apiurl).read()
     data = eval(content)['data']

+ 3 - 3
include/init_CentOS.sh

@@ -191,9 +191,9 @@ fi
 # install htop
 if [ ! -e "`which htop`" ];then
     cd src
-    src_url=http://hisham.hm/htop/releases/1.0.3/htop-1.0.3.tar.gz && Download_src 
-    tar xzf htop-1.0.3.tar.gz
-    cd htop-1.0.3
+    src_url=http://hisham.hm/htop/releases/2.0.0/htop-2.0.0.tar.gz && Download_src 
+    tar xzf htop-2.0.0.tar.gz
+    cd htop-2.0.0
     ./configure
     make && make install
     cd ../../

+ 1 - 1
include/mariadb-10.0.sh

@@ -48,7 +48,7 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
 cat > /etc/my.cnf << EOF
 [client]

+ 1 - 1
include/mariadb-10.1.sh

@@ -48,7 +48,7 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
 cat > /etc/my.cnf << EOF
 [client]

+ 1 - 1
include/mariadb-5.5.sh

@@ -48,7 +48,7 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
 cat > /etc/my.cnf << EOF
 [client]

+ 2 - 2
include/mysql-5.5.sh

@@ -60,9 +60,8 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
-[ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
 cat > /etc/my.cnf << EOF
 [client]
 port = 3306
@@ -207,6 +206,7 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.proxies_p
 $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;"
 $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;"
 rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+[ -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 
 ldconfig
 service mysqld stop

+ 2 - 2
include/mysql-5.6.sh

@@ -58,9 +58,8 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
-[ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
 cat > /etc/my.cnf << EOF
 [client]
 port = 3306
@@ -207,6 +206,7 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;"
 $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;"
 rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
 echo "$mysql_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf 
+[ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
 ldconfig
 service mysqld stop
 }

+ 6 - 6
include/mysql-5.7.sh

@@ -11,12 +11,12 @@
 Install_MySQL-5-7() {
 cd $oneinstack_dir/src
 
-[ "$IPADDR_STATE"x == "CN"x ] && { DOWN_ADDR_MYSQL=http://mirrors.linuxeye.com/oneinstack/src; DOWN_ADDR_BOOST=$DOWN_ADDR_MYSQL; } || { DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7; DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/1.60.0; }
+[ "$IPADDR_STATE"x == "CN"x ] && { DOWN_ADDR_MYSQL=http://mirrors.linuxeye.com/oneinstack/src; DOWN_ADDR_BOOST=$DOWN_ADDR_MYSQL; } || { DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7; DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/1.59.0; }
 
 if [ ! -e "/usr/local/lib/libboost_system.so" ];then
-    src_url=$DOWN_ADDR_BOOST/boost_1_60_0.tar.gz && Download_src
-    tar xzf boost_1_60_0.tar.gz
-    cd boost_1_60_0
+    src_url=$DOWN_ADDR_BOOST/boost_1_59_0.tar.gz && Download_src
+    tar xzf boost_1_59_0.tar.gz
+    cd boost_1_59_0
     ./bootstrap.sh
     ./bjam --prefix=/usr/local
     ./b2 install
@@ -72,9 +72,8 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
-[ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf
 cat > /etc/my.cnf << EOF
 [client]
 port = 3306
@@ -217,6 +216,7 @@ $mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1'
 $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;"
 rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+[ -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 
 ldconfig
 service mysqld stop

+ 1 - 1
include/percona-5.5.sh

@@ -59,7 +59,7 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
 cat > /etc/my.cnf << EOF
 [client]

+ 1 - 1
include/percona-5.6.sh

@@ -58,7 +58,7 @@ chmod +x /etc/init.d/mysqld
 [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d mysqld defaults
 cd ..
 
-# my.cf
+# my.cnf
 [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
 cat > /etc/my.cnf << EOF
 [client]

+ 223 - 0
include/percona-5.7.sh

@@ -0,0 +1,223 @@
+#!/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:
+#       http://oneinstack.com
+#       https://github.com/lj2007331/oneinstack
+
+Install_Percona-5-7() {
+cd $oneinstack_dir/src
+[ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_BOOST=http://mirrors.linuxeye.com/oneinstack/src || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/1.59.0
+
+if [ ! -e "/usr/local/lib/libboost_system.so" ];then
+    src_url=$DOWN_ADDR_BOOST/boost_1_59_0.tar.gz && Download_src
+    tar xzf boost_1_59_0.tar.gz
+    cd boost_1_59_0
+    ./bootstrap.sh
+    ./bjam --prefix=/usr/local
+    ./b2 install
+    cd ..
+fi
+echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
+ldconfig
+
+src_url=http://mirrors.linuxeye.com/oneinstack/src/percona-server-$percona_5_7_version.tar.gz && Download_src
+
+id -u mysql >/dev/null 2>&1
+[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
+
+mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir
+tar zxf percona-server-$percona_5_7_version.tar.gz 
+cd percona-server-$percona_5_7_version 
+if [ "$je_tc_malloc" == '1' ];then
+    EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"
+elif [ "$je_tc_malloc" == '2' ];then
+    EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'"
+fi
+make clean
+[ ! -d "$percona_install_dir" ] && mkdir -p $percona_install_dir
+cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
+-DMYSQL_DATADIR=$percona_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_ARCHIVE_STORAGE_ENGINE=1 \
+-DENABLED_LOCAL_INFILE=1 \
+-DENABLE_DTRACE=0 \
+-DDEFAULT_CHARSET=utf8mb4 \
+-DDEFAULT_COLLATION=utf8mb4_general_ci \
+$EXE_LINKER
+make -j `grep processor /proc/cpuinfo | wc -l` 
+make install
+
+if [ -d "$percona_install_dir/support-files" ];then
+    echo "${CSUCCESS}Percona install successfully! ${CEND}"
+    cd ..
+    rm -rf percona-server-$percona_5_7_version 
+else
+    rm -rf $percona_install_dir
+    echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}"
+    kill -9 $$
+fi
+
+/bin/cp $percona_install_dir/support-files/mysql.server /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
+cd ..
+
+# 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="Percona [\\d]> "
+no-auto-rehash
+
+[mysqld]
+port = 3306
+socket = /tmp/mysql.sock
+
+basedir = $percona_install_dir
+datadir = $percona_data_dir
+pid-file = $percona_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 = 4M
+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 = $percona_data_dir/mysql-error.log
+slow_query_log = 1
+long_query_time = 1
+slow_query_log_file = $percona_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 = 16M
+
+[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
+
+$percona_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir
+
+chown mysql.mysql -R $percona_data_dir
+[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk}
+service mysqld start
+[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$percona_install_dir/bin:\$PATH" >> /etc/profile 
+[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $percona_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$percona_install_dir/bin:\1@" /etc/profile
+
+. /etc/profile
+
+$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 -uroot -p$dbrootpwd -e "reset master;"
+rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
+[ -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
+ldconfig
+service mysqld stop
+}

+ 11 - 3
include/upgrade_db.sh

@@ -56,8 +56,8 @@ $db_install_dir/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_a
 #upgrade
 echo
 echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}"
-[ -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=2; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'"; }
 [ -e /usr/local/lib/libjemalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; }
+[ -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=2; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'"; }
 
 while :
 do
@@ -156,7 +156,11 @@ $EXE_LINKER
         mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir
         make install
         cd ..
-        $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir
+        if [ "`echo $NEW_DB_version | 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
+        else
+            $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir
+        fi
         chown mysql.mysql -R $percona_data_dir
         service mysqld start
         $percona_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql
@@ -209,7 +213,11 @@ $EXE_LINKER
         mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir
         make install
         cd ..
-        $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir
+        if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ];then
+            $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir
+        else
+            $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir
+        fi
         chown mysql.mysql -R $mysql_data_dir
         service mysqld start
         $mysql_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql

+ 9 - 5
install.sh

@@ -163,12 +163,13 @@ while :; do echo
                 echo -e "\t${CMSG}4${CEND}. Install MariaDB-10.1"
                 echo -e "\t${CMSG}5${CEND}. Install MariaDB-10.0"
                 echo -e "\t${CMSG}6${CEND}. Install MariaDB-5.5"
-                echo -e "\t${CMSG}7${CEND}. Install Percona-5.6"
-                echo -e "\t${CMSG}8${CEND}. Install Percona-5.5"
+                echo -e "\t${CMSG}7${CEND}. Install Percona-5.7"
+                echo -e "\t${CMSG}8${CEND}. Install Percona-5.6"
+                echo -e "\t${CMSG}9${CEND}. Install Percona-5.5"
                 read -p "Please input a number:(Default 2 press Enter) " DB_version
                 [ -z "$DB_version" ] && DB_version=2
-                if [[ ! $DB_version =~ ^[1-8]$ ]];then
-                    echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6,7,8${CEND}"
+                if [[ ! $DB_version =~ ^[1-9]$ ]];then
+                    echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6,7,8,9${CEND}"
                 else
                     while :; do
                         read -p "Please input the root password of database: " dbrootpwd
@@ -481,9 +482,12 @@ elif [ "$DB_version" == '6' ];then
     . include/mariadb-5.5.sh
     Install_MariaDB-5-5 2>&1 | tee -a $oneinstack_dir/install.log 
 elif [ "$DB_version" == '7' ];then
+    . include/percona-5.7.sh
+    Install_Percona-5-7 2>&1 | tee -a $oneinstack_dir/install.log
+elif [ "$DB_version" == '8' ];then
     . include/percona-5.6.sh
     Install_Percona-5-6 2>&1 | tee -a $oneinstack_dir/install.log
-elif [ "$DB_version" == '8' ];then
+elif [ "$DB_version" == '9' ];then
     . include/percona-5.5.sh 
     Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log 
 fi

+ 8 - 8
vhost.sh

@@ -401,8 +401,8 @@ cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF
          prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>
 EOF
-[ -z "`grep -o "${domain}-vhost SYSTEM" $tomcat_install_dir/conf/server.xml`" ] && sed -i "/localhost-vhost SYSTEM/a<\!ENTITY ${domain}-vhost SYSTEM \"file://$tomcat_install_dir/conf/vhost/$domain.xml\">" $tomcat_install_dir/conf/server.xml
-[ -z "`grep -o "${domain}-vhost;" $tomcat_install_dir/conf/server.xml`" ] && sed -i "s@localhost-vhost;@&\n      \&${domain}-vhost;@" $tomcat_install_dir/conf/server.xml
+[ -z "`grep -o "vhost-${domain} SYSTEM" $tomcat_install_dir/conf/server.xml`" ] && sed -i "/vhost-localhost SYSTEM/a<\!ENTITY vhost-${domain} SYSTEM \"file://$tomcat_install_dir/conf/vhost/$domain.xml\">" $tomcat_install_dir/conf/server.xml
+[ -z "`grep -o "vhost-${domain};" $tomcat_install_dir/conf/server.xml`" ] && sed -i "s@vhost-localhost;@&\n      \&vhost-${domain};@" $tomcat_install_dir/conf/server.xml
 
 echo
 $web_install_dir/sbin/nginx -t
@@ -437,8 +437,8 @@ cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF
          prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>
 EOF
-[ -z "`grep -o "${domain}-vhost SYSTEM" $tomcat_install_dir/conf/server.xml`" ] && sed -i "/localhost-vhost SYSTEM/a<\!ENTITY ${domain}-vhost SYSTEM \"file://$tomcat_install_dir/conf/vhost/$domain.xml\">" $tomcat_install_dir/conf/server.xml
-[ -z "`grep -o "${domain}-vhost;" $tomcat_install_dir/conf/server.xml`" ] && sed -i "s@localhost-vhost;@&\n      \&${domain}-vhost;@" $tomcat_install_dir/conf/server.xml
+[ -z "`grep -o "vhost-${domain} SYSTEM" $tomcat_install_dir/conf/server.xml`" ] && sed -i "/vhost-localhost SYSTEM/a<\!ENTITY vhost-${domain} SYSTEM \"file://$tomcat_install_dir/conf/vhost/$domain.xml\">" $tomcat_install_dir/conf/server.xml
+[ -z "`grep -o "vhost-${domain};" $tomcat_install_dir/conf/server.xml`" ] && sed -i "s@vhost-localhost;@&\n      \&vhost-${domain};@" $tomcat_install_dir/conf/server.xml
 
 echo
 /etc/init.d/tomcat restart
@@ -806,8 +806,8 @@ Del_Apache_Vhost() {
 Del_Tomcat_Vhost() {
     if [ -e "$tomcat_install_dir/conf/server.xml" ];then
         if [ -e "$web_install_dir/sbin/nginx" ];then
-            if [ -n "`grep ${domain}-vhost $tomcat_install_dir/conf/server.xml`" ];then
-                sed -i /${domain}-vhost/d $tomcat_install_dir/conf/server.xml 
+            if [ -n "`grep vhost-${domain} $tomcat_install_dir/conf/server.xml`" ];then
+                sed -i /vhost-${domain}/d $tomcat_install_dir/conf/server.xml 
                 rm -rf $tomcat_install_dir/conf/vhost/${domain}.xml
                 /etc/init.d/tomcat restart
             fi
@@ -824,8 +824,8 @@ Del_Tomcat_Vhost() {
                     if [ -z "`echo $domain | grep '.*\..*'`" ]; then
                         echo "${CWARNING}input error! ${CEND}"
                     else
-                        if [ -n "`grep ${domain}-vhost $tomcat_install_dir/conf/server.xml`" ];then
-                            sed -i /${domain}-vhost/d $tomcat_install_dir/conf/server.xml
+                        if [ -n "`grep vhost-${domain} $tomcat_install_dir/conf/server.xml`" ];then
+                            sed -i /vhost-${domain}/d $tomcat_install_dir/conf/server.xml
                             rm -rf $tomcat_install_dir/conf/vhost/${domain}.xml
                             /etc/init.d/tomcat restart
                             while :