From 548b7f94d4d3d88b9c2c137154356f913cab80a1 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 15:57:40 +0800 Subject: [PATCH 01/19] Add MySQL 5.5, PHP 5.3, PHP 5.5 --- lamp.sh | 123 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 32 deletions(-) diff --git a/lamp.sh b/lamp.sh index 258e413a..49b02231 100644 --- a/lamp.sh +++ b/lamp.sh @@ -21,17 +21,15 @@ echo "" # Install time state StartDate='' StartDateSecond='' -# Current folder -cur_dir=`pwd` -# CPU Number -Cpunum=`cat /proc/cpuinfo | grep 'processor' | wc -l`; # Software Version MySQLVersion='mysql-5.6.20' +MySQLVersion2='mysql-5.5.39' MariaDBVersion='mariadb-5.5.39' MariaDBVersion2='mariadb-10.0.13' PHPVersion='php-5.4.33' +PHPVersion2='php-5.3.29' +PHPVersion3='php-5.5.17' ApacheVersion='httpd-2.4.10' -phpMyAdminVersion='phpMyAdmin-4.2.9-all-languages' aprVersion='apr-1.5.1' aprutilVersion='apr-util-1.5.3' libiconvVersion='libiconv-1.14' @@ -42,6 +40,11 @@ re2cVersion='re2c-0.13.6' pcreVersion='pcre-8.35' libeditVersion='libedit-20140620-3.1' imapVersion='imap-2007f' +phpMyAdminVersion='phpMyAdmin-4.2.9-all-languages' +# Current folder +cur_dir=`pwd` +# CPU Number +Cpunum=`cat /proc/cpuinfo | grep 'processor' | wc -l`; # Install LAMP Script function install_lamp(){ @@ -134,10 +137,11 @@ function pre_installation_settings(){ echo -e "\t\033[32m1\033[0m. Install MariaDB-5.5(recommend)" echo -e "\t\033[32m2\033[0m. Install MariaDB-10.0" echo -e "\t\033[32m3\033[0m. Install MySQL-5.6" + echo -e "\t\033[32m4\033[0m. Install MySQL-5.5" read -p "Please input a number:(Default 1) " DB_version [ -z "$DB_version" ] && DB_version=1 case $DB_version in - 1|2|3) + 1|2|3|4) echo "" echo "---------------------------" echo "You choose = $DB_version" @@ -146,7 +150,7 @@ function pre_installation_settings(){ break ;; *) - echo "Input error! Please only input number 1,2,3" + echo "Input error! Please only input number 1,2,3,4" esac done # Set MySQL or MariaDB root password @@ -170,7 +174,7 @@ function pre_installation_settings(){ echo "Data location = $datalocation" echo "---------------------------" echo "" - elif [ $DB_version -eq 3 ]; then + elif [ $DB_version -eq 3 -o $DB_version -eq 4 ]; then # Define the MySQL data location. echo "Please input the MySQL data location:" read -p "(leave blank for /usr/local/mysql/data):" datalocation @@ -181,6 +185,28 @@ function pre_installation_settings(){ echo "---------------------------" echo "" fi + # Choose PHP version + while true + do + echo "Please choose a version of the PHP:" + echo -e "\t\033[32m1\033[0m. Install PHP-5.4(recommend)" + echo -e "\t\033[32m2\033[0m. Install PHP-5.3" + echo -e "\t\033[32m3\033[0m. Install PHP-5.5" + read -p "Please input a number:(Default 1) " PHP_version + [ -z "$PHP_version" ] && PHP_version=1 + case $PHP_version in + 1|2|3) + echo "" + echo "---------------------------" + echo "You choose = $PHP_version" + echo "---------------------------" + echo "" + break + ;; + *) + echo "Input error! Please only input number 1,2,3" + esac + done get_char(){ SAVEDSTTY=`stty -g` @@ -229,8 +255,16 @@ function download_all_files(){ download_file "${MariaDBVersion2}.tar.gz" elif [ $DB_version -eq 3 ]; then download_file "${MySQLVersion}.tar.gz" + elif [ $DB_version -eq 4 ]; then + download_file "${MySQLVersion2}.tar.gz" + fi + if [ $PHP_version -eq 1 ]; then + download_file "${PHPVersion}.tar.gz" + elif [ $PHP_version -eq 2 ]; then + download_file "${PHPVersion2}.tar.gz" + elif [ $PHP_version -eq 3 ]; then + download_file "${PHPVersion3}.tar.gz" fi - download_file "${PHPVersion}.tar.gz" download_file "${ApacheVersion}.tar.gz" download_file "${phpMyAdminVersion}.tar.gz" download_file "${aprVersion}.tar.gz" @@ -343,7 +377,7 @@ function install_apache(){ function install_database(){ if [ $DB_version -eq 1 -o $DB_version -eq 2 ]; then install_mariadb - elif [ $DB_version -eq 3 ]; then + elif [ $DB_version -eq 3 -o $DB_version -eq 4 ]; then install_mysql fi } @@ -422,7 +456,7 @@ delete from mysql.user where not (user='root') ; flush privileges; exit EOF - echo "${MariaDBVersion} Install completed!" + echo "MariaDB Install completed!" else echo "MariaDB had been installed!" fi @@ -432,11 +466,16 @@ EOF function install_mysql(){ if [ ! -d /usr/local/mysql ];then # Install MySQL - echo "Start Installing ${MySQLVersion}" cd $cur_dir/ + if [ $DB_version -eq 3 ]; then + echo "Start Installing ${MySQLVersion}" + cd $cur_dir/untar/$MySQLVersion + elif [ $DB_version -eq 4 ]; then + echo "Start Installing ${MySQLVersion2}" + cd $cur_dir/untar/$MySQLVersion2 + fi /usr/sbin/groupadd mysql /usr/sbin/useradd -s /sbin/nologin -M -g mysql mysql - cd $cur_dir/untar/$MySQLVersion # Compile MySQL cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ @@ -495,7 +534,7 @@ delete from mysql.user where not (user='root') ; flush privileges; exit EOF - echo "${MySQLVersion} Install completed!" + echo "MySQL Install completed!" else echo "MySQL had been installed!" fi @@ -590,11 +629,11 @@ function install_php(){ if [ $DB_version -eq 1 -o $DB_version -eq 2 ]; then WITH_MYSQL="--with-mysql=/usr/local/mariadb" WITH_MYSQLI="--with-mysqli=/usr/local/mariadb/bin/mysql_config" - elif [ $DB_version -eq 3 ]; then + elif [ $DB_version -eq 3 -o $DB_version -eq 4 ]; then WITH_MYSQL="--with-mysql=/usr/local/mysql" WITH_MYSQLI="--with-mysqli=/usr/local/mysql/bin/mysql_config" fi - echo "Start Installing ${PHPVersion}" + echo "Start Installing PHP" # ldap module dependency if is_64bit; then cp -rpf /usr/lib64/libldap* /usr/lib/ @@ -609,8 +648,13 @@ function install_php(){ else WITH_IMAP="--with-imap --with-imap-ssl --with-kerberos" fi - cd $cur_dir/untar/$PHPVersion - make clean + if [ $PHP_version -eq 1 ]; then + cd $cur_dir/untar/$PHPVersion + elif [ $PHP_version -eq 2 ]; then + cd $cur_dir/untar/$PHPVersion2 + elif [ $PHP_version -eq 3 ]; then + cd $cur_dir/untar/$PHPVersion3 + fi ./configure \ --prefix=/usr/local/php \ --with-apxs2=/usr/local/apache/bin/apxs \ @@ -673,7 +717,13 @@ function install_php(){ fi mkdir -p /usr/local/php/etc mkdir -p /usr/local/php/php.d - mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 + if [ $PHP_version -eq 1 ]; then + mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 + elif [ $PHP_version -eq 2 ]; then + mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626 + elif [ $PHP_version -eq 3 ]; then + mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212 + fi cp -f $cur_dir/conf/php.ini /usr/local/php/etc/php.ini rm -f /etc/php.ini ln -s /usr/local/php/etc/php.ini /etc/php.ini @@ -707,7 +757,7 @@ function install_phpmyadmin(){ # Install end cleanup function install_cleanup(){ - #Start httpd service + # Start httpd service /etc/init.d/httpd start if [ $? -ne 0 ]; then echo "Apache Starting failed, Please visit http://teddysun.com/lamp and contact." @@ -718,11 +768,11 @@ function install_cleanup(){ cp -f $cur_dir/conf/httpd.logrotate /etc/logrotate.d/httpd sed -i '/Order/,/All/d' /usr/bin/lamp sed -i "/AllowOverride All/i\Require all granted" /usr/bin/lamp - #Clean up + # Clean up rm -rf $cur_dir/untar clear - #Install completed or not + # Install completed or not if [ -s /usr/local/apache ] && [ -s /usr/local/php ] && [ -s /usr/local/mysql -o -s /usr/local/mariadb ]; then echo "" echo 'Congratulations, LAMP install completed!' @@ -733,7 +783,7 @@ function install_cleanup(){ if [ $DB_version -eq 1 -o $DB_version -eq 2 ]; then echo "MariaDB root password:$dbrootpwd" echo "MariaDB data location:$datalocation" - elif [ $DB_version -eq 3 ]; then + elif [ $DB_version -eq 3 -o $DB_version -eq 4 ]; then echo "MySQL root password:$dbrootpwd" echo "MySQL data location:$datalocation" fi @@ -744,19 +794,27 @@ function install_cleanup(){ echo -e "Installed MariaDB version:\033[41;37m ${MariaDBVersion2} \033[0m" elif [ $DB_version -eq 3 ]; then echo -e "Installed MySQL version:\033[41;37m ${MySQLVersion} \033[0m" + elif [ $DB_version -eq 4 ]; then + echo -e "Installed MySQL version:\033[41;37m ${MySQLVersion2} \033[0m" + fi + if [ $PHP_version -eq 1 ]; then + echo -e "Installed PHP version:\033[41;37m ${PHPVersion} \033[0m" + elif [ $PHP_version -eq 2 ]; then + echo -e "Installed PHP version:\033[41;37m ${PHPVersion2} \033[0m" + elif [ $PHP_version -eq 3 ]; then + echo -e "Installed PHP version:\033[41;37m ${PHPVersion3} \033[0m" fi - echo -e "Installed PHP version:\033[41;37m ${PHPVersion} \033[0m" echo -e "Installed phpMyAdmin version:\033[41;37m ${phpMyAdminVersion} \033[0m" echo "" echo "Start time: ${StartDate}" echo -e "Completion time: $(date) (Use:\033[41;37m $[($(date +%s)-StartDateSecond)/60] \033[0m minutes)" - echo "Welcome to visit:http://teddysun.com/lamp" + echo "Welcome to visit http://teddysun.com/lamp" echo "Enjoy it!" echo "" else echo "" echo 'Sorry, Failed to install LAMP!'; - echo 'Please contact: http://teddysun.com/lamp'; + echo 'Please visit http://teddysun.com/lamp and contact.'; fi } @@ -812,7 +870,7 @@ function uninstall_lamp(){ rm -f /usr/bin/$tmp2 done fi - rm -rf /usr/local/mysql /usr/local/mariadb /usr/lib64/mysql /usr/lib/mysql /etc/my.cnf /etc/rc.d/init.d/mysqld /etc/ld.so.conf.d/mysql.conf /etc/ld.so.conf.d/mariadb.conf /var/lock/subsys/mysql + rm -rf /usr/local/mysql /usr/local/mariadb /usr/lib64/mysql /usr/lib/mysql /etc/my.cnf /etc/init.d/mysqld /etc/ld.so.conf.d/mysql.conf /etc/ld.so.conf.d/mariadb.conf /var/lock/subsys/mysql rm -rf /usr/local/php /usr/lib/php /usr/bin/php /usr/bin/php-config /usr/bin/phpize /etc/php.ini rm -rf /data/www/default/phpmyadmin rm -rf /data/www/default/xcache @@ -826,7 +884,7 @@ function uninstall_lamp(){ # Add apache virtualhost function vhost_add(){ - #Define domain name + # Define domain name read -p "(Please input domains such as:www.example.com):" domains if [ "$domains" = "" ]; then echo "You need input a domain." @@ -837,7 +895,7 @@ function vhost_add(){ echo "$domain is exist!" exit 1 fi - #Create database or not + # Create database or not while true do read -p "(Do you want to create database?[y/N]):" create @@ -881,7 +939,7 @@ EOF esac done - #Create database + # Create database if [ "$create" == "y" ];then mysql -uroot -p$mysqlroot_passwd </usr/local/apache/conf/vhost/$domain.conf< ServerName $domain @@ -968,6 +1026,7 @@ function vhost_list(){ function ftp(){ if [ ! -f /etc/init.d/pure-ftpd ];then echo "Error: pure-ftpd not installed, please install it at first." + echo "Execute command: ./pureftpd.sh and install pure-ftpd." exit 1 fi case "$faction" in From f208d6dec675992fcd6de5f915894782179b259b Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 15:58:15 +0800 Subject: [PATCH 02/19] Add MySQL 5.5 support --- upgrade_mysql.sh | 93 ++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/upgrade_mysql.sh b/upgrade_mysql.sh index 38174138..c3202e3d 100644 --- a/upgrade_mysql.sh +++ b/upgrade_mysql.sh @@ -2,7 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================================== -# System Required: CentOS5.x (32bit/64bit) or CentOS6.x (32bit/64bit) +# System Required: CentOS / RedHat / Fedora # Description: Auto Update Script for MySQL # Author: Teddysun # Intro: http://teddysun.com/lamp @@ -20,7 +20,7 @@ fi clear echo "#############################################################" echo "# Auto Update Script for MySQL" -echo "# System Required: CentOS5.x (32bit/64bit) or CentOS6.x (32bit/64bit)" +echo "# System Required: CentOS / RedHat / Fedora" echo "# Intro: http://teddysun.com/lamp" echo "#" echo "# Author: Teddysun " @@ -31,10 +31,18 @@ echo "" cur_dir=`pwd` bkup_dir="$cur_dir/mysql_bkup" update_date=`date +"%Y%m%d"` +bkup_file="mysqld_${update_date}.bak" mysql_dump="/$bkup_dir/mysql_all_backup_$update_date.dump" -LATEST_MYSQL=$(curl -s http://dev.mysql.com/downloads/mysql/ | awk '/MySQL Community Server/{print $4}' | grep '5.6') INSTALLED_MYSQL=$(/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ",") +MYSQL_VER=$(echo $INSTALLED_MYSQL | awk -F. '{print $1$2}') +if [ $MYSQL_VER -eq 55 ]; then + mysqlVer='5.5' + LATEST_MYSQL=$(curl -s http://dev.mysql.com/downloads/mysql/5.5.html | awk '/MySQL Community Server/{print $4}' | grep '5.5') +elif [ $MYSQL_VER -eq 56 ]; then + mysqlVer='5.6' + LATEST_MYSQL=$(curl -s http://dev.mysql.com/downloads/mysql/5.6.html | awk '/MySQL Community Server/{print $4}' | grep '5.6') +fi echo -e "Latest version of MYSQL: \033[41;37m $LATEST_MYSQL \033[0m" echo -e "Installed version of MYSQL: \033[41;37m $INSTALLED_MYSQL \033[0m" @@ -120,7 +128,49 @@ function backup_mysql() { fi echo "Stoping MySQL..." /etc/init.d/mysqld stop - cp /etc/init.d/mysqld /$bkup_dir/mysqld_$update_date.bak + cp /etc/init.d/mysqld /$bkup_dir/$bkup_file +} + +# MYSQL Update +function upgrade_mysql() { + # Backup installed folder + if [[ -d "/usr/local/mysql.bak" && -d "/usr/local/mysql" ]];then + rm -rf /usr/local/mysql.bak/ + fi + mv /usr/local/mysql /usr/local/mysql.bak + cd $cur_dir + if [ ! -s mysql-$LATEST_MYSQL.tar.gz ]; then + LATEST_MYSQL_LINK="http://cdn.mysql.com/Downloads/MySQL-${mysqlVer}/mysql-${LATEST_MYSQL}.tar.gz" + BACKUP_MYSQL_LINK="http://lamp.teddysun.com/files/mysql-${LATEST_MYSQL}.tar.gz" + untar $LATEST_MYSQL_LINK $BACKUP_MYSQL_LINK + else + tar -zxf mysql-$LATEST_MYSQL.tar.gz + cd mysql-$LATEST_MYSQL/ + fi + # Compile MySQL + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ + -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ + -DDEFAULT_CHARSET=utf8 \ + -DDEFAULT_COLLATION=utf8_general_ci \ + -DWITH_EXTRA_CHARSETS=complex \ + -DWITH_INNOBASE_STORAGE_ENGINE=1 \ + -DWITH_READLINE=1 \ + -DENABLED_LOCAL_INFILE=1 + make && make install + chmod +w /usr/local/mysql + chown -R mysql:mysql /usr/local/mysql + mysqldata=$(cat /$bkup_dir/$bkup_file | grep -w 'datadir=' | awk -F= '{print $2}' | head -1) + /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf \ + --basedir=/usr/local/mysql --datadir=$mysqldata --user=mysql + cat > /etc/ld.so.conf.d/mysql.conf< /etc/ld.so.conf.d/mysql.conf< Date: Tue, 23 Sep 2014 15:59:25 +0800 Subject: [PATCH 03/19] Bug fix --- upgrade_mariadb.sh | 133 ++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 73 deletions(-) diff --git a/upgrade_mariadb.sh b/upgrade_mariadb.sh index 3046565d..ea8ca2b4 100644 --- a/upgrade_mariadb.sh +++ b/upgrade_mariadb.sh @@ -22,27 +22,27 @@ echo "#############################################################" echo "# Auto Update Script for MariaDB" echo "# System Required: CentOS / RedHat / Fedora" echo "# Intro: http://teddysun.com/lamp" -echo "" +echo "#" echo "# Author: Teddysun " -echo "" +echo "#" echo "#############################################################" echo "" cur_dir=`pwd` -bkup_dir="$cur_dir/mysql_bkup" +bkup_dir="$cur_dir/mariadb_bkup" update_date=`date +"%Y%m%d"` -mysql_dump="/$bkup_dir/mysql_all_backup_$update_date.dump" +bkup_file="mysqld_${update_date}.bak" +mariadb_dump="/$bkup_dir/mariadb_all_backup_${update_date}.dump" INSTALLED_MARIADB=$(/usr/local/mariadb/bin/mysql -V | awk '{print $5}' | tr -d "," | cut -d- -f1) -INSTALLED_MARIADB_SHORT=$(/usr/local/mariadb/bin/mysql -V | awk '{print $5}' | tr -d "," | cut -d- -f1 | awk -F. '{print $1$2}') +MARIADB_VER=$(echo $INSTALLED_MARIADB | awk -F. '{print $1$2}') -if [ $INSTALLED_MARIADB_SHORT -eq 55 ]; then +if [ $MARIADB_VER -eq 55 ]; then LATEST_MARIADB=$(curl -s https://downloads.mariadb.org/ | awk -F/ '/\/mariadb\/5.5/{print $3}') - echo -e "Latest version of MariaDB: \033[41;37m $LATEST_MARIADB \033[0m" -elif [ $INSTALLED_MARIADB_SHORT -eq 100 ];then - LATEST_MARIADB2=$(curl -s https://downloads.mariadb.org/ | awk -F/ '/\/mariadb\/10.0/{print $3}') - echo -e "Latest version of MariaDB: \033[41;37m $LATEST_MARIADB2 \033[0m" +elif [ $MARIADB_VER -eq 100 ];then + LATEST_MARIADB=$(curl -s https://downloads.mariadb.org/ | awk -F/ '/\/mariadb\/10.0/{print $3}') fi +echo -e "Latest version of MariaDB: \033[41;37m $LATEST_MARIADB \033[0m" echo -e "Installed version of MariaDB: \033[41;37m $INSTALLED_MARIADB \033[0m" echo "" echo "Do you want to upgrade MariaDB ? (y/n)" @@ -93,8 +93,8 @@ function pre_setting() { if [ ! -d $bkup_dir ]; then mkdir -p $bkup_dir fi - read -p "Please input your MariaDB root password:" mysql_root_password - /usr/local/mariadb/bin/mysql -uroot -p$mysql_root_password < $mysql_dump + /usr/local/mariadb/bin/mysqldump -uroot -p$mariadb_root_password --all-databases > $mariadb_dump if [ $? -eq 0 ]; then echo "MariaDB all of databases backup success."; else @@ -126,41 +126,7 @@ function backup_mariadb() { fi echo "Stoping MariaDB..." /etc/init.d/mysqld stop - cp /etc/init.d/mysqld /$bkup_dir/mysqld_$update_date.bak -} - -# Start all of services -function startall() { - # Apache - /etc/init.d/httpd start - # MariaDB - if [ -d "/proc/vz" ]; then - ulimit -s unlimited - fi - /etc/init.d/mysqld start - if [ $? -ne 0 ]; then - echo "Starting MariaDB failed, Please check it!" - exit 1 - fi - /usr/local/mariadb/bin/mysqladmin password $mysql_root_password - /usr/local/mariadb/bin/mysql -uroot -p$mysql_root_password < /etc/ld.so.conf.d/mariadb.conf< Date: Tue, 23 Sep 2014 16:02:12 +0800 Subject: [PATCH 04/19] Add PHP 5.3, PHP 5.5 support --- upgrade_php.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/upgrade_php.sh b/upgrade_php.sh index b7122efc..c116203e 100644 --- a/upgrade_php.sh +++ b/upgrade_php.sh @@ -11,6 +11,12 @@ if [[ $EUID -ne 0 ]]; then echo "Error:This script must be run as root!" 1>&2 exit 1 fi + +if [ ! -d /usr/local/php ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi + cur_dir=`pwd` clear @@ -24,13 +30,20 @@ echo "" echo "#############################################################" echo "" -#Description:PHP5 Update -if [ ! -L /usr/bin/php ]; then - ln -s /usr/local/php/bin/php /usr/bin/php -fi +# Description:PHP Update -LATEST_PHP=$(curl -s http://php.net/downloads.php | awk '/Changelog/{print $2}' | grep '5.4') -INSTALLED_PHP=$(php -r 'echo PHP_VERSION;' 2>/dev/null); +INSTALLED_PHP=$(php -r 'echo PHP_VERSION;' 2>/dev/null) +PHP_VER=$(echo $INSTALLED_PHP | awk -F. '{print $1$2}') +if [ $PHP_VER -eq 53 ]; then + extDate='20090626' + LATEST_PHP=$(curl -s http://php.net/downloads.php | awk '/Changelog/{print $2}' | grep '5.3') +elif [ $PHP_VER -eq 54 ]; then + extDate='20100525' + LATEST_PHP=$(curl -s http://php.net/downloads.php | awk '/Changelog/{print $2}' | grep '5.4') +elif [ $PHP_VER -eq 55 ]; then + extDate='20121212' + LATEST_PHP=$(curl -s http://php.net/downloads.php | awk '/Changelog/{print $2}' | grep '5.5') +fi echo -e "Latest version of PHP: \033[41;37m $LATEST_PHP \033[0m" echo -e "Installed version of PHP: \033[41;37m $INSTALLED_PHP \033[0m" @@ -45,7 +58,7 @@ echo "You choose = $UPGRADE_PHP" echo "---------------------------" echo "" -#Description:phpMyAdmin Update +# Description:phpMyAdmin Update if [ -d /data/www/default/phpmyadmin ]; then INSTALLED_PMA=$(awk '/Version/{print $2}' /data/www/default/phpmyadmin/README) else @@ -141,7 +154,7 @@ function centosversion(){ fi } -# PHP5 Update +# PHP Update if [[ "$UPGRADE_PHP" = "y" || "$UPGRADE_PHP" = "Y" ]];then echo "===================== PHP upgrade start====================" if [[ -d "/usr/local/php.bak" && -d "/usr/local/php" ]];then @@ -235,9 +248,10 @@ if [[ "$UPGRADE_PHP" = "y" || "$UPGRADE_PHP" = "Y" ]];then fi mkdir -p /usr/local/php/etc mkdir -p /usr/local/php/php.d - mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ + mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ cp -f /usr/local/php.bak/etc/php.ini /usr/local/php/etc/php.ini - cp -f /usr/local/php.bak/lib/php/extensions/no-debug-non-zts-20100525/* /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ + cp -f /usr/local/php.bak/lib/php/extensions/no-debug-non-zts-${extDate}/* \ + /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ php_d=`ls /usr/local/php.bak/php.d/ | wc -l` if [ $php_d -ne 0 ]; then cp -f /usr/local/php.bak/php.d/* /usr/local/php/php.d/ From 3430a68c59a47b870d5026edd9e2525a8920e161 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 16:03:02 +0800 Subject: [PATCH 05/19] Add PHP 5.3, PHP 5.5 support --- ImageMagick.sh | 19 +++++++++++++-- ZendGuardLoader.sh | 61 ++++++++++++++++++++++++++++++++++++---------- ioncube.sh | 55 ++++++++++++++++++++++++++++++++--------- oci8_oracle11g.sh | 22 ++++++++++++++--- xcache.sh | 52 ++++++++++++++++++++++----------------- 5 files changed, 157 insertions(+), 52 deletions(-) diff --git a/ImageMagick.sh b/ImageMagick.sh index 7d0df1f0..eef059f0 100644 --- a/ImageMagick.sh +++ b/ImageMagick.sh @@ -2,7 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================== -# SYSTEM REQUIRED: CentOS-5 (32bit/64bit) or CentOS-6 (32bit/64bit) +# SYSTEM REQUIRED: CentOS / RedHat / Fedora # DESCRIPTION: ImageMagick for LAMP # AUTHOR: Teddysun # VISIT: http://teddysun.com/lamp @@ -14,6 +14,21 @@ cd $cur_dir ImageMagick_Ver='ImageMagick-6.8.9-8' ImageMagick_ext_Ver='imagick-3.2.0RC1' +# get PHP version +PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $PHP_VER ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi +# get PHP extensions date +if [ $PHP_VER -eq 53 ]; then + extDate='20090626' +elif [ $PHP_VER -eq 54 ]; then + extDate='20100525' +elif [ $PHP_VER -eq 55 ]; then + extDate='20121212' +fi + #=============================================================================== #DESCRIPTION:Make sure only root can run our script #USAGE:rootness @@ -66,7 +81,7 @@ function install_imagemagick_ext(){ echo "imagemagick configuration not found, create it!" cat > $PHP_PREFIX/php.d/imagick.ini<<-EOF [imagick] -extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/imagick.so +extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/imagick.so EOF fi # Clean up diff --git a/ZendGuardLoader.sh b/ZendGuardLoader.sh index 3f955d75..f9324cfa 100644 --- a/ZendGuardLoader.sh +++ b/ZendGuardLoader.sh @@ -2,7 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================================== -# SYSTEM REQUIRED: CentOS-5 (32bit/64bit) or CentOS-6 (32bit/64bit) +# SYSTEM REQUIRED: CentOS / RedHat / Fedora # DESCRIPTION: ZendGuardLoader for LAMP # AUTHOR: Teddysun # VISIT: http://teddysun.com/lamp @@ -15,6 +15,15 @@ fi cur_dir=`pwd` cd $cur_dir +# is 64bit or not +function is_64bit(){ + if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + return 0 + else + return 1 + fi +} + clear echo "#############################################################" echo "# ZendGuardLoader for LAMP" @@ -25,33 +34,59 @@ echo "#" echo "#############################################################" echo "" +# get PHP version +INSTALLED_PHP=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $INSTALLED_PHP ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi + +# get PHP extensions date & ZendGuardLoader version +if [ $INSTALLED_PHP -eq 53 ]; then + if is_64bit; then + zendVer="ZendGuardLoader-php-5.3-linux-glibc23-x86_64" + else + zendVer="ZendGuardLoader-php-5.3-linux-glibc23-i386" + fi + phpVer='5.3' + extDate='20090626' +elif [ $INSTALLED_PHP -eq 54 ]; then + if is_64bit; then + zendVer="ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64" + else + zendVer="ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386" + fi + phpVer='5.4' + extDate='20100525' +elif [ $INSTALLED_PHP -eq 55 ]; then + echo "Error:PHP 5.5 is not support!" + echo "" + exit 1 +fi + # Install ZendGuardLoader echo "============================ZendGuardLoader install start=====================================" if [ ! -d $cur_dir/untar/ ]; then mkdir -p $cur_dir/untar/ fi # Download ZendGuardLoader -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - if ! wget -c http://lamp.teddysun.com/files/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz;then - echo "Failed to download ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz, please download it to "$cur_dir" directory manually and rerun the install script." - exit 1 - fi - tar zxf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz -C $cur_dir/untar/ - mv $cur_dir/untar/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ +if [ -s ${zendVer}.tar.gz ]; then + echo "${zendVer}.tar.gz [found]" else - if ! wget -c http://lamp.teddysun.com/files/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz;then - echo "Failed to download ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz, please download it to "$cur_dir" directory manually and rerun the install script." + echo "${zendVer}.tar.gz not found!!!download now......" + if ! wget -c http://lamp.teddysun.com/files/${zendVer}.tar.gz; then + echo "Failed to download ${zendVer}.tar.gz, please download it to "$cur_dir" directory manually and try again." exit 1 fi - tar zxf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz -C $cur_dir/untar/ - mv $cur_dir/untar/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ fi +tar zxf ${zendVer}.tar.gz -C $cur_dir/untar/ +mv $cur_dir/untar/${zendVer}/php-${phpVer}.x/ZendGuardLoader.so /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ if [ ! -f /usr/local/php/php.d/zend.ini ]; then echo "Zend Guard Loader configuration not found, create it!" cat > /usr/local/php/php.d/zend.ini<<-EOF [Zend Guard] -zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ZendGuardLoader.so +zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ZendGuardLoader.so zend_loader.enable = 1 zend_loader.disable_licensing = 0 diff --git a/ioncube.sh b/ioncube.sh index 6b3c91e2..f346b54c 100644 --- a/ioncube.sh +++ b/ioncube.sh @@ -15,6 +15,15 @@ fi cur_dir=`pwd` cd $cur_dir +# is 64bit or not +function is_64bit(){ + if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + return 0 + else + return 1 + fi +} + clear echo "#############################################################" echo "# ionCube for LAMP" @@ -25,33 +34,57 @@ echo "#" echo "#############################################################" echo "" +# get PHP version +INSTALLED_PHP=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $INSTALLED_PHP ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi + +# get PHP extensions date +if [ $INSTALLED_PHP -eq 53 ]; then + phpVer='5.3' + extDate='20090626' +elif [ $INSTALLED_PHP -eq 54 ]; then + phpVer='5.4' + extDate='20100525' +elif [ $INSTALLED_PHP -eq 55 ]; then + phpVer='5.5' + extDate='20121212' +fi +if is_64bit; then + ionCubeVer='ioncube_loaders_lin_x86-64.tar.gz' +else + ionCubeVer='ioncube_loaders_lin_x86.tar.gz' +fi + # Install ionCube echo "============================ionCube install start=====================================" if [ ! -d $cur_dir/untar/ ]; then mkdir -p $cur_dir/untar/ fi # Download ionCube -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - if ! wget -c http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz; then - echo "Failed to download ioncube_loaders_lin_x86-64.tar.gz, please download it to $cur_dir directory manually and try again." - exit 1 - fi - tar zxf ioncube_loaders_lin_x86-64.tar.gz -C $cur_dir/untar/ +if [ -s ${ionCubeVer} ]; then + echo "${ionCubeVer} [found]" else - if ! wget -c http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz; then - echo "Failed to download ioncube_loaders_lin_x86.tar.gz, please download it to $cur_dir directory manually and try again." + echo "${ionCubeVer} not found!!!download now......" + if ! wget -c http://lamp.teddysun.com/files/${ionCubeVer}; then + echo "Failed to download ${ionCubeVer}, please download it to "$cur_dir" directory manually and try again." exit 1 fi - tar zxf ioncube_loaders_lin_x86.tar.gz -C $cur_dir/untar/ fi + +tar zxf ${ionCubeVer} -C $cur_dir/untar/ + # Copy file -cp -pf $cur_dir/untar/ioncube/ioncube_loader_lin_5.4.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ +cp -pf $cur_dir/untar/ioncube/ioncube_loader_lin_$phpVer.so /usr/local/php/lib/php/extensions/no-debug-non-zts-$extDate/ + # Create configuration file if [ ! -f /usr/local/php/php.d/ioncube.ini ]; then echo "ionCube configuration not found, create it!" cat > /usr/local/php/php.d/ioncube.ini<<-EOF [ionCube Loader] -zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so +zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ioncube_loader_lin_${phpVer}.so EOF fi # Clean up diff --git a/oci8_oracle11g.sh b/oci8_oracle11g.sh index 489e8184..6c74f590 100644 --- a/oci8_oracle11g.sh +++ b/oci8_oracle11g.sh @@ -2,11 +2,10 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================== -# SYSTEM REQUIRED: CentOS-5 (32bit/64bit) or CentOS-6 (32bit/64bit) +# SYSTEM REQUIRED: CentOS / RedHat / Fedora # DESCRIPTION: OCI8 for LAMP # AUTHOR: Teddysun -# VISIT: https://code.google.com/p/teddysun/ -# http://teddysun.com/lamp +# VISIT: http://teddysun.com/lamp #=============================================================================== cur_dir=`pwd` @@ -14,6 +13,21 @@ cd $cur_dir OCIVersion='oci8-2.0.8' +# get PHP version +PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $PHP_VER ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi +# get PHP extensions date +if [ $PHP_VER -eq 53 ]; then + extDate='20090626' +elif [ $PHP_VER -eq 54 ]; then + extDate='20100525' +elif [ $PHP_VER -eq 55 ]; then + extDate='20121212' +fi + #=============================================================================== #DESCRIPTION:Make sure only root can run our script #USAGE:rootness @@ -70,7 +84,7 @@ function compile_oci8(){ echo "OCI8 configuration not found, create it!" cat > $PHP_PREFIX/php.d/oci8.ini<<-EOF [OCI8] -extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/oci8.so +extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/oci8.so oci8.privileged_connect = Off oci8.max_persistent = -1 diff --git a/xcache.sh b/xcache.sh index 12dccbae..17d78e84 100644 --- a/xcache.sh +++ b/xcache.sh @@ -2,7 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================================== -# SYSTEM REQUIRED: CentOS-5 (32bit/64bit) or CentOS-6 (32bit/64bit) +# SYSTEM REQUIRED: CentOS / RedHat / Fedora # DESCRIPTION: Xcache for LAMP # AUTHOR: Teddysun # VISIT: http://teddysun.com/lamp @@ -15,33 +15,41 @@ fi cur_dir=`pwd` cd $cur_dir -clear -echo "#############################################################" -echo "# Xcache for LAMP" -echo "# Intro: http://teddysun.com/lamp" -echo "#" -echo "# Author: Teddysun " -echo "#" -echo "#############################################################" -echo "" -#download xcache-3.1.0 -if [ -s xcache-3.1.0.tar.gz ]; then - echo "xcache-3.1.0.tar.gz [found]" +xcacheVer='xcache-3.1.0' + +# get PHP version +PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $PHP_VER ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi +# get PHP extensions date +if [ $PHP_VER -eq 53 ]; then + extDate='20090626' +elif [ $PHP_VER -eq 54 ]; then + extDate='20100525' +elif [ $PHP_VER -eq 55 ]; then + extDate='20121212' +fi + +# download xcache +if [ -s $xcacheVer.tar.gz ]; then + echo "${xcacheVer}.tar.gz [found]" else - echo "xcache-3.1.0.tar.gz not found!!!download now......" - if ! wget http://lamp.teddysun.com/files/xcache-3.1.0.tar.gz;then - echo "Failed to download xcache-3.1.0.tar.gz,please download it to $cur_dir directory manually and rerun the install script." - exit 1 - fi + echo "${xcacheVer}.tar.gz not found!!!download now......" + if ! wget http://lamp.teddysun.com/files/${xcacheVer}.tar.gz; then + echo "Failed to download ${xcacheVer}.tar.gz,please download it to ${cur_dir} directory manually and try again." + exit 1 + fi fi -#install xcache +# install xcache echo "============================Xcache install start=====================================" if [ ! -d $cur_dir/untar/ ]; then mkdir -p $cur_dir/untar/ fi -tar xzf xcache-3.1.0.tar.gz -C $cur_dir/untar/ -cd $cur_dir/untar/xcache-3.1.0 +tar xzf $xcacheVer.tar.gz -C $cur_dir/untar/ +cd $cur_dir/untar/$xcacheVer export PHP_PREFIX="/usr/local/php" $PHP_PREFIX/bin/phpize ./configure --enable-xcache -with-php-config=$PHP_PREFIX/bin/php-config @@ -57,7 +65,7 @@ if [ ! -f $PHP_PREFIX/php.d/xcache.ini ]; then echo "Xcache configuration not found, create it!" cat > $PHP_PREFIX/php.d/xcache.ini<<-EOF [xcache-common] -extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so +extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/xcache.so [xcache.admin] xcache.admin.enable_auth = On From 9bed6d7e10eb93f24b9939440e76ea6e44bdbf75 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 16:09:14 +0800 Subject: [PATCH 06/19] Update Readme --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d6e5383f..c225c63b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ * 服务器必须配置好软件源和可连接外网 * 必须具有系统 Root 权限 * 建议使用干净系统全新安装 -* 日期:2014年09月22日 +* 日期:2014年09月23日 ## 关于本脚本 * 支持 PHP 自带所有组件; @@ -26,8 +26,8 @@ ## 将会安装 * 1、Apache 2.4.10 -* 2、MySQL 5.6.20, MariaDB 5.5.39, MariaDB 10.0.13 (三选一安装) -* 3、PHP 5.4.33 +* 2、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) +* 3、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) * 4、phpMyAdmin 4.2.9 * 5、xcache 3.1.0 (推荐安装) * 6、OCI8 2.0.8 (可选安装) @@ -39,7 +39,7 @@ ## 如何安装 ### 事前准备(安装screen、unzip,创建 screen 会话): - yum -y install screen unzip + yum -y install wget screen unzip screen -S lamp ### 第一步,下载、解压、赋予权限: @@ -82,7 +82,6 @@ ./upgrade_mysql.sh | tee upgrade_mysql.log - ### 关于 upgrade_mariadb.sh 新增 upgrade_mariadb.sh 脚本,目的是为了自动检测和升级 MariaDB。升级之前自动备份全部数据库,在升级完成之后再将备份恢复。 From 75e5bb4dcb2c8717948e6d92a2098a9f8c09f87d Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 16:13:34 +0800 Subject: [PATCH 07/19] Update Changelog --- Changelog.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Changelog.md b/Changelog.md index 42833eeb..a8c1ca60 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +###版本`2.9.2`:`Release date:2014/09/23` +更新记录: + +* 1、新增 PHP 版本 5.3.29, 5.5.17 支持; +* 2、新增 MySQL 版本 5.5.39 支持; +* 3、优化 MySQL 和 MariaDB 的升级脚本; +* 4、优化 ZendGuardLoader,Xcache,OCI8,ionCube PHP Loader,ImageMagick 脚本,对应 PHP 各版本; + ###版本`2.9.1`:`Release date:2014/09/22` 更新记录: From 3754e4d032afbcb4afc7092b52ffc847a424ee59 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 17:10:33 +0800 Subject: [PATCH 08/19] Add MySQL 5.5, PHP 5.3, PHP 5.5 support --- lamp.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lamp.sh b/lamp.sh index 49b02231..6308dedc 100644 --- a/lamp.sh +++ b/lamp.sh @@ -109,18 +109,18 @@ function centosversion(){ # Make sure only root can run our script function rootness(){ -if [[ $EUID -ne 0 ]]; then - echo "Error:This script must be run as root!" 1>&2 - exit 1 -fi + if [[ $EUID -ne 0 ]]; then + echo "Error:This script must be run as root!" 1>&2 + exit 1 + fi } # Disable selinux function disable_selinux(){ -if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then - sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config - setenforce 0 -fi + if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then + sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config + setenforce 0 + fi } # Pre-installation settings @@ -283,15 +283,15 @@ function download_all_files(){ # Download file function download_file(){ -if [ -s $1 ]; then - echo "$1 [found]" -else - echo "$1 not found!!!download now......" - if ! wget -c http://lamp.teddysun.com/files/$1;then - echo "Failed to download $1,please download it to "$cur_dir" directory manually and try again." - exit 1 + if [ -s $1 ]; then + echo "$1 [found]" + else + echo "$1 not found!!!download now......" + if ! wget -c http://lamp.teddysun.com/files/$1;then + echo "Failed to download $1,please download it to "$cur_dir" directory manually and try again." + exit 1 + fi fi -fi } # Untar all files From 1e85cbab616932d7948aad89fd7e72b9155566a6 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Tue, 23 Sep 2014 19:18:34 +0800 Subject: [PATCH 09/19] Add MySQL 5.5, PHP 5.3, PHP 5.5 support --- lamp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lamp.sh b/lamp.sh index 6308dedc..8532db04 100644 --- a/lamp.sh +++ b/lamp.sh @@ -730,7 +730,7 @@ function install_php(){ ln -s /usr/local/php/bin/php /usr/bin/php ln -s /usr/local/php/bin/php-config /usr/bin/php-config ln -s /usr/local/php/bin/phpize /usr/bin/phpize - echo "${PHPVersion} install completed!" + echo "PHP install completed!" else echo "PHP had been installed!" fi From a563e9f4275296b841c408aadbf85d2067f94ec4 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 09:03:30 +0800 Subject: [PATCH 10/19] Update xcache to version 3.2.0 --- xcache.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcache.sh b/xcache.sh index 17d78e84..a93d28e3 100644 --- a/xcache.sh +++ b/xcache.sh @@ -15,7 +15,7 @@ fi cur_dir=`pwd` cd $cur_dir -xcacheVer='xcache-3.1.0' +xcacheVer='xcache-3.2.0' # get PHP version PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') From ae63b2570d02154f61fd62c220225ae257812c2f Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 09:12:46 +0800 Subject: [PATCH 11/19] Update Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c225c63b..dd5eac8c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ * 服务器必须配置好软件源和可连接外网 * 必须具有系统 Root 权限 * 建议使用干净系统全新安装 -* 日期:2014年09月23日 +* 日期:2014年09月24日 ## 关于本脚本 * 支持 PHP 自带所有组件; @@ -29,7 +29,7 @@ * 2、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) * 3、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) * 4、phpMyAdmin 4.2.9 -* 5、xcache 3.1.0 (推荐安装) +* 5、xcache 3.2.0 (推荐安装) * 6、OCI8 2.0.8 (可选安装) * 7、pure-ftpd 1.0.36 (可选安装) * 8、Zend Guard Loader 3.3( 可选安装) From 1264f73cf1a33c159c5233ebe925cc254b4bc3ac Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 09:12:57 +0800 Subject: [PATCH 12/19] Update Changelog --- Changelog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index a8c1ca60..6b7614ea 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,10 +1,11 @@ -###版本`2.9.2`:`Release date:2014/09/23` +###版本`2.9.2`:`Release date:2014/09/24` 更新记录: * 1、新增 PHP 版本 5.3.29, 5.5.17 支持; * 2、新增 MySQL 版本 5.5.39 支持; * 3、优化 MySQL 和 MariaDB 的升级脚本; * 4、优化 ZendGuardLoader,Xcache,OCI8,ionCube PHP Loader,ImageMagick 脚本,对应 PHP 各版本; +* 5、升级 Xcache 至版本 3.2.0; ###版本`2.9.1`:`Release date:2014/09/22` 更新记录: From aeed578cfa57794540e169e065a65745e2150595 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:17:11 +0800 Subject: [PATCH 13/19] Add opcache.sh --- opcache.sh | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 opcache.sh diff --git a/opcache.sh b/opcache.sh new file mode 100644 index 00000000..4dccf5c2 --- /dev/null +++ b/opcache.sh @@ -0,0 +1,90 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +#=============================================================================================== +# SYSTEM REQUIRED: CentOS / RedHat / Fedora +# DESCRIPTION: OpCache for LAMP +# AUTHOR: Teddysun +# VISIT: http://teddysun.com/lamp +#=============================================================================================== +if [[ $EUID -ne 0 ]]; then + echo "Error:This script must be run as root!" 1>&2 + exit 1 +fi + +cur_dir=`pwd` +cd $cur_dir + +PHP_PREFIX='/usr/local/php' +opcacheVer='zendopcache-7.0.3' +extDate='20121212' + +# Create opcache configuration file +function create_ini(){ +if [ ! -f $PHP_PREFIX/php.d/opcache.ini ]; then + echo "OpCache configuration not found, create it!" + cat > $PHP_PREFIX/php.d/opcache.ini<<-EOF +[OpCache] +zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/opcache.so +opcache.enable_cli=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.fast_shutdown=1 +opcache.save_comments=0 +EOF +fi +} + +# install opcache +echo "OpCache install start..." +# get PHP version +PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') +if [ $? -ne 0 -o -z $PHP_VER ]; then + echo "Error:PHP looks like not installed, please check it and try again." + exit 1 +fi +# get PHP extensions date +if [ $PHP_VER -eq 53 ]; then + extDate='20090626' +elif [ $PHP_VER -eq 54 ]; then + extDate='20100525' +elif [ $PHP_VER -eq 55 ]; then + if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/opcache.so ]; then + echo "opcache.so already exists." + create_ini + /etc/init.d/httpd restart + echo "OpCache install completed..." + exit 0 + fi +fi + +# download opcache +if [ -s $opcacheVer.tgz ]; then + echo "${opcacheVer}.tgz [found]" +else + echo "${opcacheVer}.tgz not found!!!download now......" + if ! wget http://lamp.teddysun.com/files/${opcacheVer}.tgz; then + echo "Failed to download ${opcacheVer}.tgz,please download it to ${cur_dir} directory manually and try again." + exit 1 + fi +fi + +# install opcache +if [ ! -d $cur_dir/untar/ ]; then + mkdir -p $cur_dir/untar/ +fi +tar xzf $opcacheVer.tgz -C $cur_dir/untar/ +cd $cur_dir/untar/$opcacheVer +$PHP_PREFIX/bin/phpize +./configure --with-php-config=$PHP_PREFIX/bin/php-config +make && make install +create_ini + +# Clean up +cd $cur_dir +rm -rf $cur_dir/untar/ +/etc/init.d/httpd restart +echo "OpCache install completed..." +exit 0 From 5fbd06548abaedea0d0d0b0a87340019587ec346 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:24:37 +0800 Subject: [PATCH 14/19] Update Readme --- README.md | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index dd5eac8c..e203806a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## 关于本脚本 * 支持 PHP 自带所有组件; * 支持 MySQL ,MariaDB, SQLite 数据库; -* 支持 XCache (可选安装); +* 支持 XCache ,OpCache(可选安装); * 支持 Zend Guard Loader (可选安装); * 支持 OCI8 (可让 PHP 连接 Oracle 数据库,可选安装); * 支持 ionCube PHP Loader (可选安装); @@ -25,16 +25,17 @@ * 一键卸载。 ## 将会安装 -* 1、Apache 2.4.10 -* 2、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) -* 3、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) -* 4、phpMyAdmin 4.2.9 -* 5、xcache 3.2.0 (推荐安装) -* 6、OCI8 2.0.8 (可选安装) -* 7、pure-ftpd 1.0.36 (可选安装) -* 8、Zend Guard Loader 3.3( 可选安装) -* 9、ionCube PHP Loader 4.6.1 (可选安装) +* 01、Apache 2.4.10 +* 02、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) +* 03、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) +* 04、phpMyAdmin 4.2.9 +* 05、xcache 3.2.0 (推荐安装) +* 06、OCI8 2.0.8 (可选安装) +* 07、pure-ftpd 1.0.36 (可选安装) +* 08、Zend Guard Loader 3.3( 可选安装) +* 09、ionCube PHP Loader 4.6.1 (可选安装) * 10、ImageMagick-6.8.9-8 (可选安装) +* 11、OpCache 7.0.3 (可选安装) ## 如何安装 ### 事前准备(安装screen、unzip,创建 screen 会话): @@ -56,15 +57,16 @@ ### 安装其它: -* 1、(推荐安装)执行脚本 xcache.sh 安装 xcache 。(命令:./xcache.sh) -* 2、(可选安装)执行脚本 oci8_oracle11g.sh 安装 OCI8 扩展以及 oracle-instantclient11.2(命令:./oci8_oracle11g.sh) -* 3、(可选安装)执行脚本 pureftpd.sh 安装 pure-ftpd-1.0.36。(命令:./pureftpd.sh) -* 4、(可选安装)执行脚本 ZendGuardLoader.sh 安装 Zend Guard Loader。(命令:./ZendGuardLoader.sh) -* 5、(可选安装)执行脚本 ioncube.sh 安装 ionCube PHP Loader。(命令:./ioncube.sh) -* 6、(可选安装)执行脚本 ImageMagick.sh 安装 ImageMagick 的 PHP 扩展。(命令:./ImageMagick.sh) -* 7、(升级脚本)执行脚本 upgrade_php.sh 将会升级 PHP 和 phpMyAdmin 至最新版本。(命令:./upgrade_php.sh | tee upgrade_php.log) -* 8、(升级脚本)执行脚本 upgrade_mysql.sh 将会升级 MySQL 至 5.6.x 的最新版本。(命令:./upgrade_mysql.sh | tee upgrade_mysql.log) -* 9、(升级脚本)执行脚本 upgrade_mariadb.sh 将会升级 MariaDB 至已安装版本相对应的最新版本。(命令:./upgrade_mariadb.sh | tee upgrade_mariadb.log) +* 01、(推荐安装)执行脚本 xcache.sh 安装 xcache 。(命令:./xcache.sh) +* 02、(可选安装)执行脚本 oci8_oracle11g.sh 安装 OCI8 扩展以及 oracle-instantclient11.2(命令:./oci8_oracle11g.sh) +* 03、(可选安装)执行脚本 pureftpd.sh 安装 pure-ftpd-1.0.36。(命令:./pureftpd.sh) +* 04、(可选安装)执行脚本 ZendGuardLoader.sh 安装 Zend Guard Loader。(命令:./ZendGuardLoader.sh) +* 05、(可选安装)执行脚本 ioncube.sh 安装 ionCube PHP Loader。(命令:./ioncube.sh) +* 06、(可选安装)执行脚本 ImageMagick.sh 安装 imagick 的 PHP 扩展。(命令:./ImageMagick.sh) +* 07、(可选安装)执行脚本 opcache.sh 安装 OpCache 的 PHP 扩展。(命令:./opcache.sh) +* 08、(升级脚本)执行脚本 upgrade_php.sh 将会升级 PHP 和 phpMyAdmin 至最新版本。(命令:./upgrade_php.sh | tee upgrade_php.log) +* 09、(升级脚本)执行脚本 upgrade_mysql.sh 将会升级 MySQL 至 5.6.x 的最新版本。(命令:./upgrade_mysql.sh | tee upgrade_mysql.log) +* 10、(升级脚本)执行脚本 upgrade_mariadb.sh 将会升级 MariaDB 至已安装版本相对应的最新版本。(命令:./upgrade_mariadb.sh | tee upgrade_mariadb.log) ### 关于 upgrade_php.sh From b0a98dfa4bdd96c15474ca4d3497f9d3449aa3c1 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:24:47 +0800 Subject: [PATCH 15/19] Update Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 6b7614ea..127402a9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ * 3、优化 MySQL 和 MariaDB 的升级脚本; * 4、优化 ZendGuardLoader,Xcache,OCI8,ionCube PHP Loader,ImageMagick 脚本,对应 PHP 各版本; * 5、升级 Xcache 至版本 3.2.0; +* 6、新增 opcache.sh 脚本,一键安装 Zend OpCache; ###版本`2.9.1`:`Release date:2014/09/22` 更新记录: From af71abba42b889cdca5a5db741e16fc8461f84e3 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:28:12 +0800 Subject: [PATCH 16/19] Update Readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e203806a..19340540 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## 关于本脚本 * 支持 PHP 自带所有组件; * 支持 MySQL ,MariaDB, SQLite 数据库; -* 支持 XCache ,OpCache(可选安装); +* 支持 XCache ,Zend OPcache(可选安装); * 支持 Zend Guard Loader (可选安装); * 支持 OCI8 (可让 PHP 连接 Oracle 数据库,可选安装); * 支持 ionCube PHP Loader (可选安装); @@ -35,7 +35,7 @@ * 08、Zend Guard Loader 3.3( 可选安装) * 09、ionCube PHP Loader 4.6.1 (可选安装) * 10、ImageMagick-6.8.9-8 (可选安装) -* 11、OpCache 7.0.3 (可选安装) +* 11、Zend OPcache 7.0.3 (可选安装) ## 如何安装 ### 事前准备(安装screen、unzip,创建 screen 会话): @@ -63,7 +63,7 @@ * 04、(可选安装)执行脚本 ZendGuardLoader.sh 安装 Zend Guard Loader。(命令:./ZendGuardLoader.sh) * 05、(可选安装)执行脚本 ioncube.sh 安装 ionCube PHP Loader。(命令:./ioncube.sh) * 06、(可选安装)执行脚本 ImageMagick.sh 安装 imagick 的 PHP 扩展。(命令:./ImageMagick.sh) -* 07、(可选安装)执行脚本 opcache.sh 安装 OpCache 的 PHP 扩展。(命令:./opcache.sh) +* 07、(可选安装)执行脚本 opcache.sh 安装 Zend OPcache 的 PHP 扩展。(命令:./opcache.sh) * 08、(升级脚本)执行脚本 upgrade_php.sh 将会升级 PHP 和 phpMyAdmin 至最新版本。(命令:./upgrade_php.sh | tee upgrade_php.log) * 09、(升级脚本)执行脚本 upgrade_mysql.sh 将会升级 MySQL 至 5.6.x 的最新版本。(命令:./upgrade_mysql.sh | tee upgrade_mysql.log) * 10、(升级脚本)执行脚本 upgrade_mariadb.sh 将会升级 MariaDB 至已安装版本相对应的最新版本。(命令:./upgrade_mariadb.sh | tee upgrade_mariadb.log) From dd082f05ee3e42eec02d469cee0f728a2931aa6a Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:28:22 +0800 Subject: [PATCH 17/19] Update Changelog --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 127402a9..0c43c1c7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,7 +6,7 @@ * 3、优化 MySQL 和 MariaDB 的升级脚本; * 4、优化 ZendGuardLoader,Xcache,OCI8,ionCube PHP Loader,ImageMagick 脚本,对应 PHP 各版本; * 5、升级 Xcache 至版本 3.2.0; -* 6、新增 opcache.sh 脚本,一键安装 Zend OpCache; +* 6、新增 opcache.sh 脚本,一键安装 Zend OPcache; ###版本`2.9.1`:`Release date:2014/09/22` 更新记录: From a3a9cfb3675bf23882a4ed85476784f0ba50857b Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 11:29:42 +0800 Subject: [PATCH 18/19] Add opcache.sh --- opcache.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opcache.sh b/opcache.sh index 4dccf5c2..cffab17c 100644 --- a/opcache.sh +++ b/opcache.sh @@ -3,7 +3,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================================== # SYSTEM REQUIRED: CentOS / RedHat / Fedora -# DESCRIPTION: OpCache for LAMP +# DESCRIPTION: OPcache for LAMP # AUTHOR: Teddysun # VISIT: http://teddysun.com/lamp #=============================================================================================== @@ -24,7 +24,7 @@ function create_ini(){ if [ ! -f $PHP_PREFIX/php.d/opcache.ini ]; then echo "OpCache configuration not found, create it!" cat > $PHP_PREFIX/php.d/opcache.ini<<-EOF -[OpCache] +[OPcache] zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/opcache.so opcache.enable_cli=1 opcache.memory_consumption=128 @@ -38,7 +38,7 @@ fi } # install opcache -echo "OpCache install start..." +echo "OPcache install start..." # get PHP version PHP_VER=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}') if [ $? -ne 0 -o -z $PHP_VER ]; then @@ -55,7 +55,7 @@ elif [ $PHP_VER -eq 55 ]; then echo "opcache.so already exists." create_ini /etc/init.d/httpd restart - echo "OpCache install completed..." + echo "OPcache install completed..." exit 0 fi fi @@ -86,5 +86,5 @@ create_ini cd $cur_dir rm -rf $cur_dir/untar/ /etc/init.d/httpd restart -echo "OpCache install completed..." +echo "OPcache install completed..." exit 0 From 9b593190665354537438d9b44ed424e573482ef4 Mon Sep 17 00:00:00 2001 From: Teddysun Date: Wed, 24 Sep 2014 12:46:35 +0800 Subject: [PATCH 19/19] Update Readme --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 19340540..d6efa14f 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,15 @@ * 一键卸载。 ## 将会安装 -* 01、Apache 2.4.10 -* 02、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) -* 03、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) -* 04、phpMyAdmin 4.2.9 -* 05、xcache 3.2.0 (推荐安装) -* 06、OCI8 2.0.8 (可选安装) -* 07、pure-ftpd 1.0.36 (可选安装) -* 08、Zend Guard Loader 3.3( 可选安装) -* 09、ionCube PHP Loader 4.6.1 (可选安装) +* 1、Apache 2.4.10 +* 2、MySQL 5.6.20, MySQL 5.5.39, MariaDB 5.5.39, MariaDB 10.0.13 (四选一安装) +* 3、PHP 5.4.33, PHP 5.3.29, PHP 5.5.17 (三选一安装) +* 4、phpMyAdmin 4.2.9 +* 5、xcache 3.2.0 (推荐安装) +* 6、OCI8 2.0.8 (可选安装) +* 7、pure-ftpd 1.0.36 (可选安装) +* 8、Zend Guard Loader 3.3( 可选安装) +* 9、ionCube PHP Loader 4.6.1 (可选安装) * 10、ImageMagick-6.8.9-8 (可选安装) * 11、Zend OPcache 7.0.3 (可选安装) @@ -57,15 +57,15 @@ ### 安装其它: -* 01、(推荐安装)执行脚本 xcache.sh 安装 xcache 。(命令:./xcache.sh) -* 02、(可选安装)执行脚本 oci8_oracle11g.sh 安装 OCI8 扩展以及 oracle-instantclient11.2(命令:./oci8_oracle11g.sh) -* 03、(可选安装)执行脚本 pureftpd.sh 安装 pure-ftpd-1.0.36。(命令:./pureftpd.sh) -* 04、(可选安装)执行脚本 ZendGuardLoader.sh 安装 Zend Guard Loader。(命令:./ZendGuardLoader.sh) -* 05、(可选安装)执行脚本 ioncube.sh 安装 ionCube PHP Loader。(命令:./ioncube.sh) -* 06、(可选安装)执行脚本 ImageMagick.sh 安装 imagick 的 PHP 扩展。(命令:./ImageMagick.sh) -* 07、(可选安装)执行脚本 opcache.sh 安装 Zend OPcache 的 PHP 扩展。(命令:./opcache.sh) -* 08、(升级脚本)执行脚本 upgrade_php.sh 将会升级 PHP 和 phpMyAdmin 至最新版本。(命令:./upgrade_php.sh | tee upgrade_php.log) -* 09、(升级脚本)执行脚本 upgrade_mysql.sh 将会升级 MySQL 至 5.6.x 的最新版本。(命令:./upgrade_mysql.sh | tee upgrade_mysql.log) +* 1、(推荐安装)执行脚本 xcache.sh 安装 xcache 。(命令:./xcache.sh) +* 2、(可选安装)执行脚本 oci8_oracle11g.sh 安装 OCI8 扩展以及 oracle-instantclient11.2(命令:./oci8_oracle11g.sh) +* 3、(可选安装)执行脚本 pureftpd.sh 安装 pure-ftpd-1.0.36。(命令:./pureftpd.sh) +* 4、(可选安装)执行脚本 ZendGuardLoader.sh 安装 Zend Guard Loader。(命令:./ZendGuardLoader.sh) +* 5、(可选安装)执行脚本 ioncube.sh 安装 ionCube PHP Loader。(命令:./ioncube.sh) +* 6、(可选安装)执行脚本 ImageMagick.sh 安装 imagick 的 PHP 扩展。(命令:./ImageMagick.sh) +* 7、(可选安装)执行脚本 opcache.sh 安装 Zend OPcache 的 PHP 扩展。(命令:./opcache.sh) +* 8、(升级脚本)执行脚本 upgrade_php.sh 将会升级 PHP 和 phpMyAdmin 至最新版本。(命令:./upgrade_php.sh | tee upgrade_php.log) +* 9、(升级脚本)执行脚本 upgrade_mysql.sh 将会升级 MySQL 至 5.6.x 的最新版本。(命令:./upgrade_mysql.sh | tee upgrade_mysql.log) * 10、(升级脚本)执行脚本 upgrade_mariadb.sh 将会升级 MariaDB 至已安装版本相对应的最新版本。(命令:./upgrade_mariadb.sh | tee upgrade_mariadb.log) ### 关于 upgrade_php.sh