From 3f056d00e7cd384ea47739cdf20fd2ef292d880b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Mar 2013 22:54:04 +0800 Subject: [PATCH 001/617] lnmp_v0.1 --- conf/nginx.conf | 83 ++++++++ conf/nginx.sh | 72 +++++++ conf/php-fpm.sh | 67 ++++++ conf/pure-ftpd.conf | 446 +++++++++++++++++++++++++++++++++++++++ conf/pureftpd-mysql.conf | 91 ++++++++ conf/script.mysql | 36 ++++ lnmp_install.sh | 381 +++++++++++++++++++++++++++++++++ 7 files changed, 1176 insertions(+) create mode 100644 conf/nginx.conf create mode 100644 conf/nginx.sh create mode 100755 conf/php-fpm.sh create mode 100644 conf/pure-ftpd.conf create mode 100644 conf/pureftpd-mysql.conf create mode 100644 conf/script.mysql create mode 100644 lnmp_install.sh diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 00000000..0189b2c1 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,83 @@ +user www www; +worker_processes 4; + +error_log logs/error.log crit; +pid logs/nginx.pid; +worker_rlimit_nofile 51200; + +events { + use epoll; + worker_connections 51200; +} + +http { + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 8m; + sendfile on; + tcp_nopush on; + keepalive_timeout 60; + #server_tokens off; + tcp_nodelay on; + +#tomcat add start + client_body_buffer_size 512k; + proxy_connect_timeout 300; + proxy_read_timeout 300; + proxy_send_timeout 300; + proxy_buffer_size 16k; + proxy_buffers 4 64k; + proxy_busy_buffers_size 128k; + proxy_temp_file_write_size 128k; +# upstream tomcat_server { +# server 127.0.0.1:8080; +# } +#tomcat add end + + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; + + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/x-javascript text/css application/xml; + gzip_vary on; + + limit_rate_after 3m; + limit_rate 512k; + +# proxy_temp_path /tmp/proxy_temp_dir; +# proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=cache_one:50m inactive=1d max_size=1g; +###################pureftpd AND phpmyadmin############################ + server { + listen 80; + server_name _; + access_log /dev/null; + root /data/admin; + index index.php; + location ~ .*\.(php|php5)?$ { + #fastcgi_pass unix:/tmp/php-cgi.sock; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi.conf; + } + + location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { + expires 30d; + } + + location ~ .*\.(js|css)?$ { + expires 1h; + } + } +} diff --git a/conf/nginx.sh b/conf/nginx.sh new file mode 100644 index 00000000..cd674d43 --- /dev/null +++ b/conf/nginx.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Nginnx Startup script for the Nginx HTTP Server +# chkconfig: - 60 50 +# description: Nginx is a high-performance web and proxy server. +# processname: nginx +# pidfile: /usr/local/nginx/logs/nginx.pid +# config: /usr/local/nginx/conf/nginx.conf +nginxd=/usr/local/nginx/sbin/nginx +nginx_config=/usr/local/nginx/conf/nginx.conf +nginx_pid=/usr/local/nginx/logs/nginx.pid +RETVAL=0 +prog="nginx" +# Source function library. +. /etc/rc.d/init.d/functions +# Source networking configuration. +. /etc/sysconfig/network +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 +[ -x $nginxd ] || exit 0 +# Start nginx daemons functions. +start() { +if [ -e $nginx_pid ];then + echo "nginx already running...." + exit 1 +fi + echo -n $"Starting $prog: " + daemon $nginxd -c ${nginx_config} + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx + return $RETVAL + } +# Stop nginx daemons functions. +stop() { + echo -n $"Stopping $prog: " + killproc $nginxd + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid + } +# reload nginx service functions. +reload() { + echo -n $"Reloading $prog: " + kill -HUP `cat ${nginx_pid}` + RETVAL=$? + echo + } +# See how we were called. +case "$1" in +start) + start + ;; +stop) + stop + ;; +reload) + reload + ;; +restart) + stop + start + ;; +status) + status $prog + RETVAL=$? + ;; +*) + echo $"Usage: $prog {start|stop|restart|reload|status|help}" + exit 1 + ;; +esac +exit $RETVAL diff --git a/conf/php-fpm.sh b/conf/php-fpm.sh new file mode 100755 index 00000000..238ffe4b --- /dev/null +++ b/conf/php-fpm.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Startup script for the PHP-FPM server. +# +# chkconfig: 345 85 15 +# description: PHP is an HTML-embedded scripting language +# processname: php-fpm +# config: /usr/local/php/lib/php.ini + +# Source function library. +. /etc/rc.d/init.d/functions + +PHP_PATH=/usr/local +DESC="php-fpm daemon" +NAME=php-fpm +# php-fpm path +DAEMON=$PHP_PATH/php/sbin/$NAME +# configuration file +CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf +# PID file +PIDFILE=$PHP_PATH/php/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +rh_start() { + $DAEMON -y $CONFIGFILE || echo -n " already running" +} + +rh_stop() { + kill -QUIT `cat $PIDFILE` || echo -n " not running" +} + +rh_reload() { + kill -HUP `cat $PIDFILE` || echo -n " can't reload" +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + rh_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + rh_stop + echo "." + ;; + reload) + echo -n "Reloading $DESC configuration..." + rh_reload + echo "reloaded." + ;; + restart) + echo -n "Restarting $DESC: $NAME" + rh_stop + sleep 1 + rh_start + echo "." + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 + exit 3 + ;; +esac +exit 0 diff --git a/conf/pure-ftpd.conf b/conf/pure-ftpd.conf new file mode 100644 index 00000000..a32fbb48 --- /dev/null +++ b/conf/pure-ftpd.conf @@ -0,0 +1,446 @@ + +############################################################ +# # +# Configuration file for pure-ftpd wrappers # +# # +############################################################ + +# If you want to run Pure-FTPd with this configuration +# instead of command-line options, please run the +# following command : +# +# /usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf +# +# Please don't forget to have a look at documentation at +# http://www.pureftpd.org/documentation.shtml for a complete list of +# options. + +# Cage in every user in his home directory + +ChrootEveryone yes + + + +# If the previous option is set to "no", members of the following group +# won't be caged. Others will be. If you don't want chroot()ing anyone, +# just comment out ChrootEveryone and TrustedGID. + +# TrustedGID 100 + + + +# Turn on compatibility hacks for broken clients + +BrokenClientsCompatibility no + + + +# Maximum number of simultaneous users + +MaxClientsNumber 50 + + + +# Fork in background + +Daemonize yes + + + +# Maximum number of sim clients with the same IP address + +MaxClientsPerIP 5 + + + +# If you want to log all client commands, set this to "yes". +# This directive can be duplicated to also log server responses. + +VerboseLog no + + + +# List dot-files even when the client doesn't send "-a". + +DisplayDotFiles yes + + + +# Don't allow authenticated users - have a public anonymous FTP only. + +AnonymousOnly no + + + +# Disallow anonymous connections. Only allow authenticated users. + +NoAnonymous yes + + + +# Syslog facility (auth, authpriv, daemon, ftp, security, user, local*) +# The default facility is "ftp". "none" disables logging. + +SyslogFacility ftp + + + +# Display fortune cookies + +# FortunesFile /usr/share/fortune/zippy + + + +# Don't resolve host names in log files. Logs are less verbose, but +# it uses less bandwidth. Set this to "yes" on very busy servers or +# if you don't have a working DNS. + +DontResolve yes + + + +# Maximum idle time in minutes (default = 15 minutes) + +MaxIdleTime 15 + + + +# LDAP configuration file (see README.LDAP) + +# LDAPConfigFile /etc/pureftpd-ldap.conf + + + +# MySQL configuration file (see README.MySQL) + +MySQLConfigFile /usr/local/pureftpd/pureftpd-mysql.conf + + +# Postgres configuration file (see README.PGSQL) + +# PGSQLConfigFile /etc/pureftpd-pgsql.conf + + +# PureDB user database (see README.Virtual-Users) + +# PureDB /etc/pureftpd.pdb + + +# Path to pure-authd socket (see README.Authentication-Modules) + +# ExtAuth /var/run/ftpd.sock + + + +# If you want to enable PAM authentication, uncomment the following line + +# PAMAuthentication yes + + + +# If you want simple Unix (/etc/passwd) authentication, uncomment this + +UnixAuthentication yes + + + +# Please note that LDAPConfigFile, MySQLConfigFile, PAMAuthentication and +# UnixAuthentication can be used only once, but they can be combined +# together. For instance, if you use MySQLConfigFile, then UnixAuthentication, +# the SQL server will be asked. If the SQL authentication fails because the +# user wasn't found, another try # will be done with /etc/passwd and +# /etc/shadow. If the SQL authentication fails because the password was wrong, +# the authentication chain stops here. Authentication methods are chained in +# the order they are given. + + + +# 'ls' recursion limits. The first argument is the maximum number of +# files to be displayed. The second one is the max subdirectories depth + +LimitRecursion 2000 8 + + + +# Are anonymous users allowed to create new directories ? + +AnonymousCanCreateDirs no + + + +# If the system is more loaded than the following value, +# anonymous users aren't allowed to download. + +MaxLoad 4 + + + +# Port range for passive connections replies. - for firewalling. + +PassivePortRange 20000 30000 + + + +# Force an IP address in PASV/EPSV/SPSV replies. - for NAT. +# Symbolic host names are also accepted for gateways with dynamic IP +# addresses. + +# ForcePassiveIP 192.168.0.1 + + + +# Upload/download ratio for anonymous users. + +# AnonymousRatio 1 10 + + + +# Upload/download ratio for all users. +# This directive superscedes the previous one. + +# UserRatio 1 10 + + + +# Disallow downloading of files owned by "ftp", ie. +# files that were uploaded but not validated by a local admin. + +AntiWarez yes + + + +# IP address/port to listen to (default=all IP and port 21). + +# Bind 127.0.0.1,21 + + + +# Maximum bandwidth for anonymous users in KB/s + +# AnonymousBandwidth 8 + + + +# Maximum bandwidth for *all* users (including anonymous) in KB/s +# Use AnonymousBandwidth *or* UserBandwidth, both makes no sense. + +# UserBandwidth 8 + + + +# File creation mask. : . +# 177:077 if you feel paranoid. + +Umask 133:022 + + + +# Minimum UID for an authenticated user to log in. + +MinUID 100 + + + +# Allow FXP transfers for authenticated users. + +AllowUserFXP no + + + +# Allow anonymous FXP for anonymous and non-anonymous users. + +AllowAnonymousFXP no + + + +# Users can't delete/write files beginning with a dot ('.') +# even if they own them. If TrustedGID is enabled, this group +# will have access to dot-files, though. + +ProhibitDotFilesWrite no + + + +# Prohibit *reading* of files beginning with a dot (.history, .ssh...) + +ProhibitDotFilesRead no + + + +# Never overwrite files. When a file whoose name already exist is uploaded, +# it get automatically renamed to file.1, file.2, file.3, ... + +AutoRename no + + + +# Disallow anonymous users to upload new files (no = upload is allowed) + +AnonymousCantUpload no + + + +# Only connections to this specific IP address are allowed to be +# non-anonymous. You can use this directive to open several public IPs for +# anonymous FTP, and keep a private firewalled IP for remote administration. +# You can also only allow a non-routable local IP (like 10.x.x.x) to +# authenticate, and keep a public anon-only FTP server on another IP. + +#TrustedIP 10.1.1.1 + + + +# If you want to add the PID to every logged line, uncomment the following +# line. + +#LogPID yes + + + +# Create an additional log file with transfers logged in a Apache-like format : +# fw.c9x.org - jedi [13/Dec/1975:19:36:39] "GET /ftp/linux.tar.bz2" 200 21809338 +# This log file can then be processed by www traffic analyzers. + +# AltLog clf:/var/log/pureftpd.log + + + +# Create an additional log file with transfers logged in a format optimized +# for statistic reports. + +# AltLog stats:/var/log/pureftpd.log + + + +# Create an additional log file with transfers logged in the standard W3C +# format (compatible with most commercial log analyzers) + +# AltLog w3c:/var/log/pureftpd.log + + + +# Disallow the CHMOD command. Users can't change perms of their files. + +#NoChmod yes + + + +# Allow users to resume and upload files, but *NOT* to delete them. + +#KeepAllFiles yes + + + +# Automatically create home directories if they are missing + +CreateHomeDir no + + + +# Enable virtual quotas. The first number is the max number of files. +# The second number is the max size of megabytes. +# So 1000:10 limits every user to 1000 files and 10 Mb. + +#Quota 1000:10 + + + +# If your pure-ftpd has been compiled with standalone support, you can change +# the location of the pid file. The default is /var/run/pure-ftpd.pid + +#PIDFile /var/run/pure-ftpd.pid + + + +# If your pure-ftpd has been compiled with pure-uploadscript support, +# this will make pure-ftpd write info about new uploads to +# /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and +# spawn a script to handle the upload. + +#CallUploadScript yes + + + +# This option is useful with servers where anonymous upload is +# allowed. As /var/ftp is in /var, it save some space and protect +# the log files. When the partition is more that X percent full, +# new uploads are disallowed. + +MaxDiskUsage 99 + + + +# Set to 'yes' if you don't want your users to rename files. + +#NoRename yes + + + +# Be 'customer proof' : workaround against common customer mistakes like +# 'chmod 0 public_html', that are valid, but that could cause ignorant +# customers to lock their files, and then keep your technical support busy +# with silly issues. If you're sure all your users have some basic Unix +# knowledge, this feature is useless. If you're a hosting service, enable it. + +CustomerProof yes + + + +# Per-user concurrency limits. It will only work if the FTP server has +# been compiled with --with-peruserlimits (and this is the case on +# most binary distributions) . +# The format is : : +# For instance, 3:20 means that the same authenticated user can have 3 active +# sessions max. And there are 20 anonymous sessions max. + +# PerUserLimits 3:20 + + + +# When a file is uploaded and there is already a previous version of the file +# with the same name, the old file will neither get removed nor truncated. +# Upload will take place in a temporary file and once the upload is complete, +# the switch to the new version will be atomic. For instance, when a large PHP +# script is being uploaded, the web server will still serve the old version and +# immediatly switch to the new one as soon as the full file will have been +# transfered. This option is incompatible with virtual quotas. + +# NoTruncate yes + + + +# This option can accept three values : +# 0 : disable SSL/TLS encryption layer (default). +# 1 : accept both traditional and encrypted sessions. +# 2 : refuse connections that don't use SSL/TLS security mechanisms, +# including anonymous sessions. +# Do _not_ uncomment this blindly. Be sure that : +# 1) Your server has been compiled with SSL/TLS support (--with-tls), +# 2) A valid certificate is in place, +# 3) Only compatible clients will log in. + +# TLS 1 + + + +# Listen only to IPv4 addresses in standalone mode (ie. disable IPv6) +# By default, both IPv4 and IPv6 are enabled. + +# IPV4Only yes + + + +# Listen only to IPv6 addresses in standalone mode (ie. disable IPv4) +# By default, both IPv4 and IPv6 are enabled. + +# IPV6Only yes + +# UTF-8 support for file names (RFC 2640) +# Define charset of the server filesystem and optionnally the default charset +# for remote clients if they don't use UTF-8. +# Works only if pure-ftpd has been compiled with --with-rfc2640 + +# FileSystemCharset big5 +# ClientCharset big5 +AllowOverwrite on +AllowStoreRestart on \ No newline at end of file diff --git a/conf/pureftpd-mysql.conf b/conf/pureftpd-mysql.conf new file mode 100644 index 00000000..9670bfff --- /dev/null +++ b/conf/pureftpd-mysql.conf @@ -0,0 +1,91 @@ +# If you want to use the Socket connect methode comment out the +# Lines with MMYSQLServer and MYSQLPort. +# If you want to use the Port methode comment out the MYSQLSocket line +#//IMPORTENT!!!If display 530 error,please check the following MYSQL parameter!! +MYSQLSocket /data/mysql.sock +MYSQLServer localhost +MYSQLPort 3306 +MYSQLUser ftp +MYSQLPassword tmppasswd +MYSQLDatabase ftpusers +MYSQLCrypt md5 + +# In the following directives, parts of the strings are replaced at +# run-time before performing queries : +# +# \L is replaced by the login of the user trying to authenticate. +# \I is replaced by the IP address the user connected to. +# \P is replaced by the port number the user connected to. +# \R is replaced by the IP address the user connected from. +# \D is replaced by the remote IP address, as a long decimal number. +# +# Very complex queries can be performed using these substitution strings, +# especially for virtual hosting. + + +# Query to execute in order to fetch the password + +MYSQLGetPW SELECT Password FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") + + +# Query to execute in order to fetch the system user name or uid + +MYSQLGetUID SELECT Uid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") + + +# Optional : default UID - if set this overrides MYSQLGetUID + +#MYSQLDefaultUID 1000 + + +# Query to execute in order to fetch the system user group or gid + +MYSQLGetGID SELECT Gid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") + +# Optional : default GID - if set this overrides MYSQLGetGID + +#MYSQLDefaultGID 1000 + + +# Query to execute in order to fetch the home directory + +MYSQLGetDir SELECT Dir FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") + +# Optional : query to get the maximal number of files +# Pure-FTPd must have been compiled with virtual quotas support. + +# MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L" + +# Optional : query to get the maximal disk usage (virtual quotas) +# The number should be in Megabytes. +# Pure-FTPd must have been compiled with virtual quotas support. + +# MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L" + + +# Optional : ratios. The server has to be compiled with ratio support. + +# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L" +# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L" + + +# Optional : bandwidth throttling. +# The server has to be compiled with throttling support. +# Values are in KB/s . + +MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") +MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R") + +# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS : +# 1) You know what you are doing. +# 2) Real and virtual users match. + +# MySQLForceTildeExpansion 1 + + +# If you upgraded your tables to transactionnal tables (Gemini, +# BerkeleyDB, Innobase...), you can enable SQL transactions to +# avoid races. Leave this commented if you are using the +# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions. + +# MySQLTransactions On diff --git a/conf/script.mysql b/conf/script.mysql new file mode 100644 index 00000000..4b1c5ec5 --- /dev/null +++ b/conf/script.mysql @@ -0,0 +1,36 @@ +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "grant all privileges on ftpusers.* to ftp@localhost identified by 'mysqlftppwd'" +FLUSH PRIVILEGES; + +CREATE DATABASE ftpusers; + +USE ftpusers; + +-- Table structure for table 'admin' +CREATE TABLE admin ( + Username varchar(35) NOT NULL default '', + Password char(32) binary NOT NULL default '', + PRIMARY KEY (Username) +); + +-- Data for table 'admin' +INSERT INTO admin VALUES ('Administrator',MD5('ftpmanagerpwd')); + +-- Table structure for table 'users' +CREATE TABLE `users` ( + `User` varchar(16) NOT NULL default '', + `Password` varchar(32) binary NOT NULL default '', + `Uid` int(11) NOT NULL default '501', + `Gid` int(11) NOT NULL default '501', + `Dir` varchar(128) NOT NULL default '', + `QuotaFiles` int(10) NOT NULL default '5000', + `QuotaSize` int(10) NOT NULL default '100', + `ULBandwidth` int(10) NOT NULL default '200', + `DLBandwidth` int(10) NOT NULL default '200', + `Ipaddress` varchar(15) NOT NULL default '*', + `Comment` tinytext, + `Status` enum('0','1') NOT NULL default '1', + `ULRatio` smallint(5) NOT NULL default '1', + `DLRatio` smallint(5) NOT NULL default '1', + PRIMARY KEY (`User`), + UNIQUE KEY `User` (`User`) +); diff --git a/lnmp_install.sh b/lnmp_install.sh new file mode 100644 index 00000000..5b40ae3b --- /dev/null +++ b/lnmp_install.sh @@ -0,0 +1,381 @@ +#!/bin/bash +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 + +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced + +# Set password +while : +do + read -p "Please input the root password of MySQL:" mysqlrootpwd + read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd + if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then + break + else + echo "least 5 characters" + fi +done + +# install MySQL +mkdir -p /root/lnmp/source +cd /root/lnmp/source +wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +wget -c http://sourceforge.net/projects/mysql.mirror/files/MySQL%205.5.30/mysql-5.5.30.tar.gz/download +useradd -M -s /sbin/nologin mysql +mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql +tar xzf cmake-2.8.10.2.tar.gz +cd cmake-2.8.10.2 +./configure +make && make install +cd .. +tar zxf mysql-5.5.30.tar.gz +cd mysql-5.5.30 +cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ +-DMYSQL_DATADIR=/data/mysql \ +-DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DMYSQL_TCP_PORT=3306 \ +-DCMAKE_THREAD_PREFER_PTHREAD=1 \ +-DEXTRA_CHARSETS=all \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \ +-DWITH_DEBUG=0 +make && make install + +/bin/cp support-files/my-medium.cnf /etc/my.cnf +cp support-files/mysql.server /etc/init.d/mysqld +chmod 755 /etc/init.d/mysqld +chkconfig --add mysqld +chkconfig mysqld on +cd .. + +# Modify my.cf +sed -i '38a ##############' /etc/my.cnf +sed -i '39a skip-name-resolve' /etc/my.cnf +sed -i '40a basedir=/usr/local/mysql' /etc/my.cnf +sed -i '41a datadir=/data/mysql' /etc/my.cnf +sed -i '42a user=mysql' /etc/my.cnf +sed -i '43a #lower_case_table_names = 1' /etc/my.cnf +sed -i '44a max_connections=1000' /etc/my.cnf +sed -i '45a ft_min_word_len=1' /etc/my.cnf +sed -i '46a expire_logs_days = 7' /etc/my.cnf +sed -i '47a query_cache_size=64M' /etc/my.cnf +sed -i '48a query_cache_type=1' /etc/my.cnf +sed -i '49a ##############' /etc/my.cnf + +/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql + +chown mysql.mysql -R /data/mysql +/sbin/service mysqld start +echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile +source /etc/profile + +/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" +/usr/local/mysql/bin/mysql -e "flush privileges;" +/usr/local/mysql/bin/mysql -e "delete from mysql.user where password='';" + +/sbin/service mysqld restart + +# install PHP +wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +/sbin/ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 +else + ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 +fi + +wget -c http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=&ts=1364652239&use_mirror=jaist +tar xzf mcrypt-2.6.8.tar.gz +cd mcrypt-2.6.8 +/sbin/ldconfig +./configure +make && make install +cd ../ + +wget -c http://www.php.net/get/php-5.3.23.tar.gz/from/cn2.php.net/mirror +tar xzf php-5.3.23.tar.gz +useradd -M -s /sbin/nologin www +cd php-5.3.23 +./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --enable-zip --enable-soap --disable-debug +make ZEND_EXTRA_LIBS='-liconv' +make install +cp php.ini-production /usr/local/php/lib/php.ini +cd ../ + +wget -c http://pecl.php.net/get/memcache-2.2.5.tgz +tar xzf memcache-2.2.5.tgz +cd memcache-2.2.5 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +wget -c http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2/download +tar xjf eaccelerator-0.9.6.1.tar.bz2 +cd eaccelerator-0.9.6.1 +/usr/local/php/bin/phpize +./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +wget -c http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz +tar xzf PDO_MYSQL-1.0.2.tgz +cd PDO_MYSQL-1.0.2 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql +make && make install +cd ../ + +wget -c http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz +tar xzf ImageMagick-6.8.3-10.tar.gz +cd ImageMagick-6.8.3-10 +./configure +make && make install +cd ../ + +wget -c http://pecl.php.net/get/imagick-3.0.1.tgz +tar xzf imagick-3.0.1.tgz +cd imagick-3.0.1 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Support HTTP request curls +wget -c http://pecl.php.net/get/pecl_http-1.7.5.tgz +tar xzf pecl_http-1.7.5.tgz +cd pecl_http-1.7.5 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Modify php.ini +mkdir /tmp/eaccelerator +/bin/chown -R www.www /tmp/eaccelerator/ +sed -i '808a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"' /usr/local/php/lib/php.ini +sed -i '809a extension = "memcache.so"' /usr/local/php/lib/php.ini +sed -i '810a extension = "pdo_mysql.so"' /usr/local/php/lib/php.ini +sed -i '811a extension = "imagick.so"' /usr/local/php/lib/php.ini +sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini +sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini +sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini +sed -i 's@short_open_tag = Off@short_open_tag = On@g' /usr/local/php/lib/php.ini +sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@g' /usr/local/php/lib/php.ini +sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@g' /usr/local/php/lib/php.ini +echo '[eaccelerator] +zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" +eaccelerator.shm_size="64" +eaccelerator.cache_dir="/tmp/eaccelerator" +eaccelerator.enable="1" +eaccelerator.optimizer="1" +eaccelerator.check_mtime="1" +eaccelerator.debug="0" +eaccelerator.filter="" +eaccelerator.shm_max="0" +eaccelerator.shm_ttl="0" +eaccelerator.shm_prune_period="0" +eaccelerator.shm_only="0" +eaccelerator.compress="0" +eaccelerator.compress_level="9" +eaccelerator.keys = "disk_only" +eaccelerator.sessions = "disk_only" +eaccelerator.content = "disk_only"' >> /usr/local/php/lib/php.ini + +cat > /usr/local/php/etc/php-fpm.conf <' > /data/admin/index.php +cd ../ +echo "################Congratulations####################" +echo "The path of some dirs:" +echo "Nginx dir: /usr/local/nginx" +echo "MySQL dir: /usr/local/mysql" +echo "PHP dir: /usr/local/php" +echo "Pureftpd dir: /usr/local/pureftpd" +echo "Pureftp_php_manager dir : /data/admin" +echo "MySQL Password: $mysqlrootpwd" +echo "Pureftp_manager url : http://`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`/ftp" +echo "Pureftp_manager Password: $ftpmanagerpwd" +echo "###################################################" From 0ab7c2aa7693dfd40642bd21f816e54529634c9d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Mar 2013 23:04:28 +0800 Subject: [PATCH 002/617] Create README.md --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..1a54d89d --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +Source packages version: +cmake-2.8.10.2.tar.gz +mysql-5.5.30.tar.gz +libiconv-1.14.tar.gz +libmcrypt-2.5.8.tar.gz +mhash-0.9.9.9.tar.gz +mcrypt-2.6.8.tar.gz +php-5.3.23.tar.gz +memcache-2.2.5.tgz +eaccelerator-0.9.6.1.tar.bz2 +PDO_MYSQL-1.0.2.tgz +ImageMagick-6.8.3-10.tar.gz +imagick-3.0.1.tgz +pecl_http-1.7.5.tgz +pcre-8.32.tar.gz +ngx_cache_purge-2.1.tar.gz +nginx-1.2.7.tar.gz +pure-ftpd-1.0.36.tar.gz +ftp_v2.1.tar.gz From 418366639fc47a1063b49b8ff52f83882c9e100d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 2 Apr 2013 15:14:33 +0800 Subject: [PATCH 003/617] lnmp_v0.1 --- conf/pureftpd-mysql.conf | 2 +- conf/script.mysql | 2 +- lnmp_install.sh | 43 ++++++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/conf/pureftpd-mysql.conf b/conf/pureftpd-mysql.conf index 9670bfff..4d0270f1 100644 --- a/conf/pureftpd-mysql.conf +++ b/conf/pureftpd-mysql.conf @@ -2,7 +2,7 @@ # Lines with MMYSQLServer and MYSQLPort. # If you want to use the Port methode comment out the MYSQLSocket line #//IMPORTENT!!!If display 530 error,please check the following MYSQL parameter!! -MYSQLSocket /data/mysql.sock +MYSQLSocket /data/mysql/mysql.sock MYSQLServer localhost MYSQLPort 3306 MYSQLUser ftp diff --git a/conf/script.mysql b/conf/script.mysql index 4b1c5ec5..3ea19014 100644 --- a/conf/script.mysql +++ b/conf/script.mysql @@ -1,4 +1,4 @@ -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "grant all privileges on ftpusers.* to ftp@localhost identified by 'mysqlftppwd'" +grant all privileges on ftpusers.* to ftp@localhost identified by 'mysqlftppwd'; FLUSH PRIVILEGES; CREATE DATABASE ftpusers; diff --git a/lnmp_install.sh b/lnmp_install.sh index 5b40ae3b..4bea44e0 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -2,8 +2,6 @@ # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 -yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced - # Set password while : do @@ -16,11 +14,13 @@ do fi done +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced + # install MySQL mkdir -p /root/lnmp/source cd /root/lnmp/source wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -wget -c http://sourceforge.net/projects/mysql.mirror/files/MySQL%205.5.30/mysql-5.5.30.tar.gz/download +wget -c http://iweb.dl.sourceforge.net/project/mysql.mirror/MySQL%205.5.30/mysql-5.5.30.tar.gz useradd -M -s /sbin/nologin mysql mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql tar xzf cmake-2.8.10.2.tar.gz @@ -69,13 +69,13 @@ sed -i '49a ##############' /etc/my.cnf chown mysql.mysql -R /data/mysql /sbin/service mysqld start +export PATH=$PATH:/usr/local/mysql/bin echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile source /etc/profile /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" /usr/local/mysql/bin/mysql -e "flush privileges;" -/usr/local/mysql/bin/mysql -e "delete from mysql.user where password='';" - +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" /sbin/service mysqld restart # install PHP @@ -86,7 +86,7 @@ cd libiconv-1.14 make && make install cd ../ -wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download +wget -c http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure @@ -97,7 +97,7 @@ cd libltdl/ make && make install cd ../../ -wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download +wget -c http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz tar xzf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure @@ -116,6 +116,8 @@ if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 + cp -frp /usr/lib64/libldap* /usr/lib else ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so @@ -130,7 +132,7 @@ else ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 fi -wget -c http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=&ts=1364652239&use_mirror=jaist +wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz tar xzf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8 /sbin/ldconfig @@ -138,7 +140,7 @@ cd mcrypt-2.6.8 make && make install cd ../ -wget -c http://www.php.net/get/php-5.3.23.tar.gz/from/cn2.php.net/mirror +wget -c http://cn2.php.net/distributions/php-5.3.23.tar.gz tar xzf php-5.3.23.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.23 @@ -156,7 +158,7 @@ cd memcache-2.2.5 make && make install cd ../ -wget -c http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2/download +wget -c http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 tar xjf eaccelerator-0.9.6.1.tar.bz2 cd eaccelerator-0.9.6.1 /usr/local/php/bin/phpize @@ -207,6 +209,7 @@ sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini sed -i 's@short_open_tag = Off@short_open_tag = On@g' /usr/local/php/lib/php.ini +sed -i 's@expose_php = On@expose_php = Off@g' /usr/local/php/lib/php.ini sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@g' /usr/local/php/lib/php.ini sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@g' /usr/local/php/lib/php.ini echo '[eaccelerator] @@ -287,7 +290,7 @@ EOF # /etc/init.d/php-fpm mkdir ../conf cd ../conf -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/php-fpm.sh +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/php-fpm.sh cp php-fpm.sh /etc/init.d/php-fpm chmod 755 /etc/init.d/php-fpm chkconfig php-fpm on @@ -295,7 +298,7 @@ service php-fpm start # install Nginx cd ../source -wget -c http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.gz/download +wget -c http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz tar xzf pcre-8.32.tar.gz cd pcre-8.32 ./configure @@ -315,15 +318,16 @@ sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Apache/" ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module make && make install cd ../../conf -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/nginx.sh +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/nginx.sh cp nginx.sh /etc/init.d/nginx chmod 755 /etc/init.d/nginx chkconfig --add nginx chkconfig nginx on mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/nginx.conf +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf cp nginx.conf /usr/local/nginx/conf/nginx.conf echo "Modify nginx.conf" +service nginx restart # install Pureftpd and pureftpd_php_manager cd ../source @@ -343,21 +347,22 @@ chkconfig --add pureftpd chkconfig pureftpd on cd ../conf -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/pure-ftpd.conf +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf cp pure-ftpd.conf /usr/local/pureftpd/ -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/pureftpd-mysql.conf +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf cp pureftpd-mysql.conf /usr/local/pureftpd/ mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -wget -c https://github.com/lj2007331/lnmp/blob/master/conf/script.mysql -sed -i "1i\mysqlrootpwd=$mysqlrootpwd" script.mysql +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql +service pureftpd start mkdir -p /data/admin +cd .. wget -c http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz -unzip -q ftp_v2.1.tar.gz +tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php sed -i "s/myipaddress.com/`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`/g" /data/admin/ftp/config.php From aeb2c06ebd865994479b998bca52e40ffa4fef7a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 3 Apr 2013 11:50:56 +0800 Subject: [PATCH 004/617] =?UTF-8?q?=E2=80=9Clnmp=5Fv0.1=E2=80=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 4bea44e0..14a16589 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -360,7 +360,7 @@ sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql service pureftpd start mkdir -p /data/admin -cd .. +cd ../source wget -c http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin From 7028e36eac69fe0d83ca42c7b21aecd2542511dc Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 4 Apr 2013 11:13:26 +0800 Subject: [PATCH 005/617] update nginx version --- lnmp_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 14a16589..4572cd81 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -307,9 +307,9 @@ cd ../ #wget -c http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz #tar xzf ngx_cache_purge-2.1.tar.gz -wget -c http://nginx.org/download/nginx-1.2.7.tar.gz -tar xzf nginx-1.2.7.tar.gz -cd nginx-1.2.7 +wget -c http://nginx.org/download/nginx-1.2.8.tar.gz +tar xzf nginx-1.2.8.tar.gz +cd nginx-1.2.8 # Modify Nginx version sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "2.2.14"@g' src/core/nginx.h From 70c4bb3420c2c6814f4c9bca47433c2b87506643 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 10 Apr 2013 22:51:26 +0800 Subject: [PATCH 006/617] =?UTF-8?q?=E2=80=9Clnmp=5Fv0.1=E2=80=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lnmp_install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 4572cd81..5d001b58 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -130,6 +130,9 @@ else ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig fi wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz @@ -348,12 +351,12 @@ chkconfig pureftpd on cd ../conf wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -cp pure-ftpd.conf /usr/local/pureftpd/ wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -cp pureftpd-mysql.conf /usr/local/pureftpd/ +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +/bin/cp pure-ftpd.conf /usr/local/pureftpd/ +/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql @@ -365,7 +368,8 @@ wget -c http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -sed -i "s/myipaddress.com/`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`/g" /data/admin/ftp/config.php +IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` +sed -i 's/myipaddress.com/'$IP'/g' /data/admin/ftp/config.php sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php rm -rf /data/admin/ftp/install.php @@ -381,6 +385,6 @@ echo "PHP dir: /usr/local/php" echo "Pureftpd dir: /usr/local/pureftpd" echo "Pureftp_php_manager dir : /data/admin" echo "MySQL Password: $mysqlrootpwd" -echo "Pureftp_manager url : http://`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`/ftp" +echo "Pureftp_manager url : http://$IP/ftp" echo "Pureftp_manager Password: $ftpmanagerpwd" echo "###################################################" From 6715ce6cad19bcc5c057efadc3c3d1acdcfe4255 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 11:57:02 +0800 Subject: [PATCH 007/617] lnmp_v0.1 --- lnmp_install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 5d001b58..14735802 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,7 +14,7 @@ do fi done -yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced zip unzip # install MySQL mkdir -p /root/lnmp/source @@ -74,7 +74,6 @@ echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile source /etc/profile /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" -/usr/local/mysql/bin/mysql -e "flush privileges;" /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" /sbin/service mysqld restart @@ -132,7 +131,6 @@ else ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig fi wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz @@ -186,6 +184,7 @@ cd ../ wget -c http://pecl.php.net/get/imagick-3.0.1.tgz tar xzf imagick-3.0.1.tgz +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cd imagick-3.0.1 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config From b3ab2875c5b20e86585324e95af851412f3ea120 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 20:05:56 +0800 Subject: [PATCH 008/617] lnmp_v01 --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 14735802..679be65a 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -115,7 +115,7 @@ if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 - ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 cp -frp /usr/lib64/libldap* /usr/lib else ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la @@ -131,6 +131,7 @@ else ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig fi wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz @@ -184,7 +185,6 @@ cd ../ wget -c http://pecl.php.net/get/imagick-3.0.1.tgz tar xzf imagick-3.0.1.tgz -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cd imagick-3.0.1 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config From 3a1b82504280430e800cbd18a0d1df68a47d44cb Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 20:37:13 +0800 Subject: [PATCH 009/617] php-5.3.24 --- lnmp_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 679be65a..7ed116f0 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -142,10 +142,10 @@ cd mcrypt-2.6.8 make && make install cd ../ -wget -c http://cn2.php.net/distributions/php-5.3.23.tar.gz -tar xzf php-5.3.23.tar.gz +wget -c http://cn2.php.net/distributions/php-5.3.24.tar.gz +tar xzf php-5.3.24.tar.gz useradd -M -s /sbin/nologin www -cd php-5.3.23 +cd php-5.3.24 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install From 00e7b4bc7da50aea1ee3f89a54c0e7f75092b1bb Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 20:43:57 +0800 Subject: [PATCH 010/617] php-5.3.24 --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 7ed116f0..7d3b9d10 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -142,7 +142,7 @@ cd mcrypt-2.6.8 make && make install cd ../ -wget -c http://cn2.php.net/distributions/php-5.3.24.tar.gz +wget -c http://kr1.php.net/distributions/php-5.3.24.tar.gz tar xzf php-5.3.24.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.24 From 86cd0819204315eef0ddc59d5d87aaff2a5a35ba Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 21:18:22 +0800 Subject: [PATCH 011/617] php-3.2.24 --- conf/nginx.conf | 2 +- lnmp_install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0189b2c1..b5004550 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -20,7 +20,7 @@ http { sendfile on; tcp_nopush on; keepalive_timeout 60; - #server_tokens off; + server_tokens off; tcp_nodelay on; #tomcat add start diff --git a/lnmp_install.sh b/lnmp_install.sh index 7d3b9d10..1c301e1b 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -348,7 +348,7 @@ chmod +x /etc/init.d/pureftpd chkconfig --add pureftpd chkconfig pureftpd on -cd ../conf +cd ../../conf wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf wget -c https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql From 0e4ef07d2e2b9d438f0feaea731531d07b225f44 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Apr 2013 23:19:02 +0800 Subject: [PATCH 012/617] lnmp_v01 --- lnmp_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 1c301e1b..abdf781b 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -116,6 +116,7 @@ if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick cp -frp /usr/lib64/libldap* /usr/lib else ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la @@ -131,7 +132,6 @@ else ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig fi wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz @@ -186,6 +186,7 @@ cd ../ wget -c http://pecl.php.net/get/imagick-3.0.1.tgz tar xzf imagick-3.0.1.tgz cd imagick-3.0.1 +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install From 3df294cd21759319b78f1a63a000cd1c37f684f3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 12 Apr 2013 09:54:57 +0800 Subject: [PATCH 013/617] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a54d89d..e3f45dd6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.23.tar.gz +php-5.3.24.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz @@ -14,6 +14,6 @@ imagick-3.0.1.tgz pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz -nginx-1.2.7.tar.gz +nginx-1.2.8.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz From d260f4911528f111a9145498fc3d7785d7cc2219 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 15 Apr 2013 12:37:22 +0800 Subject: [PATCH 014/617] lnmp_v01 --- lnmp_install.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index abdf781b..c656b2f4 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -17,7 +17,7 @@ done yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced zip unzip # install MySQL -mkdir -p /root/lnmp/source +mkdir -p /root/lnmp/{source,conf} cd /root/lnmp/source wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz wget -c http://iweb.dl.sourceforge.net/project/mysql.mirror/MySQL%205.5.30/mysql-5.5.30.tar.gz @@ -291,7 +291,6 @@ env[TEMP] = /tmp EOF # /etc/init.d/php-fpm -mkdir ../conf cd ../conf wget -c https://raw.github.com/lj2007331/lnmp/master/conf/php-fpm.sh cp php-fpm.sh /etc/init.d/php-fpm @@ -329,7 +328,23 @@ chkconfig nginx on mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk wget -c https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf cp nginx.conf /usr/local/nginx/conf/nginx.conf -echo "Modify nginx.conf" + +#logrotate nginx log +cat > /etc/logrotate.d/nginx < Date: Mon, 15 Apr 2013 12:40:39 +0800 Subject: [PATCH 015/617] lnmp_v01 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a54d89d..e3f45dd6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.23.tar.gz +php-5.3.24.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz @@ -14,6 +14,6 @@ imagick-3.0.1.tgz pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz -nginx-1.2.7.tar.gz +nginx-1.2.8.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz From 9c469e5f6b6cc81ee12b3ee2f679b95fb12ab4ea Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 22 Apr 2013 13:07:33 +0800 Subject: [PATCH 016/617] MySQL Version update --- README.md | 2 +- lnmp_install.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e3f45dd6..739c6f56 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Source packages version: cmake-2.8.10.2.tar.gz -mysql-5.5.30.tar.gz +mysql-5.5.31.tar.gz libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz diff --git a/lnmp_install.sh b/lnmp_install.sh index c656b2f4..297b52e0 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -20,7 +20,7 @@ yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel fr mkdir -p /root/lnmp/{source,conf} cd /root/lnmp/source wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -wget -c http://iweb.dl.sourceforge.net/project/mysql.mirror/MySQL%205.5.30/mysql-5.5.30.tar.gz +wget -c http://fossies.org/linux/misc/mysql-5.5.31.tar.gz useradd -M -s /sbin/nologin mysql mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql tar xzf cmake-2.8.10.2.tar.gz @@ -28,8 +28,8 @@ cd cmake-2.8.10.2 ./configure make && make install cd .. -tar zxf mysql-5.5.30.tar.gz -cd mysql-5.5.30 +tar zxf mysql-5.5.31.tar.gz +cd mysql-5.5.31 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ -DMYSQL_DATADIR=/data/mysql \ -DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ @@ -146,7 +146,7 @@ wget -c http://kr1.php.net/distributions/php-5.3.24.tar.gz tar xzf php-5.3.24.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.24 -./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --enable-zip --enable-soap --disable-debug +./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-production /usr/local/php/lib/php.ini From 3f0f5fc66faee86c954a2ceb8b75920d6adc20a3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 24 Apr 2013 15:28:51 +0800 Subject: [PATCH 017/617] added gettext --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 297b52e0..257d4149 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,7 +14,7 @@ do fi done -yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced zip unzip +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced zip unzip # install MySQL mkdir -p /root/lnmp/{source,conf} @@ -146,7 +146,7 @@ wget -c http://kr1.php.net/distributions/php-5.3.24.tar.gz tar xzf php-5.3.24.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.24 -./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --enable-zip --enable-soap --disable-debug +./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-production /usr/local/php/lib/php.ini From 84a193489dc3b692e8301ae0c805a3303699c7ec Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 25 Apr 2013 09:28:26 +0800 Subject: [PATCH 018/617] nginx version update --- lnmp_install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 257d4149..e162a3f0 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -36,7 +36,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_TCP_PORT=3306 \ --DCMAKE_THREAD_PREFER_PTHREAD=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ @@ -309,9 +308,9 @@ cd ../ #wget -c http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz #tar xzf ngx_cache_purge-2.1.tar.gz -wget -c http://nginx.org/download/nginx-1.2.8.tar.gz -tar xzf nginx-1.2.8.tar.gz -cd nginx-1.2.8 +wget -c http://nginx.org/download/nginx-1.4.0.tar.gz +tar xzf nginx-1.4.0.tar.gz +cd nginx-1.4.0 # Modify Nginx version sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "2.2.14"@g' src/core/nginx.h From 6725a7f48d80270519fae4553dabe689d924eced Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 6 May 2013 22:11:15 +0800 Subject: [PATCH 019/617] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 739c6f56..624262cd 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,6 @@ imagick-3.0.1.tgz pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz -nginx-1.2.8.tar.gz +nginx-1.4.0.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz From c0602c676b88fdb545b9a9a004757eba2cc083b7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 May 2013 09:34:33 +0800 Subject: [PATCH 020/617] nginx version --- README.md | 2 +- conf/nginx.conf | 88 ++++++++++++++++++++++++------------------------- lnmp_install.sh | 6 ++-- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 739c6f56..bb52a768 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,6 @@ imagick-3.0.1.tgz pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz -nginx-1.2.8.tar.gz +nginx-1.4.1.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz diff --git a/conf/nginx.conf b/conf/nginx.conf index b5004550..d656663b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,58 +6,58 @@ pid logs/nginx.pid; worker_rlimit_nofile 51200; events { - use epoll; - worker_connections 51200; + use epoll; + worker_connections 51200; } http { - include mime.types; - default_type application/octet-stream; - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 8m; - sendfile on; - tcp_nopush on; - keepalive_timeout 60; - server_tokens off; - tcp_nodelay on; + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 8m; + sendfile on; + tcp_nopush on; + keepalive_timeout 60; + server_tokens off; + tcp_nodelay on; -#tomcat add start - client_body_buffer_size 512k; - proxy_connect_timeout 300; - proxy_read_timeout 300; - proxy_send_timeout 300; - proxy_buffer_size 16k; - proxy_buffers 4 64k; - proxy_busy_buffers_size 128k; - proxy_temp_file_write_size 128k; -# upstream tomcat_server { -# server 127.0.0.1:8080; -# } -#tomcat add end +#tomcat proxy add start +# client_body_buffer_size 512k; +# proxy_connect_timeout 300; +# proxy_read_timeout 300; +# proxy_send_timeout 300; +# proxy_buffer_size 16k; +# proxy_buffers 4 64k; +# proxy_busy_buffers_size 128k; +# proxy_temp_file_write_size 128k; +# upstream tomcat_server { +# server 127.0.0.1:8080; +# } +#tomcat proxy add end - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.1; - gzip_comp_level 2; - gzip_types text/plain application/x-javascript text/css application/xml; - gzip_vary on; + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/x-javascript text/css application/xml; + gzip_vary on; - limit_rate_after 3m; - limit_rate 512k; + limit_rate_after 3m; + limit_rate 512k; -# proxy_temp_path /tmp/proxy_temp_dir; -# proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=cache_one:50m inactive=1d max_size=1g; +# proxy_temp_path /tmp/proxy_temp_dir; +# proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=cache_one:50m inactive=1d max_size=1g; ###################pureftpd AND phpmyadmin############################ server { listen 80; diff --git a/lnmp_install.sh b/lnmp_install.sh index e162a3f0..ec8d8609 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -308,9 +308,9 @@ cd ../ #wget -c http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz #tar xzf ngx_cache_purge-2.1.tar.gz -wget -c http://nginx.org/download/nginx-1.4.0.tar.gz -tar xzf nginx-1.4.0.tar.gz -cd nginx-1.4.0 +wget -c http://nginx.org/download/nginx-1.4.1.tar.gz +tar xzf nginx-1.4.1.tar.gz +cd nginx-1.4.1 # Modify Nginx version sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "2.2.14"@g' src/core/nginx.h From c6a85ab5b83b12570a6f320fbba094d19af5cde9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 May 2013 10:32:05 +0800 Subject: [PATCH 021/617] init Script --- README.md | 3 -- conf/init.d.nginx | 129 ++++++++++++++++++++++++++++++++++++++++++++++ lnmp_install.sh | 18 +++---- 3 files changed, 138 insertions(+), 12 deletions(-) create mode 100755 conf/init.d.nginx diff --git a/README.md b/README.md index 3bbe5a63..599daab5 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,7 @@ imagick-3.0.1.tgz pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz -<<<<<<< HEAD nginx-1.4.1.tar.gz -======= nginx-1.4.0.tar.gz ->>>>>>> 6725a7f48d80270519fae4553dabe689d924eced pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz diff --git a/conf/init.d.nginx b/conf/init.d.nginx new file mode 100755 index 00000000..049962d4 --- /dev/null +++ b/conf/init.d.nginx @@ -0,0 +1,129 @@ +#!/bin/sh +# +# nginx - this script starts and stops the nginx daemon +# +# chkconfig: - 85 15 +# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# proxy and IMAP/POP3 proxy server +# processname: nginx +# config: /etc/nginx/nginx.conf +# config: /etc/sysconfig/nginx +# pidfile: /var/run/nginx.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +nginx="/usr/local/nginx/sbin/nginx" +prog=$(basename $nginx) + +NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" + +[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx + +lockfile=/var/lock/subsys/nginx + +make_dirs() { + # make required directories + user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` + if [ -z "`grep $user /etc/passwd`" ]; then + useradd -M -s /bin/nologin $user + fi + options=`$nginx -V 2>&1 | grep 'configure arguments:'` + for opt in $options; do + if [ `echo $opt | grep '.*-temp-path'` ]; then + value=`echo $opt | cut -d "=" -f 2` + if [ ! -d "$value" ]; then + # echo "creating" $value + mkdir -p $value && chown -R $user $value + fi + fi + done +} + +start() { + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + make_dirs + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + configtest || return $? + stop + sleep 1 + start +} + +reload() { + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +configtest() { + $nginx -t -c $NGINX_CONF_FILE +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 +esac diff --git a/lnmp_install.sh b/lnmp_install.sh index ec8d8609..3b9e17e9 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -149,6 +149,12 @@ cd php-5.3.24 make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-production /usr/local/php/lib/php.ini + +#php-fpm Init Script +cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +chkconfig --add php-fpm +chkconfig php-fpm on cd ../ wget -c http://pecl.php.net/get/memcache-2.2.5.tgz @@ -289,16 +295,10 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -# /etc/init.d/php-fpm -cd ../conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/php-fpm.sh -cp php-fpm.sh /etc/init.d/php-fpm -chmod 755 /etc/init.d/php-fpm -chkconfig php-fpm on +#i#php-fpm start service php-fpm start # install Nginx -cd ../source wget -c http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz tar xzf pcre-8.32.tar.gz cd pcre-8.32 @@ -319,8 +319,8 @@ sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Apache/" ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module make && make install cd ../../conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/nginx.sh -cp nginx.sh /etc/init.d/nginx +wget -c https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +cp init.d.nginx /etc/init.d/nginx chmod 755 /etc/init.d/nginx chkconfig --add nginx chkconfig nginx on From 303c74b091238ff4c257757c6438fa3836864411 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 May 2013 10:39:13 +0800 Subject: [PATCH 022/617] init Script --- conf/nginx.sh | 72 ------------------------------------------------- conf/php-fpm.sh | 67 --------------------------------------------- 2 files changed, 139 deletions(-) delete mode 100644 conf/nginx.sh delete mode 100755 conf/php-fpm.sh diff --git a/conf/nginx.sh b/conf/nginx.sh deleted file mode 100644 index cd674d43..00000000 --- a/conf/nginx.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# Nginnx Startup script for the Nginx HTTP Server -# chkconfig: - 60 50 -# description: Nginx is a high-performance web and proxy server. -# processname: nginx -# pidfile: /usr/local/nginx/logs/nginx.pid -# config: /usr/local/nginx/conf/nginx.conf -nginxd=/usr/local/nginx/sbin/nginx -nginx_config=/usr/local/nginx/conf/nginx.conf -nginx_pid=/usr/local/nginx/logs/nginx.pid -RETVAL=0 -prog="nginx" -# Source function library. -. /etc/rc.d/init.d/functions -# Source networking configuration. -. /etc/sysconfig/network -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 -[ -x $nginxd ] || exit 0 -# Start nginx daemons functions. -start() { -if [ -e $nginx_pid ];then - echo "nginx already running...." - exit 1 -fi - echo -n $"Starting $prog: " - daemon $nginxd -c ${nginx_config} - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx - return $RETVAL - } -# Stop nginx daemons functions. -stop() { - echo -n $"Stopping $prog: " - killproc $nginxd - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid - } -# reload nginx service functions. -reload() { - echo -n $"Reloading $prog: " - kill -HUP `cat ${nginx_pid}` - RETVAL=$? - echo - } -# See how we were called. -case "$1" in -start) - start - ;; -stop) - stop - ;; -reload) - reload - ;; -restart) - stop - start - ;; -status) - status $prog - RETVAL=$? - ;; -*) - echo $"Usage: $prog {start|stop|restart|reload|status|help}" - exit 1 - ;; -esac -exit $RETVAL diff --git a/conf/php-fpm.sh b/conf/php-fpm.sh deleted file mode 100755 index 238ffe4b..00000000 --- a/conf/php-fpm.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# -# Startup script for the PHP-FPM server. -# -# chkconfig: 345 85 15 -# description: PHP is an HTML-embedded scripting language -# processname: php-fpm -# config: /usr/local/php/lib/php.ini - -# Source function library. -. /etc/rc.d/init.d/functions - -PHP_PATH=/usr/local -DESC="php-fpm daemon" -NAME=php-fpm -# php-fpm path -DAEMON=$PHP_PATH/php/sbin/$NAME -# configuration file -CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf -# PID file -PIDFILE=$PHP_PATH/php/var/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME - -# Gracefully exit if the package has been removed. -test -x $DAEMON || exit 0 - -rh_start() { - $DAEMON -y $CONFIGFILE || echo -n " already running" -} - -rh_stop() { - kill -QUIT `cat $PIDFILE` || echo -n " not running" -} - -rh_reload() { - kill -HUP `cat $PIDFILE` || echo -n " can't reload" -} - -case "$1" in - start) - echo -n "Starting $DESC: $NAME" - rh_start - echo "." - ;; - stop) - echo -n "Stopping $DESC: $NAME" - rh_stop - echo "." - ;; - reload) - echo -n "Reloading $DESC configuration..." - rh_reload - echo "reloaded." - ;; - restart) - echo -n "Restarting $DESC: $NAME" - rh_stop - sleep 1 - rh_start - echo "." - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 - exit 3 - ;; -esac -exit 0 From d3cd1c0eb16a7e2539a4823b25281511deb1271e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 May 2013 10:56:51 +0800 Subject: [PATCH 023/617] init Script --- conf/init.d.nginx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/init.d.nginx b/conf/init.d.nginx index 049962d4..b7f950b0 100755 --- a/conf/init.d.nginx +++ b/conf/init.d.nginx @@ -6,9 +6,8 @@ # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx -# config: /etc/nginx/nginx.conf -# config: /etc/sysconfig/nginx -# pidfile: /var/run/nginx.pid +# config: /usr/local/nginx/conf/nginx.conf +# pidfile: /usr/local/nginx/var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions From 5e9c4a25726f8c784aadac73ae14bca6b789c0f6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 9 May 2013 18:42:00 +0800 Subject: [PATCH 024/617] install pcre-devel --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 3b9e17e9..a865e3a9 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,7 +14,7 @@ do fi done -yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced zip unzip +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip # install MySQL mkdir -p /root/lnmp/{source,conf} From 609d430a6f48a070e7b7ce89aac47eb3380a9c44 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 9 May 2013 19:00:57 +0800 Subject: [PATCH 025/617] bug --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index a865e3a9..c264e74b 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -339,7 +339,7 @@ compress notifempty sharedscripts postrotate - [ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` + [ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 \`cat /usr/local/nginx/logs/nginx.pid\` endscript } EOF @@ -383,7 +383,7 @@ tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` -sed -i 's/myipaddress.com/'$IP'/g' /data/admin/ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php rm -rf /data/admin/ftp/install.php From 8f636914e29681cb7bad8bd59b54424522511465 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 10 May 2013 09:56:15 +0800 Subject: [PATCH 026/617] update php version --- README.md | 2 +- lnmp_install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 599daab5..6c0d2187 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.24.tar.gz +php-5.3.25.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz diff --git a/lnmp_install.sh b/lnmp_install.sh index c264e74b..ff431cc6 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -141,10 +141,10 @@ cd mcrypt-2.6.8 make && make install cd ../ -wget -c http://kr1.php.net/distributions/php-5.3.24.tar.gz -tar xzf php-5.3.24.tar.gz +wget -c http://kr1.php.net/distributions/php-5.3.25.tar.gz +tar xzf php-5.3.25.tar.gz useradd -M -s /sbin/nologin www -cd php-5.3.24 +cd php-5.3.25 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install From 9360f267f5933de3d9cdb171c6e9e0c9507abf62 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 20 May 2013 17:01:56 +0800 Subject: [PATCH 027/617] modify script --- README.md | 1 - lnmp_install.sh | 54 ++++++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 6c0d2187..957924c4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,5 @@ pecl_http-1.7.5.tgz pcre-8.32.tar.gz ngx_cache_purge-2.1.tar.gz nginx-1.4.1.tar.gz -nginx-1.4.0.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz diff --git a/lnmp_install.sh b/lnmp_install.sh index ff431cc6..79600f75 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,13 +14,38 @@ do fi done +#download packages +mkdir -p /root/lnmp/{source,conf} +cd /root/lnmp/source +[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +[ -s mysql-5.5.31.tar.gz ] && echo 'mysql-5.5.31.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.31.tar.gz +[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz +[ -s bmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz +[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz +[ -s php-5.3.25.tar.gz ] && echo 'php-5.3.25.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.25.tar.gz +[ -s memcache-2.2.5.tgz ] && echo 'memcache-2.2.5.tgz found' || wget http://pecl.php.net/get/memcache-2.2.5.tgz +[ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 +[ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz +[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz +[ -s imagick-3.0.1.tgz ] && echo 'imagick-3.0.1.tgz found' || wget http://pecl.php.net/get/imagick-3.0.1.tgz +[ -s pecl_http-1.7.5.tgz ] && echo 'pecl_http-1.7.5.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.5.tgz +[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz +[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz +[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz +[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz +cd ../conf +[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +[-s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[-s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[-s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[-s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql + +# install dependent packages yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip # install MySQL -mkdir -p /root/lnmp/{source,conf} -cd /root/lnmp/source -wget -c http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -wget -c http://fossies.org/linux/misc/mysql-5.5.31.tar.gz +cd ../source useradd -M -s /sbin/nologin mysql mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql tar xzf cmake-2.8.10.2.tar.gz @@ -77,14 +102,12 @@ source /etc/profile /sbin/service mysqld restart # install PHP -wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local make && make install cd ../ -wget -c http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure @@ -95,7 +118,6 @@ cd libltdl/ make && make install cd ../../ -wget -c http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz tar xzf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure @@ -133,7 +155,6 @@ else ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 fi -wget -c http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz tar xzf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8 /sbin/ldconfig @@ -141,7 +162,6 @@ cd mcrypt-2.6.8 make && make install cd ../ -wget -c http://kr1.php.net/distributions/php-5.3.25.tar.gz tar xzf php-5.3.25.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.25 @@ -157,7 +177,6 @@ chkconfig --add php-fpm chkconfig php-fpm on cd ../ -wget -c http://pecl.php.net/get/memcache-2.2.5.tgz tar xzf memcache-2.2.5.tgz cd memcache-2.2.5 /usr/local/php/bin/phpize @@ -165,7 +184,6 @@ cd memcache-2.2.5 make && make install cd ../ -wget -c http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 tar xjf eaccelerator-0.9.6.1.tar.bz2 cd eaccelerator-0.9.6.1 /usr/local/php/bin/phpize @@ -173,7 +191,6 @@ cd eaccelerator-0.9.6.1 make && make install cd ../ -wget -c http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz tar xzf PDO_MYSQL-1.0.2.tgz cd PDO_MYSQL-1.0.2 /usr/local/php/bin/phpize @@ -181,14 +198,12 @@ cd PDO_MYSQL-1.0.2 make && make install cd ../ -wget -c http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz tar xzf ImageMagick-6.8.3-10.tar.gz cd ImageMagick-6.8.3-10 ./configure make && make install cd ../ -wget -c http://pecl.php.net/get/imagick-3.0.1.tgz tar xzf imagick-3.0.1.tgz cd imagick-3.0.1 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig @@ -198,7 +213,6 @@ make && make install cd ../ # Support HTTP request curls -wget -c http://pecl.php.net/get/pecl_http-1.7.5.tgz tar xzf pecl_http-1.7.5.tgz cd pecl_http-1.7.5 /usr/local/php/bin/phpize @@ -299,16 +313,13 @@ EOF service php-fpm start # install Nginx -wget -c http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz tar xzf pcre-8.32.tar.gz cd pcre-8.32 ./configure make && make install cd ../ -#wget -c http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz #tar xzf ngx_cache_purge-2.1.tar.gz -wget -c http://nginx.org/download/nginx-1.4.1.tar.gz tar xzf nginx-1.4.1.tar.gz cd nginx-1.4.1 @@ -319,13 +330,11 @@ sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Apache/" ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module make && make install cd ../../conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx cp init.d.nginx /etc/init.d/nginx chmod 755 /etc/init.d/nginx chkconfig --add nginx chkconfig nginx on mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf cp nginx.conf /usr/local/nginx/conf/nginx.conf #logrotate nginx log @@ -348,7 +357,6 @@ service nginx restart # install Pureftpd and pureftpd_php_manager cd ../source -wget -c ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz tar xzf pure-ftpd-1.0.36.tar.gz cd pure-ftpd-1.0.36 ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese @@ -364,9 +372,6 @@ chkconfig --add pureftpd chkconfig pureftpd on cd ../../conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -wget -c https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql /bin/cp pure-ftpd.conf /usr/local/pureftpd/ /bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` @@ -378,7 +383,6 @@ service pureftpd start mkdir -p /data/admin cd ../source -wget -c http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php From ef2994eaadba9d3f7962d4dc024db5e2bcedf352 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 7 Jun 2013 17:09:39 +0800 Subject: [PATCH 028/617] update version --- README.md | 4 ++-- lnmp_install.sh | 36 +++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 957924c4..b0dd1325 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Source packages version: cmake-2.8.10.2.tar.gz -mysql-5.5.31.tar.gz +mysql-5.5.32.tar.gz libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.25.tar.gz +php-5.3.26.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz diff --git a/lnmp_install.sh b/lnmp_install.sh index 79600f75..7c36cb1d 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,16 +14,16 @@ do fi done -#download packages +# Download packages mkdir -p /root/lnmp/{source,conf} cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -[ -s mysql-5.5.31.tar.gz ] && echo 'mysql-5.5.31.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.31.tar.gz +[ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz [ -s bmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -[ -s php-5.3.25.tar.gz ] && echo 'php-5.3.25.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.25.tar.gz +[ -s php-5.3.26.tar.gz ] && echo 'php-5.3.26.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.26.tar.gz [ -s memcache-2.2.5.tgz ] && echo 'memcache-2.2.5.tgz found' || wget http://pecl.php.net/get/memcache-2.2.5.tgz [ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 [ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz @@ -53,8 +53,8 @@ cd cmake-2.8.10.2 ./configure make && make install cd .. -tar zxf mysql-5.5.31.tar.gz -cd mysql-5.5.31 +tar zxf mysql-5.5.32.tar.gz +cd mysql-5.5.32 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ -DMYSQL_DATADIR=/data/mysql \ -DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ @@ -162,9 +162,9 @@ cd mcrypt-2.6.8 make && make install cd ../ -tar xzf php-5.3.25.tar.gz +tar xzf php-5.3.26.tar.gz useradd -M -s /sbin/nologin www -cd php-5.3.25 +cd php-5.3.26 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install @@ -395,6 +395,28 @@ echo '' > /data/admin/index.php cd ../ + +# set iptables +cat > /etc/sysconfig/iptables << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +COMMIT +EOF +chkconfig iptables on +service iptables restart + echo "################Congratulations####################" echo "The path of some dirs:" echo "Nginx dir: /usr/local/nginx" From acadc0663300ecff1b2c8db314ac3d1e0e619cd1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 19 Jun 2013 20:40:10 +0800 Subject: [PATCH 029/617] bug --- lnmp_install.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 7c36cb1d..1063c71a 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -34,12 +34,12 @@ cd /root/lnmp/source [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz -cd ../conf +cd /root/lnmp/conf [ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx -[-s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[-s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[-s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[-s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql # install dependent packages yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip @@ -329,7 +329,7 @@ sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Apache/" #./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_cache_purge-2.1 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module make && make install -cd ../../conf +cd /root/lnmp/conf cp init.d.nginx /etc/init.d/nginx chmod 755 /etc/init.d/nginx chkconfig --add nginx @@ -371,7 +371,7 @@ chmod +x /etc/init.d/pureftpd chkconfig --add pureftpd chkconfig pureftpd on -cd ../../conf +cd /root/lnmp/conf /bin/cp pure-ftpd.conf /usr/local/pureftpd/ /bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` From 38917eeeefaffe00d7ce7da312c23159ea311865 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 19 Jun 2013 20:48:14 +0800 Subject: [PATCH 030/617] bug --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 1063c71a..25ddb5a0 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -34,7 +34,7 @@ cd /root/lnmp/source [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz -cd /root/lnmp/conf +cd ../conf [ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx [ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf [ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf @@ -338,7 +338,7 @@ mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk cp nginx.conf /usr/local/nginx/conf/nginx.conf #logrotate nginx log -cat > /etc/logrotate.d/nginx < /etc/logrotate.d/nginx << EOF /usr/local/nginx/logs/*.log { daily rotate 5 From 6e6ecdbb3c632391ca1a34a4a7fdf668ff279f0f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 19 Jun 2013 21:30:17 +0800 Subject: [PATCH 031/617] get ip --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 25ddb5a0..73cf3c15 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -386,7 +386,7 @@ cd ../source tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` +IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php From 519a3b8cd98ccf8c9e306ed439999ac2985ce820 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 12:27:21 +0800 Subject: [PATCH 032/617] add init.sh --- init.sh | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 init.sh diff --git a/init.sh b/init.sh new file mode 100644 index 00000000..c4a68264 --- /dev/null +++ b/init.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Configure yum source +mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo$(date +%m%d) +mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo$(date +%m%d) +mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo$(date +%m%d) +yum clean all +# Remove obsolete rpm package +yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Office/Productivity" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" +# Update rpm package +yum -y update +# Install dependencies package +yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip + +# chkconfig +chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh +chkconfig crond on +chkconfig irqbalance on +chkconfig network on +chkconfig sshd on +chkconfig rsyslog on #CentOS 6 +chkconfig syslog on #CentOS/RHEL 5 +chkconfig iptables on + +# Close SELINUX +setenforce 0 +sed -i 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config + +# Set LANG +sed -i 's@^LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n +# initdefault +sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab +/sbin/init q +# PS1 +echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile + +# Record command +sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /etc/profile +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bash_profile + +# Wrong password five times locked 180s +sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth + +# alias vi +sed -i '7a alias vi=vim' /root/.bashrc +echo 'syntax on' >> /etc/vimrc + +# /etc/security/limits.conf +echo "* soft nofile 60000" >> /etc/security/limits.conf +echo "* hard nofile 65535" >> /etc/security/limits.conf +echo "ulimit -SH 65535" >> /etc/rc.local + +# /etc/sysctl.conf +sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf +echo 'net.ipv4.tcp_tw_reuse = 1' >> /etc/sysctl.conf +echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf +echo 'net.ipv4.ip_local_port_range = 1024 65000' >> /etc/sysctl.conf +sysctl -p + +# Set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +# Update time +/usr/sbin/ntpdate pool.ntp.org +echo '*/5 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root +/sbin/service crond restart + +# iptables +cat > /etc/sysconfig/iptables << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +# -A INPUT -p udp -m udp --dport 20 -j ACCEPT +COMMIT +EOF +/sbin/service iptables restart +source /etc/profile From bf797c51e19016b34dee8601ca971daf2ee3f482 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 14:26:06 +0800 Subject: [PATCH 033/617] function --- README | 18 +++++++++++++ init.sh | 2 ++ lnmp_install.sh | 70 ++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 00000000..5da0753e --- /dev/null +++ b/README @@ -0,0 +1,18 @@ +Source packages version: +cmake-2.8.10.2.tar.gz +mysql-5.5.32.tar.gz +libiconv-1.14.tar.gz +libmcrypt-2.5.8.tar.gz +mhash-0.9.9.9.tar.gz +mcrypt-2.6.8.tar.gz +php-5.3.26.tar.gz +memcache-2.2.5.tgz +eaccelerator-0.9.6.1.tar.bz2 +PDO_MYSQL-1.0.2.tgz +ImageMagick-6.8.3-10.tar.gz +imagick-3.0.1.tgz +pecl_http-1.7.5.tgz +pcre-8.32.tar.gz +nginx-1.4.1.tar.gz +pure-ftpd-1.0.36.tar.gz +ftp_v2.1.tar.gz diff --git a/init.sh b/init.sh index c4a68264..2aeb33a1 100644 --- a/init.sh +++ b/init.sh @@ -32,6 +32,7 @@ sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab /sbin/init q # PS1 echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile +export PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]" # Record command sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /etc/profile @@ -42,6 +43,7 @@ sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/ # alias vi sed -i '7a alias vi=vim' /root/.bashrc +alias vi=vim echo 'syntax on' >> /etc/vimrc # /etc/security/limits.conf diff --git a/lnmp_install.sh b/lnmp_install.sh index 73cf3c15..ebcea493 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -2,6 +2,12 @@ # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 +echo -e "\033[37m#######################################################################\033[0m" +echo -e "\033[37m#\033[0m \033[32mLNMP for CentOS/RadHat Linux\033[0m #" +echo -e "\033[37m#\033[0m\033[36m For more information please visit\033[0m \033[35mhttps://github.com/lj2007331/lnmp\033[0m #" +echo -e "\033[37m#######################################################################\033[0m" +echo '' + # Set password while : do @@ -16,6 +22,10 @@ done # Download packages mkdir -p /root/lnmp/{source,conf} +function Download() +{ +cd /root/lnmp +[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz [ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz @@ -40,12 +50,13 @@ cd ../conf [ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf [ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf [ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +} -# install dependent packages -yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip +function MySQL() # install MySQL -cd ../source +{ +cd /root/lnmp/source useradd -M -s /sbin/nologin mysql mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql tar xzf cmake-2.8.10.2.tar.gz @@ -75,7 +86,7 @@ chkconfig --add mysqld chkconfig mysqld on cd .. -# Modify my.cf +# my.cf sed -i '38a ##############' /etc/my.cnf sed -i '39a skip-name-resolve' /etc/my.cnf sed -i '40a basedir=/usr/local/mysql' /etc/my.cnf @@ -100,8 +111,12 @@ source /etc/profile /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" /sbin/service mysqld restart +} +function PHP() # install PHP +{ +cd /root/lnmp/source tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local @@ -309,10 +324,14 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -#i#php-fpm start +# php start service php-fpm start +} +function Nginx() # install Nginx +{ +cd /root/lnmp/source tar xzf pcre-8.32.tar.gz cd pcre-8.32 ./configure @@ -354,9 +373,12 @@ endscript EOF service nginx restart +} +function Pureftp() # install Pureftpd and pureftpd_php_manager -cd ../source +{ +cd /root/lnmp/source tar xzf pure-ftpd-1.0.36.tar.gz cd pure-ftpd-1.0.36 ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese @@ -395,8 +417,10 @@ echo '' > /data/admin/index.php cd ../ +} -# set iptables +function Iptables() +{ cat > /etc/sysconfig/iptables << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -414,17 +438,31 @@ cat > /etc/sysconfig/iptables << EOF -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT COMMIT EOF -chkconfig iptables on service iptables restart +} + +sh init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +echo 'initialized successfully' +Download 2>&1 | tee -a /root/lnmp/lnmp_install.log +Download +MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/mysql" ] && echo 'MySQL install successfully' || echo "MySQL install failed";exit +PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/php" ] && echo 'PHP install successfully' || echo "PHP install failed";exit +Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/nginx" ] && echo 'Nginx install successfully' || echo "Nginx install failed";exit +Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/pureftpd" ] && echo 'Pureftpd install successfully' || echo "Pureftpd install failed";exit +Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log echo "################Congratulations####################" echo "The path of some dirs:" -echo "Nginx dir: /usr/local/nginx" -echo "MySQL dir: /usr/local/mysql" -echo "PHP dir: /usr/local/php" -echo "Pureftpd dir: /usr/local/pureftpd" -echo "Pureftp_php_manager dir : /data/admin" -echo "MySQL Password: $mysqlrootpwd" -echo "Pureftp_manager url : http://$IP/ftp" -echo "Pureftp_manager Password: $ftpmanagerpwd" +echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" +echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" +echo -e "PHP dir: \033[32m/usr/local/php\033[0m" +echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" +echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" +echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" +echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" +echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" echo "###################################################" From 43b16b4e340c66a968c100ae99396b01b76f536e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 14:28:55 +0800 Subject: [PATCH 034/617] function --- README.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index b0dd1325..00000000 --- a/README.md +++ /dev/null @@ -1,19 +0,0 @@ -Source packages version: -cmake-2.8.10.2.tar.gz -mysql-5.5.32.tar.gz -libiconv-1.14.tar.gz -libmcrypt-2.5.8.tar.gz -mhash-0.9.9.9.tar.gz -mcrypt-2.6.8.tar.gz -php-5.3.26.tar.gz -memcache-2.2.5.tgz -eaccelerator-0.9.6.1.tar.bz2 -PDO_MYSQL-1.0.2.tgz -ImageMagick-6.8.3-10.tar.gz -imagick-3.0.1.tgz -pecl_http-1.7.5.tgz -pcre-8.32.tar.gz -ngx_cache_purge-2.1.tar.gz -nginx-1.4.1.tar.gz -pure-ftpd-1.0.36.tar.gz -ftp_v2.1.tar.gz From 7dd351b85d6ae0c0103383e610d755d65210139b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 15:18:28 +0800 Subject: [PATCH 035/617] bug --- lnmp_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index ebcea493..cb8d7233 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -30,7 +30,7 @@ cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz [ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s bmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz [ -s php-5.3.26.tar.gz ] && echo 'php-5.3.26.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.26.tar.gz @@ -441,10 +441,10 @@ EOF service iptables restart } -sh init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -echo 'initialized successfully' Download 2>&1 | tee -a /root/lnmp/lnmp_install.log Download +sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +echo 'initialized successfully' MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log [ -d "/usr/local/mysql" ] && echo 'MySQL install successfully' || echo "MySQL install failed";exit PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log From 2719afbb5047233b83e061842048e0cb2ce877c0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 15:38:18 +0800 Subject: [PATCH 036/617] bug --- init.sh | 4 ++-- lnmp_install.sh | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/init.sh b/init.sh index 2aeb33a1..da8ab0fe 100644 --- a/init.sh +++ b/init.sh @@ -32,7 +32,7 @@ sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab /sbin/init q # PS1 echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile -export PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]" +export PS1='\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]' # Record command sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /etc/profile @@ -86,4 +86,4 @@ cat > /etc/sysconfig/iptables << EOF COMMIT EOF /sbin/service iptables restart -source /etc/profile +. /etc/profile diff --git a/lnmp_install.sh b/lnmp_install.sh index cb8d7233..8adc79be 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -25,7 +25,7 @@ mkdir -p /root/lnmp/{source,conf} function Download() { cd /root/lnmp -[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh +[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz [ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz @@ -443,16 +443,17 @@ service iptables restart Download 2>&1 | tee -a /root/lnmp/lnmp_install.log Download -sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -echo 'initialized successfully' +chmod +x /root/lnmp/init.sh +/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +echo -e "\033[32minitialized successfully\033[0m" MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/mysql" ] && echo 'MySQL install successfully' || echo "MySQL install failed";exit +[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/php" ] && echo 'PHP install successfully' || echo "PHP install failed";exit +[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/nginx" ] && echo 'Nginx install successfully' || echo "Nginx install failed";exit +[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/pureftpd" ] && echo 'Pureftpd install successfully' || echo "Pureftpd install failed";exit +[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log echo "################Congratulations####################" From 4352fa9bfcd8ca06d9408a6f5cf560e5b26d9524 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Jun 2013 16:37:12 +0800 Subject: [PATCH 037/617] bug --- init.sh | 7 ++++--- lnmp_install.sh | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/init.sh b/init.sh index da8ab0fe..35e3a46a 100644 --- a/init.sh +++ b/init.sh @@ -32,7 +32,6 @@ sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab /sbin/init q # PS1 echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile -export PS1='\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]' # Record command sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /etc/profile @@ -43,7 +42,6 @@ sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/ # alias vi sed -i '7a alias vi=vim' /root/.bashrc -alias vi=vim echo 'syntax on' >> /etc/vimrc # /etc/security/limits.conf @@ -58,6 +56,9 @@ echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf echo 'net.ipv4.ip_local_port_range = 1024 65000' >> /etc/sysctl.conf sysctl -p +# disable ipv6 +sed -i 's/NETWORKING_IPV6=.*$/NETWORKING_IPV6=no/g' /etc/sysconfig/network + # Set timezone rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime @@ -86,4 +87,4 @@ cat > /etc/sysconfig/iptables << EOF COMMIT EOF /sbin/service iptables restart -. /etc/profile +source /etc/profile diff --git a/lnmp_install.sh b/lnmp_install.sh index 8adc79be..5d6b236c 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -2,12 +2,15 @@ # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 -echo -e "\033[37m#######################################################################\033[0m" -echo -e "\033[37m#\033[0m \033[32mLNMP for CentOS/RadHat Linux\033[0m #" -echo -e "\033[37m#\033[0m\033[36m For more information please visit\033[0m \033[35mhttps://github.com/lj2007331/lnmp\033[0m #" -echo -e "\033[37m#######################################################################\033[0m" +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat Linux #" +echo "# For more information please visit https://github.com/lj2007331/lnmp #" +echo "#######################################################################" echo '' +# get IP +IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` + # Set password while : do @@ -357,8 +360,7 @@ mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk cp nginx.conf /usr/local/nginx/conf/nginx.conf #logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF -/usr/local/nginx/logs/*.log { +echo '/usr/local/nginx/logs/*.log { daily rotate 5 missingok @@ -367,10 +369,9 @@ compress notifempty sharedscripts postrotate - [ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 \`cat /usr/local/nginx/logs/nginx.pid\` + [ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` endscript -} -EOF +}' > /etc/logrotate.d/nginx service nginx restart } @@ -408,7 +409,6 @@ cd ../source tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php @@ -462,8 +462,8 @@ echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" echo -e "PHP dir: \033[32m/usr/local/php\033[0m" echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" -echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" +echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" -echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" +echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" echo "###################################################" From d53f9585c00bc6194bfad4cf2f9545d76f6fa846 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 13 Jul 2013 16:23:30 +0800 Subject: [PATCH 038/617] update php version --- README | 2 +- lnmp_install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 5da0753e..49cb2a4b 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.26.tar.gz +php-5.3.27.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz diff --git a/lnmp_install.sh b/lnmp_install.sh index 5d6b236c..fbd5798f 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -36,7 +36,7 @@ cd /root/lnmp/source [ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -[ -s php-5.3.26.tar.gz ] && echo 'php-5.3.26.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.26.tar.gz +[ -s php-5.3.27.tar.gz ] && echo 'php-5.3.27.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.27.tar.gz [ -s memcache-2.2.5.tgz ] && echo 'memcache-2.2.5.tgz found' || wget http://pecl.php.net/get/memcache-2.2.5.tgz [ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 [ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz @@ -180,9 +180,9 @@ cd mcrypt-2.6.8 make && make install cd ../ -tar xzf php-5.3.26.tar.gz +tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www -cd php-5.3.26 +cd php-5.3.27 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install From de78500b760631259936ee860be8c887c83c0332 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 15 Jul 2013 16:15:56 +0800 Subject: [PATCH 039/617] request_order --- lnmp_install.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index fbd5798f..b94e73ff 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -248,10 +248,11 @@ sed -i '811a extension = "imagick.so"' /usr/local/php/lib/php.ini sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini -sed -i 's@short_open_tag = Off@short_open_tag = On@g' /usr/local/php/lib/php.ini -sed -i 's@expose_php = On@expose_php = Off@g' /usr/local/php/lib/php.ini -sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@g' /usr/local/php/lib/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@g' /usr/local/php/lib/php.ini +sed -i 's@short_open_tag = Off@short_open_tag = On@' /usr/local/php/lib/php.ini +sed -i 's@expose_php = On@expose_php = Off@' /usr/local/php/lib/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/lib/php.ini +sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/lib/php.ini +sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/lib/php.ini echo '[eaccelerator] zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" eaccelerator.shm_size="64" From cb45d28b0d4032228e24deca0635a2bb5d386dd5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 16 Jul 2013 17:53:23 +0800 Subject: [PATCH 040/617] update php-5.5.0 and MySQL-5.6.12 --- README | 13 +- lnmp_install.sh | 195 ++++++++++------- lnmp_v5.3_install.sh | 471 ++++++++++++++++++++++++++++++++++++++++ lnmp_v5.5_install.sh | 505 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1097 insertions(+), 87 deletions(-) create mode 100644 lnmp_v5.3_install.sh create mode 100644 lnmp_v5.5_install.sh diff --git a/README b/README index 49cb2a4b..7a54b301 100644 --- a/README +++ b/README @@ -1,17 +1,16 @@ Source packages version: cmake-2.8.10.2.tar.gz -mysql-5.5.32.tar.gz +mysql-5.6.12.tar.gz libiconv-1.14.tar.gz -libmcrypt-2.5.8.tar.gz +bmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.3.27.tar.gz -memcache-2.2.5.tgz -eaccelerator-0.9.6.1.tar.bz2 +php-5.5.0.tar.gz +memcache-2.2.7.tgz PDO_MYSQL-1.0.2.tgz ImageMagick-6.8.3-10.tar.gz -imagick-3.0.1.tgz -pecl_http-1.7.5.tgz +imagick-3.1.0RC2.tgz +pecl_http-1.7.6.tgz pcre-8.32.tar.gz nginx-1.4.1.tar.gz pure-ftpd-1.0.36.tar.gz diff --git a/lnmp_install.sh b/lnmp_install.sh index b94e73ff..183c3293 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -31,18 +31,17 @@ cd /root/lnmp [ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -[ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz +[ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz [ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -[ -s php-5.3.27.tar.gz ] && echo 'php-5.3.27.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.27.tar.gz -[ -s memcache-2.2.5.tgz ] && echo 'memcache-2.2.5.tgz found' || wget http://pecl.php.net/get/memcache-2.2.5.tgz -[ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 +[ -s php-5.5.0.tar.gz ] && echo 'php-5.5.0.tar.gz found' || wget http://kr1.php.net/distributions/php-5.5.0.tar.gz +[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz [ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz [ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz -[ -s imagick-3.0.1.tgz ] && echo 'imagick-3.0.1.tgz found' || wget http://pecl.php.net/get/imagick-3.0.1.tgz -[ -s pecl_http-1.7.5.tgz ] && echo 'pecl_http-1.7.5.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.5.tgz +[ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz +[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz [ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz @@ -67,22 +66,27 @@ cd cmake-2.8.10.2 ./configure make && make install cd .. -tar zxf mysql-5.5.32.tar.gz -cd mysql-5.5.32 +tar zxf mysql-5.6.12.tar.gz +cd mysql-5.6.12 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ --DMYSQL_DATADIR=/data/mysql \ -DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_MEMORY_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MEMORY_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DMYSQL_DATADIR=/data/mysql \ +-DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -DEXTRA_CHARSETS=all \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \ -DWITH_DEBUG=0 make && make install -/bin/cp support-files/my-medium.cnf /etc/my.cnf +/bin/cp support-files/my-default.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chkconfig --add mysqld @@ -90,18 +94,55 @@ chkconfig mysqld on cd .. # my.cf -sed -i '38a ##############' /etc/my.cnf -sed -i '39a skip-name-resolve' /etc/my.cnf -sed -i '40a basedir=/usr/local/mysql' /etc/my.cnf -sed -i '41a datadir=/data/mysql' /etc/my.cnf -sed -i '42a user=mysql' /etc/my.cnf -sed -i '43a #lower_case_table_names = 1' /etc/my.cnf -sed -i '44a max_connections=1000' /etc/my.cnf -sed -i '45a ft_min_word_len=1' /etc/my.cnf -sed -i '46a expire_logs_days = 7' /etc/my.cnf -sed -i '47a query_cache_size=64M' /etc/my.cnf -sed -i '48a query_cache_type=1' /etc/my.cnf -sed -i '49a ##############' /etc/my.cnf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = /usr/local/mysql +datadir = /data/mysql +socket = /data/mysql/mysql.sock +character-set-server=utf8 +collation-server=utf8_general_ci +user=mysql +port = 3306 +default_storage_engine = InnoDB +server_id = 1 +log_bin=mysql-bin +binlog_format=mixed +expire_logs_days = 7 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len=1 +query_cache_size=64M +query_cache_type=1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K + +# LOG +log_error = /data/mysql/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = /data/mysql/mysql-slow.log + +# Oher +explicit_defaults_for_timestamp=true +#max_connections = 1000 +open_files_limit = 65535 +sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES + +[client] +port = 3306 +socket = /data/mysql/mysql.sock +EOF /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql @@ -113,6 +154,7 @@ source /etc/profile /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" /sbin/service mysqld restart } @@ -142,6 +184,12 @@ cd mhash-0.9.9.9 make && make install cd ../ +tar xzf ImageMagick-6.8.3-10.tar.gz +cd ImageMagick-6.8.3-10 +./configure +make && make install +cd ../ + if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so @@ -154,6 +202,7 @@ if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 + ln -s /usr/local/mysql/include/* /usr/local/include/ ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick cp -frp /usr/lib64/libldap* /usr/lib @@ -169,6 +218,7 @@ else ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 + ln -s /usr/local/mysql/include/* /usr/local/include/ ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 fi @@ -180,13 +230,23 @@ cd mcrypt-2.6.8 make && make install cd ../ -tar xzf php-5.3.27.tar.gz +tar xzf php-5.5.0.tar.gz useradd -M -s /sbin/nologin www -cd php-5.3.27 -./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug +cd php-5.5.0 +./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-opcache \ +--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop \ +--enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex --enable-fpm \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ +--enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug make ZEND_EXTRA_LIBS='-liconv' make install -cp php.ini-production /usr/local/php/lib/php.ini +#wget http://pear.php.net/go-pear.phar +#/usr/local/php/bin/php go-pear.phar + +cp php.ini-production /usr/local/php/etc/php.ini #php-fpm Init Script cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm @@ -195,20 +255,13 @@ chkconfig --add php-fpm chkconfig php-fpm on cd ../ -tar xzf memcache-2.2.5.tgz -cd memcache-2.2.5 +tar xzf memcache-2.2.7.tgz +cd memcache-2.2.7 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install cd ../ -tar xjf eaccelerator-0.9.6.1.tar.bz2 -cd eaccelerator-0.9.6.1 -/usr/local/php/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - tar xzf PDO_MYSQL-1.0.2.tgz cd PDO_MYSQL-1.0.2 /usr/local/php/bin/phpize @@ -216,14 +269,8 @@ cd PDO_MYSQL-1.0.2 make && make install cd ../ -tar xzf ImageMagick-6.8.3-10.tar.gz -cd ImageMagick-6.8.3-10 -./configure -make && make install -cd ../ - -tar xzf imagick-3.0.1.tgz -cd imagick-3.0.1 +tar xzf imagick-3.1.0RC2.tgz +cd imagick-3.1.0RC2 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config @@ -231,46 +278,34 @@ make && make install cd ../ # Support HTTP request curls -tar xzf pecl_http-1.7.5.tgz -cd pecl_http-1.7.5 +tar xzf pecl_http-1.7.6.tgz +cd pecl_http-1.7.6 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install cd ../ # Modify php.ini -mkdir /tmp/eaccelerator -/bin/chown -R www.www /tmp/eaccelerator/ -sed -i '808a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"' /usr/local/php/lib/php.ini -sed -i '809a extension = "memcache.so"' /usr/local/php/lib/php.ini -sed -i '810a extension = "pdo_mysql.so"' /usr/local/php/lib/php.ini -sed -i '811a extension = "imagick.so"' /usr/local/php/lib/php.ini -sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini -sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini -sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini -sed -i 's@short_open_tag = Off@short_open_tag = On@' /usr/local/php/lib/php.ini -sed -i 's@expose_php = On@expose_php = Off@' /usr/local/php/lib/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/lib/php.ini -sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/lib/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/lib/php.ini -echo '[eaccelerator] -zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" -eaccelerator.shm_size="64" -eaccelerator.cache_dir="/tmp/eaccelerator" -eaccelerator.enable="1" -eaccelerator.optimizer="1" -eaccelerator.check_mtime="1" -eaccelerator.debug="0" -eaccelerator.filter="" -eaccelerator.shm_max="0" -eaccelerator.shm_ttl="0" -eaccelerator.shm_prune_period="0" -eaccelerator.shm_only="0" -eaccelerator.compress="0" -eaccelerator.compress_level="9" -eaccelerator.keys = "disk_only" -eaccelerator.sessions = "disk_only" -eaccelerator.content = "disk_only"' >> /usr/local/php/lib/php.ini +sed -i '730a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"' /usr/local/php/etc/php.ini +sed -i '731a extension = "memcache.so"' /usr/local/php/etc/php.ini +sed -i '732a extension = "pdo_mysql.so"' /usr/local/php/etc/php.ini +sed -i '733a extension = "imagick.so"' /usr/local/php/etc/php.ini +sed -i '734a extension = "http.so"' /usr/local/php/etc/php.ini +sed -i '242a output_buffering = On' /usr/local/php/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' /usr/local/php/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/etc/php.ini +sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini +sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/etc/php.ini + +sed -i 's@^;opcache.enable.*@opcache.enable=1@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' /usr/local/php/etc/php.ini cat > /usr/local/php/etc/php-fpm.conf <= 5 && ${#ftpmanagerpwd} >=5 ));then + break + else + echo "least 5 characters" + fi +done + +# Download packages +mkdir -p /root/lnmp/{source,conf} +function Download() +{ +cd /root/lnmp +[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh +cd /root/lnmp/source +[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +[ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz +[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz +[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz +[ -s php-5.3.27.tar.gz ] && echo 'php-5.3.27.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.27.tar.gz +[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz +[ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 +[ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz +[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz +[ -s imagick-3.0.1.tgz ] && echo 'imagick-3.0.1.tgz found' || wget http://pecl.php.net/get/imagick-3.0.1.tgz +[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz +[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz +[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz +[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz +[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz +cd ../conf +[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +} + + +function MySQL() +# install MySQL +{ +cd /root/lnmp/source +useradd -M -s /sbin/nologin mysql +mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql +tar xzf cmake-2.8.10.2.tar.gz +cd cmake-2.8.10.2 +./configure +make && make install +cd .. +tar zxf mysql-5.5.32.tar.gz +cd mysql-5.5.32 +cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ +-DMYSQL_DATADIR=/data/mysql \ +-DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DMYSQL_TCP_PORT=3306 \ +-DEXTRA_CHARSETS=all \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \ +-DWITH_DEBUG=0 +make && make install + +/bin/cp support-files/my-medium.cnf /etc/my.cnf +cp support-files/mysql.server /etc/init.d/mysqld +chmod 755 /etc/init.d/mysqld +chkconfig --add mysqld +chkconfig mysqld on +cd .. + +# my.cf +sed -i '38a ##############' /etc/my.cnf +sed -i '39a skip-name-resolve' /etc/my.cnf +sed -i '40a basedir=/usr/local/mysql' /etc/my.cnf +sed -i '41a datadir=/data/mysql' /etc/my.cnf +sed -i '42a user=mysql' /etc/my.cnf +sed -i '43a #lower_case_table_names = 1' /etc/my.cnf +sed -i '44a max_connections=1000' /etc/my.cnf +sed -i '45a ft_min_word_len=1' /etc/my.cnf +sed -i '46a expire_logs_days = 7' /etc/my.cnf +sed -i '47a query_cache_size=64M' /etc/my.cnf +sed -i '48a query_cache_type=1' /etc/my.cnf +sed -i '49a ##############' /etc/my.cnf + +/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql + +chown mysql.mysql -R /data/mysql +/sbin/service mysqld start +export PATH=$PATH:/usr/local/mysql/bin +echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile +source /etc/profile + +/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" +/sbin/service mysqld restart +} + +function PHP() +# install PHP +{ +cd /root/lnmp/source +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +/sbin/ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.3-10.tar.gz +cd ImageMagick-6.8.3-10 +./configure +make && make install +cd ../ + +if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + cp -frp /usr/lib64/libldap* /usr/lib +else + ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 +fi + +tar xzf mcrypt-2.6.8.tar.gz +cd mcrypt-2.6.8 +/sbin/ldconfig +./configure +make && make install +cd ../ + +tar xzf php-5.3.27.tar.gz +useradd -M -s /sbin/nologin www +cd php-5.3.27 +./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug +make ZEND_EXTRA_LIBS='-liconv' +make install +cp php.ini-production /usr/local/php/lib/php.ini + +#php-fpm Init Script +cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +chkconfig --add php-fpm +chkconfig php-fpm on +cd ../ + +tar xzf memcache-2.2.7.tgz +cd memcache-2.2.7 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +tar xjf eaccelerator-0.9.6.1.tar.bz2 +cd eaccelerator-0.9.6.1 +/usr/local/php/bin/phpize +./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +tar xzf PDO_MYSQL-1.0.2.tgz +cd PDO_MYSQL-1.0.2 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql +make && make install +cd ../ + +tar xzf imagick-3.0.1.tgz +cd imagick-3.0.1 +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Support HTTP request curls +tar xzf pecl_http-1.7.6.tgz +cd pecl_http-1.7.6 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Modify php.ini +mkdir /tmp/eaccelerator +/bin/chown -R www.www /tmp/eaccelerator/ +sed -i '808a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"' /usr/local/php/lib/php.ini +sed -i '809a extension = "memcache.so"' /usr/local/php/lib/php.ini +sed -i '810a extension = "pdo_mysql.so"' /usr/local/php/lib/php.ini +sed -i '811a extension = "imagick.so"' /usr/local/php/lib/php.ini +sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini +sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini +sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini +sed -i 's@short_open_tag = Off@short_open_tag = On@' /usr/local/php/lib/php.ini +sed -i 's@expose_php = On@expose_php = Off@' /usr/local/php/lib/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/lib/php.ini +sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/lib/php.ini +sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/lib/php.ini +echo '[eaccelerator] +zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" +eaccelerator.shm_size="64" +eaccelerator.cache_dir="/tmp/eaccelerator" +eaccelerator.enable="1" +eaccelerator.optimizer="1" +eaccelerator.check_mtime="1" +eaccelerator.debug="0" +eaccelerator.filter="" +eaccelerator.shm_max="0" +eaccelerator.shm_ttl="0" +eaccelerator.shm_prune_period="0" +eaccelerator.shm_only="0" +eaccelerator.compress="0" +eaccelerator.compress_level="9" +eaccelerator.keys = "disk_only" +eaccelerator.sessions = "disk_only" +eaccelerator.content = "disk_only"' >> /usr/local/php/lib/php.ini + +cat > /usr/local/php/etc/php-fpm.conf < /etc/logrotate.d/nginx + +service nginx restart +} + +function Pureftp() +# install Pureftpd and pureftpd_php_manager +{ +cd /root/lnmp/source +tar xzf pure-ftpd-1.0.36.tar.gz +cd pure-ftpd-1.0.36 +./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese +make && make install +cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin +chmod +x /usr/local/pureftpd/sbin/pure-config.pl +cp contrib/redhat.init /etc/init.d/pureftpd +sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pureftpd +sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd +sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd +chmod +x /etc/init.d/pureftpd +chkconfig --add pureftpd +chkconfig pureftpd on + +cd /root/lnmp/conf +/bin/cp pure-ftpd.conf /usr/local/pureftpd/ +/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ +mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` +sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf +sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql +sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql +service pureftpd start + +mkdir -p /data/admin +cd ../source +tar xzf ftp_v2.1.tar.gz +mv ftp /data/admin;chown -R www.www /data/admin +sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php +sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php +sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php +rm -rf /data/admin/ftp/install.php +echo '' > /data/admin/index.php +cd ../ +} + +function Iptables() +{ +cat > /etc/sysconfig/iptables << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +COMMIT +EOF +service iptables restart +} + +Download 2>&1 | tee -a /root/lnmp/lnmp_install.log +Download +chmod +x /root/lnmp/init.sh +/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +echo -e "\033[32minitialized successfully\033[0m" +MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" +PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" +Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" +Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" +Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log + +echo "################Congratulations####################" +echo "The path of some dirs:" +echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" +echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" +echo -e "PHP dir: \033[32m/usr/local/php\033[0m" +echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" +echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" +echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" +echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" +echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" +echo "###################################################" diff --git a/lnmp_v5.5_install.sh b/lnmp_v5.5_install.sh new file mode 100644 index 00000000..183c3293 --- /dev/null +++ b/lnmp_v5.5_install.sh @@ -0,0 +1,505 @@ +#!/bin/bash +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 + +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat Linux #" +echo "# For more information please visit https://github.com/lj2007331/lnmp #" +echo "#######################################################################" +echo '' + +# get IP +IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` + +# Set password +while : +do + read -p "Please input the root password of MySQL:" mysqlrootpwd + read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd + if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then + break + else + echo "least 5 characters" + fi +done + +# Download packages +mkdir -p /root/lnmp/{source,conf} +function Download() +{ +cd /root/lnmp +[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh +cd /root/lnmp/source +[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +[ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz +[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz +[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz +[ -s php-5.5.0.tar.gz ] && echo 'php-5.5.0.tar.gz found' || wget http://kr1.php.net/distributions/php-5.5.0.tar.gz +[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz +[ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz +[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz +[ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz +[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz +[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz +[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz +[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz +[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz +cd ../conf +[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +} + + +function MySQL() +# install MySQL +{ +cd /root/lnmp/source +useradd -M -s /sbin/nologin mysql +mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql +tar xzf cmake-2.8.10.2.tar.gz +cd cmake-2.8.10.2 +./configure +make && make install +cd .. +tar zxf mysql-5.6.12.tar.gz +cd mysql-5.6.12 +cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ +-DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_MEMORY_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MEMORY_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DMYSQL_DATADIR=/data/mysql \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DEXTRA_CHARSETS=all \ +-DWITH_DEBUG=0 +make && make install + +/bin/cp support-files/my-default.cnf /etc/my.cnf +cp support-files/mysql.server /etc/init.d/mysqld +chmod 755 /etc/init.d/mysqld +chkconfig --add mysqld +chkconfig mysqld on +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = /usr/local/mysql +datadir = /data/mysql +socket = /data/mysql/mysql.sock +character-set-server=utf8 +collation-server=utf8_general_ci +user=mysql +port = 3306 +default_storage_engine = InnoDB +server_id = 1 +log_bin=mysql-bin +binlog_format=mixed +expire_logs_days = 7 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len=1 +query_cache_size=64M +query_cache_type=1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K + +# LOG +log_error = /data/mysql/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = /data/mysql/mysql-slow.log + +# Oher +explicit_defaults_for_timestamp=true +#max_connections = 1000 +open_files_limit = 65535 +sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES + +[client] +port = 3306 +socket = /data/mysql/mysql.sock +EOF + +/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql + +chown mysql.mysql -R /data/mysql +/sbin/service mysqld start +export PATH=$PATH:/usr/local/mysql/bin +echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile +source /etc/profile + +/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" +/sbin/service mysqld restart +} + +function PHP() +# install PHP +{ +cd /root/lnmp/source +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +/sbin/ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.3-10.tar.gz +cd ImageMagick-6.8.3-10 +./configure +make && make install +cd ../ + +if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 + ln -s /usr/local/mysql/include/* /usr/local/include/ + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + cp -frp /usr/lib64/libldap* /usr/lib +else + ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 + ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 + ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config + ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 + ln -s /usr/local/mysql/include/* /usr/local/include/ + ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 +fi + +tar xzf mcrypt-2.6.8.tar.gz +cd mcrypt-2.6.8 +/sbin/ldconfig +./configure +make && make install +cd ../ + +tar xzf php-5.5.0.tar.gz +useradd -M -s /sbin/nologin www +cd php-5.5.0 +./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-opcache \ +--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop \ +--enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex --enable-fpm \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ +--enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +make ZEND_EXTRA_LIBS='-liconv' +make install +#wget http://pear.php.net/go-pear.phar +#/usr/local/php/bin/php go-pear.phar + +cp php.ini-production /usr/local/php/etc/php.ini + +#php-fpm Init Script +cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +chkconfig --add php-fpm +chkconfig php-fpm on +cd ../ + +tar xzf memcache-2.2.7.tgz +cd memcache-2.2.7 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +tar xzf PDO_MYSQL-1.0.2.tgz +cd PDO_MYSQL-1.0.2 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql +make && make install +cd ../ + +tar xzf imagick-3.1.0RC2.tgz +cd imagick-3.1.0RC2 +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Support HTTP request curls +tar xzf pecl_http-1.7.6.tgz +cd pecl_http-1.7.6 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +cd ../ + +# Modify php.ini +sed -i '730a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"' /usr/local/php/etc/php.ini +sed -i '731a extension = "memcache.so"' /usr/local/php/etc/php.ini +sed -i '732a extension = "pdo_mysql.so"' /usr/local/php/etc/php.ini +sed -i '733a extension = "imagick.so"' /usr/local/php/etc/php.ini +sed -i '734a extension = "http.so"' /usr/local/php/etc/php.ini +sed -i '242a output_buffering = On' /usr/local/php/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' /usr/local/php/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/etc/php.ini +sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini +sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/etc/php.ini + +sed -i 's@^;opcache.enable.*@opcache.enable=1@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' /usr/local/php/etc/php.ini +sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' /usr/local/php/etc/php.ini + +cat > /usr/local/php/etc/php-fpm.conf < /etc/logrotate.d/nginx + +service nginx restart +} + +function Pureftp() +# install Pureftpd and pureftpd_php_manager +{ +cd /root/lnmp/source +tar xzf pure-ftpd-1.0.36.tar.gz +cd pure-ftpd-1.0.36 +./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese +make && make install +cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin +chmod +x /usr/local/pureftpd/sbin/pure-config.pl +cp contrib/redhat.init /etc/init.d/pureftpd +sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pureftpd +sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd +sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd +chmod +x /etc/init.d/pureftpd +chkconfig --add pureftpd +chkconfig pureftpd on + +cd /root/lnmp/conf +/bin/cp pure-ftpd.conf /usr/local/pureftpd/ +/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ +mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` +sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf +sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql +sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql +service pureftpd start + +mkdir -p /data/admin +cd ../source +tar xzf ftp_v2.1.tar.gz +mv ftp /data/admin;chown -R www.www /data/admin +sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php +sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php +sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php +rm -rf /data/admin/ftp/install.php +echo '' > /data/admin/index.php +cd ../ +} + +function Iptables() +{ +cat > /etc/sysconfig/iptables << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +COMMIT +EOF +service iptables restart +} + +Download 2>&1 | tee -a /root/lnmp/lnmp_install.log +Download +chmod +x /root/lnmp/init.sh +/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +echo -e "\033[32minitialized successfully\033[0m" +MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" +PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" +Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" +Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" +Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log + +echo "################Congratulations####################" +echo "The path of some dirs:" +echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" +echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" +echo -e "PHP dir: \033[32m/usr/local/php\033[0m" +echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" +echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" +echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" +echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" +echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" +echo "###################################################" From d5be6e99592b3178fe0cfcd5f963f92113855397 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 16 Jul 2013 17:56:01 +0800 Subject: [PATCH 041/617] update php-5.5.0 and MySQL-5.6.12 --- lnmp_v5.5_install.sh | 505 ------------------------------------------- 1 file changed, 505 deletions(-) delete mode 100644 lnmp_v5.5_install.sh diff --git a/lnmp_v5.5_install.sh b/lnmp_v5.5_install.sh deleted file mode 100644 index 183c3293..00000000 --- a/lnmp_v5.5_install.sh +++ /dev/null @@ -1,505 +0,0 @@ -#!/bin/bash -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 - -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat Linux #" -echo "# For more information please visit https://github.com/lj2007331/lnmp #" -echo "#######################################################################" -echo '' - -# get IP -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` - -# Set password -while : -do - read -p "Please input the root password of MySQL:" mysqlrootpwd - read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd - if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then - break - else - echo "least 5 characters" - fi -done - -# Download packages -mkdir -p /root/lnmp/{source,conf} -function Download() -{ -cd /root/lnmp -[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh -cd /root/lnmp/source -[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -[ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz -[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz -[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -[ -s php-5.5.0.tar.gz ] && echo 'php-5.5.0.tar.gz found' || wget http://kr1.php.net/distributions/php-5.5.0.tar.gz -[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz -[ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz -[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz -[ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz -[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz -[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz -[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz -[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz -cd ../conf -[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx -[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql -} - - -function MySQL() -# install MySQL -{ -cd /root/lnmp/source -useradd -M -s /sbin/nologin mysql -mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql -tar xzf cmake-2.8.10.2.tar.gz -cd cmake-2.8.10.2 -./configure -make && make install -cd .. -tar zxf mysql-5.6.12.tar.gz -cd mysql-5.6.12 -cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ --DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_MEMORY_STORAGE_ENGINE=1 \ --DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ --DWITH_MEMORY_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DMYSQL_DATADIR=/data/mysql \ --DMYSQL_USER=mysql \ --DMYSQL_TCP_PORT=3306 \ --DEXTRA_CHARSETS=all \ --DWITH_DEBUG=0 -make && make install - -/bin/cp support-files/my-default.cnf /etc/my.cnf -cp support-files/mysql.server /etc/init.d/mysqld -chmod 755 /etc/init.d/mysqld -chkconfig --add mysqld -chkconfig mysqld on -cd .. - -# my.cf -cat > /etc/my.cnf << EOF -[mysqld] -basedir = /usr/local/mysql -datadir = /data/mysql -socket = /data/mysql/mysql.sock -character-set-server=utf8 -collation-server=utf8_general_ci -user=mysql -port = 3306 -default_storage_engine = InnoDB -server_id = 1 -log_bin=mysql-bin -binlog_format=mixed -expire_logs_days = 7 - -# name-resolve -skip-name-resolve -skip-host-cache - -#lower_case_table_names = 1 -ft_min_word_len=1 -query_cache_size=64M -query_cache_type=1 - -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K - -# LOG -log_error = /data/mysql/mysql-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = /data/mysql/mysql-slow.log - -# Oher -explicit_defaults_for_timestamp=true -#max_connections = 1000 -open_files_limit = 65535 -sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES - -[client] -port = 3306 -socket = /data/mysql/mysql.sock -EOF - -/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql - -chown mysql.mysql -R /data/mysql -/sbin/service mysqld start -export PATH=$PATH:/usr/local/mysql/bin -echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile -source /etc/profile - -/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" -/sbin/service mysqld restart -} - -function PHP() -# install PHP -{ -cd /root/lnmp/source -tar xzf libiconv-1.14.tar.gz -cd libiconv-1.14 -./configure --prefix=/usr/local -make && make install -cd ../ - -tar xzf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8 -./configure -make && make install -/sbin/ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -tar xzf mhash-0.9.9.9.tar.gz -cd mhash-0.9.9.9 -./configure -make && make install -cd ../ - -tar xzf ImageMagick-6.8.3-10.tar.gz -cd ImageMagick-6.8.3-10 -./configure -make && make install -cd ../ - -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la - ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so - ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 - ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 - ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a - ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la - ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so - ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 - ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 - ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config - ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 - ln -s /usr/local/mysql/include/* /usr/local/include/ - ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 - ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick - cp -frp /usr/lib64/libldap* /usr/lib -else - ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la - ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so - ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 - ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 - ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a - ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la - ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so - ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 - ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 - ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config - ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 - ln -s /usr/local/mysql/include/* /usr/local/include/ - ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick - ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 -fi - -tar xzf mcrypt-2.6.8.tar.gz -cd mcrypt-2.6.8 -/sbin/ldconfig -./configure -make && make install -cd ../ - -tar xzf php-5.5.0.tar.gz -useradd -M -s /sbin/nologin www -cd php-5.5.0 -./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-opcache \ ---with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex --enable-fpm \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -make ZEND_EXTRA_LIBS='-liconv' -make install -#wget http://pear.php.net/go-pear.phar -#/usr/local/php/bin/php go-pear.phar - -cp php.ini-production /usr/local/php/etc/php.ini - -#php-fpm Init Script -cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm -chmod +x /etc/init.d/php-fpm -chkconfig --add php-fpm -chkconfig php-fpm on -cd ../ - -tar xzf memcache-2.2.7.tgz -cd memcache-2.2.7 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -tar xzf PDO_MYSQL-1.0.2.tgz -cd PDO_MYSQL-1.0.2 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql -make && make install -cd ../ - -tar xzf imagick-3.1.0RC2.tgz -cd imagick-3.1.0RC2 -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Modify php.ini -sed -i '730a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"' /usr/local/php/etc/php.ini -sed -i '731a extension = "memcache.so"' /usr/local/php/etc/php.ini -sed -i '732a extension = "pdo_mysql.so"' /usr/local/php/etc/php.ini -sed -i '733a extension = "imagick.so"' /usr/local/php/etc/php.ini -sed -i '734a extension = "http.so"' /usr/local/php/etc/php.ini -sed -i '242a output_buffering = On' /usr/local/php/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' /usr/local/php/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/etc/php.ini -sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/etc/php.ini - -sed -i 's@^;opcache.enable.*@opcache.enable=1@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' /usr/local/php/etc/php.ini - -cat > /usr/local/php/etc/php-fpm.conf < /etc/logrotate.d/nginx - -service nginx restart -} - -function Pureftp() -# install Pureftpd and pureftpd_php_manager -{ -cd /root/lnmp/source -tar xzf pure-ftpd-1.0.36.tar.gz -cd pure-ftpd-1.0.36 -./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese -make && make install -cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin -chmod +x /usr/local/pureftpd/sbin/pure-config.pl -cp contrib/redhat.init /etc/init.d/pureftpd -sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pureftpd -sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd -sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd -chmod +x /etc/init.d/pureftpd -chkconfig --add pureftpd -chkconfig pureftpd on - -cd /root/lnmp/conf -/bin/cp pure-ftpd.conf /usr/local/pureftpd/ -/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ -mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql -sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql -service pureftpd start - -mkdir -p /data/admin -cd ../source -tar xzf ftp_v2.1.tar.gz -mv ftp /data/admin;chown -R www.www /data/admin -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php -sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php -rm -rf /data/admin/ftp/install.php -echo '' > /data/admin/index.php -cd ../ -} - -function Iptables() -{ -cat > /etc/sysconfig/iptables << EOF -# Firewall configuration written by system-config-securitylevel -# Manual customization of this file is not recommended. -*filter -:INPUT DROP [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] --A INPUT -i lo -j ACCEPT --A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -COMMIT -EOF -service iptables restart -} - -Download 2>&1 | tee -a /root/lnmp/lnmp_install.log -Download -chmod +x /root/lnmp/init.sh -/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -echo -e "\033[32minitialized successfully\033[0m" -MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" -PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" -Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" -Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" -Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log - -echo "################Congratulations####################" -echo "The path of some dirs:" -echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" -echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" -echo -e "PHP dir: \033[32m/usr/local/php\033[0m" -echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" -echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" -echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" -echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" -echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" -echo "###################################################" From 7e0167dcee68cdfeb0ebde2558de9de12a3913e3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 16 Jul 2013 18:15:23 +0800 Subject: [PATCH 042/617] update php-5.5.0 and MySQL-5.6.12 --- lnmp_install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 183c3293..5ed78ffc 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -28,7 +28,7 @@ mkdir -p /root/lnmp/{source,conf} function Download() { cd /root/lnmp -[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh +[ -s init.sh ] && echo 'init.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh cd /root/lnmp/source [ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz [ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz @@ -47,11 +47,11 @@ cd /root/lnmp/source [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz cd ../conf -[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx -[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +[ -s nginx.conf ] && echo 'nginx.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s script.mysql ] && echo 'script.mysql found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql } From f643ce61344fb760ae3a2ebdb4ade459f76eab89 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 16 Jul 2013 23:36:35 +0800 Subject: [PATCH 043/617] update source packages --- README | 9 +++++---- init.sh | 6 ++++++ lnmp_install.sh | 24 ++++++++++++++---------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/README b/README index 7a54b301..f7b0ac9b 100644 --- a/README +++ b/README @@ -1,17 +1,18 @@ Source packages version: -cmake-2.8.10.2.tar.gz +cmake-2.8.11.2.tar.gz mysql-5.6.12.tar.gz libiconv-1.14.tar.gz -bmcrypt-2.5.8.tar.gz +libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz php-5.5.0.tar.gz memcache-2.2.7.tgz PDO_MYSQL-1.0.2.tgz -ImageMagick-6.8.3-10.tar.gz +ImageMagick-6.8.6-5.tar.gz imagick-3.1.0RC2.tgz pecl_http-1.7.6.tgz -pcre-8.32.tar.gz +pcre-8.33.tar.gz nginx-1.4.1.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz +phpMyAdmin-4.0.4.1-all-languages.tar.gz diff --git a/init.sh b/init.sh index 35e3a46a..e1242fc4 100644 --- a/init.sh +++ b/init.sh @@ -1,5 +1,11 @@ #!/bin/bash # Configure yum source +wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz +tar zxf yum-3.4.3.tar.gz +cd yum-3.4.3 +./yummain.py install yum +rm -rf yum-3.4.3* +yum check-update mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo$(date +%m%d) diff --git a/lnmp_install.sh b/lnmp_install.sh index 5ed78ffc..8419a684 100644 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -30,22 +30,23 @@ function Download() cd /root/lnmp [ -s init.sh ] && echo 'init.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh cd /root/lnmp/source -[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +[ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz [ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz [ -s php-5.5.0.tar.gz ] && echo 'php-5.5.0.tar.gz found' || wget http://kr1.php.net/distributions/php-5.5.0.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz [ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz -[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz +[ -s ImageMagick-6.8.6-5.tar.gz ] && echo 'ImageMagick-6.8.6-5.tar.gz found' || wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.8.6-5.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz +[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz +[ -s phpMyAdmin-4.0.4.1-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.4.1-all-languages.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.4.1/phpMyAdmin-4.0.4.1-all-languages.tar.gz cd ../conf [ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx [ -s nginx.conf ] && echo 'nginx.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf @@ -61,8 +62,8 @@ function MySQL() cd /root/lnmp/source useradd -M -s /sbin/nologin mysql mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql -tar xzf cmake-2.8.10.2.tar.gz -cd cmake-2.8.10.2 +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 ./configure make && make install cd .. @@ -184,8 +185,8 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.3-10.tar.gz -cd ImageMagick-6.8.3-10 +tar xzf ImageMagick-6.8.6-5.tar.gz +cd ImageMagick-6.8.6-5 ./configure make && make install cd ../ @@ -371,8 +372,8 @@ function Nginx() # install Nginx { cd /root/lnmp/source -tar xzf pcre-8.32.tar.gz -cd pcre-8.32 +tar xzf pcre-8.33.tar.gz +cd pcre-8.33 ./configure make && make install cd ../ @@ -442,6 +443,8 @@ service pureftpd start mkdir -p /data/admin cd ../source +tar xzf phpMyAdmin-4.0.4.1-all-languages.tar.gz +mv phpMyAdmin-4.0.4.1-all-languages /data/admin/phpMyAdmin tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php @@ -502,4 +505,5 @@ echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" +echo -e "MySQL_manager url: \033[32mhttp://$IP/phpMyAdmin\033[0m" echo "###################################################" From ea1ad566eef34773ed6adeda9ebf2432e75c9e2d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 13:34:34 +0800 Subject: [PATCH 044/617] update --- init.sh | 48 +++++++++-- lnmp_install.sh | 17 ++-- lnmp_v5.3_install.sh | 0 vhost.sh | 188 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 242 insertions(+), 11 deletions(-) mode change 100644 => 100755 init.sh mode change 100644 => 100755 lnmp_install.sh mode change 100644 => 100755 lnmp_v5.3_install.sh create mode 100755 vhost.sh diff --git a/init.sh b/init.sh old mode 100644 new mode 100755 index e1242fc4..ffb1d19e --- a/init.sh +++ b/init.sh @@ -1,19 +1,24 @@ #!/bin/bash # Configure yum source +cd /tmp wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz tar zxf yum-3.4.3.tar.gz cd yum-3.4.3 ./yummain.py install yum +cd .. rm -rf yum-3.4.3* yum check-update mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo$(date +%m%d) yum clean all + # Remove obsolete rpm package yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Office/Productivity" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" + # Update rpm package yum -y update + # Install dependencies package yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison gd-devel libtool vim-enhanced pcre-devel zip unzip @@ -31,8 +36,6 @@ chkconfig iptables on setenforce 0 sed -i 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config -# Set LANG -sed -i 's@^LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n # initdefault sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab /sbin/init q @@ -62,8 +65,18 @@ echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf echo 'net.ipv4.ip_local_port_range = 1024 65000' >> /etc/sysctl.conf sysctl -p -# disable ipv6 -sed -i 's/NETWORKING_IPV6=.*$/NETWORKING_IPV6=no/g' /etc/sysconfig/network +if [ -z "$(cat /etc/redhat-release | grep '6\.')" ];then + sed -i 's/3:2345:respawn/#3:2345:respawn/g' /etc/inittab + sed -i 's/4:2345:respawn/#4:2345:respawn/g' /etc/inittab + sed -i 's/5:2345:respawn/#5:2345:respawn/g' /etc/inittab + sed -i 's/6:2345:respawn/#6:2345:respawn/g' /etc/inittab + sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/g' /etc/inittab + sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n +else + sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init + sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf +fi +/sbin/init q # Set timezone rm -rf /etc/localtime @@ -86,11 +99,34 @@ cat > /etc/sysconfig/iptables << EOF -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -# -A INPUT -p udp -m udp --dport 20 -j ACCEPT COMMIT EOF /sbin/service iptables restart source /etc/profile + +###install tmux +yum -y install ncurses-devel +mkdir tmux +cd tmux +wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz +wget http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz +tar xzf libevent-2.0.21-stable.tar.gz +cd libevent-2.0.21-stable +./configure +make && make install +cd ../ + +tar xzf tmux-1.8.tar.gz +cd tmux-1.8 +CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure +make && make install +cd ../../ +rm -rf tmux + +if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 +else + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 +fi diff --git a/lnmp_install.sh b/lnmp_install.sh old mode 100644 new mode 100755 index 8419a684..33f11a7e --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -42,7 +42,7 @@ cd /root/lnmp/source [ -s ImageMagick-6.8.6-5.tar.gz ] && echo 'ImageMagick-6.8.6-5.tar.gz found' || wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.8.6-5.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz +[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz @@ -297,7 +297,11 @@ sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini sed -i 's@^expose_php = On@expose_php = Off@' /usr/local/php/etc/php.ini sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/etc/php.ini -sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini +sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini +sed -i 's@^post_max_size.*@post_max_size = 50M@' /usr/local/php/etc/php.ini +sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' /usr/local/php/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 300@' /usr/local/php/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' /usr/local/php/etc/php.ini sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/etc/php.ini sed -i 's@^;opcache.enable.*@opcache.enable=1@' /usr/local/php/etc/php.ini @@ -352,7 +356,7 @@ pm.max_requests = 512 request_terminate_timeout = 0 request_slowlog_timeout = 0 -slowlog = log/$pool.log.slow +slowlog = log/pool.log.slow rlimit_files = 51200 rlimit_core = 0 @@ -384,7 +388,7 @@ cd nginx-1.4.1 # Modify Nginx version sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "2.2.14"@g' src/core/nginx.h -sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Apache/" NGINX_VERSION@g' src/core/nginx.h +sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@g' src/core/nginx.h #./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_cache_purge-2.1 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module make && make install @@ -445,6 +449,9 @@ mkdir -p /data/admin cd ../source tar xzf phpMyAdmin-4.0.4.1-all-languages.tar.gz mv phpMyAdmin-4.0.4.1-all-languages /data/admin/phpMyAdmin +sed -i 's@localhost@127.0.0.1@' /data/admin/phpMyAdmin/libraries/config.default.php +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "update mysql.user set host = '%' where user ='root';" +/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "flush privileges;" tar xzf ftp_v2.1.tar.gz mv ftp /data/admin;chown -R www.www /data/admin sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php @@ -454,7 +461,7 @@ sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php rm -rf /data/admin/ftp/install.php echo '' > /data/admin/index.php +?>' > /data/admin/phpinfo.php cd ../ } diff --git a/lnmp_v5.3_install.sh b/lnmp_v5.3_install.sh old mode 100644 new mode 100755 diff --git a/vhost.sh b/vhost.sh new file mode 100755 index 00000000..c1bb4de4 --- /dev/null +++ b/vhost.sh @@ -0,0 +1,188 @@ +#!/bin/bash +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 + +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat Linux #" +echo "# For more information please visit https://github.com/lj2007331/lnmp #" +echo "#######################################################################" +echo '' + +if [ "$1" != "--help" ]; then + + domain="www.lnmp.org" + echo "Please input domain:" + read -p "(Default domain: www.lnmp.org):" domain + if [ "$domain" = "" ]; then + domain="www.lnmp.org" + fi + if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then + echo "===========================" + echo "domain=$domain" + echo "===========================" + else + echo "===========================" + echo "$domain is exist!" + echo "===========================" + fi + + echo "Do you want to add more domain name? (y/n)" + read add_more_domainame + + if [ "$add_more_domainame" == 'y' ]; then + + echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):" + read moredomain + echo "===========================" + echo domain list="$moredomain" + echo "===========================" + moredomainame=" $moredomain" + fi + + vhostdir="/home/wwwroot/$domain" + echo "Please input the directory for the domain:$domain :" + read -p "(Default directory: /home/wwwroot/$domain):" vhostdir + if [ "$vhostdir" = "" ]; then + vhostdir="/home/wwwroot/$domain" + fi + echo "===========================" + echo Virtual Host Directory="$vhostdir" + echo "===========================" + + echo "===========================" + echo "Allow Rewrite rule? (y/n)" + echo "===========================" + read allow_rewrite + + if [ "$allow_rewrite" == 'n' ]; then + rewrite="none" + else + rewrite="other" + echo "Please input the rewrite of programme :" + echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist." + read -p "(Default rewrite: other):" rewrite + if [ "$rewrite" = "" ]; then + rewrite="other" + fi + fi + echo "===========================" + echo You choose rewrite="$rewrite" + echo "===========================" + + echo "===========================" + echo "Allow access_log? (y/n)" + echo "===========================" + read access_log + + if [ "$access_log" == 'n' ]; then + al="access_log off;" + else + echo "Type access_log name(Default access log file:$domain.log):" + read al_name + if [ "$al_name" = "" ]; then + al_name="$domain" + fi + alf="log_format $al_name '\$remote_addr - \$remote_user [\$time_local] \"\$request\" ' + '\$status \$body_bytes_sent \"\$http_referer\" ' + '\"\$http_user_agent\" \$http_x_forwarded_for';" + al="access_log /home/wwwlogs/$al_name.log $al_name;" + echo "===========================" + echo You access log file="$al_name.log" + echo "===========================" + fi + + get_char() + { + SAVEDSTTY=`stty -g` + stty -echo + stty cbreak + dd if=/dev/tty bs=1 count=1 2> /dev/null + stty -raw + stty echo + stty $SAVEDSTTY + } + echo "" + echo "Press any key to start create virtul host..." + char=`get_char` + + +if [ ! -d /usr/local/nginx/conf/vhost ]; then + mkdir /usr/local/nginx/conf/vhost +fi + +echo "Create Virtul Host directory......" +mkdir -p $vhostdir +touch /home/wwwlogs/$al_name.log +echo "set permissions of Virtual Host directory......" +chmod -R 755 $vhostdir +chown -R www:www $vhostdir + +if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then + echo "Create Virtul Host ReWrite file......" + touch /usr/local/nginx/conf/$rewrite.conf + echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf." +else + echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf" +fi + +cat >/usr/local/nginx/conf/vhost/$domain.conf<>/usr/local/php/etc/php.ini< Date: Wed, 17 Jul 2013 17:55:30 +0800 Subject: [PATCH 045/617] 0.1 version --- conf/index.html | 37 + conf/nginx.conf | 5 +- conf/pureftpd-mysql.conf | 2 +- conf/script.mysql | 8 +- conf/tz.php | 1482 ++++++++++++++++++++++++++++++++++++++ lnmp_install.sh | 24 +- vhost.sh | 231 +++--- 7 files changed, 1623 insertions(+), 166 deletions(-) create mode 100644 conf/index.html create mode 100644 conf/tz.php diff --git a/conf/index.html b/conf/index.html new file mode 100644 index 00000000..58e2bba4 --- /dev/null +++ b/conf/index.html @@ -0,0 +1,37 @@ + + + +LNMP最新源码一键安装脚本 + + + + + + +
+
恭喜,LNMP最新源码安装成功!
+
+

LNMP最新源码一键安装脚本Linux+Nginx+MySQL+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。适用于CentOS/RadHat 5/6

+ +

查看本地环境:探针 phpinfo ftp manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名为不容易猜到的目录!)

+ +

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

+

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

+ + +
+ + diff --git a/conf/nginx.conf b/conf/nginx.conf index d656663b..0330aaa9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -64,7 +64,7 @@ http { server_name _; access_log /dev/null; root /data/admin; - index index.php; + index index.html index.php; location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; @@ -80,4 +80,7 @@ http { expires 1h; } } + +##########################vhost##################################### + include vhost/*.conf; } diff --git a/conf/pureftpd-mysql.conf b/conf/pureftpd-mysql.conf index 4d0270f1..3ce3b0e6 100644 --- a/conf/pureftpd-mysql.conf +++ b/conf/pureftpd-mysql.conf @@ -3,7 +3,7 @@ # If you want to use the Port methode comment out the MYSQLSocket line #//IMPORTENT!!!If display 530 error,please check the following MYSQL parameter!! MYSQLSocket /data/mysql/mysql.sock -MYSQLServer localhost +MYSQLServer 127.0.0.1 MYSQLPort 3306 MYSQLUser ftp MYSQLPassword tmppasswd diff --git a/conf/script.mysql b/conf/script.mysql index 3ea19014..d5611566 100644 --- a/conf/script.mysql +++ b/conf/script.mysql @@ -1,4 +1,4 @@ -grant all privileges on ftpusers.* to ftp@localhost identified by 'mysqlftppwd'; +grant all privileges on ftpusers.* to ftp@`127.0.0.1` identified by 'mysqlftppwd'; FLUSH PRIVILEGES; CREATE DATABASE ftpusers; @@ -23,9 +23,9 @@ CREATE TABLE `users` ( `Gid` int(11) NOT NULL default '501', `Dir` varchar(128) NOT NULL default '', `QuotaFiles` int(10) NOT NULL default '5000', - `QuotaSize` int(10) NOT NULL default '100', - `ULBandwidth` int(10) NOT NULL default '200', - `DLBandwidth` int(10) NOT NULL default '200', + `QuotaSize` int(10) NOT NULL default '1000', + `ULBandwidth` int(10) NOT NULL default '2000', + `DLBandwidth` int(10) NOT NULL default '2000', `Ipaddress` varchar(15) NOT NULL default '*', `Comment` tinytext, `Status` enum('0','1') NOT NULL default '1', diff --git a/conf/tz.php b/conf/tz.php new file mode 100644 index 00000000..894b3814 --- /dev/null +++ b/conf/tz.php @@ -0,0 +1,1482 @@ +=0; $l--) + { + $allsize1[$l]=floor($size/pow(1024,$l)); + $allsize[$l]=$allsize1[$l]-$allsize1[$l+1]*1024; + } + + $len=count($allsize); + + for($j = $len-1; $j >=0; $j--) + { + $fsize=$fsize.$allsize[$j].$danwei[$j]; + } + return $fsize; +} + +function valid_email($str) +{ + return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; +} + +//检测PHP设置参数 +function show($varName) +{ + switch($result = get_cfg_var($varName)) + { + case 0: + return '×'; + break; + + case 1: + return ''; + break; + + default: + return $result; + break; + } +} + +//保留服务器性能测试结果 +$valInt = isset($_POST['pInt']) ? $_POST['pInt'] : "未测试"; +$valFloat = isset($_POST['pFloat']) ? $_POST['pFloat'] : "未测试"; +$valIo = isset($_POST['pIo']) ? $_POST['pIo'] : "未测试"; + +if ($_GET['act'] == "phpinfo") +{ + phpinfo(); + exit(); +} +elseif($_POST['act'] == "整型测试") +{ + $valInt = test_int(); +} +elseif($_POST['act'] == "浮点测试") +{ + $valFloat = test_float(); +} +elseif($_POST['act'] == "IO测试") +{ + $valIo = test_io(); +} +//网速测试-开始 +elseif($_POST['act']=="开始测试") +{ +?> + + "; + } + ?> + +"; + Echo "这里显示系统所支持的所有函数,和自定义函数\n"; + print_r($arr); + echo ""; + exit(); +}elseif($_GET['act'] == "disable_functions") +{ + $disFuns=get_cfg_var("disable_functions"); + if(empty($disFuns)) + { + $arr = '×'; + } + else + { + $arr = $disFuns; + } + Function php() + { + } + echo "
";
+	Echo "这里显示系统被禁用的函数\n";
+	print_r($arr);
+	echo "
"; + exit(); +} + +//MySQL检测 +if ($_POST['act'] == 'MySQL检测') +{ + $host = isset($_POST['host']) ? trim($_POST['host']) : ''; + $port = isset($_POST['port']) ? (int) $_POST['port'] : ''; + $login = isset($_POST['login']) ? trim($_POST['login']) : ''; + $password = isset($_POST['password']) ? trim($_POST['password']) : ''; + $host = preg_match('~[^a-z0-9\-\.]+~i', $host) ? '' : $host; + $port = intval($port) ? intval($port) : ''; + $login = preg_match('~[^a-z0-9\_\-]+~i', $login) ? '' : htmlspecialchars($login); + $password = is_string($password) ? htmlspecialchars($password) : ''; +} +elseif ($_POST['act'] == '函数检测') +{ + $funRe = "函数".$_POST['funName']."支持状况检测结果:".isfun1($_POST['funName']); +} +elseif ($_POST['act'] == '邮件检测') +{ + $mailRe = "邮件发送检测结果:发送"; + if($_SERVER['SERVER_PORT']==80){$mailContent = "http://".$_SERVER['SERVER_NAME'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);} + else{$mailContent = "http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);} + $mailRe .= (false !== @mail($_POST["mailAdd"], $mailContent, "This is a test mail!")) ? "完成":"失败"; +} + +//网络速度测试 +if(isset($_POST['speed'])) +{ + $speed=round(100/($_POST['speed']/1000),2); +} +elseif($_GET['speed']=="0") +{ + $speed=6666.67; +} +elseif(isset($_GET['speed']) and $_GET['speed']>0) +{ + $speed=round(100/($_GET['speed']/1000),2); //下载速度:$speed kb/s +} +else +{ + $speed=" 未探测 "; +} + + +// 检测函数支持 +function isfun($funName = '') +{ + if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误'; + return (false !== function_exists($funName)) ? '' : '×'; +} +function isfun1($funName = '') +{ + if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误'; + return (false !== function_exists($funName)) ? '√' : '×'; +} + +//整数运算能力测试 +function test_int() +{ + $timeStart = gettimeofday(); + for($i = 0; $i < 3000000; $i++) + { + $t = 1+1; + } + $timeEnd = gettimeofday(); + $time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"]; + $time = round($time, 3)."秒"; + return $time; +} + +//浮点运算能力测试 +function test_float() +{ + //得到圆周率值 + $t = pi(); + $timeStart = gettimeofday(); + + for($i = 0; $i < 3000000; $i++) + { + //开平方 + sqrt($t); + } + + $timeEnd = gettimeofday(); + $time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"]; + $time = round($time, 3)."秒"; + return $time; +} + +//IO能力测试 +function test_io() +{ + $fp = @fopen(PHPSELF, "r"); + $timeStart = gettimeofday(); + for($i = 0; $i < 10000; $i++) + { + @fread($fp, 10240); + @rewind($fp); + } + $timeEnd = gettimeofday(); + @fclose($fp); + $time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"]; + $time = round($time, 3)."秒"; + return($time); +} + +function GetCoreInformation() {$data = file('/proc/stat');$cores = array();foreach( $data as $line ) {if( preg_match('/^cpu[0-9]/', $line) ){$info = explode(' ', $line);$cores[]=array('user'=>$info[1],'nice'=>$info[2],'sys' => $info[3],'idle'=>$info[4],'iowait'=>$info[5],'irq' => $info[6],'softirq' => $info[7]);}}return $cores;} +function GetCpuPercentages($stat1, $stat2) {if(count($stat1)!==count($stat2)){return;}$cpus=array();for( $i = 0, $l = count($stat1); $i < $l; $i++) { $dif = array(); $dif['user'] = $stat2[$i]['user'] - $stat1[$i]['user'];$dif['nice'] = $stat2[$i]['nice'] - $stat1[$i]['nice']; $dif['sys'] = $stat2[$i]['sys'] - $stat1[$i]['sys'];$dif['idle'] = $stat2[$i]['idle'] - $stat1[$i]['idle'];$dif['iowait'] = $stat2[$i]['iowait'] - $stat1[$i]['iowait'];$dif['irq'] = $stat2[$i]['irq'] - $stat1[$i]['irq'];$dif['softirq'] = $stat2[$i]['softirq'] - $stat1[$i]['softirq'];$total = array_sum($dif);$cpu = array();foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 2);$cpus['cpu' . $i] = $cpu;}return $cpus;} +$stat1 = GetCoreInformation();sleep(1);$stat2 = GetCoreInformation();$data = GetCpuPercentages($stat1, $stat2); +$cpu_show = $data['cpu0']['user']."%us, ".$data['cpu0']['sys']."%sy, ".$data['cpu0']['nice']."%ni, ".$data['cpu0']['idle']."%id, ".$data['cpu0']['iowait']."%wa, ".$data['cpu0']['irq']."%irq, ".$data['cpu0']['softirq']."%softirq"; +function makeImageUrl($title, $data) {$api='http://api.yahei.net/tz/cpu_show.php?id=';$url.=$data['user'].',';$url.=$data['nice'].',';$url.=$data['sys'].',';$url.=$data['idle'].',';$url.=$data['iowait'];$url.='&chdl=User|Nice|Sys|Idle|Iowait&chdlp=b&chl=';$url.=$data['user'].'%25|';$url.=$data['nice'].'%25|';$url.=$data['sys'].'%25|';$url.=$data['idle'].'%25|';$url.=$data['iowait'].'%25';$url.='&chtt=Core+'.$title;return $api.base64_encode($url);} +if($_GET['act'] == "cpu_percentage"){echo "
图片加载慢,请耐心等待!

";foreach( $data as $k => $v ) {echo '';}echo "
";exit();} + +// 根据不同系统取得CPU相关信息 +switch(PHP_OS) +{ + case "Linux": + $sysReShow = (false !== ($sysInfo = sys_linux()))?"show":"none"; + break; + + case "FreeBSD": + $sysReShow = (false !== ($sysInfo = sys_freebsd()))?"show":"none"; + break; +/* + case "WINNT": + $sysReShow = (false !== ($sysInfo = sys_windows()))?"show":"none"; + break; +*/ + default: + break; +} + +//linux系统探测 +function sys_linux() +{ + // CPU + if (false === ($str = @file("/proc/cpuinfo"))) return false; + $str = implode("", $str); + @preg_match_all("/model\s+name\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $model); + @preg_match_all("/cpu\s+MHz\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $mhz); + @preg_match_all("/cache\s+size\s{0,}\:+\s{0,}([\d\.]+\s{0,}[A-Z]+[\r\n]+)/", $str, $cache); + @preg_match_all("/bogomips\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $bogomips); + if (false !== is_array($model[1])) + { + $res['cpu']['num'] = sizeof($model[1]); + /* + for($i = 0; $i < $res['cpu']['num']; $i++) + { + $res['cpu']['model'][] = $model[1][$i].' ('.$mhz[1][$i].')'; + $res['cpu']['mhz'][] = $mhz[1][$i]; + $res['cpu']['cache'][] = $cache[1][$i]; + $res['cpu']['bogomips'][] = $bogomips[1][$i]; + }*/ + if($res['cpu']['num']==1) + $x1 = ''; + else + $x1 = ' ×'.$res['cpu']['num']; + $mhz[1][0] = ' | 频率:'.$mhz[1][0]; + $cache[1][0] = ' | 二级缓存:'.$cache[1][0]; + $bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0]; + $res['cpu']['model'][] = $model[1][0].$mhz[1][0].$cache[1][0].$bogomips[1][0].$x1; + if (false !== is_array($res['cpu']['model'])) $res['cpu']['model'] = implode("
", $res['cpu']['model']); + if (false !== is_array($res['cpu']['mhz'])) $res['cpu']['mhz'] = implode("
", $res['cpu']['mhz']); + if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("
", $res['cpu']['cache']); + if (false !== is_array($res['cpu']['bogomips'])) $res['cpu']['bogomips'] = implode("
", $res['cpu']['bogomips']); + } + + // NETWORK + + // UPTIME + if (false === ($str = @file("/proc/uptime"))) return false; + $str = explode(" ", implode("", $str)); + $str = trim($str[0]); + $min = $str / 60; + $hours = $min / 60; + $days = floor($hours / 24); + $hours = floor($hours - ($days * 24)); + $min = floor($min - ($days * 60 * 24) - ($hours * 60)); + if ($days !== 0) $res['uptime'] = $days."天"; + if ($hours !== 0) $res['uptime'] .= $hours."小时"; + $res['uptime'] .= $min."分钟"; + + // MEMORY + if (false === ($str = @file("/proc/meminfo"))) return false; + $str = implode("", $str); + preg_match_all("/MemTotal\s{0,}\:+\s{0,}([\d\.]+).+?MemFree\s{0,}\:+\s{0,}([\d\.]+).+?Cached\s{0,}\:+\s{0,}([\d\.]+).+?SwapTotal\s{0,}\:+\s{0,}([\d\.]+).+?SwapFree\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buf); + preg_match_all("/Buffers\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buffers); + + $res['memTotal'] = round($buf[1][0]/1024, 2); + $res['memFree'] = round($buf[2][0]/1024, 2); + $res['memBuffers'] = round($buffers[1][0]/1024, 2); + $res['memCached'] = round($buf[3][0]/1024, 2); + $res['memUsed'] = $res['memTotal']-$res['memFree']; + $res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0; + + $res['memRealUsed'] = $res['memTotal'] - $res['memFree'] - $res['memCached'] - $res['memBuffers']; //真实内存使用 + $res['memRealFree'] = $res['memTotal'] - $res['memRealUsed']; //真实空闲 + $res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0; //真实内存使用率 + + $res['memCachedPercent'] = (floatval($res['memCached'])!=0)?round($res['memCached']/$res['memTotal']*100,2):0; //Cached内存使用率 + + $res['swapTotal'] = round($buf[4][0]/1024, 2); + $res['swapFree'] = round($buf[5][0]/1024, 2); + $res['swapUsed'] = round($res['swapTotal']-$res['swapFree'], 2); + $res['swapPercent'] = (floatval($res['swapTotal'])!=0)?round($res['swapUsed']/$res['swapTotal']*100,2):0; + + // LOAD AVG + if (false === ($str = @file("/proc/loadavg"))) return false; + $str = explode(" ", implode("", $str)); + $str = array_chunk($str, 4); + $res['loadAvg'] = implode(" ", $str[0]); + + return $res; +} + +//FreeBSD系统探测 +function sys_freebsd() +{ + //CPU + if (false === ($res['cpu']['num'] = get_key("hw.ncpu"))) return false; + $res['cpu']['model'] = get_key("hw.model"); + //LOAD AVG + if (false === ($res['loadAvg'] = get_key("vm.loadavg"))) return false; + //UPTIME + if (false === ($buf = get_key("kern.boottime"))) return false; + $buf = explode(' ', $buf); + $sys_ticks = time() - intval($buf[3]); + $min = $sys_ticks / 60; + $hours = $min / 60; + $days = floor($hours / 24); + $hours = floor($hours - ($days * 24)); + $min = floor($min - ($days * 60 * 24) - ($hours * 60)); + if ($days !== 0) $res['uptime'] = $days."天"; + if ($hours !== 0) $res['uptime'] .= $hours."小时"; + $res['uptime'] .= $min."分钟"; + //MEMORY + if (false === ($buf = get_key("hw.physmem"))) return false; + $res['memTotal'] = round($buf/1024/1024, 2); + + $str = get_key("vm.vmtotal"); + preg_match_all("/\nVirtual Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buff, PREG_SET_ORDER); + preg_match_all("/\nReal Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buf, PREG_SET_ORDER); + + $res['memRealUsed'] = round($buf[0][2]/1024, 2); + $res['memCached'] = round($buff[0][2]/1024, 2); + $res['memUsed'] = round($buf[0][1]/1024, 2) + $res['memCached']; + $res['memFree'] = $res['memTotal'] - $res['memUsed']; + $res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0; + + $res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0; + + return $res; +} + +//取得参数值 FreeBSD +function get_key($keyName) +{ + return do_command('sysctl', "-n $keyName"); +} + +//确定执行文件位置 FreeBSD +function find_command($commandName) +{ + $path = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin'); + foreach($path as $p) + { + if (@is_executable("$p/$commandName")) return "$p/$commandName"; + } + return false; +} + +//执行系统命令 FreeBSD +function do_command($commandName, $args) +{ + $buffer = ""; + if (false === ($command = find_command($commandName))) return false; + if ($fp = @popen("$command $args", 'r')) + { + while (!@feof($fp)) + { + $buffer .= @fgets($fp, 4096); + } + return trim($buffer); + } + return false; +} + +//windows系统探测 +function sys_windows() +{ + if (PHP_VERSION >= 5) + { + $objLocator = new COM("WbemScripting.SWbemLocator"); + $wmi = $objLocator->ConnectServer(); + $prop = $wmi->get("Win32_PnPEntity"); + } + else + { + return false; + } + + //CPU + $cpuinfo = GetWMI($wmi,"Win32_Processor", array("Name","L2CacheSize","NumberOfCores")); + $res['cpu']['num'] = $cpuinfo[0]['NumberOfCores']; + if (null == $res['cpu']['num']) + { + $res['cpu']['num'] = 1; + }/* + for ($i=0;$i<$res['cpu']['num'];$i++) + { + $res['cpu']['model'] .= $cpuinfo[0]['Name']."
"; + $res['cpu']['cache'] .= $cpuinfo[0]['L2CacheSize']."
"; + }*/ + $cpuinfo[0]['L2CacheSize'] = ' ('.$cpuinfo[0]['L2CacheSize'].')'; + if($res['cpu']['num']==1) + $x1 = ''; + else + $x1 = ' ×'.$res['cpu']['num']; + $res['cpu']['model'] = $cpuinfo[0]['Name'].$cpuinfo[0]['L2CacheSize'].$x1; + // SYSINFO + $sysinfo = GetWMI($wmi,"Win32_OperatingSystem", array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate')); + $sysinfo[0]['Caption']=iconv('GBK', 'UTF-8',$sysinfo[0]['Caption']); + $sysinfo[0]['CSDVersion']=iconv('GBK', 'UTF-8',$sysinfo[0]['CSDVersion']); + $res['win_n'] = $sysinfo[0]['Caption']." ".$sysinfo[0]['CSDVersion']." 序列号:{$sysinfo[0]['SerialNumber']} 于".date('Y年m月d日H:i:s',strtotime(substr($sysinfo[0]['InstallDate'],0,14)))."安装"; + //UPTIME + $res['uptime'] = $sysinfo[0]['LastBootUpTime']; + + $sys_ticks = 3600*8 + time() - strtotime(substr($res['uptime'],0,14)); + $min = $sys_ticks / 60; + $hours = $min / 60; + $days = floor($hours / 24); + $hours = floor($hours - ($days * 24)); + $min = floor($min - ($days * 60 * 24) - ($hours * 60)); + if ($days !== 0) $res['uptime'] = $days."天"; + if ($hours !== 0) $res['uptime'] .= $hours."小时"; + $res['uptime'] .= $min."分钟"; + + //MEMORY + $res['memTotal'] = round($sysinfo[0]['TotalVisibleMemorySize']/1024,2); + $res['memFree'] = round($sysinfo[0]['FreePhysicalMemory']/1024,2); + $res['memUsed'] = $res['memTotal']-$res['memFree']; //上面两行已经除以1024,这行不用再除了 + $res['memPercent'] = round($res['memUsed'] / $res['memTotal']*100,2); + + $swapinfo = GetWMI($wmi,"Win32_PageFileUsage", array('AllocatedBaseSize','CurrentUsage')); + + // LoadPercentage + $loadinfo = GetWMI($wmi,"Win32_Processor", array("LoadPercentage")); + $res['loadAvg'] = $loadinfo[0]['LoadPercentage']; + + return $res; +} + +function GetWMI($wmi,$strClass, $strValue = array()) +{ + $arrData = array(); + + $objWEBM = $wmi->Get($strClass); + $arrProp = $objWEBM->Properties_; + $arrWEBMCol = $objWEBM->Instances_(); + foreach($arrWEBMCol as $objItem) + { + @reset($arrProp); + $arrInstance = array(); + foreach($arrProp as $propItem) + { + eval("\$value = \$objItem->" . $propItem->Name . ";"); + if (empty($strValue)) + { + $arrInstance[$propItem->Name] = trim($value); + } + else + { + if (in_array($propItem->Name, $strValue)) + { + $arrInstance[$propItem->Name] = trim($value); + } + } + } + $arrData[] = $arrInstance; + } + return $arrData; +} + +//比例条 +function bar($percent) +{ +?> +
 
+"$du",'freeSpace'=>"$df",'hdPercent'=>"$hdPercent",'barhdPercent'=>"$hdPercent%",'TotalMemory'=>"$mt",'UsedMemory'=>"$mu",'FreeMemory'=>"$mf",'CachedMemory'=>"$mc",'Buffers'=>"$mb",'TotalSwap'=>"$st",'swapUsed'=>"$su",'swapFree'=>"$sf",'loadAvg'=>"$load",'uptime'=>"$uptime",'freetime'=>"$freetime",'bjtime'=>"$bjtime",'stime'=>"$stime",'memRealPercent'=>"$memRealPercent",'memRealUsed'=>"$memRealUsed",'memRealFree'=>"$memRealFree",'memPercent'=>"$memPercent%",'memCachedPercent'=>"$memCachedPercent",'barmemCachedPercent'=>"$memCachedPercent%",'swapPercent'=>"$swapPercent",'barmemRealPercent'=>"$memRealPercent%",'barswapPercent'=>"$swapPercent%",'NetOut2'=>"$NetOut[2]",'NetOut3'=>"$NetOut[3]",'NetOut4'=>"$NetOut[4]",'NetOut5'=>"$NetOut[5]",'NetOut6'=>"$NetOut[6]",'NetOut7'=>"$NetOut[7]",'NetOut8'=>"$NetOut[8]",'NetOut9'=>"$NetOut[9]",'NetOut10'=>"$NetOut[10]",'NetInput2'=>"$NetInput[2]",'NetInput3'=>"$NetInput[3]",'NetInput4'=>"$NetInput[4]",'NetInput5'=>"$NetInput[5]",'NetInput6'=>"$NetInput[6]",'NetInput7'=>"$NetInput[7]",'NetInput8'=>"$NetInput[8]",'NetInput9'=>"$NetInput[9]",'NetInput10'=>"$NetInput[10]",'NetOutSpeed2'=>"$NetOutSpeed[2]",'NetOutSpeed3'=>"$NetOutSpeed[3]",'NetOutSpeed4'=>"$NetOutSpeed[4]",'NetOutSpeed5'=>"$NetOutSpeed[5]",'NetInputSpeed2'=>"$NetInputSpeed[2]",'NetInputSpeed3'=>"$NetInputSpeed[3]",'NetInputSpeed4'=>"$NetInputSpeed[4]",'NetInputSpeed5'=>"$NetInputSpeed[5]"); + $jarr=json_encode($arr); + $_GET['callback'] = htmlspecialchars($_GET['callback']); + echo $_GET['callback'],'(',$jarr,')'; + exit; +} +?> + + + +<?php echo $title.$version; ?> + + + + + + + + + +
+ + + + + + + + + + + + + + + +
PHP参数组件支持第三方组件数据库支持性能检测网速检测MySQL检测函数检测邮件检测探针下载
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
服务器参数
服务器域名/IP地址 - ()  你的IP地址是:
服务器标识
服务器操作系统  内核版本:服务器解译引擎
服务器语言服务器端口
服务器主机名绝对路径
管理员邮箱探针路径
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
服务器实时数据
服务器当前时间服务器已运行时间
CPU型号 [核]
CPU使用状况查看图表";}else{echo "暂时只支持Linux系统";}?> +
硬盘使用状况 + 总空间  G, + 已用  G, + 空闲  G, + 使用率 % +
 
+
内存使用状况 + + 物理内存:共 + + , 已用 + + , 空闲 + + , 使用率 + +
 
+0) +{ +?> + Cache化内存为 + , 使用率 + + % | Buffers缓冲为 +
 
+ + 真实内存使用 + + , 真实内存空闲 + + , 使用率 + + % +
 
+0) +{ +?> + SWAP区:共 + + , 已使用 + + , 空闲 + + , 使用率 + + % +
 
+ + +
系统平均负载
+ + + + + + + + + + + + + + + +
网络使用状况
: 入网: 实时: 0B/s出网: 实时: 0B/s
+ + + + + + + + + +
PHP已编译模块检测
+$value) { + if ($key!=0 && $key%13==0) { + echo '
'; + } + echo "$value  "; +} +?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PHP相关参数
PHP信息(phpinfo): + + ×' :"PHPINFO";?> + PHP版本(php_version):
PHP运行方式:脚本占用最大内存(memory_limit):
PHP安全模式(safe_mode):POST方法提交最大限制(post_max_size):
上传文件最大限制(upload_max_filesize):浮点型数据显示的有效位数(precision):
脚本超时时间(max_execution_time):socket超时时间(default_socket_timeout):
PHP页面根目录(doc_root):用户根目录(user_dir):
dl()函数(enable_dl):指定包含文件目录(include_path):
显示错误信息(display_errors):自定义全局变量(register_globals):
数据反斜杠转义(magic_quotes_gpc):"<?...?>"短标签(short_open_tag):
"<% %>"ASP风格标记(asp_tags):忽略重复错误信息(ignore_repeated_errors):
忽略重复的错误源(ignore_repeated_source):报告内存泄漏(report_memleaks):
自动字符串转义(magic_quotes_gpc):外部字符串自动转义(magic_quotes_runtime):
打开远程文件(allow_url_fopen):声明argv和argc变量(register_argc_argv):
Cookie 支持:√' : '×';?>拼写检查(ASpell Library):
高精度数学运算(BCMath):PREL相容语法(PCRE):
PDF文档支持:SNMP网络管理协议:
VMailMgr邮件处理:Curl支持:
SMTP支持:√' : '×';?>SMTP地址:×';?>
默认支持函数(enable_functions):请点这里查看详细!
被禁用的函数(disable_functions): +×'; +} +else +{ + //echo $disFuns; + $disFuns_array = explode(',',$disFuns); + foreach ($disFuns_array as $key=>$value) + { + if ($key!=0 && $key%5==0) { + echo '
'; + } + echo "$value  "; +} +} + +?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
组件支持
FTP支持:XML解析支持:
Session支持:Socket支持:
Calendar支持 + 允许URL打开文件:
GD库支持: + ×';} + ?>压缩文件支持(Zlib):
IMAP电子邮件系统函数库:历法运算函数库:
正则表达式函数库:WDDX支持:
Iconv编码转换:mbstring:
高精度数学运算:LDAP目录协议:
MCrypt加密处理:哈稀计算:
+ + + + + + + + + + + + + + + + + + + + + + + +
第三方组件
Zend版本×';}else{echo $zend_version;}?> + 2) +{ + echo "ZendGuardLoader[启用]"; +} +else +{ + echo "Zend Optimizer"; +} +?> + 2){echo (get_cfg_var("zend_loader.enable"))?'':'×';} else{if(function_exists('zend_optimizer_version')){ echo zend_optimizer_version();}else{ echo (get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend.ze1_compatibility_mode")||get_cfg_var("zend_extension_ts"))?'':'×';}}?>
eAccelerator×";} ?>ioncube×";}?>
XCache×";} ?>APC×";} ?>
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
数据库支持
MySQL 数据库: + + ODBC 数据库:
Oracle 数据库:SQL Server 数据库:
dBASE 数据库:mSQL 数据库:
SQLite 数据库:√ ';echo "SQLite3 Ver ";echo $sqliteVer[versionString];}else {echo isfun("sqlite_close");if(isfun("sqlite_close") == '') {echo "  版本: ".@sqlite_libversion();}}?>Hyperwave 数据库:
Postgre SQL 数据库:Informix 数据库:
DBA 数据库:DBM 数据库:
FilePro 数据库:SyBase 数据库:
+ + +
" method="post"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
服务器性能检测
参照对象整数运算能力检测
(1+1运算300万次)
浮点运算能力检测
(圆周率开平方300万次)
数据I/O能力检测
(读取10K文件1万次)
CPU信息
美国 LinodeVPS0.357秒0.802秒0.023秒4 x Xeon L5520 @ 2.27GHz
美国 PhotonVPS.com0.431秒1.024秒0.034秒8 x Xeon E5520 @ 2.27GHz
德国 SpaceRich.com0.421秒1.003秒0.038秒4 x Core i7 920 @ 2.67GHz
美国 RiZie.com0.521秒1.559秒0.054秒2 x Pentium4 3.00GHz
埃及 CitynetHost.com0.343秒0.761秒0.023秒2 x Core2Duo E4600 @ 2.40GHz
美国 IXwebhosting.com0.535秒1.607秒0.058秒4 x Xeon E5530 @ 2.40GHz
本台服务器


+ + + + + + + + + + + + +
网络速度测试
+
+ 向客户端传送1000k字节数据
+ 带宽比例按理想值计算 +
+ + + + + + + + + + + + + + + + + + +
带宽1M2M3M4M5M6M7M8M9M10M
+ + + + +
">">
+
+ ".$_GET['speed']." 毫秒,下载速度:"."".$speed.""." kb/s,需测试多次取平均值,超过10M直接看下载速度":" 未探测 " ?> + +
+ + + + + + + + + + +
MySQL数据库连接检测
+ 地址: + 端口: + 用户名: + 密码: + + +
+ alert('连接到MySql数据库正常')"; + } else { + echo ""; + } + } else { + echo ""; + } + } + ?> + + + + + + + + + + + alert('$funRe')"; + } + ?> +
函数检测
+ 请输入您要检测的函数: + + + +
+ + + + + + + + + + + alert('$mailRe')"; + } + ?> +
邮件发送检测
+ 请输入您要检测的邮件地址: + + + +
+
+ + + + + + + +
Processed in seconds. memory usage.返回顶部
+ +
+ + \ No newline at end of file diff --git a/lnmp_install.sh b/lnmp_install.sh index 33f11a7e..4a56faa2 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -3,7 +3,7 @@ [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 echo "#######################################################################" -echo "# LNMP for CentOS/RadHat Linux #" +echo "# LNMP for CentOS/RadHat 5/6 #" echo "# For more information please visit https://github.com/lj2007331/lnmp #" echo "#######################################################################" echo '' @@ -45,7 +45,7 @@ cd /root/lnmp/source [ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz [ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz -[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz +[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.4.1-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.4.1-all-languages.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.4.1/phpMyAdmin-4.0.4.1-all-languages.tar.gz cd ../conf [ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx @@ -153,6 +153,7 @@ export PATH=$PATH:/usr/local/mysql/bin echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile source /etc/profile +/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$mysqlrootpwd\" with grant option;" /usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" @@ -356,7 +357,7 @@ pm.max_requests = 512 request_terminate_timeout = 0 request_slowlog_timeout = 0 -slowlog = log/pool.log.slow +slowlog = log/slow.log rlimit_files = 51200 rlimit_core = 0 @@ -423,7 +424,7 @@ function Pureftp() cd /root/lnmp/source tar xzf pure-ftpd-1.0.36.tar.gz cd pure-ftpd-1.0.36 -./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese +./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english make && make install cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin chmod +x /usr/local/pureftpd/sbin/pure-config.pl @@ -450,18 +451,21 @@ cd ../source tar xzf phpMyAdmin-4.0.4.1-all-languages.tar.gz mv phpMyAdmin-4.0.4.1-all-languages /data/admin/phpMyAdmin sed -i 's@localhost@127.0.0.1@' /data/admin/phpMyAdmin/libraries/config.default.php -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "update mysql.user set host = '%' where user ='root';" -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "flush privileges;" tar xzf ftp_v2.1.tar.gz -mv ftp /data/admin;chown -R www.www /data/admin -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php -sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php +mv ftp /data/admin +sed -i 's/tmppasswd/'$mysqlftppwd'/' /data/admin/ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/" /data/admin/ftp/config.php +sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' /data/admin/ftp/config.php +sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' /data/admin/ftp/config.php sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php rm -rf /data/admin/ftp/install.php +cd /data/admin echo '' > /data/admin/phpinfo.php +wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html +wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/tz.php +chown -R www.www /data/admin cd ../ } diff --git a/vhost.sh b/vhost.sh index c1bb4de4..237aabdd 100755 --- a/vhost.sh +++ b/vhost.sh @@ -1,109 +1,72 @@ #!/bin/bash + # Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to create vhost" && exit 1 echo "#######################################################################" -echo "# LNMP for CentOS/RadHat Linux #" +echo "# LNMP for CentOS/RadHat 5/6 #" echo "# For more information please visit https://github.com/lj2007331/lnmp #" echo "#######################################################################" echo '' -if [ "$1" != "--help" ]; then - - domain="www.lnmp.org" - echo "Please input domain:" - read -p "(Default domain: www.lnmp.org):" domain - if [ "$domain" = "" ]; then - domain="www.lnmp.org" +while : +do + read -p "Please input domain(example: www.test.com test.com):" domain + if [ -z "`echo $domain | grep '.*\..*'`" ]; then + echo -e "\033[31minput error\033[0m" + else + break fi - if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then - echo "===========================" +done +if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then + echo "################################" echo "domain=$domain" - echo "===========================" - else - echo "===========================" + echo "################################" +else + echo "################################" echo "$domain is exist!" - echo "===========================" - fi - - echo "Do you want to add more domain name? (y/n)" - read add_more_domainame - - if [ "$add_more_domainame" == 'y' ]; then - - echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):" - read moredomain - echo "===========================" - echo domain list="$moredomain" - echo "===========================" - moredomainame=" $moredomain" - fi - - vhostdir="/home/wwwroot/$domain" - echo "Please input the directory for the domain:$domain :" - read -p "(Default directory: /home/wwwroot/$domain):" vhostdir - if [ "$vhostdir" = "" ]; then - vhostdir="/home/wwwroot/$domain" - fi - echo "===========================" - echo Virtual Host Directory="$vhostdir" - echo "===========================" - - echo "===========================" - echo "Allow Rewrite rule? (y/n)" - echo "===========================" - read allow_rewrite + echo "################################" + exit 1 +fi - if [ "$allow_rewrite" == 'n' ]; then - rewrite="none" - else - rewrite="other" - echo "Please input the rewrite of programme :" - echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist." - read -p "(Default rewrite: other):" rewrite - if [ "$rewrite" = "" ]; then - rewrite="other" +read -p "Do you want to add more domain name? (y/n)" add_more_domainame +if [ "$add_more_domainame" == 'y' ]; then + while : + do + read -p "Type domainname,example(test.com bbs.test.com):" moredomain + if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then + echo -e "\033[31minput error\033[0m" + else + echo "################################" + echo domain list="$moredomain" + echo "################################" + moredomainame=" $moredomain" + break fi - fi - echo "===========================" - echo You choose rewrite="$rewrite" - echo "===========================" + done +fi - echo "===========================" - echo "Allow access_log? (y/n)" - echo "===========================" - read access_log +echo "Please input the directory for the domain:$domain :" +read -p "(Default directory: /data/wwwroot/$domain):" vhostdir +if [ -z "$vhostdir" ]; then + vhostdir="/data/wwwroot/$domain" +fi +echo "################################" +echo Virtual Host Directory="$vhostdir" +echo "################################" - if [ "$access_log" == 'n' ]; then - al="access_log off;" - else - echo "Type access_log name(Default access log file:$domain.log):" - read al_name - if [ "$al_name" = "" ]; then - al_name="$domain" - fi - alf="log_format $al_name '\$remote_addr - \$remote_user [\$time_local] \"\$request\" ' - '\$status \$body_bytes_sent \"\$http_referer\" ' - '\"\$http_user_agent\" \$http_x_forwarded_for';" - al="access_log /home/wwwlogs/$al_name.log $al_name;" - echo "===========================" - echo You access log file="$al_name.log" - echo "===========================" - fi +echo "################################" +read -p "Allow access_log? (y/n)" access_log +echo "################################" - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start create virtul host..." - char=`get_char` +if [ "$access_log" == 'n' ]; then + al="access_log off;" +else + al="access_log logs/$domain.log;" + echo "################################" + echo You access log file="/usr/local/nginx/logs/$domain.log" + echo "################################" +fi if [ ! -d /usr/local/nginx/conf/vhost ]; then @@ -112,63 +75,32 @@ fi echo "Create Virtul Host directory......" mkdir -p $vhostdir -touch /home/wwwlogs/$al_name.log echo "set permissions of Virtual Host directory......" -chmod -R 755 $vhostdir -chown -R www:www $vhostdir - -if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then - echo "Create Virtul Host ReWrite file......" - touch /usr/local/nginx/conf/$rewrite.conf - echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf." -else - echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf" -fi - -cat >/usr/local/nginx/conf/vhost/$domain.conf<>/usr/local/php/etc/php.ini</usr/local/nginx/conf/vhost/$domain.conf< Date: Wed, 17 Jul 2013 18:00:55 +0800 Subject: [PATCH 046/617] lnmp_v0.1 --- lnmp_install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lnmp_install.sh b/lnmp_install.sh index 4a56faa2..34b1953d 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -29,6 +29,7 @@ function Download() { cd /root/lnmp [ -s init.sh ] && echo 'init.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh +[ -s vhost.sh ] && echo 'vhost.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh cd /root/lnmp/source [ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz [ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz From be1de553e69cd6181a62837d8bf5e9609c193053 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 18:37:38 +0800 Subject: [PATCH 047/617] bug --- conf/index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/index.html b/conf/index.html index 58e2bba4..653f2f76 100644 --- a/conf/index.html +++ b/conf/index.html @@ -22,16 +22,17 @@
-
恭喜,LNMP最新源码安装成功!

-

LNMP最新源码一键安装脚本Linux+Nginx+MySQL+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。适用于CentOS/RadHat 5/6

+

恭喜,LNMP最新源码安装成功!

+

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5/6

-

查看本地环境:探针 phpinfo ftp manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名为不容易猜到的目录!)

+

Github地址:https://github.com/lj2007331/lnmp

+

查看本地环境:探针 phpinfo ftp manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

- +
From de94ce9e9fb429d68abab2d9391113c13c82eaf9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 21:53:44 +0800 Subject: [PATCH 048/617] update --- lnmp_install.sh | 119 ++++++++++++++++++++++++++++++------------------ vhost.sh | 4 +- 2 files changed, 77 insertions(+), 46 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 34b1953d..c1772629 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -9,18 +9,42 @@ echo "#######################################################################" echo '' # get IP -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` +IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` -# Set password +# start while : do - read -p "Please input the root password of MySQL:" mysqlrootpwd - read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd - if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then - break - else - echo "least 5 characters" - fi + read -p "Please input the root password of MySQL:" mysqlrootpwd + FTP_yn='y' + echo -e "\033[32mDefault install Pure-FTPd\033[0m" + read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn + if [ $FTP_yn != 'y' ] && [ $FTP_yn != 'n' ];then + echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + break + fi + if [ $FTP_yn == 'y' ];then + read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd + fi + phpMyAdmin_yn='y' + echo -e "\033[32mDefault install phpMyAdmin\033[0m" + read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn + if [ $phpMyAdmin_yn != 'y' ] && [ $phpMyAdmin_yn != 'n' ];then + echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + break + fi + if [ $FTP_yn == 'y' ];then + if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then + break + else + echo -e "\033[31mpassword least 5 characters\033[0m" + fi + else + if (( ${#mysqlrootpwd} >= 5 ));then + break + else + echo -e "\033[31mpassword least 5 characters\033[0m" + fi + fi done # Download packages @@ -30,6 +54,14 @@ function Download() cd /root/lnmp [ -s init.sh ] && echo 'init.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh [ -s vhost.sh ] && echo 'vhost.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh +cd conf +[ -s tz.php ] && echo 'tz.php found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/tz.php +[ -s index.html ] && echo 'index.html found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/index.html +[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx +[ -s nginx.conf ] && echo 'nginx.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf +[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf +[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s script.mysql ] && echo 'script.mysql found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql cd /root/lnmp/source [ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz [ -s mysql-5.6.12.tar.gz ] && echo 'mysql-5.6.12.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.6.12.tar.gz @@ -48,15 +80,8 @@ cd /root/lnmp/source [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.4.1-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.4.1-all-languages.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.4.1/phpMyAdmin-4.0.4.1-all-languages.tar.gz -cd ../conf -[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx -[ -s nginx.conf ] && echo 'nginx.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[ -s script.mysql ] && echo 'script.mysql found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql } - function MySQL() # install MySQL { @@ -447,27 +472,32 @@ sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql service pureftpd start -mkdir -p /data/admin -cd ../source -tar xzf phpMyAdmin-4.0.4.1-all-languages.tar.gz -mv phpMyAdmin-4.0.4.1-all-languages /data/admin/phpMyAdmin -sed -i 's@localhost@127.0.0.1@' /data/admin/phpMyAdmin/libraries/config.default.php -tar xzf ftp_v2.1.tar.gz -mv ftp /data/admin -sed -i 's/tmppasswd/'$mysqlftppwd'/' /data/admin/ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/" /data/admin/ftp/config.php -sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' /data/admin/ftp/config.php -sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' /data/admin/ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php -rm -rf /data/admin/ftp/install.php -cd /data/admin +tar xzf ftp_v2.1.tar.gz -C /home/wwwroot +sed -i 's/tmppasswd/'$mysqlftppwd'/' /home/wwwroot/ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/" /home/wwwroot/ftp/config.php +sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' /home/wwwroot/ftp/config.php +sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' /home/wwwroot/ftp/config.php +sed -i 's@iso-8859-1@UTF-8@' /home/wwwroot/ftp/language/english.php +rm -rf /home/wwwroot/ftp/install.php +} + +function phpMyAdmin() +{ +mkdir -p /home/wwwroot +cd /home/wwwroot +tar xzf /root/lnmp/source/phpMyAdmin-4.0.4.1-all-languages.tar.gz +mv phpMyAdmin-4.0.4.1-all-languages phpMyAdmin +sed -i 's@localhost@127.0.0.1@' phpMyAdmin/libraries/config.default.php +} + +function TEST() +{ echo '' > /data/admin/phpinfo.php -wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html -wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/tz.php -chown -R www.www /data/admin -cd ../ +?>' > /home/wwwroot/phpinfo.php +cp /root/lnmp/conf/index.html /home/wwwroot +cp /root/lnmp/conf/tz.php /home/wwwroot +chown -R www.www /home/wwwroot } function Iptables() @@ -496,16 +526,18 @@ Download 2>&1 | tee -a /root/lnmp/lnmp_install.log Download chmod +x /root/lnmp/init.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -echo -e "\033[32minitialized successfully\033[0m" MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" -Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" -Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log + +if [ $FTP_yn == 'y' ];then + Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log + Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log +fi + +if [ $phpMyAdmin_yn == 'y' ];then + TEST 2>&1 | tee -a /root/lnmp/lnmp_install.log +fi echo "################Congratulations####################" echo "The path of some dirs:" @@ -513,9 +545,8 @@ echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" echo -e "PHP dir: \033[32m/usr/local/php\033[0m" echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" -echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" echo -e "MySQL_manager url: \033[32mhttp://$IP/phpMyAdmin\033[0m" -echo "###################################################" +echo "################Congratulations####################" diff --git a/vhost.sh b/vhost.sh index 237aabdd..307638c6 100755 --- a/vhost.sh +++ b/vhost.sh @@ -47,9 +47,9 @@ if [ "$add_more_domainame" == 'y' ]; then fi echo "Please input the directory for the domain:$domain :" -read -p "(Default directory: /data/wwwroot/$domain):" vhostdir +read -p "(Default directory: /home/wwwroot/$domain):" vhostdir if [ -z "$vhostdir" ]; then - vhostdir="/data/wwwroot/$domain" + vhostdir="/home/wwwroot/$domain" fi echo "################################" echo Virtual Host Directory="$vhostdir" From d108181e726e077d043a0b98958f4f8b12bf643b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 22:56:01 +0800 Subject: [PATCH 049/617] update --- conf/nginx.conf | 2 +- lnmp_install.sh | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0330aaa9..68728fbb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -63,7 +63,7 @@ http { listen 80; server_name _; access_log /dev/null; - root /data/admin; + root /home/wwwroot; index index.html index.php; location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; diff --git a/lnmp_install.sh b/lnmp_install.sh index c1772629..d0e7c6b0 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -55,8 +55,8 @@ cd /root/lnmp [ -s init.sh ] && echo 'init.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh [ -s vhost.sh ] && echo 'vhost.sh found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh cd conf -[ -s tz.php ] && echo 'tz.php found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/tz.php -[ -s index.html ] && echo 'index.html found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/index.html +[ -s tz.php ] && echo 'tz.php found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/tz.php +[ -s index.html ] && echo 'index.html found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html [ -s init.d.nginx ] && echo 'init.d.nginx found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx [ -s nginx.conf ] && echo 'nginx.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf [ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf @@ -472,7 +472,8 @@ sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql /usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql service pureftpd start -tar xzf ftp_v2.1.tar.gz -C /home/wwwroot +mkdir -p /home/wwwroot +tar xzf /root/lnmp/source/ftp_v2.1.tar.gz -C /home/wwwroot sed -i 's/tmppasswd/'$mysqlftppwd'/' /home/wwwroot/ftp/config.php sed -i "s/myipaddress.com/`echo $IP`/" /home/wwwroot/ftp/config.php sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' /home/wwwroot/ftp/config.php @@ -483,7 +484,6 @@ rm -rf /home/wwwroot/ftp/install.php function phpMyAdmin() { -mkdir -p /home/wwwroot cd /home/wwwroot tar xzf /root/lnmp/source/phpMyAdmin-4.0.4.1-all-languages.tar.gz mv phpMyAdmin-4.0.4.1-all-languages phpMyAdmin @@ -546,7 +546,5 @@ echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" echo -e "PHP dir: \033[32m/usr/local/php\033[0m" echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" -echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" -echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" -echo -e "MySQL_manager url: \033[32mhttp://$IP/phpMyAdmin\033[0m" +echo -e "Manager url: \033[32mhttp://$IP/\033[0m" echo "################Congratulations####################" From f36eac1993be91da0fe604a18880f646d880287b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 23:04:47 +0800 Subject: [PATCH 050/617] update --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index d0e7c6b0..628266bf 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -524,7 +524,7 @@ service iptables restart Download 2>&1 | tee -a /root/lnmp/lnmp_install.log Download -chmod +x /root/lnmp/init.sh +chmod +x /root/lnmp/{init,vhost}.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log From 4d0261b71853004b0ae65494cadce060310e177d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Jul 2013 23:14:33 +0800 Subject: [PATCH 051/617] update --- lnmp_v5.3_install.sh | 471 ------------------------------------------- 1 file changed, 471 deletions(-) delete mode 100755 lnmp_v5.3_install.sh diff --git a/lnmp_v5.3_install.sh b/lnmp_v5.3_install.sh deleted file mode 100755 index b38a6cb4..00000000 --- a/lnmp_v5.3_install.sh +++ /dev/null @@ -1,471 +0,0 @@ -#!/bin/bash -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 - -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat Linux #" -echo "# For more information please visit https://github.com/lj2007331/lnmp #" -echo "#######################################################################" -echo '' - -# get IP -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10. | grep -v ^192.168 | grep -v ^172. | grep -v ^127. | awk '{print $1}' | awk '{print;exit}'` - -# Set password -while : -do - read -p "Please input the root password of MySQL:" mysqlrootpwd - read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd - if (( ${#mysqlrootpwd} >= 5 && ${#ftpmanagerpwd} >=5 ));then - break - else - echo "least 5 characters" - fi -done - -# Download packages -mkdir -p /root/lnmp/{source,conf} -function Download() -{ -cd /root/lnmp -[ -s init.sh ] && echo 'init.sh found' || wget https://raw.github.com/lj2007331/lnmp/master/init.sh -cd /root/lnmp/source -[ -s cmake-2.8.10.2.tar.gz ] && echo 'cmake-2.8.10.2.tar.gz found' || wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -[ -s mysql-5.5.32.tar.gz ] && echo 'mysql-5.5.32.tar.gz found' || wget http://fossies.org/linux/misc/mysql-5.5.32.tar.gz -[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'bmcrypt-2.5.8.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz -[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -[ -s php-5.3.27.tar.gz ] && echo 'php-5.3.27.tar.gz found' || wget http://kr1.php.net/distributions/php-5.3.27.tar.gz -[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget http://pecl.php.net/get/memcache-2.2.7.tgz -[ -s eaccelerator-0.9.6.1.tar.bz2 ] && echo 'eaccelerator-0.9.6.1.tar.bz2 found' || wget http://superb-dca2.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2 -[ -s PDO_MYSQL-1.0.2.tgz ] && echo 'PDO_MYSQL-1.0.2.tgz found' || wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz -[ -s ImageMagick-6.8.3-10.tar.gz ] && echo 'ImageMagick-6.8.3-10.tar.gz found' || wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.3-10.tar.gz -[ -s imagick-3.0.1.tgz ] && echo 'imagick-3.0.1.tgz found' || wget http://pecl.php.net/get/imagick-3.0.1.tgz -[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.32.tar.gz ] && echo 'pcre-8.32.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz -[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz -[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz -[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://acelnmp.googlecode.com/files/ftp_v2.1.tar.gz -cd ../conf -[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx -[ -s nginx.conf ] && echo 'nginx.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[ -s script.mysql ] && echo 'script.mysql found' || wget https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql -} - - -function MySQL() -# install MySQL -{ -cd /root/lnmp/source -useradd -M -s /sbin/nologin mysql -mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql -tar xzf cmake-2.8.10.2.tar.gz -cd cmake-2.8.10.2 -./configure -make && make install -cd .. -tar zxf mysql-5.5.32.tar.gz -cd mysql-5.5.32 -cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ --DMYSQL_DATADIR=/data/mysql \ --DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DMYSQL_TCP_PORT=3306 \ --DEXTRA_CHARSETS=all \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \ --DWITH_DEBUG=0 -make && make install - -/bin/cp support-files/my-medium.cnf /etc/my.cnf -cp support-files/mysql.server /etc/init.d/mysqld -chmod 755 /etc/init.d/mysqld -chkconfig --add mysqld -chkconfig mysqld on -cd .. - -# my.cf -sed -i '38a ##############' /etc/my.cnf -sed -i '39a skip-name-resolve' /etc/my.cnf -sed -i '40a basedir=/usr/local/mysql' /etc/my.cnf -sed -i '41a datadir=/data/mysql' /etc/my.cnf -sed -i '42a user=mysql' /etc/my.cnf -sed -i '43a #lower_case_table_names = 1' /etc/my.cnf -sed -i '44a max_connections=1000' /etc/my.cnf -sed -i '45a ft_min_word_len=1' /etc/my.cnf -sed -i '46a expire_logs_days = 7' /etc/my.cnf -sed -i '47a query_cache_size=64M' /etc/my.cnf -sed -i '48a query_cache_type=1' /etc/my.cnf -sed -i '49a ##############' /etc/my.cnf - -/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql - -chown mysql.mysql -R /data/mysql -/sbin/service mysqld start -export PATH=$PATH:/usr/local/mysql/bin -echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile -source /etc/profile - -/usr/local/mysql/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$mysqlrootpwd\" with grant option;" -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "delete from mysql.user where Password='';" -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd -e "drop database test;" -/sbin/service mysqld restart -} - -function PHP() -# install PHP -{ -cd /root/lnmp/source -tar xzf libiconv-1.14.tar.gz -cd libiconv-1.14 -./configure --prefix=/usr/local -make && make install -cd ../ - -tar xzf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8 -./configure -make && make install -/sbin/ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -tar xzf mhash-0.9.9.9.tar.gz -cd mhash-0.9.9.9 -./configure -make && make install -cd ../ - -tar xzf ImageMagick-6.8.3-10.tar.gz -cd ImageMagick-6.8.3-10 -./configure -make && make install -cd ../ - -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la - ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so - ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 - ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 - ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a - ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la - ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so - ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 - ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 - ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config - ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64/libmysqlclient.so.18 - ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 - ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick - cp -frp /usr/lib64/libldap* /usr/lib -else - ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la - ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so - ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 - ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 - ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a - ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la - ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so - ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 - ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 - ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config - ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18 - ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick - ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 -fi - -tar xzf mcrypt-2.6.8.tar.gz -cd mcrypt-2.6.8 -/sbin/ldconfig -./configure -make && make install -cd ../ - -tar xzf php-5.3.27.tar.gz -useradd -M -s /sbin/nologin www -cd php-5.3.27 -./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug -make ZEND_EXTRA_LIBS='-liconv' -make install -cp php.ini-production /usr/local/php/lib/php.ini - -#php-fpm Init Script -cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm -chmod +x /etc/init.d/php-fpm -chkconfig --add php-fpm -chkconfig php-fpm on -cd ../ - -tar xzf memcache-2.2.7.tgz -cd memcache-2.2.7 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -tar xjf eaccelerator-0.9.6.1.tar.bz2 -cd eaccelerator-0.9.6.1 -/usr/local/php/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -tar xzf PDO_MYSQL-1.0.2.tgz -cd PDO_MYSQL-1.0.2 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql -make && make install -cd ../ - -tar xzf imagick-3.0.1.tgz -cd imagick-3.0.1 -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Modify php.ini -mkdir /tmp/eaccelerator -/bin/chown -R www.www /tmp/eaccelerator/ -sed -i '808a extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"' /usr/local/php/lib/php.ini -sed -i '809a extension = "memcache.so"' /usr/local/php/lib/php.ini -sed -i '810a extension = "pdo_mysql.so"' /usr/local/php/lib/php.ini -sed -i '811a extension = "imagick.so"' /usr/local/php/lib/php.ini -sed -i '812a extension = "http.so"' /usr/local/php/lib/php.ini -sed -i '135a output_buffering = On' /usr/local/php/lib/php.ini -sed -i '848a cgi.fix_pathinfo=0' /usr/local/php/lib/php.ini -sed -i 's@short_open_tag = Off@short_open_tag = On@' /usr/local/php/lib/php.ini -sed -i 's@expose_php = On@expose_php = Off@' /usr/local/php/lib/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/lib/php.ini -sed -i 's@;date.timezone =@date.timezone = Asia/Shanghai@' /usr/local/php/lib/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/lib/php.ini -echo '[eaccelerator] -zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" -eaccelerator.shm_size="64" -eaccelerator.cache_dir="/tmp/eaccelerator" -eaccelerator.enable="1" -eaccelerator.optimizer="1" -eaccelerator.check_mtime="1" -eaccelerator.debug="0" -eaccelerator.filter="" -eaccelerator.shm_max="0" -eaccelerator.shm_ttl="0" -eaccelerator.shm_prune_period="0" -eaccelerator.shm_only="0" -eaccelerator.compress="0" -eaccelerator.compress_level="9" -eaccelerator.keys = "disk_only" -eaccelerator.sessions = "disk_only" -eaccelerator.content = "disk_only"' >> /usr/local/php/lib/php.ini - -cat > /usr/local/php/etc/php-fpm.conf < /etc/logrotate.d/nginx - -service nginx restart -} - -function Pureftp() -# install Pureftpd and pureftpd_php_manager -{ -cd /root/lnmp/source -tar xzf pure-ftpd-1.0.36.tar.gz -cd pure-ftpd-1.0.36 -./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinese -make && make install -cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin -chmod +x /usr/local/pureftpd/sbin/pure-config.pl -cp contrib/redhat.init /etc/init.d/pureftpd -sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pureftpd -sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd -sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd -chmod +x /etc/init.d/pureftpd -chkconfig --add pureftpd -chkconfig pureftpd on - -cd /root/lnmp/conf -/bin/cp pure-ftpd.conf /usr/local/pureftpd/ -/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ -mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql -sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql -/usr/local/mysql/bin/mysql -uroot -p$mysqlrootpwd< script.mysql -service pureftpd start - -mkdir -p /data/admin -cd ../source -tar xzf ftp_v2.1.tar.gz -mv ftp /data/admin;chown -R www.www /data/admin -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /data/admin/ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/g" /data/admin/ftp/config.php -sed -i 's/127.0.0.1/localhost/g' /data/admin/ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' /data/admin/ftp/language/english.php -rm -rf /data/admin/ftp/install.php -echo '' > /data/admin/index.php -cd ../ -} - -function Iptables() -{ -cat > /etc/sysconfig/iptables << EOF -# Firewall configuration written by system-config-securitylevel -# Manual customization of this file is not recommended. -*filter -:INPUT DROP [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] --A INPUT -i lo -j ACCEPT --A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -COMMIT -EOF -service iptables restart -} - -Download 2>&1 | tee -a /root/lnmp/lnmp_install.log -Download -chmod +x /root/lnmp/init.sh -/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -echo -e "\033[32minitialized successfully\033[0m" -MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/mysql" ] && echo -e "\033[32mMySQL install successfully\033[0m" || echo "MySQL install failed" -PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/php" ] && echo -e "\033[32mPHP install successfully\033[0m" || echo "PHP install failed" -Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/nginx" ] && echo -e "\033[32mNginx install successfully\033[0m" || echo "Nginx install failed" -Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ -d "/usr/local/pureftpd" ] && echo -e "\033[32mPureftpd install successfully\033[0m" || echo "Pureftpd install failed" -Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log - -echo "################Congratulations####################" -echo "The path of some dirs:" -echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" -echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" -echo -e "PHP dir: \033[32m/usr/local/php\033[0m" -echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" -echo -e "Pureftp_php_manager dir: \033[32m/data/admin\033[0m" -echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" -echo -e "Pureftp_manager url: \033[32mhttp://$IP/ftp\033[0m" -echo -e "Pureftp_manager Password: \033[32m${ftpmanagerpwd}\033[0m" -echo "###################################################" From 0e15bc78c60951c828016e8abe5adceedd469150 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 18 Jul 2013 09:50:28 +0800 Subject: [PATCH 052/617] update Nginx version --- lnmp_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 628266bf..1c1466a2 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -76,7 +76,7 @@ cd /root/lnmp/source [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget http://pecl.php.net/get/pecl_http-1.7.6.tgz [ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz -[ -s nginx-1.4.1.tar.gz ] && echo 'nginx-1.4.1.tar.gz found' || wget http://nginx.org/download/nginx-1.4.1.tar.gz +[ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget http://nginx.org/download/nginx-1.4.2.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.4.1-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.4.1-all-languages.tar.gz found' || wget http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.4.1/phpMyAdmin-4.0.4.1-all-languages.tar.gz @@ -410,8 +410,8 @@ make && make install cd ../ #tar xzf ngx_cache_purge-2.1.tar.gz -tar xzf nginx-1.4.1.tar.gz -cd nginx-1.4.1 +tar xzf nginx-1.4.2.tar.gz +cd nginx-1.4.2 # Modify Nginx version sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "2.2.14"@g' src/core/nginx.h From f2116a561d7caef4f0a699a91eddfffcdb6bab5b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 18 Jul 2013 09:53:18 +0800 Subject: [PATCH 053/617] update Nginx version --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index f7b0ac9b..4e2b9f42 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ ImageMagick-6.8.6-5.tar.gz imagick-3.1.0RC2.tgz pecl_http-1.7.6.tgz pcre-8.33.tar.gz -nginx-1.4.1.tar.gz +nginx-1.4.2.tar.gz pure-ftpd-1.0.36.tar.gz ftp_v2.1.tar.gz phpMyAdmin-4.0.4.1-all-languages.tar.gz From 197815beacfab476c539f17d3c62de9f518b7564 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 18 Jul 2013 11:24:10 +0800 Subject: [PATCH 054/617] update --- init.sh | 1 + lnmp_install.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index ffb1d19e..1dd0f9ae 100755 --- a/init.sh +++ b/init.sh @@ -8,6 +8,7 @@ cd yum-3.4.3 cd .. rm -rf yum-3.4.3* yum check-update + mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo$(date +%m%d) mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo$(date +%m%d) diff --git a/lnmp_install.sh b/lnmp_install.sh index 1c1466a2..2df4d111 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -536,15 +536,16 @@ if [ $FTP_yn == 'y' ];then fi if [ $phpMyAdmin_yn == 'y' ];then - TEST 2>&1 | tee -a /root/lnmp/lnmp_install.log + phpMyAdmin 2>&1 | tee -a /root/lnmp/lnmp_install.log fi +TEST 2>&1 | tee -a /root/lnmp/lnmp_install.log echo "################Congratulations####################" echo "The path of some dirs:" echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" echo -e "MySQL dir: \033[32m/usr/local/mysql\033[0m" echo -e "PHP dir: \033[32m/usr/local/php\033[0m" -echo -e "Pureftpd dir: \033[32m/usr/local/pureftpd\033[0m" +echo -e "MySQL User: \033[32mroot\033[0m" echo -e "MySQL Password: \033[32m${mysqlrootpwd}\033[0m" echo -e "Manager url: \033[32mhttp://$IP/\033[0m" echo "################Congratulations####################" From 89b6f2f4eaca20c6a562ba133418f1957781aa10 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 18 Jul 2013 22:41:48 +0800 Subject: [PATCH 055/617] update ImageMagick-6.8.6-6 --- conf/index.html | 2 +- conf/nginx.conf | 2 +- lnmp_install.sh | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/index.html b/conf/index.html index 653f2f76..d060c0a8 100644 --- a/conf/index.html +++ b/conf/index.html @@ -4,7 +4,7 @@ LNMP最新源码一键安装脚本 - + - - - - - -
- - - - - - - - - - - - - - - -
PHP参数组件支持第三方组件数据库支持性能检测网速检测MySQL检测函数检测邮件检测探针下载
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
服务器参数
服务器域名/IP地址 - ()  你的IP地址是:
服务器标识
服务器操作系统  内核版本:服务器解译引擎
服务器语言服务器端口
服务器主机名绝对路径
管理员邮箱探针路径
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
服务器实时数据
服务器当前时间服务器已运行时间
CPU型号 [核]
CPU使用状况查看图表";}else{echo "暂时只支持Linux系统";}?> -
硬盘使用状况 - 总空间  G, - 已用  G, - 空闲  G, - 使用率 % -
 
-
内存使用状况 - - 物理内存:共 - - , 已用 - - , 空闲 - - , 使用率 - -
 
-0) -{ -?> - Cache化内存为 - , 使用率 - - % | Buffers缓冲为 -
 
- - 真实内存使用 - - , 真实内存空闲 - - , 使用率 - - % -
 
-0) -{ -?> - SWAP区:共 - - , 已使用 - - , 空闲 - - , 使用率 - - % -
 
- - -
系统平均负载
- - - - - - - - - - - - - - - -
网络使用状况
: 入网: 实时: 0B/s出网: 实时: 0B/s
- - - - - - - - - -
PHP已编译模块检测
-$value) { - if ($key!=0 && $key%13==0) { - echo '
'; - } - echo "$value  "; -} -?>
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PHP相关参数
PHP信息(phpinfo): - - ×' :"PHPINFO";?> - PHP版本(php_version):
PHP运行方式:脚本占用最大内存(memory_limit):
PHP安全模式(safe_mode):POST方法提交最大限制(post_max_size):
上传文件最大限制(upload_max_filesize):浮点型数据显示的有效位数(precision):
脚本超时时间(max_execution_time):socket超时时间(default_socket_timeout):
PHP页面根目录(doc_root):用户根目录(user_dir):
dl()函数(enable_dl):指定包含文件目录(include_path):
显示错误信息(display_errors):自定义全局变量(register_globals):
数据反斜杠转义(magic_quotes_gpc):"<?...?>"短标签(short_open_tag):
"<% %>"ASP风格标记(asp_tags):忽略重复错误信息(ignore_repeated_errors):
忽略重复的错误源(ignore_repeated_source):报告内存泄漏(report_memleaks):
自动字符串转义(magic_quotes_gpc):外部字符串自动转义(magic_quotes_runtime):
打开远程文件(allow_url_fopen):声明argv和argc变量(register_argc_argv):
Cookie 支持:√' : '×';?>拼写检查(ASpell Library):
高精度数学运算(BCMath):PREL相容语法(PCRE):
PDF文档支持:SNMP网络管理协议:
VMailMgr邮件处理:Curl支持:
SMTP支持:√' : '×';?>SMTP地址:×';?>
默认支持函数(enable_functions):请点这里查看详细!
被禁用的函数(disable_functions): -×'; -} -else -{ - //echo $disFuns; - $disFuns_array = explode(',',$disFuns); - foreach ($disFuns_array as $key=>$value) - { - if ($key!=0 && $key%5==0) { - echo '
'; - } - echo "$value  "; -} -} - -?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
组件支持
FTP支持:XML解析支持:
Session支持:Socket支持:
Calendar支持 - 允许URL打开文件:
GD库支持: - ×';} - ?>压缩文件支持(Zlib):
IMAP电子邮件系统函数库:历法运算函数库:
正则表达式函数库:WDDX支持:
Iconv编码转换:mbstring:
高精度数学运算:LDAP目录协议:
MCrypt加密处理:哈稀计算:
- - - - - - - - - - - - - - - - - - - - - - - -
第三方组件
Zend版本×';}else{echo $zend_version;}?> - 2) -{ - echo "ZendGuardLoader[启用]"; -} -else -{ - echo "Zend Optimizer"; -} -?> - 2){echo (get_cfg_var("zend_loader.enable"))?'':'×';} else{if(function_exists('zend_optimizer_version')){ echo zend_optimizer_version();}else{ echo (get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend.ze1_compatibility_mode")||get_cfg_var("zend_extension_ts"))?'':'×';}}?>
eAccelerator×";} ?>ioncube×";}?>
XCache×";} ?>APC×";} ?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
数据库支持
MySQL 数据库: - - ODBC 数据库:
Oracle 数据库:SQL Server 数据库:
dBASE 数据库:mSQL 数据库:
SQLite 数据库:√ ';echo "SQLite3 Ver ";echo $sqliteVer[versionString];}else {echo isfun("sqlite_close");if(isfun("sqlite_close") == '') {echo "  版本: ".@sqlite_libversion();}}?>Hyperwave 数据库:
Postgre SQL 数据库:Informix 数据库:
DBA 数据库:DBM 数据库:
FilePro 数据库:SyBase 数据库:
- - -
" method="post"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
服务器性能检测
参照对象整数运算能力检测
(1+1运算300万次)
浮点运算能力检测
(圆周率开平方300万次)
数据I/O能力检测
(读取10K文件1万次)
CPU信息
美国 LinodeVPS0.357秒0.802秒0.023秒4 x Xeon L5520 @ 2.27GHz
美国 PhotonVPS.com0.431秒1.024秒0.034秒8 x Xeon E5520 @ 2.27GHz
德国 SpaceRich.com0.421秒1.003秒0.038秒4 x Core i7 920 @ 2.67GHz
美国 RiZie.com0.521秒1.559秒0.054秒2 x Pentium4 3.00GHz
埃及 CitynetHost.com0.343秒0.761秒0.023秒2 x Core2Duo E4600 @ 2.40GHz
美国 IXwebhosting.com0.535秒1.607秒0.058秒4 x Xeon E5530 @ 2.40GHz
本台服务器


- - - - - - - - - - - - -
网络速度测试
-
- 向客户端传送1000k字节数据
- 带宽比例按理想值计算 -
- - - - - - - - - - - - - - - - - - -
带宽1M2M3M4M5M6M7M8M9M10M
- - - - -
">">
-
- ".$_GET['speed']." 毫秒,下载速度:"."".$speed.""." kb/s,需测试多次取平均值,超过10M直接看下载速度":" 未探测 " ?> - -
- - - - - - - - - - -
MySQL数据库连接检测
- 地址: - 端口: - 用户名: - 密码: - - -
- alert('连接到MySql数据库正常')"; - } else { - echo ""; - } - } else { - echo ""; - } - } - ?> - - - - - - - - - - - alert('$funRe')"; - } - ?> -
函数检测
- 请输入您要检测的函数: - - - -
- - - - - - - - - - - alert('$mailRe')"; - } - ?> -
邮件发送检测
- 请输入您要检测的邮件地址: - - - -
-
- - - - - - - -
Processed in seconds. memory usage.返回顶部
- -
- - \ No newline at end of file diff --git a/lnmp_install.sh b/lnmp_install.sh index 2bd5cc65..2f4159a2 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -1,6 +1,6 @@ #!/bin/bash # Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && exit 1 +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && kill -9 $$ echo "#######################################################################" echo "# LNMP for CentOS/RadHat 5/6 #" @@ -11,6 +11,7 @@ echo '' # get ipv4 IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` [ ! -n "$IP" ] && IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` + #Definition Directory home_dir=/home/wwwroot mkdir -p $home_dir @@ -80,7 +81,7 @@ cd /root/lnmp [ -s vhost.sh ] && echo 'vhost.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh [ -s install_ngx_pagespeed.sh ] && echo 'install_ngx_pagespeed.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/install_ngx_pagespeed.sh cd conf -[ -s tz.php ] && echo 'tz.php found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/tz.php +[ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip [ -s index.html ] && echo 'index.html found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html [ -s wordpress.conf ] && echo 'wordpress.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/wordpress.conf [ -s discuz.conf ] && echo 'discuz.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/discuz.conf @@ -118,7 +119,7 @@ do if [ ! -e "/root/lnmp/source/$src" ];then echo -e "\033[31m$src no found! \033[0m" echo -e "\033[31mUpdated version of the Package source,Please Contact Author! \033[0m" - exit 1 + kill -9 $$ fi done } @@ -127,7 +128,7 @@ function Install_MySQL() { cd /root/lnmp/source useradd -M -s /sbin/nologin mysql -mkdir -p /data/mysql;chown mysql.mysql -R /data/mysql +mkdir -p $db_data_dir;chown mysql.mysql -R $db_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 ./configure @@ -135,9 +136,9 @@ make && make install cd .. tar zxf mysql-5.6.13.tar.gz cd mysql-5.6.13 -cmake . -DCMAKE_INSTALL_PREFIX=$db_install_prefix \ +cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=/data/mysql \ +-DMYSQL_DATADIR=$db_data_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ @@ -155,11 +156,11 @@ cmake . -DCMAKE_INSTALL_PREFIX=$db_install_prefix \ -DWITH_DEBUG=0 make && make install -if [ -d "$db_install_prefix" ];then +if [ -d "$db_install_dir" ];then echo -e "\033[32mMySQL install successfully! \033[0m" else echo -e "\033[31mMySQL install failed,Please Contact Author! \033[0m" - exit 1 + kill -9 $$ fi /bin/cp support-files/mysql.server /etc/init.d/mysqld @@ -171,9 +172,9 @@ cd .. # my.cf cat > /etc/my.cnf << EOF [mysqld] -basedir = $db_install_prefix -datadir = /data/mysql -pid-file=/data/mysql/mysqld.pid +basedir = $db_install_dir +datadir = $db_data_dir +pid-file = /var/run/mysql.pid character-set-server = utf8 collation-server = utf8_general_ci user = mysql @@ -206,10 +207,10 @@ read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # LOG -log_error = /data/mysql/mysql-error.log +log_error = $db_data_dir/mysql-error.log long_query_time = 1 slow_query_log -slow_query_log_file = /data/mysql/mysql-slow.log +slow_query_log_file = $db_data_dir/mysql-slow.log # Oher #max_connections = 1000 @@ -219,20 +220,20 @@ open_files_limit = 65535 port = 3306 EOF -$db_install_prefix/scripts/mysql_install_db --user=mysql --basedir=$db_install_prefix --datadir=/data/mysql +$db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir -chown mysql.mysql -R /data/mysql +chown mysql.mysql -R $db_data_dir /sbin/service mysqld start -export PATH=$PATH:$db_install_prefix/bin -echo "export PATH=\$PATH:$db_install_prefix/bin" >> /etc/profile +export PATH=$PATH:$db_install_dir/bin +echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile source /etc/profile -$db_install_prefix/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$db_install_prefix/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" /sbin/service mysqld restart } @@ -240,7 +241,7 @@ function Install_MariaDB() { cd /root/lnmp/source useradd -M -s /sbin/nologin mysql -mkdir -p /data/mariadb;chown mysql.mysql -R /data/mariadb +mkdir -p $db_data_dir;chown mysql.mysql -R $db_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 ./configure @@ -248,9 +249,9 @@ make && make install cd .. tar zxf mariadb-5.5.32.tar.gz cd mariadb-5.5.32 -cmake . -DCMAKE_INSTALL_PREFIX=$db_install_prefix \ +cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=/data/mariadb \ +-DMYSQL_DATADIR=$db_data_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ @@ -269,11 +270,11 @@ cmake . -DCMAKE_INSTALL_PREFIX=$db_install_prefix \ -DWITH_DEBUG=0 make && make install -if [ -d "$db_install_prefix" ];then +if [ -d "$db_install_dir" ];then echo -e "\033[32mMariaDB install successfully! \033[0m" else echo -e "\033[31mMariaDB install failed,Please Contact Author! \033[0m" - exit 1 + kill -9 $$ fi /bin/cp support-files/my-small.cnf /etc/my.cnf @@ -286,9 +287,9 @@ cd .. # my.cf cat > /etc/my.cnf << EOF [mysqld] -basedir = $db_install_prefix -datadir = /data/mariadb -pid-file=/data/mariadb/mariadb.pid +basedir = $db_install_dir +datadir = $db_data_dir +pid-file = /var/run/mariadb.pid character-set-server = utf8 collation-server = utf8_general_ci user = mysql @@ -321,10 +322,10 @@ read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # LOG -log_error = /data/mariadb/mariadb-error.log +log_error = $db_data_dir/mariadb-error.log long_query_time = 1 slow_query_log -slow_query_log_file = /data/mariadb/mariadb-slow.log +slow_query_log_file = $db_data_dir/mariadb-slow.log # Oher #max_connections = 1000 @@ -334,20 +335,20 @@ open_files_limit = 65535 port = 3306 EOF -$db_install_prefix/scripts/mysql_install_db --user=mysql --basedir=$db_install_prefix --datadir=/data/mariadb +$db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir -chown mysql.mysql -R /data/mariadb +chown mysql.mysql -R $db_data_dir /sbin/service mysqld start -export PATH=$PATH:$db_install_prefix/bin -echo "export PATH=\$PATH:$db_install_prefix/bin" >> /etc/profile +export PATH=$PATH:$db_install_dir/bin +echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile source /etc/profile -$db_install_prefix/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$db_install_prefix/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$db_install_prefix/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" /sbin/service mysqld restart } @@ -387,11 +388,11 @@ cat >> /etc/ld.so.conf.d/local.conf <> /etc/ld.so.conf.d/mysql.conf <' > $home_dir/phpinfo.php cp /root/lnmp/conf/index.html $home_dir -cp /root/lnmp/conf/tz.php $home_dir +unzip -q /root/lnmp/conf/tz.zip -d $home_dir chown -R www.www $home_dir } @@ -714,11 +715,13 @@ chmod +x /root/lnmp/{init,vhost}.sh sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log if [ $choice_db == 'mysql' ];then - db_install_prefix=/usr/local/mysql + db_install_dir=/usr/local/mysql + db_data_dir=/data/mysql Install_MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log fi if [ $choice_db == 'mariadb' ];then - db_install_prefix=/usr/local/mariadb + db_install_dir=/usr/local/mariadb + db_data_dir=/data/mariadb Install_MariaDB 2>&1 | tee -a /root/lnmp/lnmp_install.log fi Install_PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log @@ -743,7 +746,7 @@ echo -e "\033[32mPlease restart the server and see if the services start up fine echo '' echo "The path of some dirs:" echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" -echo -e "$choice_DB dir: \033[32m$db_install_prefix\033[0m" +echo -e "$choice_DB dir: \033[32m$db_install_dir\033[0m" echo -e "PHP dir: \033[32m/usr/local/php\033[0m" echo -e "$choice_DB User: \033[32mroot\033[0m" echo -e "$choice_DB Password: \033[32m${dbrootpwd}\033[0m" From 996a41c472d704e164c57c9799deefb81b9f8a30 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Aug 2013 20:18:01 +0800 Subject: [PATCH 117/617] update pid-file --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 2f4159a2..cec44800 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -174,7 +174,7 @@ cat > /etc/my.cnf << EOF [mysqld] basedir = $db_install_dir datadir = $db_data_dir -pid-file = /var/run/mysql.pid +pid-file = $db_data_dir/mysql.pid character-set-server = utf8 collation-server = utf8_general_ci user = mysql @@ -289,7 +289,7 @@ cat > /etc/my.cnf << EOF [mysqld] basedir = $db_install_dir datadir = $db_data_dir -pid-file = /var/run/mariadb.pid +pid-file = $db_data_dir/mariadb.pid character-set-server = utf8 collation-server = utf8_general_ci user = mysql From c05eb64372517b41cf153b7c62ab0e0ece693e30 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Aug 2013 20:55:07 +0800 Subject: [PATCH 118/617] tz bug --- lnmp_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index cec44800..11a42018 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -81,7 +81,6 @@ cd /root/lnmp [ -s vhost.sh ] && echo 'vhost.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh [ -s install_ngx_pagespeed.sh ] && echo 'install_ngx_pagespeed.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/install_ngx_pagespeed.sh cd conf -[ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip [ -s index.html ] && echo 'index.html found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html [ -s wordpress.conf ] && echo 'wordpress.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/wordpress.conf [ -s discuz.conf ] && echo 'discuz.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/discuz.conf @@ -95,6 +94,7 @@ cd conf [ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf [ -s script.mysql ] && echo 'script.mysql found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql cd /root/lnmp/source +[ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip [ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget -c http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz [ -s mysql-5.6.13.tar.gz ] && echo 'mysql-5.6.13.tar.gz found' || wget -c http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz [ -s mariadb-5.5.32.tar.gz ] && echo 'mariadb-5.5.32.tar.gz found' || wget -c http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz @@ -684,7 +684,7 @@ echo '' > $home_dir/phpinfo.php cp /root/lnmp/conf/index.html $home_dir -unzip -q /root/lnmp/conf/tz.zip -d $home_dir +unzip -q /root/lnmp/source/tz.zip -d $home_dir chown -R www.www $home_dir } From fe2ff24de5703f1119ab0210f6fa4279bfd5529c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Aug 2013 21:27:27 +0800 Subject: [PATCH 119/617] update imagemagick source address --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 11a42018..ad9b8873 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -105,7 +105,7 @@ cd /root/lnmp/source [ -s php-5.5.1.tar.gz ] && echo 'php-5.5.1.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.1.tar.gz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz -[ -s ImageMagick-6.8.6-6.tar.gz ] && echo 'ImageMagick-6.8.6-6.tar.gz found' || wget -c ftp://sunsite.icm.edu.pl/packages/ImageMagick/ImageMagick-6.8.6-6.tar.gz +[ -s ImageMagick-6.8.6-6.tar.gz ] && echo 'ImageMagick-6.8.6-6.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz [ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz From 81b2a4a2d5f446f18eb5d6ed2f243fc0e709c44d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Aug 2013 22:25:54 +0800 Subject: [PATCH 120/617] update ImageMagick --- README | 2 +- lnmp_install.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index 922f7fa4..9e13868d 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ mcrypt-2.6.8.tar.gz php-5.5.1.tar.gz memcached-1.4.15.tar.gz memcache-2.2.7.tgz -ImageMagick-6.8.6-6.tar.gz +ImageMagick-6.8.6-8.tar.gz imagick-3.1.0RC2.tgz pecl_http-1.7.6.tgz pcre-8.33.tar.gz diff --git a/lnmp_install.sh b/lnmp_install.sh index ad9b8873..0d3e52e9 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -105,10 +105,10 @@ cd /root/lnmp/source [ -s php-5.5.1.tar.gz ] && echo 'php-5.5.1.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.1.tar.gz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz -[ -s ImageMagick-6.8.6-6.tar.gz ] && echo 'ImageMagick-6.8.6-6.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz +[ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz +[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz [ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz @@ -377,8 +377,8 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-6.tar.gz -cd ImageMagick-6.8.6-6 +tar xzf ImageMagick-6.8.6-8.tar.gz +cd ImageMagick-6.8.6-8 ./configure make && make install cd ../ From 32e859b2d54d5e8f9bf6b90cc921989c0cbf8858 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Aug 2013 23:22:46 +0800 Subject: [PATCH 121/617] update source address --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 0e50bd66..591556cf 100755 --- a/init.sh +++ b/init.sh @@ -151,7 +151,7 @@ fi ###install htop mkdir htop cd htop -wget -c http://fossies.org/linux/misc/htop-1.0.2.tar.gz +wget -c http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz tar xzf htop-1.0.2.tar.gz cd htop-1.0.2 ./configure From 85c43dcc7dd6f9636e0ecf50776f7be5f5d9e932 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 Aug 2013 09:35:34 +0800 Subject: [PATCH 122/617] pureftp MYSQLSocket --- conf/pureftpd-mysql.conf | 2 +- lnmp_install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/pureftpd-mysql.conf b/conf/pureftpd-mysql.conf index 3ce3b0e6..47a9b1aa 100644 --- a/conf/pureftpd-mysql.conf +++ b/conf/pureftpd-mysql.conf @@ -2,7 +2,7 @@ # Lines with MMYSQLServer and MYSQLPort. # If you want to use the Port methode comment out the MYSQLSocket line #//IMPORTENT!!!If display 530 error,please check the following MYSQL parameter!! -MYSQLSocket /data/mysql/mysql.sock +MYSQLSocket /tmp/mysql.sock MYSQLServer 127.0.0.1 MYSQLPort 3306 MYSQLUser ftp diff --git a/lnmp_install.sh b/lnmp_install.sh index 0d3e52e9..ee889034 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -110,7 +110,7 @@ cd /root/lnmp/source [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz [ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz [ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz -[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz +[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz # check source packages From d7daa32ee20d583ba6f5c0af67c812938cee6e6e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 Aug 2013 16:19:58 +0800 Subject: [PATCH 123/617] update default php dir and ftp manager chinese --- conf/chinese.php | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ conf/nginx.conf | 6 ++-- init.sh | 13 ++++++--- lnmp_install.sh | 49 ++++++++++++++++++++------------- vhost.sh | 4 +-- 5 files changed, 115 insertions(+), 28 deletions(-) create mode 100644 conf/chinese.php diff --git a/conf/chinese.php b/conf/chinese.php new file mode 100644 index 00000000..4a8ed2f2 --- /dev/null +++ b/conf/chinese.php @@ -0,0 +1,71 @@ + + + $CharSet = "UTF-8"; + + // 全局设置 (Global) + $Translate[0] = "PureFTPd 帐号管理"; + $Translate[1] = "Version 2.1"; + + // 预设帐号 (Default username) + $Translate[10] = "myftp"; + + // 系统信息 (System messages) + $Translate[20] = "所选择的帐号或密码不存在。"; + $Translate[21] = "密码不一致,当前的设置不会保存。"; + $Translate[22] = "除了目前的密码外,设定值都会被保存。"; + $Translate[23] = "设定值將會被保存。"; + $Translate[24] = "该ftp 帐号"; + $Translate[25] = "将会被删除。"; + $Translate[26] = "错误: 无法存取任何目录"; + + // 標籤说明 (Labels) + $Translate[30] = "登入页"; + $Translate[31] = "按此新增帐号"; + $Translate[32] = "帐号"; + $Translate[33] = "UID"; + $Translate[34] = "GID"; + $Translate[35] = "主目录"; + $Translate[36] = "上传带宽(KB/s)"; + $Translate[37] = "下载带宽(KB/s)"; + $Translate[38] = "IP 地址"; + $Translate[39] = "设置"; + $Translate[40] = "启用"; + $Translate[41] = "密码"; + $Translate[42] = "再次确认密码"; + $Translate[43] = "文件配额"; + $Translate[44] = "磁盘配额(MB)"; + $Translate[45] = "上传/下载比 [上:下]"; + $Translate[46] = "备注"; + + // 按钮信息 (Button info) + $Translate[60] = "修改"; + $Translate[61] = "删除"; + $Translate[62] = "锁定"; + $Translate[63] = "解锁"; + $Translate[64] = "开启"; + $Translate[65] = "选择目录"; + $Translate[66] = "关闭浏览目录"; + $Translate[67] = "保存"; + + // 在瀏覽目錄時的各項屬性說明 (Attributes from the directory browser) + $Translate[80] = "名称"; + $Translate[81] = "大小"; + $Translate[82] = "类型"; + $Translate[83] = "修改日期"; + $Translate[84] = "拥有者"; + $Translate[85] = "群组"; + $Translate[86] = "属性"; + + // 辅助说明 (Help balloons) + $Translate[90] = "帐号只有『启用』被选取时,才会生效。"; + $Translate[91] = "该 ftp 帐号所要使用的 UID (帐号权限)"; + $Translate[92] = "该 ftp 帐号所要使用的 GID (群組权限)"; + $Translate[93] = "上传文件时的带宽限制(单位: KB/s)"; + $Translate[94] = "下载文件时的带宽限制(单位: KB/s)"; + $Translate[95] = "限制此帐号所能存放的(最多的)文件数量。"; + $Translate[96] = "限制此帐号所能存放的(最多的)空间大小。(单位: Mb)"; + $Translate[97] = "比如 <1:2> 代表的是: 至少先上传4Mb 才能下载 8Mb,而 <0:0> 則是关闭上下传比限制"; + $Translate[98] = "限制此帐号只能由特定 IP 來源,或是任何地方均可使用 (*)"; + +?> diff --git a/conf/nginx.conf b/conf/nginx.conf index f3c126e9..f7edcc02 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,7 @@ user www www; worker_processes 4; -error_log logs/error.log crit; +error_log /home/wwwlogs/nginx_error.log crit; pid /var/run/nginx.pid; worker_rlimit_nofile 51200; @@ -62,8 +62,8 @@ http { server { listen 80; server_name _; - access_log off; - root /home/wwwroot; + access_log /home/wwwlogs/access.log combined; + root /home/wwwroot/default; index index.html index.php; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; diff --git a/init.sh b/init.sh index 591556cf..2895aed4 100755 --- a/init.sh +++ b/init.sh @@ -45,23 +45,23 @@ service sendmail restart # Close SELINUX setenforce 0 -sed -i 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config +sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config # initdefault -sed -i '^s/id:.*$/id:3:initdefault:/g' /etc/inittab +sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab /sbin/init q # PS1 echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile # Record command -sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /etc/profile +sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bash_profile # Wrong password five times locked 180s sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth # alias vi -sed -i '7a alias vi=vim' /root/.bashrc +sed "s@alias mv=.*@alias mv='mv -i'\nalias vi=vim@" /root/.bashrc echo 'syntax on' >> /etc/vimrc # /etc/security/limits.conf @@ -113,12 +113,17 @@ cat > /etc/sysconfig/iptables << EOF :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] +:syn-flood - [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood +-A INPUT -j REJECT --reject-with icmp-host-prohibited +-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN +-A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF /sbin/service iptables restart diff --git a/lnmp_install.sh b/lnmp_install.sh index ee889034..279001ee 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -14,8 +14,8 @@ IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.1 #Definition Directory home_dir=/home/wwwroot -mkdir -p $home_dir -mkdir -p /root/lnmp/{source,conf} +wwwlogs_dir=/home/wwwlogs +mkdir -p $home_dir $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} #choice database while : @@ -113,6 +113,7 @@ cd /root/lnmp/source [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz + # check source packages for src in `cat ./lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` do @@ -598,7 +599,7 @@ chkconfig --add nginx chkconfig nginx on mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk cp nginx.conf /usr/local/nginx/conf/nginx.conf -sed -i "s@/home/wwwroot@$home_dir@" nginx.conf +sed -i "s@/home/wwwroot/default@$home_dir/default@" nginx.conf #worker_cpu_affinity Nginx_conf=/usr/local/nginx/conf/nginx.conf CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` @@ -619,7 +620,8 @@ else fi #logrotate nginx log -echo '/usr/local/nginx/logs/*.log { +cat > /etc/logrotate.d/nginx << EOF +$wwwlogs_dir/*.log { daily rotate 5 missingok @@ -628,10 +630,10 @@ compress notifempty sharedscripts postrotate - [ -e /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` + [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` endscript -}' > /etc/logrotate.d/nginx - +} +EOF service nginx restart } @@ -662,18 +664,21 @@ sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql $db_install_dir/bin/mysql -uroot -p$dbrootpwd< script.mysql service pureftpd start -tar xzf /root/lnmp/source/ftp_v2.1.tar.gz -C $home_dir -sed -i 's/tmppasswd/'$mysqlftppwd'/' $home_dir/ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/" $home_dir/ftp/config.php -sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' $home_dir/ftp/config.php -sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' $home_dir/ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' $home_dir/ftp/language/english.php -rm -rf $home_dir/ftp/install.php +tar xzf /root/lnmp/source/ftp_v2.1.tar.gz +sed -i 's/tmppasswd/'$mysqlftppwd'/' ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php +sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php +sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php +sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php +/bin/cp /root/lnmp/conf/chinese.php ftp/language/ +sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php +rm -rf ftp/install.php +mv ftp $home_dir/default } function Install_phpMyAdmin() { -cd $home_dir +cd $home_dir/default tar xzf /root/lnmp/source/phpMyAdmin-4.0.5-all-languages.tar.gz mv phpMyAdmin-4.0.5-all-languages phpMyAdmin } @@ -682,10 +687,10 @@ function TEST() { echo '' > $home_dir/phpinfo.php -cp /root/lnmp/conf/index.html $home_dir -unzip -q /root/lnmp/source/tz.zip -d $home_dir -chown -R www.www $home_dir +?>' > $home_dir/default/phpinfo.php +cp /root/lnmp/conf/index.html $home_dir/default +unzip -q /root/lnmp/source/tz.zip -d $home_dir/default +chown -R www.www $home_dir/default } function Iptables() @@ -697,6 +702,7 @@ cat > /etc/sysconfig/iptables << EOF :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] +:syn-flood - [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT @@ -705,6 +711,10 @@ cat > /etc/sysconfig/iptables << EOF -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood +-A INPUT -j REJECT --reject-with icmp-host-prohibited +-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN +-A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF service iptables restart @@ -713,6 +723,7 @@ service iptables restart Download_src 2>&1 | tee -a /root/lnmp/lnmp_install.log chmod +x /root/lnmp/{init,vhost}.sh sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh +sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" /root/lnmp/vhost.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log if [ $choice_db == 'mysql' ];then db_install_dir=/usr/local/mysql diff --git a/vhost.sh b/vhost.sh index 95c6a28f..a2e6811e 100755 --- a/vhost.sh +++ b/vhost.sh @@ -132,9 +132,9 @@ done if [ "$access_yn" == 'n' ]; then al="access_log off;" else - al="access_log logs/$domain.log combined;" + al="access_log /home/wwwlogs/$domain.log combined;" echo "################################" - echo -e "You access log file=\033[32m/usr/local/nginx/logs/$domain.log\033[0m" + echo -e "You access log file=\033[32m/home/wwwlogs/$domain.log\033[0m" echo "################################" fi From 063cacceeac329aaf365b7e6f68f8428b9c03eb2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 Aug 2013 17:47:50 +0800 Subject: [PATCH 124/617] update default php dir and ftp manager chinese --- init.sh | 2 +- install_ngx_pagespeed.sh | 4 ++-- lnmp_install.sh | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/init.sh b/init.sh index 2895aed4..53aa3848 100755 --- a/init.sh +++ b/init.sh @@ -132,7 +132,7 @@ source /etc/profile ###install tmux mkdir tmux cd tmux -wget -c --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz +wget -c http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz wget -c http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz tar xzf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable diff --git a/install_ngx_pagespeed.sh b/install_ngx_pagespeed.sh index a6566fe7..b5841a2f 100755 --- a/install_ngx_pagespeed.sh +++ b/install_ngx_pagespeed.sh @@ -27,8 +27,8 @@ make if [ -f "objs/nginx" ];then /bin/mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d) /bin/cp objs/nginx /usr/local/nginx/sbin/nginx - kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` - kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` mkdir /var/ngx_pagespeed_cache chown www.www /var/ngx_pagespeed_cache /bin/cp /root/lnmp/vhost.sh /root/lnmp/vhost_ngx_pagespeed.sh diff --git a/lnmp_install.sh b/lnmp_install.sh index 279001ee..33d96743 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -92,6 +92,7 @@ cd conf [ -s nginx.conf ] && echo 'nginx.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf [ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf [ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf +[ -s chinese.php ] && echo 'chinese.php found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/chinese.php [ -s script.mysql ] && echo 'script.mysql found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql cd /root/lnmp/source [ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip @@ -108,14 +109,14 @@ cd /root/lnmp/source [ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz +[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz [ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz # check source packages -for src in `cat ./lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` +for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` do if [ ! -e "/root/lnmp/source/$src" ];then echo -e "\033[31m$src no found! \033[0m" From 35606edc2eceee316befc800575cd68dccdedd72 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 Aug 2013 22:49:39 +0800 Subject: [PATCH 125/617] update source address --- init.sh | 4 ++-- lnmp_install.sh | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/init.sh b/init.sh index 53aa3848..3aa1690b 100755 --- a/init.sh +++ b/init.sh @@ -133,7 +133,7 @@ source /etc/profile mkdir tmux cd tmux wget -c http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz -wget -c http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz +wget -c http://sourceforge.net/projects/tmux/files/tmux/tmux-1.8/tmux-1.8.tar.gz/download tar xzf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable ./configure @@ -156,7 +156,7 @@ fi ###install htop mkdir htop cd htop -wget -c http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz +wget -c http://sourceforge.net/projects/htop/files/htop/1.0.2/htop-1.0.2.tar.gz/download tar xzf htop-1.0.2.tar.gz cd htop-1.0.2 ./configure diff --git a/lnmp_install.sh b/lnmp_install.sh index 33d96743..30cc68e9 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -15,7 +15,7 @@ IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.1 #Definition Directory home_dir=/home/wwwroot wwwlogs_dir=/home/wwwlogs -mkdir -p $home_dir $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} +mkdir -p $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} #choice database while : @@ -100,9 +100,9 @@ cd /root/lnmp/source [ -s mysql-5.6.13.tar.gz ] && echo 'mysql-5.6.13.tar.gz found' || wget -c http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz [ -s mariadb-5.5.32.tar.gz ] && echo 'mariadb-5.5.32.tar.gz found' || wget -c http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz -[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c --no-check-certificate https://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz +[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download +[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download [ -s php-5.5.1.tar.gz ] && echo 'php-5.5.1.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.1.tar.gz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz @@ -113,7 +113,7 @@ cd /root/lnmp/source [ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz -[ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz +[ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz/download # check source packages for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` From 87cab2f35192c9b5a2ec350b3bd99e2e01efac39 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 17 Aug 2013 10:41:24 +0800 Subject: [PATCH 126/617] screen -S lnmp --- init.sh | 2 +- lnmp_install.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 3aa1690b..f3cf99fb 100755 --- a/init.sh +++ b/init.sh @@ -26,7 +26,7 @@ fi yum -y update # Install dependencies package -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail screen # chkconfig chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh diff --git a/lnmp_install.sh b/lnmp_install.sh index 30cc68e9..6af9420a 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -726,6 +726,7 @@ chmod +x /root/lnmp/{init,vhost}.sh sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" /root/lnmp/vhost.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log +screen -S lnmp if [ $choice_db == 'mysql' ];then db_install_dir=/usr/local/mysql db_data_dir=/data/mysql From 4d8ad3174598aafa9a0c6d7a70a2feb75642c44e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 17 Aug 2013 10:44:17 +0800 Subject: [PATCH 127/617] add screen --- lnmp_install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 6af9420a..30cc68e9 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -726,7 +726,6 @@ chmod +x /root/lnmp/{init,vhost}.sh sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" /root/lnmp/vhost.sh /root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log -screen -S lnmp if [ $choice_db == 'mysql' ];then db_install_dir=/usr/local/mysql db_data_dir=/data/mysql From 8545790d476662c6e7f8be8941ca93b223ec6e68 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 17 Aug 2013 13:33:54 +0800 Subject: [PATCH 128/617] update extension_dir --- lnmp_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 30cc68e9..42d37de9 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -460,7 +460,7 @@ make && make install cd ../ # Modify php.ini -sed -i 's@extension_dir = "ext"@extension_dir = "ext"\nextension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"\nextension = "imagick.so"\nextension = "http.so"@' /usr/local/php/etc/php.ini +sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"/usr/local/php/lib/php/extensions/`ls /usr/local/php/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" /usr/local/php/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' /usr/local/php/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini From 539a19e3a4fb2df726802743373f35eeafb5e467 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 17 Aug 2013 15:03:17 +0800 Subject: [PATCH 129/617] upadte php-5.5.2 --- README | 2 +- lnmp_install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 9e13868d..f87a370b 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ libiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz -php-5.5.1.tar.gz +php-5.5.2.tar.gz memcached-1.4.15.tar.gz memcache-2.2.7.tgz ImageMagick-6.8.6-8.tar.gz diff --git a/lnmp_install.sh b/lnmp_install.sh index 42d37de9..6a9aba59 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -103,7 +103,7 @@ cd /root/lnmp/source [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download [ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download -[ -s php-5.5.1.tar.gz ] && echo 'php-5.5.1.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.1.tar.gz +[ -s php-5.5.2.tar.gz ] && echo 'php-5.5.2.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.2.tar.gz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz [ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz @@ -410,9 +410,9 @@ cd mcrypt-2.6.8 make && make install cd ../ -tar xzf php-5.5.1.tar.gz +tar xzf php-5.5.2.tar.gz useradd -M -s /sbin/nologin www -cd php-5.5.1 +cd php-5.5.2 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc \ --with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql --disable-fileinfo \ From 2d47fd495459f419f5f8bbe6b23c8e5024179501 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 19 Aug 2013 12:57:50 +0800 Subject: [PATCH 130/617] memcache dir --- init.sh | 2 +- lnmp_install.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/init.sh b/init.sh index f3cf99fb..3aa1690b 100755 --- a/init.sh +++ b/init.sh @@ -26,7 +26,7 @@ fi yum -y update # Install dependencies package -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail screen +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail # chkconfig chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh diff --git a/lnmp_install.sh b/lnmp_install.sh index 6a9aba59..56da632f 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -29,7 +29,7 @@ do fi done -#eheck dbrootpwd +#check dbrootpwd while : do read -p "Please input the root password of database:" dbrootpwd @@ -434,10 +434,10 @@ fi #wget -c http://pear.php.net/go-pear.phar #/usr/local/php/bin/php go-pear.phar -cp php.ini-production /usr/local/php/etc/php.ini +/bin/cp php.ini-production /usr/local/php/etc/php.ini #php-fpm Init Script -cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on @@ -552,7 +552,7 @@ cd memcache-2.2.7 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install -sed -i 's@-zts-20121212/"@-zts-20121212/"\nextension = "memcache.so"@' /usr/local/php/etc/php.ini +sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' /usr/local/php/etc/php.ini cd ../ tar xzf memcached-1.4.15.tar.gz From 514e60c31b9d5b798e796a9a31584453437c0b71 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 19 Aug 2013 14:23:04 +0800 Subject: [PATCH 131/617] Character alignment --- install_ngx_pagespeed.sh | 6 +++--- lnmp_install.sh | 14 +++++++------- vhost.sh | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/install_ngx_pagespeed.sh b/install_ngx_pagespeed.sh index b5841a2f..a97ae30d 100755 --- a/install_ngx_pagespeed.sh +++ b/install_ngx_pagespeed.sh @@ -34,9 +34,9 @@ if [ -f "objs/nginx" ];then /bin/cp /root/lnmp/vhost.sh /root/lnmp/vhost_ngx_pagespeed.sh sed -i 's@root $vhostdir;@root $vhostdir;\n\tpagespeed on;\n\tpagespeed FileCachePath /var/ngx_pagespeed_cache;\n\tpagespeed RewriteLevel CoreFilters;\n\tpagespeed EnableFilters local_storage_cache;\n\tpagespeed EnableFilters collapse_whitespace,remove_comments;\n\tpagespeed EnableFilters outline_css;\n\tpagespeed EnableFilters flatten_css_imports;\n\tpagespeed EnableFilters move_css_above_scripts;\n\tpagespeed EnableFilters move_css_to_head;\n\tpagespeed EnableFilters outline_javascript;\n\tpagespeed EnableFilters combine_javascript;\n\tpagespeed EnableFilters combine_css;\n\tpagespeed EnableFilters rewrite_javascript;\n\tpagespeed EnableFilters rewrite_css,sprite_images;\n\tpagespeed EnableFilters rewrite_style_attributes;\n\tpagespeed EnableFilters recompress_images;\n\tpagespeed EnableFilters resize_images;\n\tpagespeed EnableFilters convert_meta_tags;\n\tlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\n\tlocation ~ "^/ngx_pagespeed_static/" { }\n\tlocation ~ "^/ngx_pagespeed_beacon$" { }\n\tlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\n\tlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }@' /root/lnmp/vhost_ngx_pagespeed.sh echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" - echo -e "add Virtual Hosts: \033[32m/root/lnmp/vhost.sh\033[0m" - echo -e "add ngx_pagespeed Virtual Hosts: \033[32m/root/lnmp/vhost_ngx_pagespeed.sh\033[0m" + echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[32m/root/lnmp/vhost.sh\033[0m" + echo -e "`printf "%-40s" "add ngx_pagespeed Virtual Hosts:"`\033[32m/root/lnmp/vhost_ngx_pagespeed.sh\033[0m" else - echo -e "add Virtual Hosts: \033[31minstall ngx_pagespeed failed\033[0m" + echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[31minstall ngx_pagespeed failed\033[0m" fi fi diff --git a/lnmp_install.sh b/lnmp_install.sh index 56da632f..99f0876d 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -757,10 +757,10 @@ echo "################Congratulations####################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo '' echo "The path of some dirs:" -echo -e "Nginx dir: \033[32m/usr/local/nginx\033[0m" -echo -e "$choice_DB dir: \033[32m$db_install_dir\033[0m" -echo -e "PHP dir: \033[32m/usr/local/php\033[0m" -echo -e "$choice_DB User: \033[32mroot\033[0m" -echo -e "$choice_DB Password: \033[32m${dbrootpwd}\033[0m" -echo -e "Manager url: \033[32mhttp://$IP/\033[0m" -echo -e "add ngx_pagespeed module: \033[32m./install_ngx_pagespeed.sh\033[0m" +echo -e "`printf "%-32s" "Nginx dir":`\033[32m/usr/local/nginx\033[0m" +echo -e "`printf "%-32s" "$choice_DB dir:"`\033[32m$db_install_dir\033[0m" +echo -e "`printf "%-32s" "PHP dir:"`\033[32m/usr/local/php\033[0m" +echo -e "`printf "%-32s" "$choice_DB User:"`\033[32mroot\033[0m" +echo -e "`printf "%-32s" "$choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" +echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" +echo -e "`printf "%-32s" "add ngx_pagespeed module:"`\033[32m./install_ngx_pagespeed.sh\033[0m" diff --git a/vhost.sh b/vhost.sh index a2e6811e..0113b80a 100755 --- a/vhost.sh +++ b/vhost.sh @@ -185,8 +185,8 @@ echo "# LNMP for CentOS/RadHat 5/6 #" echo "# For more information please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' -echo -e "Your domain:\033[32m$domain\033[0m" -echo -e "Virtualhost conf:\033[32m/usr/local/nginx/conf/vhost/$domain.conf\033[0m" -echo -e "Directory of:\033[32m$vhostdir\033[0m" -[ "$rewrite_yn" == 'y' ] && echo -e "Rewrite rule:\033[32m$rewrite\033[0m" +echo -e "`printf "%-32s" "Your domain"`:\033[32m$domain\033[0m" +echo -e "`printf "%-32s" "Virtualhost conf:"`\033[32m/usr/local/nginx/conf/vhost/$domain.conf\033[0m" +echo -e "`printf "%-32s" "Directory of:"`\033[32m$vhostdir\033[0m" +[ "$rewrite_yn" == 'y' ] && echo -e "`printf "%-32s" "Rewrite rule:"`\033[32m$rewrite\033[0m" echo '' From 7a798a7716e10e38ad39d03b43338e5b35909704 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 19 Aug 2013 21:22:10 +0800 Subject: [PATCH 132/617] MariaDB STORAGE ENGINE --- init.sh | 2 +- lnmp_install.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init.sh b/init.sh index 3aa1690b..a629d1e2 100755 --- a/init.sh +++ b/init.sh @@ -102,7 +102,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Update time /usr/sbin/ntpdate pool.ntp.org -echo '*/5 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root +echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root /sbin/service crond restart # iptables diff --git a/lnmp_install.sh b/lnmp_install.sh index 99f0876d..f7ad43e3 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -150,7 +150,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ --DWITH_EXTRA_CHARSETS=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ @@ -257,14 +256,15 @@ cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ +-DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ --DWITH_EXTRA_CHARSETS=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ From ce96ea6d95a950ce246a43a58a754de0204e810b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 19 Aug 2013 21:38:13 +0800 Subject: [PATCH 133/617] update source address --- init.sh | 4 ++-- lnmp_install.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/init.sh b/init.sh index a629d1e2..a46d5810 100755 --- a/init.sh +++ b/init.sh @@ -133,7 +133,7 @@ source /etc/profile mkdir tmux cd tmux wget -c http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz -wget -c http://sourceforge.net/projects/tmux/files/tmux/tmux-1.8/tmux-1.8.tar.gz/download +wget -c http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz tar xzf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable ./configure @@ -156,7 +156,7 @@ fi ###install htop mkdir htop cd htop -wget -c http://sourceforge.net/projects/htop/files/htop/1.0.2/htop-1.0.2.tar.gz/download +wget -c http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz tar xzf htop-1.0.2.tar.gz cd htop-1.0.2 ./configure diff --git a/lnmp_install.sh b/lnmp_install.sh index f7ad43e3..b24d49e6 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -100,9 +100,9 @@ cd /root/lnmp/source [ -s mysql-5.6.13.tar.gz ] && echo 'mysql-5.6.13.tar.gz found' || wget -c http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz [ -s mariadb-5.5.32.tar.gz ] && echo 'mariadb-5.5.32.tar.gz found' || wget -c http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz [ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download -[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download +[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz +[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz +[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s php-5.5.2.tar.gz ] && echo 'php-5.5.2.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.2.tar.gz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz @@ -113,7 +113,7 @@ cd /root/lnmp/source [ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz [ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz -[ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz/download +[ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz # check source packages for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` From fbdffbbcbe8cb8b4949a2102f73e003f95994840 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 16:17:59 +0800 Subject: [PATCH 134/617] LNMP for Ubuntu 12+ --- README | 19 -- README.md | 78 ++++++++ conf/Memcached-init-CentOS | 106 +++++++++++ conf/Memcached-init-Ubuntu | 85 +++++++++ conf/Nginx-init-CentOS | 128 +++++++++++++ conf/Nginx-init-Ubuntu | 336 +++++++++++++++++++++++++++++++++ conf/index.html | 4 +- init.sh => conf/init_CentOS.sh | 6 +- conf/init_Ubuntu.sh | 86 +++++++++ install_ngx_pagespeed.sh | 19 +- lnmp_install.sh | 226 +++++++++++++--------- vhost.sh | 2 +- 12 files changed, 978 insertions(+), 117 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100755 conf/Memcached-init-CentOS create mode 100755 conf/Memcached-init-Ubuntu create mode 100755 conf/Nginx-init-CentOS create mode 100755 conf/Nginx-init-Ubuntu rename init.sh => conf/init_CentOS.sh (96%) create mode 100755 conf/init_Ubuntu.sh diff --git a/README b/README deleted file mode 100644 index f87a370b..00000000 --- a/README +++ /dev/null @@ -1,19 +0,0 @@ -Source packages version: -cmake-2.8.11.2.tar.gz -mysql-5.6.13.tar.gz -mariadb-5.5.32.tar.gz -libiconv-1.14.tar.gz -libmcrypt-2.5.8.tar.gz -mhash-0.9.9.9.tar.gz -mcrypt-2.6.8.tar.gz -php-5.5.2.tar.gz -memcached-1.4.15.tar.gz -memcache-2.2.7.tgz -ImageMagick-6.8.6-8.tar.gz -imagick-3.1.0RC2.tgz -pecl_http-1.7.6.tgz -pcre-8.33.tar.gz -nginx-1.4.2.tar.gz -pure-ftpd-1.0.36.tar.gz -ftp_v2.1.tar.gz -phpMyAdmin-4.0.5-all-languages.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 00000000..1d7ad1aa --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +## Introduction + + `Linux`+`Nginx`+`MySQL` (Can Choose to install MariaDB)+PHP (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host. + The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .Features include: + +- Constant updates +- Source compiler, Almost all of source packages is the latest stable version and downloaded from the official website +- Fixes some security issues +- Choose to install MySQL or MariaDB database +- Choose whether to install memcache, Pureftpd, phpMyAdmin +- Support ngx_pagespeed module (after installing lnmp) +- Add a virtual host script provided + +## How to use + +```bash + # Please ensure that the downloaded script in the root directory. + cd /root + wget http://blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz + tar xzf lnmp.tar.gz + cd lnmp + chmod +x lnmp_install.sh + # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. + yum -y install screen + screen -S lnmp + ./lnmp_install.sh +``` + +## How to install [ngx_pagespeed](https://github.com/pagespeed/ngx_pagespeed) the module + If you need to use ngx_pagespeed module (after installing lnmp), you can run script +```bash + cd /root/lnmp + ./install_ngx_pagespeed.sh +``` + +## How to add a virtual host + +```bash + cd /root/lnmp + # Does not have ngx_pagespeed function add a virtual host ,You need to run + ./vhost.sh + # Add a virtual host with ngx_pagespeed functionality ,you need to run (must be installed ngx_pagespeed) + ./vhost_ngx_pagespeed.sh +``` + +## Related definitions and explanations + + Web directory, you can customize, Which default directory to default. (Include `Ftp Manager` `phpinfo.php` `phpMyAdmin`, Rename the directory for security) +```bash + home_dir=/home/wwwroot +``` + Nginx Generate a log storage directory, you can customize. +```bash + wwwlogs_dir=/home/wwwlogs +``` + Database data storage directory, you can customize. +```bash + db_data_dir=/data/mysql +``` + +## Program Installation directory (not recommended to change) + + PHP install to the specified directory, For example: /data/webserver/php + Replaced by the following +```bash + sed -i 's@/usr/local/php@/data/webserver/php@g' /root/lnmp/lnmp_install.sh +``` + + Nginx Install to the specified directory, For example :/data/webserver/nginx + Replaced by the following +```bash + sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/vhost.sh + sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/lnmp_install.sh + sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/conf/Nginx-init-* +``` + + For feedback, questions, and to follow the progress of the project (Chinese): + [lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) diff --git a/conf/Memcached-init-CentOS b/conf/Memcached-init-CentOS new file mode 100755 index 00000000..59e4e543 --- /dev/null +++ b/conf/Memcached-init-CentOS @@ -0,0 +1,106 @@ +#!/bin/sh +# +# chkconfig: - 55 45 +# description: The memcached daemon is a network memory cache service. +# processname: memcached +# config: /etc/sysconfig/memcached +# pidfile: /var/run/memcached/memcached.*.pid + +# Source function library. +. /etc/init.d/functions + +PORT=11211 +USER=www +MAXCONN=1024 +OPTIONS="" + +if [ -f /etc/sysconfig/memcached ];then + . /etc/sysconfig/memcached +fi + +# Check that networking is up. +. /etc/sysconfig/network + +if [ "$NETWORKING" = "no" ] +then + exit 0 +fi + +RETVAL=0 +prog="/usr/local/memcached/bin/memcached" + +start_instance() { + echo -n $"Starting $prog ($1): " + daemon --pidfile /var/run/memcached/memcached.$1.pid memcached -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached.$1 + PORT=`expr $PORT + 1` +} + +stop_instance() { + echo -n $"Stopping $prog ($1): " + killproc -p /var/run/memcached/memcached.$1.pid /usr/bin/memcached + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/subsys/memcached.$1 + rm -f /var/run/memcached.$1.pid + fi +} + +start () { + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + + start_instance default 64; + #start_instance block 16; + #start_instance content 128; + #start_instance filter 128; + #start_instance form 32; + #start_instance menu 16; + #start_instance page 8; + #start_instance update 8; + #start_instance views 8; +} +stop () { + stop_instance default; + #stop_instance block; + #stop_instance content; + #stop_instance filter; + #stop_instance form; + #stop_instance menu; + #stop_instance page; + #stop_instance update; + #stop_instance views; +} + +restart () { + stop + start +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status memcached + ;; + restart|reload|force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? diff --git a/conf/Memcached-init-Ubuntu b/conf/Memcached-init-Ubuntu new file mode 100755 index 00000000..9945b14b --- /dev/null +++ b/conf/Memcached-init-Ubuntu @@ -0,0 +1,85 @@ +#! /bin/sh +# + +PORT=11211 +USER=www +MAXCONN=1024 +OPTIONS="" +DAEMON=/usr/local/memcached/bin/memcached + +RETVAL=0 +prog="/usr/local/memcached/bin/memcached" + +start_instance() { + echo -n $"Starting $prog ($1): " + start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 + PORT=`expr $PORT + 1` +} + +stop_instance() { + echo -n $"Stopping $prog ($1): " + start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/memcached.$1 + rm -f /var/run/memcached/memcached.$1.pid + fi +} +start () { + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + + start_instance default 64; + #start_instance block 16; + #start_instance content 128; + #start_instance filter 128; + #start_instance form 32; + #start_instance menu 16; + #start_instance page 8; + #start_instance update 8; + #start_instance views 8; +} +stop () { + stop_instance default; + #stop_instance block; + #stop_instance content; + #stop_instance filter; + #stop_instance form; + #stop_instance menu; + #stop_instance page; + #stop_instance update; + #stop_instance views; +} + +restart () { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status memcached + ;; + restart|reload|force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? diff --git a/conf/Nginx-init-CentOS b/conf/Nginx-init-CentOS new file mode 100755 index 00000000..64f2066a --- /dev/null +++ b/conf/Nginx-init-CentOS @@ -0,0 +1,128 @@ +#!/bin/sh +# +# nginx - this script starts and stops the nginx daemon +# +# chkconfig: - 85 15 +# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# proxy and IMAP/POP3 proxy server +# processname: nginx +# config: /usr/local/nginx/conf/nginx.conf +# pidfile: /var/run/nginx.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +nginx="/usr/local/nginx/sbin/nginx" +prog=$(basename $nginx) + +NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" + +[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx + +lockfile=/var/lock/subsys/nginx + +make_dirs() { + # make required directories + user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` + if [ -z "`grep $user /etc/passwd`" ]; then + useradd -M -s /bin/nologin $user + fi + options=`$nginx -V 2>&1 | grep 'configure arguments:'` + for opt in $options; do + if [ `echo $opt | grep '.*-temp-path'` ]; then + value=`echo $opt | cut -d "=" -f 2` + if [ ! -d "$value" ]; then + # echo "creating" $value + mkdir -p $value && chown -R $user $value + fi + fi + done +} + +start() { + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + make_dirs + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + configtest || return $? + stop + sleep 1 + start +} + +reload() { + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +configtest() { + $nginx -t -c $NGINX_CONF_FILE +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 +esac diff --git a/conf/Nginx-init-Ubuntu b/conf/Nginx-init-Ubuntu new file mode 100755 index 00000000..5cf16464 --- /dev/null +++ b/conf/Nginx-init-Ubuntu @@ -0,0 +1,336 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: nginx +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: nginx init.d dash script for Ubuntu <=9.10. +# Description: nginx init.d dash script for Ubuntu <=9.10. +### END INIT INFO +#------------------------------------------------------------------------------ +# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx +# daemon for ubuntu 9.10 and lesser version numbered releases. +# +# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# proxy and IMAP/POP3 proxy server. This \ +# script will manage the initiation of the \ +# server and it's process state. +# +# processname: nginx +# config: /usr/local/nginx/conf/nginx.conf +# pidfile: /var/run/nginx.pid +# Provides: nginx +# +# Author: Jason Giedymin +# . +# +# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com +# Notes: nginx init.d dash script for Ubuntu <=9.10. +# +# This script's project home is: +# http://code.google.com/p/nginx-init-ubuntu/ +# +#------------------------------------------------------------------------------ +# Functions +#------------------------------------------------------------------------------ +. /lib/lsb/init-functions + +#------------------------------------------------------------------------------ +# Consts +#------------------------------------------------------------------------------ +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/local/nginx/sbin/nginx + +PS="nginx" +PIDNAME="nginx" #lets you do $PS-slave +PIDFILE=$PIDNAME.pid #pid file +PIDSPATH=/var/run + +DESCRIPTION="Nginx Server..." + +RUNAS=root #user to run as + +SCRIPT_OK=0 #ala error codes +SCRIPT_ERROR=1 #ala error codes +TRUE=1 #boolean +FALSE=0 #boolean + +lockfile=/var/lock/subsys/nginx +NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" + +#------------------------------------------------------------------------------ +# Simple Tests +#------------------------------------------------------------------------------ + +#test if nginx is a file and executable +test -x $DAEMON || exit 0 + +# Include nginx defaults if available +if [ -f /etc/default/nginx ] ; then + . /etc/default/nginx +fi + +#set exit condition +#set -e + +#------------------------------------------------------------------------------ +# Functions +#------------------------------------------------------------------------------ + +setFilePerms(){ + + if [ -f $PIDSPATH/$PIDFILE ]; then + chmod 400 $PIDSPATH/$PIDFILE + fi +} + +configtest() { + $DAEMON -t -c $NGINX_CONF_FILE +} + +getPSCount() { + return `pgrep -f $PS | wc -l` +} + +isRunning() { + if [ $1 ]; then + pidof_daemon $1 + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + else + pidof_daemon + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + fi +} + +#courtesy of php-fpm +wait_for_pid () { + try=0 + + while test $try -lt 35 ; do + + case "$1" in + 'created') + if [ -f "$2" ] ; then + try='' + break + fi + ;; + + 'removed') + if [ ! -f "$2" ] ; then + try='' + break + fi + ;; + esac + + #echo -n . + try=`expr $try + 1` + sleep 1 + done +} + +status(){ + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then + echo "$PIDNAME found running with processes: `pidof $PS`" + else + echo "$PIDNAME is NOT running." + fi + + +} + +removePIDFile(){ + if [ $1 ]; then + if [ -f $1 ]; then + rm -f $1 + fi + else + #Do default removal + if [ -f $PIDSPATH/$PIDFILE ]; then + rm -f $PIDSPATH/$PIDFILE + fi + fi +} + +start() { + log_daemon_msg "Starting $DESCRIPTION" + + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then + log_end_msg $SCRIPT_ERROR + else + start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ + -- -c $NGINX_CONF_FILE + setFilePerms + log_end_msg $SCRIPT_OK + fi +} + +stop() { + log_daemon_msg "Stopping $DESCRIPTION" + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + + if [ -n "$try" ] ; then + log_end_msg $SCRIPT_ERROR + else + removePIDFile + log_end_msg $SCRIPT_OK + fi + + else + log_end_msg $SCRIPT_ERROR + fi +} + +reload() { + configtest || return $? + + log_daemon_msg "Reloading (via HUP) $DESCRIPTION" + + isRunning + if [ $? -eq $TRUE ]; then + `killall -HUP $PS` #to be safe + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi +} + +quietupgrade() { + log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -USR2 `cat $PIDSPATH/$PIDFILE` + kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + + log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" + + kill -HUP `cat $PIDSPATH/$PIDFILE` + kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_ok + fi + else + log_end_msg $SCRIPT_ERROR + fi +} + +terminate() { + log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" + + PIDS=`pidof $PS` || true + + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + kill $i + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + removePIDFile + fi + done + + log_end_msg $SCRIPT_OK +} + +destroy() { + log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" + killall $PS -q >> /dev/null 2>&1 + log_end_msg $SCRIPT_OK +} + +pidof_daemon() { + PIDS=`pidof $PS` || true + + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + return 1 + fi + done + return 0 +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + sleep 1 + start + ;; + reload) + $1 + ;; + status) + status + ;; + configtest) + $1 + ;; + quietupgrade) + $1 + ;; + terminate) + $1 + ;; + destroy) + $1 + ;; + *) + FULLPATH=/etc/init.d/$PS + echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" + echo " The 'destroy' command should only be used as a last resort." + exit 1 + ;; +esac + +exit 0 diff --git a/conf/index.html b/conf/index.html index 73f92b46..dbe35218 100644 --- a/conf/index.html +++ b/conf/index.html @@ -23,8 +23,8 @@

-

恭喜,LNMP最新源码安装成功!

-

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5/6

+

Congratulations, lnmp安装成功!

+

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Ubuntu 12+

Github地址:https://github.com/lj2007331/lnmp

查看本地环境:探针 phpinfo FTP Manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

diff --git a/init.sh b/conf/init_CentOS.sh similarity index 96% rename from init.sh rename to conf/init_CentOS.sh index a46d5810..4b64aa54 100755 --- a/init.sh +++ b/conf/init_CentOS.sh @@ -25,7 +25,7 @@ fi # Update rpm package yum -y update -# Install dependencies package +# Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail # chkconfig @@ -41,7 +41,7 @@ chkconfig sendmail on service sendmail restart # /etc/hosts -[ "$(hostname -i)" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts +[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts # Close SELINUX setenforce 0 @@ -147,7 +147,7 @@ make && make install cd ../../ rm -rf tmux -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 else ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 diff --git a/conf/init_Ubuntu.sh b/conf/init_Ubuntu.sh new file mode 100755 index 00000000..075ea3e4 --- /dev/null +++ b/conf/init_Ubuntu.sh @@ -0,0 +1,86 @@ +#! /bin/sh +apt-get -y update +apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +apt-get -y upgrade + +cat > /etc/ldap.conf << EOF +base dc=example,dc=net +uri ldapi:/// +ldap_version 3 +rootbinddn cn=manager,dc=example,dc=net +pam_password md5 +EOF + +# Install needed packages +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev vim zip unzip tmux htop wget + +# /etc/hosts +[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts + +# PS1 +echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$'" >> /etc/profile + +# Record command +sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /root/.bashrc +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bashrc + +# alias vi +sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" /root/.bashrc + +# /etc/security/limits.conf +cat >> /etc/security/limits.conf <> /etc/rc.local + +# /etc/sysctl.conf +cat >> /etc/sysctl.conf << EOF +net.ipv4.tcp_syncookies = 1 +fs.file-max=65535 +net.ipv4.tcp_tw_reuse = 1 +net.ipv4.tcp_tw_recycle = 1 +net.ipv4.ip_local_port_range = 1024 65000 +EOF +sysctl -p + +sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup +sed -i 's@^@#@g' /etc/init/tty[3-6].conf +echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local +sed -i 's@^@#@g' /etc/init/control-alt-delete.conf + +# Set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +# Update time +ntpdate pool.ntp.org +echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +service cron restart + +# iptables +cat > /etc/iptables.up.rules << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:syn-flood - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood +-A INPUT -j REJECT --reject-with icmp-host-prohibited +-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN +-A syn-flood -j REJECT --reject-with icmp-port-unreachable +COMMIT +EOF +iptables-restore < /etc/iptables.up.rules +source /etc/profile diff --git a/install_ngx_pagespeed.sh b/install_ngx_pagespeed.sh index a97ae30d..de9f2610 100755 --- a/install_ngx_pagespeed.sh +++ b/install_ngx_pagespeed.sh @@ -1,9 +1,24 @@ #!/bin/bash +# Author: yeho +# . +# Blog: http://blog.linuxeye.com +# +# Version: 0.2 21-Aug-2013 lj2007331 AT gmail.com +# Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ +# +# This script's project home is: +# https://github.com/lj2007331/lnmp + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, Please use root to install ngx_pagespeed " && kill -9 $$ + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5/6 #" +echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" echo "# For more information please visit http://blog.linuxeye.com/318.html #" echo "#######################################################################" -echo '' + read -p "Do you want to install ngx_pagespeed? (y/n)" nps_yn if [ $nps_yn == 'y' ];then cd /root/lnmp/source diff --git a/lnmp_install.sh b/lnmp_install.sh index b24d49e6..eff0bc85 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -1,35 +1,69 @@ #!/bin/bash +# Author: yeho +# . +# Blog: http://blog.linuxeye.com +# +# Version: 0.2 21-Aug-2013 lj2007331 AT gmail.com +# Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ +# +# This script's project home is: +# https://github.com/lj2007331/lnmp + # Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to install lnmp" && kill -9 $$ +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, Please use root to install lnmp" && kill -9 $$ + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5/6 #" -echo "# For more information please visit http://blog.linuxeye.com/31.html #" +echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' +# check OS +if [ -f /etc/redhat-release ];then + OS=CentOS +elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then + OS=Ubuntu +else + echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" + kill -9 $$ +fi + +function OS_command() +{ +if [ $OS == 'CentOS' ];then + echo -e $OS_CentOS | bash +elif [ $OS == 'Ubuntu' ];then + echo -e $OS_Ubuntu | bash +else + echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" + kill -9 $$ +fi +} + # get ipv4 IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` [ ! -n "$IP" ] && IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` -#Definition Directory +# Definition Directory home_dir=/home/wwwroot wwwlogs_dir=/home/wwwlogs mkdir -p $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} -#choice database +# choice database while : do read -p "Do you want to install MySQL or MariaDB ? ( MySQL / MariaDB ) " choice_DB choice_db=`echo $choice_DB | tr [A-Z] [a-z]` if [ "$choice_db" != 'mariadb' ] && [ "$choice_db" != 'mysql' ];then - echo -e "\033[31minput error! please input 'MySQL' or 'MariaDB'\033[0m" + echo -e "\033[31minput error! Please input 'MySQL' or 'MariaDB'\033[0m" else break fi done -#check dbrootpwd +# check dbrootpwd while : do read -p "Please input the root password of database:" dbrootpwd @@ -40,7 +74,7 @@ while : do read -p "Do you want to install Memcache? (y/n)" Memcache_yn if [ "$Memcache_yn" != 'y' ] && [ "$Memcache_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi @@ -50,7 +84,7 @@ while : do read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi @@ -68,7 +102,7 @@ while : do read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi @@ -77,7 +111,6 @@ done function Download_src() { cd /root/lnmp -[ -s init.sh ] && echo 'init.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/init.sh [ -s vhost.sh ] && echo 'vhost.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh [ -s install_ngx_pagespeed.sh ] && echo 'install_ngx_pagespeed.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/install_ngx_pagespeed.sh cd conf @@ -88,12 +121,17 @@ cd conf [ -s typecho.conf ] && echo 'typecho.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/typecho.conf [ -s ecshop.conf ] && echo 'ecshop.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/ecshop.conf [ -s drupal.conf ] && echo 'drupal.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/drupal.conf -[ -s init.d.nginx ] && echo 'init.d.nginx found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init.d.nginx [ -s nginx.conf ] && echo 'nginx.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf [ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf [ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf [ -s chinese.php ] && echo 'chinese.php found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/chinese.php [ -s script.mysql ] && echo 'script.mysql found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql +[ -s Nginx-init-CentOS ] && echo 'Nginx-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-CentOS +[ -s Memcached-init-CentOS ] && echo 'Memcached-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-CentOS +[ -s Nginx-init-Ubuntu ] && echo 'Nginx-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-Ubuntu +[ -s Memcached-init-Ubuntu ] && echo 'Memcached-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-Ubuntu +[ -s init_CentOS.sh ] && echo 'init_CentOS.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_CentOS.sh +[ -s init_Ubuntu.sh ] && echo 'init_Ubuntu.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_Ubuntu.sh cd /root/lnmp/source [ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip [ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget -c http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz @@ -104,7 +142,7 @@ cd /root/lnmp/source [ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s php-5.5.2.tar.gz ] && echo 'php-5.5.2.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.2.tar.gz -[ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c --no-check-certificate https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz +[ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz [ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz @@ -115,12 +153,12 @@ cd /root/lnmp/source [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz -# check source packages +# check download source packages for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` do if [ ! -e "/root/lnmp/source/$src" ];then echo -e "\033[31m$src no found! \033[0m" - echo -e "\033[31mUpdated version of the Package source,Please Contact Author! \033[0m" + echo -e "\033[31mUpdated version of the Package source, Please contact the author! \033[0m" kill -9 $$ fi done @@ -160,14 +198,16 @@ make && make install if [ -d "$db_install_dir" ];then echo -e "\033[32mMySQL install successfully! \033[0m" else - echo -e "\033[31mMySQL install failed,Please Contact Author! \033[0m" + echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" kill -9 $$ fi /bin/cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld -chkconfig --add mysqld -chkconfig mysqld on +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command cd .. # my.cf @@ -224,7 +264,7 @@ EOF $db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir chown mysql.mysql -R $db_data_dir -/sbin/service mysqld start +service mysqld start export PATH=$PATH:$db_install_dir/bin echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile source /etc/profile @@ -235,7 +275,6 @@ $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where P $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -/sbin/service mysqld restart } function Install_MariaDB() @@ -275,15 +314,17 @@ make && make install if [ -d "$db_install_dir" ];then echo -e "\033[32mMariaDB install successfully! \033[0m" else - echo -e "\033[31mMariaDB install failed,Please Contact Author! \033[0m" + echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" kill -9 $$ fi /bin/cp support-files/my-small.cnf /etc/my.cnf /bin/cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld -chkconfig --add mysqld -chkconfig mysqld on +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command cd .. # my.cf @@ -340,7 +381,7 @@ EOF $db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir chown mysql.mysql -R $db_data_dir -/sbin/service mysqld start +service mysqld start export PATH=$PATH:$db_install_dir/bin echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile source /etc/profile @@ -351,7 +392,6 @@ $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where P $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -/sbin/service mysqld restart } function Install_PHP() @@ -367,7 +407,7 @@ tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure make && make install -/sbin/ldconfig +ldconfig cd libltdl/ ./configure --enable-ltdl-install make && make install @@ -392,20 +432,26 @@ EOF cat >> /etc/ld.so.conf.d/mysql.conf < /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*.log { daily @@ -635,7 +683,7 @@ postrotate endscript } EOF -service nginx restart +service nginx start } function Install_Pureftp() @@ -643,8 +691,15 @@ function Install_Pureftp() cd /root/lnmp/source tar xzf pure-ftpd-1.0.36.tar.gz cd pure-ftpd-1.0.36 +[ $OS == 'Ubuntu' ] && ln -s $db_install_dir/lib/libmysqlclient.so /usr/lib ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=$db_install_dir --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english make && make install +if [ -d "/usr/local/pureftpd" ];then + echo -e "\033[32mPure-Ftp install successfully! \033[0m" +else + echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" + kill -9 $$ +fi cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin chmod +x /usr/local/pureftpd/sbin/pure-config.pl cp contrib/redhat.init /etc/init.d/pureftpd @@ -652,8 +707,11 @@ sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pure sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd chmod +x /etc/init.d/pureftpd -chkconfig --add pureftpd -chkconfig pureftpd on +OS_CentOS='chkconfig --add pureftpd \n +chkconfig pureftpd on' +OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n +update-rc.d pureftpd defaults" +OS_command cd /root/lnmp/conf /bin/cp pure-ftpd.conf /usr/local/pureftpd/ @@ -694,38 +752,26 @@ unzip -q /root/lnmp/source/tz.zip -d $home_dir/default chown -R www.www $home_dir/default } -function Iptables() +function Iptables_Ftp() { -cat > /etc/sysconfig/iptables << EOF -# Firewall configuration written by system-config-securitylevel -# Manual customization of this file is not recommended. -*filter -:INPUT DROP [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] -:syn-flood - [0:0] --A INPUT -i lo -j ACCEPT --A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT --A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT --A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood --A INPUT -j REJECT --reject-with icmp-host-prohibited --A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN --A syn-flood -j REJECT --reject-with icmp-port-unreachable -COMMIT -EOF -service iptables restart +iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +OS_CentOS='service iptables save' +OS_Ubuntu='iptables-save > /etc/iptables.up.rules' +OS_command } Download_src 2>&1 | tee -a /root/lnmp/lnmp_install.log -chmod +x /root/lnmp/{init,vhost}.sh +chmod +x /root/lnmp/*.sh /root/lnmp/conf/*init* sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" /root/lnmp/vhost.sh -/root/lnmp/init.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log + +OS_CentOS='/root/lnmp/conf/init_CentOS.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log \n +/bin/mv /root/lnmp/conf/init_CentOS.sh /root/lnmp/conf/init_CentOS.ed' +OS_Ubuntu='/root/lnmp/conf/init_Ubuntu.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log \n +/bin/mv /root/lnmp/conf/init_Ubuntu.sh /root/lnmp/conf/init_Ubuntu.ed' +OS_command + if [ $choice_db == 'mysql' ];then db_install_dir=/usr/local/mysql db_data_dir=/data/mysql @@ -745,7 +791,7 @@ fi if [ $FTP_yn == 'y' ];then Install_Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log - Iptables 2>&1 | tee -a /root/lnmp/lnmp_install.log + Iptables_Ftp 2>&1 | tee -a /root/lnmp/lnmp_install.log fi if [ $phpMyAdmin_yn == 'y' ];then @@ -763,4 +809,4 @@ echo -e "`printf "%-32s" "PHP dir:"`\033[32m/usr/local/php\033[0m" echo -e "`printf "%-32s" "$choice_DB User:"`\033[32mroot\033[0m" echo -e "`printf "%-32s" "$choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" -echo -e "`printf "%-32s" "add ngx_pagespeed module:"`\033[32m./install_ngx_pagespeed.sh\033[0m" +echo -e "`printf "%-32s" "install ngx_pagespeed module:"`\033[32m./install_ngx_pagespeed.sh\033[0m" diff --git a/vhost.sh b/vhost.sh index 0113b80a..fb1a5756 100755 --- a/vhost.sh +++ b/vhost.sh @@ -4,7 +4,7 @@ [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to create vhost" && exit 1 echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5/6 #" +echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" echo "# For more information please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' From 97144b7a624be057b87e0f68e8c7df7da3283538 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 16:22:19 +0800 Subject: [PATCH 135/617] LNMP for Ubuntu 12+ --- README.md | 4 +- conf/init.d.nginx | 128 ---------------------------------------------- 2 files changed, 2 insertions(+), 130 deletions(-) delete mode 100755 conf/init.d.nginx diff --git a/README.md b/README.md index 1d7ad1aa..f30ccc03 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Introduction - `Linux`+`Nginx`+`MySQL` (Can Choose to install MariaDB)+PHP (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host. + `Linux`+`Nginx`+`MySQL` (Can Choose to install `MariaDB`)+PHP (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host. The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .Features include: - Constant updates @@ -66,7 +66,7 @@ sed -i 's@/usr/local/php@/data/webserver/php@g' /root/lnmp/lnmp_install.sh ``` - Nginx Install to the specified directory, For example :/data/webserver/nginx + Nginx Install to the specified directory, For example: /data/webserver/nginx Replaced by the following ```bash sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/vhost.sh diff --git a/conf/init.d.nginx b/conf/init.d.nginx deleted file mode 100755 index 64f2066a..00000000 --- a/conf/init.d.nginx +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -# -# nginx - this script starts and stops the nginx daemon -# -# chkconfig: - 85 15 -# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ -# proxy and IMAP/POP3 proxy server -# processname: nginx -# config: /usr/local/nginx/conf/nginx.conf -# pidfile: /var/run/nginx.pid - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ "$NETWORKING" = "no" ] && exit 0 - -nginx="/usr/local/nginx/sbin/nginx" -prog=$(basename $nginx) - -NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" - -[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx - -lockfile=/var/lock/subsys/nginx - -make_dirs() { - # make required directories - user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` - if [ -z "`grep $user /etc/passwd`" ]; then - useradd -M -s /bin/nologin $user - fi - options=`$nginx -V 2>&1 | grep 'configure arguments:'` - for opt in $options; do - if [ `echo $opt | grep '.*-temp-path'` ]; then - value=`echo $opt | cut -d "=" -f 2` - if [ ! -d "$value" ]; then - # echo "creating" $value - mkdir -p $value && chown -R $user $value - fi - fi - done -} - -start() { - [ -x $nginx ] || exit 5 - [ -f $NGINX_CONF_FILE ] || exit 6 - make_dirs - echo -n $"Starting $prog: " - daemon $nginx -c $NGINX_CONF_FILE - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc $prog -QUIT - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - configtest || return $? - stop - sleep 1 - start -} - -reload() { - configtest || return $? - echo -n $"Reloading $prog: " - killproc $nginx -HUP - RETVAL=$? - echo -} - -force_reload() { - restart -} - -configtest() { - $nginx -t -c $NGINX_CONF_FILE -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart|configtest) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" - exit 2 -esac From 83be0c883175c7140b578fba5dbacc57d335ae0d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 16:41:22 +0800 Subject: [PATCH 136/617] LNMP for Ubuntu 12+ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f30ccc03..cf1fa630 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ ## Related definitions and explanations - Web directory, you can customize, Which default directory to default. (Include `Ftp Manager` `phpinfo.php` `phpMyAdmin`, Rename the directory for security) + Web directory, you can customize, Which default directory to `Ftp Manager` `phpinfo.php` `phpMyAdmin`. (Rename the directory for security) ```bash home_dir=/home/wwwroot ``` From d77b7f6e21c4573c6ab78da4e02844437c30cb73 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 17:18:10 +0800 Subject: [PATCH 137/617] README.md --- README.md | 6 +++--- lnmp_install.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cf1fa630..bd79e312 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ ./lnmp_install.sh ``` -## How to install [ngx_pagespeed](https://github.com/pagespeed/ngx_pagespeed) the module +## How to install [![ngx_pagespeed]](https://github.com/pagespeed/ngx_pagespeed) the module If you need to use ngx_pagespeed module (after installing lnmp), you can run script ```bash cd /root/lnmp @@ -74,5 +74,5 @@ sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/conf/Nginx-init-* ``` - For feedback, questions, and to follow the progress of the project (Chinese): - [lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) + For feedback, questions, and to follow the progress of the project (Chinese):
+ [![lnmp最新源码一键安装脚本]](http://blog.linuxeye.com/31.html) diff --git a/lnmp_install.sh b/lnmp_install.sh index eff0bc85..9633af05 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -153,7 +153,7 @@ cd /root/lnmp/source [ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz [ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz -# check download source packages +# check downloaded source packages for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` do if [ ! -e "/root/lnmp/source/$src" ];then From 6dd56b688f103ef8a3f8758418039e0fdd879245 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 17:20:25 +0800 Subject: [PATCH 138/617] README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd79e312..31c8088f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ ./lnmp_install.sh ``` -## How to install [![ngx_pagespeed]](https://github.com/pagespeed/ngx_pagespeed) the module +## How to install [ngx_pagespeed](https://github.com/pagespeed/ngx_pagespeed) the module If you need to use ngx_pagespeed module (after installing lnmp), you can run script ```bash cd /root/lnmp @@ -75,4 +75,4 @@ ``` For feedback, questions, and to follow the progress of the project (Chinese):
- [![lnmp最新源码一键安装脚本]](http://blog.linuxeye.com/31.html) + [lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) From 220724237666f6b0c4639b204e03593d8f18d6ea Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Aug 2013 22:40:33 +0800 Subject: [PATCH 139/617] README.md --- README.md | 12 ++++++------ conf/Memcached-init-CentOS | 2 +- conf/Memcached-init-Ubuntu | 2 +- lnmp_install.sh | 18 ++++++++---------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 31c8088f..3c751cc0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Introduction - `Linux`+`Nginx`+`MySQL` (Can Choose to install `MariaDB`)+PHP (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host. + `Linux`+`Nginx`+`MySQL` (Can Choose to install `MariaDB`)+`PHP` (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host.
The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .Features include: - Constant updates @@ -58,15 +58,15 @@ db_data_dir=/data/mysql ``` -## Program Installation directory (not recommended to change) - - PHP install to the specified directory, For example: /data/webserver/php +## Program Installation directory + not recommended to change
+ PHP install to the specified directory, For example: /data/webserver/php
Replaced by the following ```bash sed -i 's@/usr/local/php@/data/webserver/php@g' /root/lnmp/lnmp_install.sh ``` - Nginx Install to the specified directory, For example: /data/webserver/nginx + Nginx Install to the specified directory, For example: /data/webserver/nginx
Replaced by the following ```bash sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/vhost.sh @@ -74,5 +74,5 @@ sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/conf/Nginx-init-* ``` - For feedback, questions, and to follow the progress of the project (Chinese):
+ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) diff --git a/conf/Memcached-init-CentOS b/conf/Memcached-init-CentOS index 59e4e543..523371f2 100755 --- a/conf/Memcached-init-CentOS +++ b/conf/Memcached-init-CentOS @@ -10,7 +10,7 @@ . /etc/init.d/functions PORT=11211 -USER=www +USER=memcached MAXCONN=1024 OPTIONS="" diff --git a/conf/Memcached-init-Ubuntu b/conf/Memcached-init-Ubuntu index 9945b14b..1f527d37 100755 --- a/conf/Memcached-init-Ubuntu +++ b/conf/Memcached-init-Ubuntu @@ -2,7 +2,7 @@ # PORT=11211 -USER=www +USER=memcached MAXCONN=1024 OPTIONS="" DAEMON=/usr/local/memcached/bin/memcached diff --git a/lnmp_install.sh b/lnmp_install.sh index 9633af05..86858fcb 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -603,6 +603,7 @@ make && make install sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' /usr/local/php/etc/php.ini cd ../ +useradd -M -s /sbin/nologin memcached tar xzf memcached-1.4.15.tar.gz cd memcached-1.4.15 ./configure --prefix=/usr/local/memcached @@ -733,6 +734,13 @@ sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php rm -rf ftp/install.php mv ftp $home_dir/default + +# iptables Ftp +iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +OS_CentOS='service iptables save' +OS_Ubuntu='iptables-save > /etc/iptables.up.rules' +OS_command } function Install_phpMyAdmin() @@ -752,15 +760,6 @@ unzip -q /root/lnmp/source/tz.zip -d $home_dir/default chown -R www.www $home_dir/default } -function Iptables_Ftp() -{ -iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT -iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT -OS_CentOS='service iptables save' -OS_Ubuntu='iptables-save > /etc/iptables.up.rules' -OS_command -} - Download_src 2>&1 | tee -a /root/lnmp/lnmp_install.log chmod +x /root/lnmp/*.sh /root/lnmp/conf/*init* sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh @@ -791,7 +790,6 @@ fi if [ $FTP_yn == 'y' ];then Install_Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log - Iptables_Ftp 2>&1 | tee -a /root/lnmp/lnmp_install.log fi if [ $phpMyAdmin_yn == 'y' ];then From 5298826773f562ade392e32900f827d5849b7699 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 22 Aug 2013 14:32:43 +0800 Subject: [PATCH 140/617] add redis --- README.md | 6 +- conf/Redis-server-init-CentOS | 102 +++++++++++++++++++++++++++++++ conf/Redis-server-init-Ubuntu | 60 +++++++++++++++++++ lnmp_install.sh | 109 ++++++++++++++++++++++++++-------- 4 files changed, 250 insertions(+), 27 deletions(-) create mode 100755 conf/Redis-server-init-CentOS create mode 100755 conf/Redis-server-init-Ubuntu diff --git a/README.md b/README.md index 3c751cc0..ef14b524 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ ## Introduction `Linux`+`Nginx`+`MySQL` (Can Choose to install `MariaDB`)+`PHP` (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host.
- The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .Features include: + The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .
+ Features include: - Constant updates - Source compiler, Almost all of source packages is the latest stable version and downloaded from the official website - Fixes some security issues - Choose to install MySQL or MariaDB database -- Choose whether to install memcache, Pureftpd, phpMyAdmin +- Choose whether to install Pureftpd, phpMyAdmin +- Choose whether to install memcache or redis - Support ngx_pagespeed module (after installing lnmp) - Add a virtual host script provided diff --git a/conf/Redis-server-init-CentOS b/conf/Redis-server-init-CentOS new file mode 100755 index 00000000..8b59f542 --- /dev/null +++ b/conf/Redis-server-init-CentOS @@ -0,0 +1,102 @@ +#!/bin/sh +# +# redis - this script starts and stops the redis-server daemon +# +# chkconfig: - 85 15 +# description: Redis is a persistent key-value database +# processname: redis-server +# config: /etc/redis/redis.conf +# config: /etc/sysconfig/redis +# pidfile: /var/run/redis.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +redis="/usr/local/redis/bin/redis-server" +prog=$(basename $redis) + +REDIS_CONF_FILE="/usr/local/redis/etc/redis.conf" + +[ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis + +lockfile=/var/lock/subsys/redis + +start() { + [ -x $redis ] || exit 5 + [ -f $REDIS_CONF_FILE ] || exit 6 + echo -n $"Starting $prog: " + daemon $redis $REDIS_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading $prog: " + killproc $redis -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac diff --git a/conf/Redis-server-init-Ubuntu b/conf/Redis-server-init-Ubuntu new file mode 100755 index 00000000..0f160ee3 --- /dev/null +++ b/conf/Redis-server-init-Ubuntu @@ -0,0 +1,60 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: redis-server +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: redis-server - Persistent key-value db +# Description: redis-server - Persistent key-value db +### END INIT INFO + + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/local/redis/bin/redis-server +DAEMON_ARGS=/usr/local/redis/etc/redis.conf +NAME=redis-server +DESC=redis-server +PIDFILE=/var/run/redis.pid + +test -x $DAEMON || exit 0 +test -x $DAEMONBOOTSTRAP || exit 0 + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + touch $PIDFILE + chown redis:redis $PIDFILE + if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS + then + echo "$NAME." + else + echo "failed" + fi + ;; + stop) + echo -n "Stopping $DESC: " + if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON + then + echo "$NAME." + else + echo "failed" + fi + rm -f $PIDFILE + ;; + + restart|force-reload) + ${0} stop + ${0} start + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/lnmp_install.sh b/lnmp_install.sh index 86858fcb..86b324ae 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -54,8 +54,8 @@ mkdir -p $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} # choice database while : do - read -p "Do you want to install MySQL or MariaDB ? ( MySQL / MariaDB ) " choice_DB - choice_db=`echo $choice_DB | tr [A-Z] [a-z]` + read -p "Do you want to install MySQL or MariaDB ? ( MySQL / MariaDB ) " Choice_DB + choice_db=`echo $Choice_DB | tr [A-Z] [a-z]` if [ "$choice_db" != 'mariadb' ] && [ "$choice_db" != 'mysql' ];then echo -e "\033[31minput error! Please input 'MySQL' or 'MariaDB'\033[0m" else @@ -63,23 +63,38 @@ do fi done -# check dbrootpwd +# check dbrootpwd while : do read -p "Please input the root password of database:" dbrootpwd - (( ${#dbrootpwd} >= 5 )) && break || echo -e "\033[31m$choice_DB root password least 5 characters! \033[0m" + (( ${#dbrootpwd} >= 5 )) && break || echo -e "\033[31m$Choice_DB root password least 5 characters! \033[0m" done +# check cache while : do - read -p "Do you want to install Memcache? (y/n)" Memcache_yn - if [ "$Memcache_yn" != 'y' ] && [ "$Memcache_yn" != 'n' ];then + read -p "Do you want to install Memcache or Redis ? (y/n)" Cache_yn + if [ "$Cache_yn" != 'y' ] && [ "$Cache_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi done +if [ "$Cache_yn" == 'y' ];then +while : +do + read -p "Memcache or Redis ? ( Memcache / Redis ) " Choice_Cache + choice_cache=`echo $Choice_Cache | tr [A-Z] [a-z]` + if [ "$choice_cache" != 'memcache' ] && [ "$choice_cache" != 'redis' ];then + echo -e "\033[31minput error! Please input 'Memcache' or 'Redis'\033[0m" + else + break + fi +done +fi + +# check Pureftpd while : do read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn @@ -90,7 +105,7 @@ do fi done -if [ $FTP_yn == 'y' ];then +if [ "$FTP_yn" == 'y' ];then while : do read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd @@ -98,6 +113,7 @@ if [ $FTP_yn == 'y' ];then done fi +# check phpMyAdmin while : do read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn @@ -127,9 +143,11 @@ cd conf [ -s chinese.php ] && echo 'chinese.php found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/chinese.php [ -s script.mysql ] && echo 'script.mysql found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql [ -s Nginx-init-CentOS ] && echo 'Nginx-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-CentOS -[ -s Memcached-init-CentOS ] && echo 'Memcached-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-CentOS [ -s Nginx-init-Ubuntu ] && echo 'Nginx-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-Ubuntu +[ -s Memcached-init-CentOS ] && echo 'Memcached-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-CentOS [ -s Memcached-init-Ubuntu ] && echo 'Memcached-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-Ubuntu +[ -s Redis-server-init-CentOS ] && echo 'Redis-server-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Redis-server-init-CentOS +[ -s Redis-server-init-Ubuntu ] && echo 'Redis-server-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Redis-server-init-Ubuntu [ -s init_CentOS.sh ] && echo 'init_CentOS.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_CentOS.sh [ -s init_Ubuntu.sh ] && echo 'init_Ubuntu.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_Ubuntu.sh cd /root/lnmp/source @@ -142,8 +160,10 @@ cd /root/lnmp/source [ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz [ -s php-5.5.2.tar.gz ] && echo 'php-5.5.2.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.2.tar.gz -[ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz +[ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz +[ -s redis-2.2.3.tgz ] && echo 'redis-2.2.3.tgz found' || wget -c http://pecl.php.net/get/redis-2.2.3.tgz +[ -s redis-2.6.14.tar.gz ] && echo 'redis-2.6.14.tar.gz found' || wget -c http://redis.googlecode.com/files/redis-2.6.14.tar.gz [ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz [ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz [ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz @@ -256,6 +276,7 @@ slow_query_log_file = $db_data_dir/mysql-slow.log # Oher #max_connections = 1000 open_files_limit = 65535 +explicit_defaults_for_timestamp = true [client] port = 3306 @@ -601,6 +622,7 @@ cd memcache-2.2.7 ./configure --with-php-config=/usr/local/php/bin/php-config make && make install sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' /usr/local/php/etc/php.ini +service php-fpm restart cd ../ useradd -M -s /sbin/nologin memcached @@ -616,11 +638,47 @@ chkconfig memcached on' OS_Ubuntu='/bin/cp /root/lnmp/conf/Memcached-init-Ubuntu /etc/init.d/memcached \n update-rc.d memcached defaults' OS_command -service php-fpm restart service memcached start cd .. } +function Install_Redis() +{ +cd /root/lnmp/source +tar xzf redis-2.2.3.tgz +cd redis-2.2.3 +/usr/local/php/bin/phpize +./configure --with-php-config=/usr/local/php/bin/php-config +make && make install +sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' /usr/local/php/etc/php.ini +service php-fpm restart +cd .. + +tar xzf redis-2.6.14.tar.gz +cd redis-2.6.14 +make +mkdir -p /usr/local/redis/{bin,etc,var} +/bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} /usr/local/redis/bin/ +/bin/cp redis.conf /usr/local/redis/etc/ +ln -s /usr/local/redis/bin/* /usr/local/bin/ +sed -i 's@pidfile.*$@pidfile /var/run/redis.pid@' /usr/local/redis/etc/redis.conf +sed -i 's@logfile.*$@logfile /usr/local/redis/var/redis.log@' /usr/local/redis/etc/redis.conf +sed -i 's@^dir.*$@dir /usr/local/redis/var@' /usr/local/redis/etc/redis.conf +sed -i 's@daemonize no@daemonize yes@' /usr/local/redis/etc/redis.conf +OS_CentOS='/bin/cp /root/lnmp/conf/Redis-server-init-CentOS /etc/init.d/redis-server \n +chkconfig --add redis-server \n +chkconfig redis-server on' +OS_Ubuntu='useradd -M -s /sbin/nologin redis \n +chown -R redis:redis /usr/local/redis/var/ \n +/bin/cp /root/lnmp/conf/Redis-server-init-Ubuntu /etc/init.d/redis-server \n +update-rc.d redis-server defaults' +OS_command +echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf +sysctl -p +service redis-server start +cd .. +} + function Install_Nginx() { cd /root/lnmp/source @@ -721,7 +779,8 @@ mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql -$db_install_dir/bin/mysql -uroot -p$dbrootpwd< script.mysql +service mysqld restart +$db_install_dir/bin/mysql -uroot -p$dbrootpwd < script.mysql service pureftpd start tar xzf /root/lnmp/source/ftp_v2.1.tar.gz @@ -758,6 +817,7 @@ phpinfo() cp /root/lnmp/conf/index.html $home_dir/default unzip -q /root/lnmp/source/tz.zip -d $home_dir/default chown -R www.www $home_dir/default +service mysqld restart } Download_src 2>&1 | tee -a /root/lnmp/lnmp_install.log @@ -771,30 +831,29 @@ OS_Ubuntu='/root/lnmp/conf/init_Ubuntu.sh 2>&1 | tee -a /root/lnmp/lnmp_install. /bin/mv /root/lnmp/conf/init_Ubuntu.sh /root/lnmp/conf/init_Ubuntu.ed' OS_command -if [ $choice_db == 'mysql' ];then +if [ "$choice_db" == 'mysql' ];then db_install_dir=/usr/local/mysql db_data_dir=/data/mysql Install_MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log + service mysqld stop fi -if [ $choice_db == 'mariadb' ];then +if [ "$choice_db" == 'mariadb' ];then db_install_dir=/usr/local/mariadb db_data_dir=/data/mariadb Install_MariaDB 2>&1 | tee -a /root/lnmp/lnmp_install.log + service mysqld stop fi + Install_PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log Install_Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log -if [ $Memcache_yn == 'y' ];then - Install_Memcache 2>&1 | tee -a /root/lnmp/lnmp_install.log -fi +[ "$choice_cache" == 'memcache' ] && Install_Memcache 2>&1 | tee -a /root/lnmp/lnmp_install.log +[ "$choice_cache" == 'redis' ] && Install_Redis 2>&1 | tee -a /root/lnmp/lnmp_install.log -if [ $FTP_yn == 'y' ];then - Install_Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log -fi +[ "$FTP_yn" == 'y' ] && Install_Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log + +[ "$phpMyAdmin_yn" == 'y' ] && Install_phpMyAdmin 2>&1 | tee -a /root/lnmp/lnmp_install.log -if [ $phpMyAdmin_yn == 'y' ];then - Install_phpMyAdmin 2>&1 | tee -a /root/lnmp/lnmp_install.log -fi TEST 2>&1 | tee -a /root/lnmp/lnmp_install.log echo "################Congratulations####################" @@ -802,9 +861,9 @@ echo -e "\033[32mPlease restart the server and see if the services start up fine echo '' echo "The path of some dirs:" echo -e "`printf "%-32s" "Nginx dir":`\033[32m/usr/local/nginx\033[0m" -echo -e "`printf "%-32s" "$choice_DB dir:"`\033[32m$db_install_dir\033[0m" +echo -e "`printf "%-32s" "$Choice_DB dir:"`\033[32m$db_install_dir\033[0m" echo -e "`printf "%-32s" "PHP dir:"`\033[32m/usr/local/php\033[0m" -echo -e "`printf "%-32s" "$choice_DB User:"`\033[32mroot\033[0m" -echo -e "`printf "%-32s" "$choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" +echo -e "`printf "%-32s" "$Choice_DB User:"`\033[32mroot\033[0m" +echo -e "`printf "%-32s" "$Choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" echo -e "`printf "%-32s" "install ngx_pagespeed module:"`\033[32m./install_ngx_pagespeed.sh\033[0m" From a5c59da64276faa5bd19c1c5937e73560f8b03b6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 23 Aug 2013 15:01:54 +0800 Subject: [PATCH 141/617] update php-5.5.3 --- conf/Redis-server-init-CentOS | 2 +- conf/init_CentOS.sh | 8 ++------ conf/nginx.conf | 5 +++-- lnmp_install.sh | 6 +++--- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/conf/Redis-server-init-CentOS b/conf/Redis-server-init-CentOS index 8b59f542..f94517be 100755 --- a/conf/Redis-server-init-CentOS +++ b/conf/Redis-server-init-CentOS @@ -5,7 +5,7 @@ # chkconfig: - 85 15 # description: Redis is a persistent key-value database # processname: redis-server -# config: /etc/redis/redis.conf +# config: /usr/local/redis/etc/redis.conf # config: /etc/sysconfig/redis # pidfile: /var/run/redis.pid diff --git a/conf/init_CentOS.sh b/conf/init_CentOS.sh index 4b64aa54..26262274 100755 --- a/conf/init_CentOS.sh +++ b/conf/init_CentOS.sh @@ -9,11 +9,6 @@ cd .. rm -rf yum-3.4.3* sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -yum check-update - -mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo$(date +%m%d) -mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo$(date +%m%d) -mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo$(date +%m%d) # Remove obsolete rpm package if [ -z "$(cat /etc/redhat-release | grep '5\.')" ];then @@ -22,7 +17,8 @@ else yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "Ruby Support" "X Window System" "Printing client" "Desktop*" fi -# Update rpm package +# update rpm packages +yum check-update yum -y update # Install needed packages diff --git a/conf/nginx.conf b/conf/nginx.conf index f7edcc02..358074f4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -46,12 +46,13 @@ http { fastcgi_temp_file_write_size 128k; gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_comp_level 2; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; - gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; - gzip_vary on; limit_rate_after 3m; limit_rate 512k; diff --git a/lnmp_install.sh b/lnmp_install.sh index 86b324ae..2243babd 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -159,7 +159,7 @@ cd /root/lnmp/source [ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz [ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz -[ -s php-5.5.2.tar.gz ] && echo 'php-5.5.2.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.2.tar.gz +[ -s php-5.5.3.tar.gz ] && echo 'php-5.5.3.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.3.tar.gz [ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz [ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz [ -s redis-2.2.3.tgz ] && echo 'redis-2.2.3.tgz found' || wget -c http://pecl.php.net/get/redis-2.2.3.tgz @@ -477,9 +477,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.2.tar.gz +tar xzf php-5.5.3.tar.gz useradd -M -s /sbin/nologin www -cd php-5.5.2 +cd php-5.5.3 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc \ --with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql --disable-fileinfo \ From 64c8aa6707ba1eea2406c4bd3fb6bcc8a24b1956 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 24 Aug 2013 21:17:30 +0800 Subject: [PATCH 142/617] Modular script --- README.md | 42 +- conf/script.mysql | 2 +- functions/check_os.sh | 24 + functions/download.sh | 12 + functions/get_ipv4.sh | 6 + functions/mariadb.sh | 131 ++++ functions/memcache.sh | 50 ++ functions/mysql.sh | 128 ++++ functions/nginx.sh | 77 ++ functions/ngx_pagespeed.sh | 44 ++ functions/php.sh | 214 ++++++ functions/phpmyadmin.sh | 17 + functions/pureftpd.sh | 70 ++ functions/redis.sh | 64 ++ functions/test.sh | 19 + {conf => init}/Memcached-init-CentOS | 0 {conf => init}/Memcached-init-Ubuntu | 0 {conf => init}/Nginx-init-CentOS | 0 {conf => init}/Nginx-init-Ubuntu | 0 {conf => init}/Redis-server-init-CentOS | 0 {conf => init}/Redis-server-init-Ubuntu | 0 {conf => init}/init_CentOS.sh | 12 +- {conf => init}/init_Ubuntu.sh | 10 +- lnmp_install.sh | 904 ++++-------------------- options.conf | 38 + vhost.sh | 2 + 26 files changed, 1035 insertions(+), 831 deletions(-) create mode 100755 functions/check_os.sh create mode 100755 functions/download.sh create mode 100755 functions/get_ipv4.sh create mode 100755 functions/mariadb.sh create mode 100755 functions/memcache.sh create mode 100755 functions/mysql.sh create mode 100755 functions/nginx.sh create mode 100755 functions/ngx_pagespeed.sh create mode 100755 functions/php.sh create mode 100755 functions/phpmyadmin.sh create mode 100755 functions/pureftpd.sh create mode 100755 functions/redis.sh create mode 100755 functions/test.sh rename {conf => init}/Memcached-init-CentOS (100%) rename {conf => init}/Memcached-init-Ubuntu (100%) rename {conf => init}/Nginx-init-CentOS (100%) rename {conf => init}/Nginx-init-Ubuntu (100%) rename {conf => init}/Redis-server-init-CentOS (100%) rename {conf => init}/Redis-server-init-Ubuntu (100%) rename {conf => init}/init_CentOS.sh (95%) rename {conf => init}/init_Ubuntu.sh (95%) create mode 100644 options.conf diff --git a/README.md b/README.md index ef14b524..c84bd44d 100644 --- a/README.md +++ b/README.md @@ -17,64 +17,24 @@ ```bash # Please ensure that the downloaded script in the root directory. - cd /root + yum -y install wget screen wget http://blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz tar xzf lnmp.tar.gz cd lnmp chmod +x lnmp_install.sh # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. - yum -y install screen screen -S lnmp ./lnmp_install.sh ``` -## How to install [ngx_pagespeed](https://github.com/pagespeed/ngx_pagespeed) the module - If you need to use ngx_pagespeed module (after installing lnmp), you can run script -```bash - cd /root/lnmp - ./install_ngx_pagespeed.sh -``` - ## How to add a virtual host ```bash - cd /root/lnmp # Does not have ngx_pagespeed function add a virtual host ,You need to run ./vhost.sh # Add a virtual host with ngx_pagespeed functionality ,you need to run (must be installed ngx_pagespeed) ./vhost_ngx_pagespeed.sh ``` -## Related definitions and explanations - - Web directory, you can customize, Which default directory to `Ftp Manager` `phpinfo.php` `phpMyAdmin`. (Rename the directory for security) -```bash - home_dir=/home/wwwroot -``` - Nginx Generate a log storage directory, you can customize. -```bash - wwwlogs_dir=/home/wwwlogs -``` - Database data storage directory, you can customize. -```bash - db_data_dir=/data/mysql -``` - -## Program Installation directory - not recommended to change
- PHP install to the specified directory, For example: /data/webserver/php
- Replaced by the following -```bash - sed -i 's@/usr/local/php@/data/webserver/php@g' /root/lnmp/lnmp_install.sh -``` - - Nginx Install to the specified directory, For example: /data/webserver/nginx
- Replaced by the following -```bash - sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/vhost.sh - sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/lnmp_install.sh - sed -i 's@/usr/local/nginx@/data/webserver/nginx@g' /root/lnmp/conf/Nginx-init-* -``` - For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) diff --git a/conf/script.mysql b/conf/script.mysql index d5611566..cf46d83c 100644 --- a/conf/script.mysql +++ b/conf/script.mysql @@ -1,4 +1,4 @@ -grant all privileges on ftpusers.* to ftp@`127.0.0.1` identified by 'mysqlftppwd'; +grant all privileges on ftpusers.* to ftp@`127.0.0.1` identified by 'conn_ftpusers_dbpwd'; FLUSH PRIVILEGES; CREATE DATABASE ftpusers; diff --git a/functions/check_os.sh b/functions/check_os.sh new file mode 100755 index 00000000..b7f4a9ad --- /dev/null +++ b/functions/check_os.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +if [ -f /etc/redhat-release ];then + OS=CentOS +elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then + OS=Ubuntu +else + echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" + kill -9 $$ +fi + +OS_command() +{ + if [ $OS == 'CentOS' ];then + echo -e $OS_CentOS | bash + elif [ $OS == 'Ubuntu' ];then + echo -e $OS_Ubuntu | bash + else + echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" + kill -9 $$ + fi +} diff --git a/functions/download.sh b/functions/download.sh new file mode 100755 index 00000000..0b4e02f3 --- /dev/null +++ b/functions/download.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Download_src() +{ + [ -s "${src_url##*/}" ] && echo "${src_url##*/} found" || wget -c --no-check-certificate $src_url + if [ ! -e "${src_url##*/}" ];then + echo -e "\033[31m${src_url##*/} download failed, Please contact the author! \033[0m" + kill -9 $$ + fi +} diff --git a/functions/get_ipv4.sh b/functions/get_ipv4.sh new file mode 100755 index 00000000..07ba626e --- /dev/null +++ b/functions/get_ipv4.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` +[ ! -n "$IP" ] && IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` diff --git a/functions/mariadb.sh b/functions/mariadb.sh new file mode 100755 index 00000000..a3222aba --- /dev/null +++ b/functions/mariadb.sh @@ -0,0 +1,131 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_MariaDB() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf mariadb-5.5.32.tar.gz +cd mariadb-5.5.32 +cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$mariadb_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_ARIA_STORAGE_ENGINE=1 \ +-DWITH_XTRADB_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DEXTRA_CHARSETS=all \ +-DWITH_BIG_TABLES=1 \ +-DWITH_DEBUG=0 +make && make install + +if [ -d "$mariadb_install_dir" ];then + echo -e "\033[32mMariaDB install successfully! \033[0m" +else + echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/my-small.cnf /etc/my.cnf +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $mariadb_install_dir +datadir = $mariadb_data_dir +pid-file = $mariadb_data_dir/mariadb.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $mariadb_data_dir/mariadb-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $mariadb_data_dir/mariadb-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir + +chown mysql.mysql -R $mariadb_data_dir +service mysqld start +export PATH=$PATH:$mariadb_install_dir/bin +echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile +. /etc/profile + +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +cd ../ +sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir$mariadb_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/memcache.sh b/functions/memcache.sh new file mode 100755 index 00000000..df398829 --- /dev/null +++ b/functions/memcache.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Memcache() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src +src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz && Download_src + +tar xzf memcache-2.2.7.tgz +cd memcache-2.2.7 +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini +else + echo -e "\033[31mPHP Memcache module install failed, Please contact the author! \033[0m" +fi +service php-fpm restart +cd ../ + +useradd -M -s /sbin/nologin memcached +tar xzf memcached-1.4.15.tar.gz +cd memcached-1.4.15 +./configure --prefix=$memcached_install_dir +make && make install +cd ../../ +if [ -d "$memcached_install_dir" ];then + echo -e "\033[32mmemcached install successfully! \033[0m" +else + echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached +OS_CentOS='/bin/cp init/Memcached-init-CentOS /etc/init.d/memcached \n +chkconfig --add memcached \n +chkconfig memcached on' +OS_Ubuntu='/bin/cp init/Memcached-init-Ubuntu /etc/init.d/memcached \n +update-rc.d memcached defaults' +OS_command +sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached +service memcached start +} diff --git a/functions/mysql.sh b/functions/mysql.sh new file mode 100755 index 00000000..91b416de --- /dev/null +++ b/functions/mysql.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_MySQL() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf mysql-5.6.13.tar.gz +cd mysql-5.6.13 +cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$mysql_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DEXTRA_CHARSETS=all \ +-DWITH_BIG_TABLES=1 \ +-DWITH_DEBUG=0 +make && make install + +if [ -d "$mysql_install_dir" ];then + echo -e "\033[32mMySQL install successfully! \033[0m" +else + echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $mysql_install_dir +datadir = $mysql_data_dir +pid-file = $mysql_data_dir/mysql.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $mysql_data_dir/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $mysql_data_dir/mysql-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 +explicit_defaults_for_timestamp = true + +[client] +port = 3306 +EOF + +$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + +chown mysql.mysql -R $mysql_data_dir +service mysqld start +export PATH=$PATH:$mysql_install_dir/bin +echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile +. /etc/profile + +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +cd ../ +sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/nginx.sh b/functions/nginx.sh new file mode 100755 index 00000000..f370b0b7 --- /dev/null +++ b/functions/nginx.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Nginx() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.2.tar.gz && Download_src + +tar xzf pcre-8.33.tar.gz +cd pcre-8.33 +./configure +make && make install +cd ../ + +tar xzf nginx-1.4.2.tar.gz +cd nginx-1.4.2 + +# Modify Nginx version +sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@g' src/core/nginx.h +sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@g' src/core/nginx.h + +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module +make && make install +cd ../../ +OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n +chkconfig --add nginx \n +chkconfig nginx on' +OS_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n +update-rc.d nginx defaults' +OS_command +sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx + +mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk +sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf +/bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf + +# worker_cpu_affinity +CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` +if [ $CPU_num == 1 ];then + sed -i 's@^worker_processes.*@worker_processes 1;@' $nginx_install_dir/conf/nginx.conf +elif [ $CPU_num == 2 ];then + sed -i 's@^worker_processes.*@worker_processes 2;\nworker_cpu_affinity 10 01;@' $nginx_install_dir/conf/nginx.conf +elif [ $CPU_num == 3 ];then + sed -i 's@^worker_processes.*@worker_processes 3;\nworker_cpu_affinity 100 010 001;@' $nginx_install_dir/conf/nginx.conf +elif [ $CPU_num == 4 ];then + sed -i 's@^worker_processes.*@worker_processes 4;\nworker_cpu_affinity 1000 0100 0010 0001;@' $nginx_install_dir/conf/nginx.conf +elif [ $CPU_num == 6 ];then + sed -i 's@^worker_processes.*@worker_processes 6;\nworker_cpu_affinity 100000 010000 001000 000100 000010 000001;@' $nginx_install_dir/conf/nginx.conf +elif [ $CPU_num == 8 ];then + sed -i 's@^worker_processes.*@worker_processes 8;\nworker_cpu_affinity 10000000 01000000 00100000 00010000 00001000 00000100 00000010 00000001;@' $nginx_install_dir/conf/nginx.conf +else + echo Google worker_cpu_affinity +fi + +# logrotate nginx log +cat > /etc/logrotate.d/nginx << EOF +$wwwlogs_dir/*.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate + [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` +endscript +} +EOF +service nginx start +} diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh new file mode 100755 index 00000000..07581fcc --- /dev/null +++ b/functions/ngx_pagespeed.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_ngx_pagespeed() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +rm -rf release* ngx_pagespeed-release* +src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz && Download_src +wget -c --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-1.6.29.5-beta.zip + +unzip -q release-1.6.29.5-beta +tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta +cd nginx-1.4.2/ +make clean +if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ;then +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ +--add-module=../ngx_pagespeed-release-1.6.29.5-beta \ +--with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' +else +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ +--add-module=../ngx_pagespeed-release-1.6.29.5-beta \ +--with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' +fi +make +if [ -f "objs/nginx" ];then + /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $nginx_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + mkdir /var/ngx_pagespeed_cache + chown www.www /var/ngx_pagespeed_cache + /bin/cp $lnmp_dir/vhost.sh $lnmp_dir/vhost_ngx_pagespeed.sh + sed -i 's@root $vhostdir;@root $vhostdir;\n\tpagespeed on;\n\tpagespeed FileCachePath /var/ngx_pagespeed_cache;\n\tpagespeed RewriteLevel CoreFilters;\n\tpagespeed EnableFilters local_storage_cache;\n\tpagespeed EnableFilters collapse_whitespace,remove_comments;\n\tpagespeed EnableFilters outline_css;\n\tpagespeed EnableFilters flatten_css_imports;\n\tpagespeed EnableFilters move_css_above_scripts;\n\tpagespeed EnableFilters move_css_to_head;\n\tpagespeed EnableFilters outline_javascript;\n\tpagespeed EnableFilters combine_javascript;\n\tpagespeed EnableFilters combine_css;\n\tpagespeed EnableFilters rewrite_javascript;\n\tpagespeed EnableFilters rewrite_css,sprite_images;\n\tpagespeed EnableFilters rewrite_style_attributes;\n\tpagespeed EnableFilters recompress_images;\n\tpagespeed EnableFilters resize_images;\n\tpagespeed EnableFilters convert_meta_tags;\n\tlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\n\tlocation ~ "^/ngx_pagespeed_static/" { }\n\tlocation ~ "^/ngx_pagespeed_beacon$" { }\n\tlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\n\tlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }@' $lnmp_dir/vhost_ngx_pagespeed.sh + echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" + echo -e "`printf "%-40s" "add ngx_pagespeed Virtual Hosts:"`\033[32m$lnmp_dir/vhost_ngx_pagespeed.sh\033[0m" +else + echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[31minstall ngx_pagespeed failed\033[0m" + kill -9 $$ +fi +} diff --git a/functions/php.sh b/functions/php.sh new file mode 100755 index 00000000..e2db97e0 --- /dev/null +++ b/functions/php.sh @@ -0,0 +1,214 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_PHP() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.6-8.tar.gz +cd ImageMagick-6.8.6-8 +./configure +make && make install +cd ../ + +# linked library +cat >> /etc/ld.so.conf.d/local.conf <> /etc/ld.so.conf.d/mysql.conf < $php_install_dir/etc/php-fpm.conf < +# Blog: http://blog.linuxeye.com + +Install_phpMyAdmin() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz && Download_src + +tar xzf phpMyAdmin-4.0.5-all-languages.tar.gz +/bin/mv phpMyAdmin-4.0.5-all-languages $home_dir/default/phpMyAdmin +chown -R www.www $home_dir/default/phpMyAdmin +cd .. +} diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh new file mode 100755 index 00000000..7071817a --- /dev/null +++ b/functions/pureftpd.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Pureftpd() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz && Download_src +src_url=http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz && Download_src + +tar xzf pure-ftpd-1.0.36.tar.gz +cd pure-ftpd-1.0.36 +[ $OS == 'Ubuntu' ] && ln -s $db_install_dir/lib/libmysqlclient.so /usr/lib +./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-mysql=$db_install_dir --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english +make && make install +if [ -d "$pureftpd_install_dir" ];then + echo -e "\033[32mPure-Ftp install successfully! \033[0m" +else + echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin +chmod +x $pureftpd_install_dir/sbin/pure-config.pl +cp contrib/redhat.init /etc/init.d/pureftpd +cd ../../ +sed -i "s@fullpath=.*@fullpath=$pureftpd_install_dir/sbin/\$prog@" /etc/init.d/pureftpd +sed -i "s@pureftpwho=.*@pureftpwho=$pureftpd_install_dir/sbin/pure-ftpwho@" /etc/init.d/pureftpd +sed -i "s@/etc/pure-ftpd.conf@$pureftpd_install_dir/pure-ftpd.conf@" /etc/init.d/pureftpd +chmod +x /etc/init.d/pureftpd +OS_CentOS='chkconfig --add pureftpd \n +chkconfig pureftpd on' +OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n +update-rc.d pureftpd defaults" +OS_command + +/bin/cp conf/pure-ftpd.conf $pureftpd_install_dir/ +/bin/cp conf/pureftpd-mysql.conf $pureftpd_install_dir/ +conn_ftpusers_dbpwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` +sed -i "s@^conn_ftpusers_dbpwd.*@conn_ftpusers_dbpwd=$conn_ftpusers_dbpwd@" options.conf +sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/g' $pureftpd_install_dir/pureftpd-mysql.conf +sed -i 's/conn_ftpusers_dbpwd/'$conn_ftpusers_dbpwd'/g' conf/script.mysql +sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' conf/script.mysql +service mysqld restart +$db_install_dir/bin/mysql -uroot -p$dbrootpwd < conf/script.mysql +service pureftpd start + +cd src +tar xzf ftp_v2.1.tar.gz +sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/' ftp/config.php +sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php +sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php +sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php +sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php +/bin/cp ../conf/chinese.php ftp/language/ +sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php +rm -rf ftp/install.php +mv ftp $home_dir/default +cd ../ + +# iptables Ftp +iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT +iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT +OS_CentOS='service iptables save' +OS_Ubuntu='iptables-save > /etc/iptables.up.rules' +OS_command +} diff --git a/functions/redis.sh b/functions/redis.sh new file mode 100755 index 00000000..d203c470 --- /dev/null +++ b/functions/redis.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Redis() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://pecl.php.net/get/redis-2.2.3.tgz && Download_src +src_url=http://redis.googlecode.com/files/redis-2.6.14.tar.gz && Download_src + +tar xzf redis-2.2.3.tgz +cd redis-2.2.3 +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini +else + echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" +fi +service php-fpm restart +cd .. + +tar xzf redis-2.6.14.tar.gz +cd redis-2.6.14 +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then + sed -i '1i\CFLAGS= -march=i686' src/Makefile + sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings +fi + +make + +if [ -f "src/redis-server" ];then + mkdir -p $redis_install_dir/{bin,etc,var} + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + /bin/cp redis.conf $redis_install_dir/etc/ +else + echo -e "\033[31mRedis install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cd ../../ + +ln -s $redis_install_dir/bin/* /usr/local/bin/ +sed -i 's@pidfile.*$@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf +sed -i "s@logfile.*$@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf +sed -i "s@^dir.*$@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf +sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf +OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n +chkconfig --add redis-server \n +chkconfig redis-server on' +OS_Ubuntu='useradd -M -s /sbin/nologin redis \n +chown -R redis:redis $redis_install_dir/var/ \n +/bin/cp init/Redis-server-init-Ubuntu /etc/init.d/redis-server \n +update-rc.d redis-server defaults' +OS_command +sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server +echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf +sysctl -p +service redis-server start +} diff --git a/functions/test.sh b/functions/test.sh new file mode 100755 index 00000000..4e3f8546 --- /dev/null +++ b/functions/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +TEST() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://www.yahei.net/tz/tz.zip && Download_src + +echo '' > $home_dir/default/phpinfo.php +/bin/cp $lnmp_dir/conf/index.html $home_dir/default +unzip -q tz.zip -d $home_dir/default +chown -R www.www $home_dir/default +service mysqld restart +cd .. +} diff --git a/conf/Memcached-init-CentOS b/init/Memcached-init-CentOS similarity index 100% rename from conf/Memcached-init-CentOS rename to init/Memcached-init-CentOS diff --git a/conf/Memcached-init-Ubuntu b/init/Memcached-init-Ubuntu similarity index 100% rename from conf/Memcached-init-Ubuntu rename to init/Memcached-init-Ubuntu diff --git a/conf/Nginx-init-CentOS b/init/Nginx-init-CentOS similarity index 100% rename from conf/Nginx-init-CentOS rename to init/Nginx-init-CentOS diff --git a/conf/Nginx-init-Ubuntu b/init/Nginx-init-Ubuntu similarity index 100% rename from conf/Nginx-init-Ubuntu rename to init/Nginx-init-Ubuntu diff --git a/conf/Redis-server-init-CentOS b/init/Redis-server-init-CentOS similarity index 100% rename from conf/Redis-server-init-CentOS rename to init/Redis-server-init-CentOS diff --git a/conf/Redis-server-init-Ubuntu b/init/Redis-server-init-Ubuntu similarity index 100% rename from conf/Redis-server-init-Ubuntu rename to init/Redis-server-init-Ubuntu diff --git a/conf/init_CentOS.sh b/init/init_CentOS.sh similarity index 95% rename from conf/init_CentOS.sh rename to init/init_CentOS.sh index 26262274..872b0150 100755 --- a/conf/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -57,7 +57,7 @@ echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user= sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth # alias vi -sed "s@alias mv=.*@alias mv='mv -i'\nalias vi=vim@" /root/.bashrc +sed -i "s@alias mv=.*@alias mv='mv -i'\nalias vi=vim@" /root/.bashrc echo 'syntax on' >> /etc/vimrc # /etc/security/limits.conf @@ -96,6 +96,14 @@ fi rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +# Set OpenDNS +if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF +fi + # Update time /usr/sbin/ntpdate pool.ntp.org echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root @@ -123,7 +131,7 @@ cat > /etc/sysconfig/iptables << EOF COMMIT EOF /sbin/service iptables restart -source /etc/profile +. /etc/profile ###install tmux mkdir tmux diff --git a/conf/init_Ubuntu.sh b/init/init_Ubuntu.sh similarity index 95% rename from conf/init_Ubuntu.sh rename to init/init_Ubuntu.sh index 075ea3e4..b0a2d24c 100755 --- a/conf/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -56,6 +56,14 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +# Set OpenDNS +if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF +fi + # Update time ntpdate pool.ntp.org echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root @@ -83,4 +91,4 @@ cat > /etc/iptables.up.rules << EOF COMMIT EOF iptables-restore < /etc/iptables.up.rules -source /etc/profile +. /etc/profile diff --git a/lnmp_install.sh b/lnmp_install.sh index 2243babd..1d3ec25f 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Author: yeho -# . +# Author: yeho # Blog: http://blog.linuxeye.com # # Version: 0.2 21-Aug-2013 lj2007331 AT gmail.com @@ -20,850 +19,183 @@ echo "# For more information Please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' -# check OS -if [ -f /etc/redhat-release ];then - OS=CentOS -elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then - OS=Ubuntu -else - echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" - kill -9 $$ -fi +#get pwd +sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" options.conf -function OS_command() -{ -if [ $OS == 'CentOS' ];then - echo -e $OS_CentOS | bash -elif [ $OS == 'Ubuntu' ];then - echo -e $OS_Ubuntu | bash -else - echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" - kill -9 $$ -fi -} # get ipv4 -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` -[ ! -n "$IP" ] && IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` +. functions/get_ipv4.sh # Definition Directory -home_dir=/home/wwwroot -wwwlogs_dir=/home/wwwlogs -mkdir -p $home_dir/default $wwwlogs_dir /root/lnmp/{source,conf} +. ./options.conf +mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice database -while : -do - read -p "Do you want to install MySQL or MariaDB ? ( MySQL / MariaDB ) " Choice_DB - choice_db=`echo $Choice_DB | tr [A-Z] [a-z]` - if [ "$choice_db" != 'mariadb' ] && [ "$choice_db" != 'mysql' ];then - echo -e "\033[31minput error! Please input 'MySQL' or 'MariaDB'\033[0m" - else - break - fi -done - -# check dbrootpwd -while : -do - read -p "Please input the root password of database:" dbrootpwd - (( ${#dbrootpwd} >= 5 )) && break || echo -e "\033[31m$Choice_DB root password least 5 characters! \033[0m" -done +if [ ! -d "$db_install_dir" ];then + while : + do + read -p "Do you want to install MySQL or MariaDB ? ( MySQL / MariaDB ) " Choice_DB + choice_db=`echo $Choice_DB | tr [A-Z] [a-z]` + if [ "$choice_db" != 'mariadb' ] && [ "$choice_db" != 'mysql' ];then + echo -e "\033[31minput error! Please input 'MySQL' or 'MariaDB'\033[0m" + else + while : + do + read -p "Please input the root password of $Choice_DB:" dbrootpwd + (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31m$Choice_DB root password least 5 characters! \033[0m" + done + break + fi + done +fi -# check cache +# check Pureftpd +if [ ! -d "$pureftpd_install_dir" ];then while : do - read -p "Do you want to install Memcache or Redis ? (y/n)" Cache_yn - if [ "$Cache_yn" != 'y' ] && [ "$Cache_yn" != 'n' ];then + read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn + if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else - break + if [ "$FTP_yn" == 'y' ];then + while : + do + read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd + (( ${#ftpmanagerpwd} >= 5 )) && sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf && break || echo -e "\033[31mFtp manager password least 5 characters! \033[0m" + done fi -done - -if [ "$Cache_yn" == 'y' ];then -while : -do - read -p "Memcache or Redis ? ( Memcache / Redis ) " Choice_Cache - choice_cache=`echo $Choice_Cache | tr [A-Z] [a-z]` - if [ "$choice_cache" != 'memcache' ] && [ "$choice_cache" != 'redis' ];then - echo -e "\033[31minput error! Please input 'Memcache' or 'Redis'\033[0m" - else - break + break fi done fi -# check Pureftpd +# check phpMyAdmin +if [ ! -d "$wwwroot/default/phpMyAdmin" ];then while : do - read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn - if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then + read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn + if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi done +fi -if [ "$FTP_yn" == 'y' ];then +# check redis +if [ ! -d "$redis_install_dir" ];then + while : + do + read -p "Do you want to install Redis? (y/n)" redis_yn + if [ "$redis_yn" != 'y' ] && [ "$redis_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi + done +fi + +# check memcache +if [ ! -d "$memcached_install_dir" ];then while : do - read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd - (( ${#ftpmanagerpwd} >= 5 )) && break || echo -e "\033[31mFtp manager password least 5 characters! \033[0m" + read -p "Do you want to install Memcache? (y/n)" memcache_yn + if [ "$memcache_yn" != 'y' ] && [ "$memcache_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi done fi -# check phpMyAdmin +# check ngx_pagespeed while : do - read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn - if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then + read -p "Do you want to install ngx_pagespeed? (y/n)" ngx_pagespeed_yn + if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break fi done -function Download_src() -{ -cd /root/lnmp -[ -s vhost.sh ] && echo 'vhost.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/vhost.sh -[ -s install_ngx_pagespeed.sh ] && echo 'install_ngx_pagespeed.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/install_ngx_pagespeed.sh -cd conf -[ -s index.html ] && echo 'index.html found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/index.html -[ -s wordpress.conf ] && echo 'wordpress.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/wordpress.conf -[ -s discuz.conf ] && echo 'discuz.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/discuz.conf -[ -s phpwind.conf ] && echo 'phpwind.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/phpwind.conf -[ -s typecho.conf ] && echo 'typecho.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/typecho.conf -[ -s ecshop.conf ] && echo 'ecshop.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/ecshop.conf -[ -s drupal.conf ] && echo 'drupal.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/drupal.conf -[ -s nginx.conf ] && echo 'nginx.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/nginx.conf -[ -s pure-ftpd.conf ] && echo 'pure-ftpd.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pure-ftpd.conf -[ -s pureftpd-mysql.conf ] && echo 'pureftpd-mysql.conf found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/pureftpd-mysql.conf -[ -s chinese.php ] && echo 'chinese.php found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/chinese.php -[ -s script.mysql ] && echo 'script.mysql found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/script.mysql -[ -s Nginx-init-CentOS ] && echo 'Nginx-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-CentOS -[ -s Nginx-init-Ubuntu ] && echo 'Nginx-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Nginx-init-Ubuntu -[ -s Memcached-init-CentOS ] && echo 'Memcached-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-CentOS -[ -s Memcached-init-Ubuntu ] && echo 'Memcached-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Memcached-init-Ubuntu -[ -s Redis-server-init-CentOS ] && echo 'Redis-server-init-CentOS found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Redis-server-init-CentOS -[ -s Redis-server-init-Ubuntu ] && echo 'Redis-server-init-Ubuntu found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/Redis-server-init-Ubuntu -[ -s init_CentOS.sh ] && echo 'init_CentOS.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_CentOS.sh -[ -s init_Ubuntu.sh ] && echo 'init_Ubuntu.sh found' || wget -c --no-check-certificate https://raw.github.com/lj2007331/lnmp/master/conf/init_Ubuntu.sh -cd /root/lnmp/source -[ -s tz.zip ] && echo 'tz.zip found' || wget -c http://www.yahei.net/tz/tz.zip -[ -s cmake-2.8.11.2.tar.gz ] && echo 'cmake-2.8.11.2.tar.gz found' || wget -c http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz -[ -s mysql-5.6.13.tar.gz ] && echo 'mysql-5.6.13.tar.gz found' || wget -c http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz -[ -s mariadb-5.5.32.tar.gz ] && echo 'mariadb-5.5.32.tar.gz found' || wget -c http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz -[ -s libiconv-1.14.tar.gz ] && echo 'libiconv-1.14.tar.gz found' || wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -[ -s mcrypt-2.6.8.tar.gz ] && echo 'mcrypt-2.6.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz -[ -s libmcrypt-2.5.8.tar.gz ] && echo 'libmcrypt-2.5.8.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -[ -s mhash-0.9.9.9.tar.gz ] && echo 'mhash-0.9.9.9.tar.gz found' || wget -c http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz -[ -s php-5.5.3.tar.gz ] && echo 'php-5.5.3.tar.gz found' || wget -c http://kr1.php.net/distributions/php-5.5.3.tar.gz -[ -s memcache-2.2.7.tgz ] && echo 'memcache-2.2.7.tgz found' || wget -c http://pecl.php.net/get/memcache-2.2.7.tgz -[ -s memcached-1.4.15.tar.gz ] && echo 'memcached-1.4.15.tar.gz found' || wget -c http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz -[ -s redis-2.2.3.tgz ] && echo 'redis-2.2.3.tgz found' || wget -c http://pecl.php.net/get/redis-2.2.3.tgz -[ -s redis-2.6.14.tar.gz ] && echo 'redis-2.6.14.tar.gz found' || wget -c http://redis.googlecode.com/files/redis-2.6.14.tar.gz -[ -s ImageMagick-6.8.6-8.tar.gz ] && echo 'ImageMagick-6.8.6-8.tar.gz found' || wget -c http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz -[ -s imagick-3.1.0RC2.tgz ] && echo 'imagick-3.1.0RC2.tgz found' || wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz -[ -s pecl_http-1.7.6.tgz ] && echo 'pecl_http-1.7.6.tgz found' || wget -c http://pecl.php.net/get/pecl_http-1.7.6.tgz -[ -s pcre-8.33.tar.gz ] && echo 'pcre-8.33.tar.gz found' || wget -c http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz -[ -s nginx-1.4.2.tar.gz ] && echo 'nginx-1.4.2.tar.gz found' || wget -c http://nginx.org/download/nginx-1.4.2.tar.gz -[ -s pure-ftpd-1.0.36.tar.gz ] && echo 'pure-ftpd-1.0.36.tar.gz found' || wget -c http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.gz -[ -s ftp_v2.1.tar.gz ] && echo 'ftp_v2.1.tar.gz found' || wget -c http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz -[ -s phpMyAdmin-4.0.5-all-languages.tar.gz ] && echo 'phpMyAdmin-4.0.5-all-languages.tar.gz found' || wget -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz +chmod +x functions/*.sh init/* *.sh -# check downloaded source packages -for src in `cat /root/lnmp/lnmp_install.sh | grep found.*wget | awk '{print $3}' | grep gz` -do - if [ ! -e "/root/lnmp/source/$src" ];then - echo -e "\033[31m$src no found! \033[0m" - echo -e "\033[31mUpdated version of the Package source, Please contact the author! \033[0m" - kill -9 $$ - fi -done -} - -function Install_MySQL() -{ -cd /root/lnmp/source -useradd -M -s /sbin/nologin mysql -mkdir -p $db_data_dir;chown mysql.mysql -R $db_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 -./configure -make && make install -cd .. -tar zxf mysql-5.6.13.tar.gz -cd mysql-5.6.13 -cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=$db_data_dir \ --DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ --DMYSQL_TCP_PORT=3306 \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DWITH_PARTITION_STORAGE_ENGINE=1 \ --DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ --DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 -make && make install - -if [ -d "$db_install_dir" ];then - echo -e "\033[32mMySQL install successfully! \033[0m" -else - echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -/bin/cp support-files/mysql.server /etc/init.d/mysqld -chmod +x /etc/init.d/mysqld -OS_CentOS='chkconfig --add mysqld \n -chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' +# init +. functions/check_os.sh +OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n +/bin/mv init/init_CentOS.sh init/init_CentOS.ed' +OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n +/bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' OS_command -cd .. - -# my.cf -cat > /etc/my.cnf << EOF -[mysqld] -basedir = $db_install_dir -datadir = $db_data_dir -pid-file = $db_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci -user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 -bind-address = 0.0.0.0 - -# name-resolve -skip-name-resolve -skip-host-cache - -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 - -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M -# LOG -log_error = $db_data_dir/mysql-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = $db_data_dir/mysql-slow.log - -# Oher -#max_connections = 1000 -open_files_limit = 65535 -explicit_defaults_for_timestamp = true - -[client] -port = 3306 -EOF - -$db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir - -chown mysql.mysql -R $db_data_dir -service mysqld start -export PATH=$PATH:$db_install_dir/bin -echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile -source /etc/profile - -$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -} - -function Install_MariaDB() -{ -cd /root/lnmp/source -useradd -M -s /sbin/nologin mysql -mkdir -p $db_data_dir;chown mysql.mysql -R $db_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 -./configure -make && make install -cd .. -tar zxf mariadb-5.5.32.tar.gz -cd mariadb-5.5.32 -cmake . -DCMAKE_INSTALL_PREFIX=$db_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=$db_data_dir \ --DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ --DMYSQL_TCP_PORT=3306 \ --DWITH_ARIA_STORAGE_ENGINE=1 \ --DWITH_XTRADB_STORAGE_ENGINE=1 \ --DWITH_ARCHIVE_STORAGE_ENGINE=1 \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DWITH_PARTITION_STORAGE_ENGINE=1 \ --DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ --DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 -make && make install - -if [ -d "$db_install_dir" ];then - echo -e "\033[32mMariaDB install successfully! \033[0m" -else - echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" - kill -9 $$ +if [ "$choice_db" == 'mysql' ];then + cd $lnmp_dir + . functions/mysql.sh + Install_MySQL 2>&1 | tee -a $lnmp_dir/lnmp_install.log + db_install_dir=$mysql_install_dir + sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf + sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf fi - -/bin/cp support-files/my-small.cnf /etc/my.cnf -/bin/cp support-files/mysql.server /etc/init.d/mysqld -chmod +x /etc/init.d/mysqld -OS_CentOS='chkconfig --add mysqld \n -chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' -OS_command -cd .. - -# my.cf -cat > /etc/my.cnf << EOF -[mysqld] -basedir = $db_install_dir -datadir = $db_data_dir -pid-file = $db_data_dir/mariadb.pid -character-set-server = utf8 -collation-server = utf8_general_ci -user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 -bind-address = 0.0.0.0 - -# name-resolve -skip-name-resolve -skip-host-cache - -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 - -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M - -# LOG -log_error = $db_data_dir/mariadb-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = $db_data_dir/mariadb-slow.log - -# Oher -#max_connections = 1000 -open_files_limit = 65535 - -[client] -port = 3306 -EOF - -$db_install_dir/scripts/mysql_install_db --user=mysql --basedir=$db_install_dir --datadir=$db_data_dir - -chown mysql.mysql -R $db_data_dir -service mysqld start -export PATH=$PATH:$db_install_dir/bin -echo "export PATH=\$PATH:$db_install_dir/bin" >> /etc/profile -source /etc/profile - -$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$db_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -} - -function Install_PHP() -{ -cd /root/lnmp/source -tar xzf libiconv-1.14.tar.gz -cd libiconv-1.14 -./configure --prefix=/usr/local -make && make install -cd ../ - -tar xzf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8 -./configure -make && make install -ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -tar xzf mhash-0.9.9.9.tar.gz -cd mhash-0.9.9.9 -./configure -make && make install -cd ../ - -tar xzf ImageMagick-6.8.6-8.tar.gz -cd ImageMagick-6.8.6-8 -./configure -make && make install -cd ../ - -# linked library -cat >> /etc/ld.so.conf.d/local.conf <> /etc/ld.so.conf.d/mysql.conf <&1 | tee -a $lnmp_dir/lnmp_install.log + db_install_dir=$mariadb_install_dir + sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf + sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf fi -# wget -c http://pear.php.net/go-pear.phar -# /usr/local/php/bin/php go-pear.phar - -/bin/cp php.ini-production /usr/local/php/etc/php.ini - -# php-fpm Init Script -/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm -chmod +x /etc/init.d/php-fpm -OS_CentOS='chkconfig --add php-fpm \n -chkconfig php-fpm on' -OS_Ubuntu='update-rc.d php-fpm defaults' -OS_command -cd ../ - -tar xzf imagick-3.1.0RC2.tgz -cd imagick-3.1.0RC2 -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -# Modify php.ini -sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"/usr/local/php/lib/php/extensions/`ls /usr/local/php/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" /usr/local/php/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' /usr/local/php/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' /usr/local/php/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' /usr/local/php/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' /usr/local/php/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' /usr/local/php/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' /usr/local/php/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 50M@' /usr/local/php/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' /usr/local/php/etc/php.ini -sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' /usr/local/php/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 300@' /usr/local/php/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' /usr/local/php/etc/php.ini -sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' /usr/local/php/etc/php.ini -sed -i 's@^pdo_mysql.default_socket.*@pdo_mysql.default_socket = /tmp/mysql.sock@' /usr/local/php/etc/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' /usr/local/php/etc/php.ini - -sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.enable=.*@opcache.enable=1@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' /usr/local/php/etc/php.ini -sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' /usr/local/php/etc/php.ini - -cat > /usr/local/php/etc/php-fpm.conf <> /etc/sysctl.conf -sysctl -p -service redis-server start -cd .. -} - -function Install_Nginx() -{ -cd /root/lnmp/source -tar xzf pcre-8.33.tar.gz -cd pcre-8.33 -./configure -make && make install -cd ../ - -tar xzf nginx-1.4.2.tar.gz -cd nginx-1.4.2 - -# Modify Nginx version -sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@g' src/core/nginx.h -sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@g' src/core/nginx.h - -./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module -make && make install -cd /root/lnmp/conf -OS_CentOS='/bin/cp Nginx-init-CentOS /etc/init.d/nginx \n -chkconfig --add nginx \n -chkconfig nginx on' -OS_Ubuntu='/bin/cp Nginx-init-Ubuntu /etc/init.d/nginx \n -update-rc.d nginx defaults' -OS_command - -mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bk -sed -i "s@/home/wwwroot/default@$home_dir/default@" nginx.conf -/bin/cp nginx.conf /usr/local/nginx/conf/nginx.conf -# worker_cpu_affinity -Nginx_conf=/usr/local/nginx/conf/nginx.conf -CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` -if [ $CPU_num == 1 ];then - sed -i 's@^worker_processes.*@worker_processes 1;@' $Nginx_conf -elif [ $CPU_num == 2 ];then - sed -i 's@^worker_processes.*@worker_processes 2;\nworker_cpu_affinity 10 01;@' $Nginx_conf -elif [ $CPU_num == 3 ];then - sed -i 's@^worker_processes.*@worker_processes 3;\nworker_cpu_affinity 100 010 001;@' $Nginx_conf -elif [ $CPU_num == 4 ];then - sed -i 's@^worker_processes.*@worker_processes 4;\nworker_cpu_affinity 1000 0100 0010 0001;@' $Nginx_conf -elif [ $CPU_num == 6 ];then - sed -i 's@^worker_processes.*@worker_processes 6;\nworker_cpu_affinity 100000 010000 001000 000100 000010 000001;@' $Nginx_conf -elif [ $CPU_num == 8 ];then - sed -i 's@^worker_processes.*@worker_processes 8;\nworker_cpu_affinity 10000000 01000000 00100000 00010000 00001000 00000100 00000010 00000001;@' $Nginx_conf -else - echo Google worker_cpu_affinity +if [ ! -d "$php_install_dir" ];then + . functions/php.sh + Install_PHP 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi -# logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF -$wwwlogs_dir/*.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate - [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` -endscript -} -EOF -service nginx start -} - -function Install_Pureftp() -{ -cd /root/lnmp/source -tar xzf pure-ftpd-1.0.36.tar.gz -cd pure-ftpd-1.0.36 -[ $OS == 'Ubuntu' ] && ln -s $db_install_dir/lib/libmysqlclient.so /usr/lib -./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=$db_install_dir --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english -make && make install -if [ -d "/usr/local/pureftpd" ];then - echo -e "\033[32mPure-Ftp install successfully! \033[0m" -else - echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" - kill -9 $$ +if [ ! -d "$nginx_install_dir" ];then + . functions/nginx.sh + Install_Nginx 2>&1 | tee -a $lnmp_dir/lnmp_install.log + sed -i "s@/usr/local/nginx@$nginx_install_dir@g" vhost.sh + sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh + sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh fi -cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin -chmod +x /usr/local/pureftpd/sbin/pure-config.pl -cp contrib/redhat.init /etc/init.d/pureftpd -sed -i 's@fullpath=.*@fullpath=/usr/local/pureftpd/sbin/$prog@' /etc/init.d/pureftpd -sed -i 's@pureftpwho=.*@pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho@' /etc/init.d/pureftpd -sed -i 's@/etc/pure-ftpd.conf@/usr/local/pureftpd/pure-ftpd.conf@' /etc/init.d/pureftpd -chmod +x /etc/init.d/pureftpd -OS_CentOS='chkconfig --add pureftpd \n -chkconfig pureftpd on' -OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n -update-rc.d pureftpd defaults" -OS_command - -cd /root/lnmp/conf -/bin/cp pure-ftpd.conf /usr/local/pureftpd/ -/bin/cp pureftpd-mysql.conf /usr/local/pureftpd/ -mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' script.mysql -sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' script.mysql -service mysqld restart -$db_install_dir/bin/mysql -uroot -p$dbrootpwd < script.mysql -service pureftpd start - -tar xzf /root/lnmp/source/ftp_v2.1.tar.gz -sed -i 's/tmppasswd/'$mysqlftppwd'/' ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php -sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php -sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php -/bin/cp /root/lnmp/conf/chinese.php ftp/language/ -sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php -rm -rf ftp/install.php -mv ftp $home_dir/default -# iptables Ftp -iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT -iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT -OS_CentOS='service iptables save' -OS_Ubuntu='iptables-save > /etc/iptables.up.rules' -OS_command -} - -function Install_phpMyAdmin() -{ -cd $home_dir/default -tar xzf /root/lnmp/source/phpMyAdmin-4.0.5-all-languages.tar.gz -mv phpMyAdmin-4.0.5-all-languages phpMyAdmin -} - -function TEST() -{ -echo '' > $home_dir/default/phpinfo.php -cp /root/lnmp/conf/index.html $home_dir/default -unzip -q /root/lnmp/source/tz.zip -d $home_dir/default -chown -R www.www $home_dir/default -service mysqld restart -} - -Download_src 2>&1 | tee -a /root/lnmp/lnmp_install.log -chmod +x /root/lnmp/*.sh /root/lnmp/conf/*init* -sed -i "s@/home/wwwroot@$home_dir@g" /root/lnmp/vhost.sh -sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" /root/lnmp/vhost.sh - -OS_CentOS='/root/lnmp/conf/init_CentOS.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log \n -/bin/mv /root/lnmp/conf/init_CentOS.sh /root/lnmp/conf/init_CentOS.ed' -OS_Ubuntu='/root/lnmp/conf/init_Ubuntu.sh 2>&1 | tee -a /root/lnmp/lnmp_install.log \n -/bin/mv /root/lnmp/conf/init_Ubuntu.sh /root/lnmp/conf/init_Ubuntu.ed' -OS_command - -if [ "$choice_db" == 'mysql' ];then - db_install_dir=/usr/local/mysql - db_data_dir=/data/mysql - Install_MySQL 2>&1 | tee -a /root/lnmp/lnmp_install.log - service mysqld stop -fi -if [ "$choice_db" == 'mariadb' ];then - db_install_dir=/usr/local/mariadb - db_data_dir=/data/mariadb - Install_MariaDB 2>&1 | tee -a /root/lnmp/lnmp_install.log - service mysqld stop +if [ "$FTP_yn" == 'y' ];then + . functions/pureftpd.sh + Install_Pureftpd 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi -Install_PHP 2>&1 | tee -a /root/lnmp/lnmp_install.log -Install_Nginx 2>&1 | tee -a /root/lnmp/lnmp_install.log +if [ "$phpMyAdmin_yn" == 'y' ];then + . functions/phpmyadmin.sh + Install_phpMyAdmin 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi -[ "$choice_cache" == 'memcache' ] && Install_Memcache 2>&1 | tee -a /root/lnmp/lnmp_install.log -[ "$choice_cache" == 'redis' ] && Install_Redis 2>&1 | tee -a /root/lnmp/lnmp_install.log +if [ "$redis_yn" == 'y' ];then + . functions/redis.sh + Install_Redis 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi -[ "$FTP_yn" == 'y' ] && Install_Pureftp 2>&1 | tee -a /root/lnmp/lnmp_install.log +if [ "$memcache_yn" == 'y' ];then + . functions/memcache.sh + Install_Memcache 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi -[ "$phpMyAdmin_yn" == 'y' ] && Install_phpMyAdmin 2>&1 | tee -a /root/lnmp/lnmp_install.log +if [ ! -f "$home_dir/default/index.html" ];then + . functions/test.sh + TEST 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi -TEST 2>&1 | tee -a /root/lnmp/lnmp_install.log +if [ "$ngx_pagespeed_yn" == 'y' ];then + . functions/ngx_pagespeed.sh + Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi echo "################Congratulations####################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo '' echo "The path of some dirs:" -echo -e "`printf "%-32s" "Nginx dir":`\033[32m/usr/local/nginx\033[0m" +echo -e "`printf "%-32s" "Nginx dir":`\033[32m$nginx_install_dir\033[0m" +echo -e "`printf "%-32s" "PHP dir:"`\033[32m$php_install_dir\033[0m" echo -e "`printf "%-32s" "$Choice_DB dir:"`\033[32m$db_install_dir\033[0m" -echo -e "`printf "%-32s" "PHP dir:"`\033[32m/usr/local/php\033[0m" echo -e "`printf "%-32s" "$Choice_DB User:"`\033[32mroot\033[0m" echo -e "`printf "%-32s" "$Choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" -echo -e "`printf "%-32s" "install ngx_pagespeed module:"`\033[32m./install_ngx_pagespeed.sh\033[0m" diff --git a/options.conf b/options.conf new file mode 100644 index 00000000..86c5843d --- /dev/null +++ b/options.conf @@ -0,0 +1,38 @@ +# Run with DIR as the current working directory +lnmp_dir= + +# +nginx_install_dir=/usr/local/nginx + +mysql_install_dir=/usr/local/mysql +mariadb_install_dir=/usr/local/mariadb + +php_install_dir=/usr/local/php + +pureftpd_install_dir=/usr/local/pureftpd + +memcached_install_dir=/usr/local/memcached + +redis_install_dir=/usr/local/redis + +# +home_dir=/home/wwwroot +# Nginx Generate a log storage directory, you can customize +wwwlogs_dir=/home/wwwlogs + +# Database data storage directory, you can customize +mysql_data_dir=/data/mysql +mariadb_data_dir=/data/mariadb + +# +db_install_dir= +# +db_data_dir= + +# +dbrootpwd= +# +ftpmanagerpwd= + +# +conn_ftpusers_dbpwd= diff --git a/vhost.sh b/vhost.sh index fb1a5756..b7bfa1ab 100755 --- a/vhost.sh +++ b/vhost.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to create vhost" && exit 1 From 3ea17b46fcae11d838645cda1238e8f7b503e9f1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 24 Aug 2013 21:22:26 +0800 Subject: [PATCH 143/617] Modular script --- install_ngx_pagespeed.sh | 57 ---------------------------------------- 1 file changed, 57 deletions(-) delete mode 100755 install_ngx_pagespeed.sh diff --git a/install_ngx_pagespeed.sh b/install_ngx_pagespeed.sh deleted file mode 100755 index de9f2610..00000000 --- a/install_ngx_pagespeed.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# Author: yeho -# . -# Blog: http://blog.linuxeye.com -# -# Version: 0.2 21-Aug-2013 lj2007331 AT gmail.com -# Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ -# -# This script's project home is: -# https://github.com/lj2007331/lnmp - -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, Please use root to install ngx_pagespeed " && kill -9 $$ - -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" -echo "# For more information please visit http://blog.linuxeye.com/318.html #" -echo "#######################################################################" - -read -p "Do you want to install ngx_pagespeed? (y/n)" nps_yn -if [ $nps_yn == 'y' ];then -cd /root/lnmp/source -rm -rf release* ngx_pagespeed-release* -wget --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-1.6.29.5-beta.zip -unzip -q release-1.6.29.5-beta -wget https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz -tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta -cd nginx-1.4.2/ -make clean -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ;then -./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ ---add-module=../ngx_pagespeed-release-1.6.29.5-beta \ ---with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' -else -./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ ---add-module=../ngx_pagespeed-release-1.6.29.5-beta \ ---with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' -fi -make -if [ -f "objs/nginx" ];then - /bin/mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d) - /bin/cp objs/nginx /usr/local/nginx/sbin/nginx - kill -USR2 `cat /var/run/nginx.pid` - kill -QUIT `cat /var/run/nginx.pid.oldbin` - mkdir /var/ngx_pagespeed_cache - chown www.www /var/ngx_pagespeed_cache - /bin/cp /root/lnmp/vhost.sh /root/lnmp/vhost_ngx_pagespeed.sh - sed -i 's@root $vhostdir;@root $vhostdir;\n\tpagespeed on;\n\tpagespeed FileCachePath /var/ngx_pagespeed_cache;\n\tpagespeed RewriteLevel CoreFilters;\n\tpagespeed EnableFilters local_storage_cache;\n\tpagespeed EnableFilters collapse_whitespace,remove_comments;\n\tpagespeed EnableFilters outline_css;\n\tpagespeed EnableFilters flatten_css_imports;\n\tpagespeed EnableFilters move_css_above_scripts;\n\tpagespeed EnableFilters move_css_to_head;\n\tpagespeed EnableFilters outline_javascript;\n\tpagespeed EnableFilters combine_javascript;\n\tpagespeed EnableFilters combine_css;\n\tpagespeed EnableFilters rewrite_javascript;\n\tpagespeed EnableFilters rewrite_css,sprite_images;\n\tpagespeed EnableFilters rewrite_style_attributes;\n\tpagespeed EnableFilters recompress_images;\n\tpagespeed EnableFilters resize_images;\n\tpagespeed EnableFilters convert_meta_tags;\n\tlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\n\tlocation ~ "^/ngx_pagespeed_static/" { }\n\tlocation ~ "^/ngx_pagespeed_beacon$" { }\n\tlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\n\tlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }@' /root/lnmp/vhost_ngx_pagespeed.sh - echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" - echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[32m/root/lnmp/vhost.sh\033[0m" - echo -e "`printf "%-40s" "add ngx_pagespeed Virtual Hosts:"`\033[32m/root/lnmp/vhost_ngx_pagespeed.sh\033[0m" -else - echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[31minstall ngx_pagespeed failed\033[0m" -fi -fi From c9528e1c1d9e1ce4363c3fc419a20ac9bb0f44ad Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 25 Aug 2013 16:04:18 +0800 Subject: [PATCH 144/617] add php-5.4 php-5.3 --- functions/mariadb-5.5.sh | 131 ++++++++++++++++++++++ functions/memcache.sh | 1 + functions/mysql-5.5.sh | 126 ++++++++++++++++++++++ functions/mysql-5.6.sh | 127 ++++++++++++++++++++++ functions/ngx_pagespeed.sh | 2 +- functions/php-5.3.sh | 207 +++++++++++++++++++++++++++++++++++ functions/php-5.4.sh | 207 +++++++++++++++++++++++++++++++++++ functions/php-5.5.sh | 216 +++++++++++++++++++++++++++++++++++++ functions/redis.sh | 1 + lnmp_install.sh | 73 ++++++++++--- test.sh | 18 ++++ 11 files changed, 1091 insertions(+), 18 deletions(-) create mode 100755 functions/mariadb-5.5.sh create mode 100755 functions/mysql-5.5.sh create mode 100755 functions/mysql-5.6.sh create mode 100755 functions/php-5.3.sh create mode 100755 functions/php-5.4.sh create mode 100755 functions/php-5.5.sh create mode 100644 test.sh diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh new file mode 100755 index 00000000..887bb92e --- /dev/null +++ b/functions/mariadb-5.5.sh @@ -0,0 +1,131 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_MariaDB-5.5() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf mariadb-5.5.32.tar.gz +cd mariadb-5.5.32 +cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$mariadb_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_ARIA_STORAGE_ENGINE=1 \ +-DWITH_XTRADB_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DEXTRA_CHARSETS=all \ +-DWITH_BIG_TABLES=1 \ +-DWITH_DEBUG=0 +make && make install + +if [ -d "$mariadb_install_dir" ];then + echo -e "\033[32mMariaDB install successfully! \033[0m" +else + echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/my-small.cnf /etc/my.cnf +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $mariadb_install_dir +datadir = $mariadb_data_dir +pid-file = $mariadb_data_dir/mariadb.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $mariadb_data_dir/mariadb-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $mariadb_data_dir/mariadb-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir + +chown mysql.mysql -R $mariadb_data_dir +service mysqld start +export PATH=$PATH:$mariadb_install_dir/bin +echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile +. /etc/profile + +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +cd ../ +sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir$mariadb_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/memcache.sh b/functions/memcache.sh index df398829..5b156a4f 100755 --- a/functions/memcache.sh +++ b/functions/memcache.sh @@ -14,6 +14,7 @@ src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15. tar xzf memcache-2.2.7.tgz cd memcache-2.2.7 +make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh new file mode 100755 index 00000000..66eb9ceb --- /dev/null +++ b/functions/mysql-5.5.sh @@ -0,0 +1,126 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +Install_MySQL-5.5() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf mysql-5.5.33.tar.gz +cd mysql-5.5.33 +cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$mysql_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DEXTRA_CHARSETS=all \ +-DWITH_BIG_TABLES=1 \ +-DWITH_DEBUG=0 +make && make install + +if [ -d "$mysql_install_dir" ];then + echo -e "\033[32mMySQL install successfully! \033[0m" +else + echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $mysql_install_dir +datadir = $mysql_data_dir +pid-file = $mysql_data_dir/mysql.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $mysql_data_dir/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $mysql_data_dir/mysql-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + +chown mysql.mysql -R $mysql_data_dir +service mysqld start +export PATH=$PATH:$mysql_install_dir/bin +echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile +. /etc/profile + +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +cd ../ +sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh new file mode 100755 index 00000000..a90d9a45 --- /dev/null +++ b/functions/mysql-5.6.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_MySQL-5.6() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf mysql-5.6.13.tar.gz +cd mysql-5.6.13 +cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$mysql_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_USER=mysql \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DEXTRA_CHARSETS=all \ +-DWITH_BIG_TABLES=1 \ +-DWITH_DEBUG=0 +make && make install + +if [ -d "$mysql_install_dir" ];then + echo -e "\033[32mMySQL install successfully! \033[0m" +else + echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd .. + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $mysql_install_dir +datadir = $mysql_data_dir +pid-file = $mysql_data_dir/mysql.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $mysql_data_dir/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $mysql_data_dir/mysql-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + +chown mysql.mysql -R $mysql_data_dir +service mysqld start +export PATH=$PATH:$mysql_install_dir/bin +echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile +. /etc/profile + +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +cd ../ +sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 07581fcc..a0b901cf 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src rm -rf release* ngx_pagespeed-release* src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz && Download_src -wget -c --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-1.6.29.5-beta.zip +[ -s "release-1.6.29.5-beta" ] && echo "release-1.6.29.5-beta found" || wget -c --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-1.6.29.5-beta.zip unzip -q release-1.6.29.5-beta tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh new file mode 100755 index 00000000..c7470211 --- /dev/null +++ b/functions/php-5.3.sh @@ -0,0 +1,207 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_PHP-5.3() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.3.27.tar.gz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.6-8.tar.gz +cd ImageMagick-6.8.6-8 +./configure +make && make install +cd ../ + +# linked library +cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < $php_install_dir/etc/php-fpm.conf < +# Blog: http://blog.linuxeye.com + +Install_PHP-5.4() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.4.19.tar.gz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.6-8.tar.gz +cd ImageMagick-6.8.6-8 +./configure +make && make install +cd ../ + +# linked library +cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < $php_install_dir/etc/php-fpm.conf < +# Blog: http://blog.linuxeye.com + +Install_PHP-5.5() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +make && make install +cd ../ + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ + +tar xzf ImageMagick-6.8.6-8.tar.gz +cd ImageMagick-6.8.6-8 +./configure +make && make install +cd ../ + +# linked library +cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < $php_install_dir/etc/php-fpm.conf <= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31m$Choice_DB root password least 5 characters! \033[0m" + read -p "Please input database root password:" dbrootpwd + (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" done break fi done fi +# check PHP +if [ ! -d "$php_install_dir" ];then + while : + do + echo -e "\t\033[32m1\033[0m. Install php-5.5" + echo -e "\t\033[32m1\033[0m. Install php-5.4" + echo -e "\t\033[32m1\033[0m. Install php-5.3" + read -p "Please input a number:(Default 1 press Enter) " PHP_version + [ -z "$PHP_version" ] && PHP_version=1 + if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then + echo -e "\033[31minput error! Please input 1 2 3 \033[0m" + else + break + fi + done +fi + # check Pureftpd if [ ! -d "$pureftpd_install_dir" ];then while : @@ -129,26 +148,46 @@ OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' OS_command -if [ "$choice_db" == 'mysql' ];then +# Database +if [ $DB_version == 1 ];then cd $lnmp_dir - . functions/mysql.sh - Install_MySQL 2>&1 | tee -a $lnmp_dir/lnmp_install.log + . functions/mysql-5.6.sh + Install_MySQL-5.6 2>&1 | tee -a $lnmp_dir/lnmp_install.log db_install_dir=$mysql_install_dir sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf -fi -if [ "$choice_db" == 'mariadb' ];then +elif [ $DB_version == 2 ];then + cd $lnmp_dir + . functions/mysql-5.5.sh + Install_MySQL-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log + db_install_dir=$mysql_install_dir + sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf + sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf +elif [ $DB_version == 3 ];then cd $lnmp_dir - . functions/mariadb.sh - Install_MariaDB 2>&1 | tee -a $lnmp_dir/lnmp_install.log + . functions/mariadb-5.5.sh + Install_MariaDB-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log db_install_dir=$mariadb_install_dir sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf +else + echo -e "\033[31mdatabase install failed, Please contact the author! \033[0m" + kill -9 $$ fi -if [ ! -d "$php_install_dir" ];then - . functions/php.sh - Install_PHP 2>&1 | tee -a $lnmp_dir/lnmp_install.log +# PHP +if [ $PHP_version == 1 ];then + . functions/php-5.5.sh + Install_PHP-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log +elif [ $PHP_version == 2 ];then + . functions/php-5.4.sh + Install_PHP-5.4 2>&1 | tee -a $lnmp_dir/lnmp_install.log +elif [ $PHP_version == 3 ];then + . functions/php-5.3.sh + Install_PHP-5.3 2>&1 | tee -a $lnmp_dir/lnmp_install.log +else + echo -e "\033[31mPHP install failed, Please contact the author! \033[0m" + kill -9 $$ fi if [ ! -d "$nginx_install_dir" ];then diff --git a/test.sh b/test.sh new file mode 100644 index 00000000..b77839c3 --- /dev/null +++ b/test.sh @@ -0,0 +1,18 @@ +#!/bin/bash +. ./options.conf +if [ ! -d "$php_install_dir" ];then + while : + do + echo -e "\t\033[32m1\033[0m. Install php-5.5" + echo -e "\t\033[32m1\033[0m. Install php-5.4" + echo -e "\t\033[32m1\033[0m. Install php-5.3" + read -p "Please input a number:(Default 1) " PHP_version + [ -z "$PHP_version" ] && PHP_version=1 + if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then + echo -e "\033[31minput error! Please input 1 2 3 \033[0m" + else + break + fi + done +fi +echo $PHP_version From b075f6fa3e954c6138907e0524095c146934ea3e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 25 Aug 2013 16:08:02 +0800 Subject: [PATCH 145/617] add php-5.5 php-5.4 --- functions/mariadb.sh | 131 -------------------------- functions/mysql.sh | 128 -------------------------- functions/php.sh | 214 ------------------------------------------- 3 files changed, 473 deletions(-) delete mode 100755 functions/mariadb.sh delete mode 100755 functions/mysql.sh delete mode 100755 functions/php.sh diff --git a/functions/mariadb.sh b/functions/mariadb.sh deleted file mode 100755 index a3222aba..00000000 --- a/functions/mariadb.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -Install_MariaDB() -{ -cd $lnmp_dir/src -. ../functions/download.sh -. ../functions/check_os.sh -. ../options.conf - -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz && Download_src - -useradd -M -s /sbin/nologin mysql -mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 -./configure -make && make install -cd .. -tar zxf mariadb-5.5.32.tar.gz -cd mariadb-5.5.32 -cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=$mariadb_data_dir \ --DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ --DMYSQL_TCP_PORT=3306 \ --DWITH_ARIA_STORAGE_ENGINE=1 \ --DWITH_XTRADB_STORAGE_ENGINE=1 \ --DWITH_ARCHIVE_STORAGE_ENGINE=1 \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DWITH_PARTITION_STORAGE_ENGINE=1 \ --DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ --DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 -make && make install - -if [ -d "$mariadb_install_dir" ];then - echo -e "\033[32mMariaDB install successfully! \033[0m" -else - echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -/bin/cp support-files/my-small.cnf /etc/my.cnf -/bin/cp support-files/mysql.server /etc/init.d/mysqld -chmod +x /etc/init.d/mysqld -OS_CentOS='chkconfig --add mysqld \n -chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' -OS_command -cd .. - -# my.cf -cat > /etc/my.cnf << EOF -[mysqld] -basedir = $mariadb_install_dir -datadir = $mariadb_data_dir -pid-file = $mariadb_data_dir/mariadb.pid -character-set-server = utf8 -collation-server = utf8_general_ci -user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 -bind-address = 0.0.0.0 - -# name-resolve -skip-name-resolve -skip-host-cache - -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 - -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M - -# LOG -log_error = $mariadb_data_dir/mariadb-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = $mariadb_data_dir/mariadb-slow.log - -# Oher -#max_connections = 1000 -open_files_limit = 65535 - -[client] -port = 3306 -EOF - -$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir - -chown mysql.mysql -R $mariadb_data_dir -service mysqld start -export PATH=$PATH:$mariadb_install_dir/bin -echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile -. /etc/profile - -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -cd ../ -sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf -sed -i "s@^db_data_dir.*@db_data_dir$mariadb_data_dir@" options.conf -service mysqld stop -} diff --git a/functions/mysql.sh b/functions/mysql.sh deleted file mode 100755 index 91b416de..00000000 --- a/functions/mysql.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -Install_MySQL() -{ -cd $lnmp_dir/src -. ../functions/download.sh -. ../functions/check_os.sh -. ../options.conf - -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz && Download_src - -useradd -M -s /sbin/nologin mysql -mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 -./configure -make && make install -cd .. -tar zxf mysql-5.6.13.tar.gz -cd mysql-5.6.13 -cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ --DMYSQL_DATADIR=$mysql_data_dir \ --DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ --DMYSQL_TCP_PORT=3306 \ --DWITH_INNOBASE_STORAGE_ENGINE=1 \ --DWITH_PARTITION_STORAGE_ENGINE=1 \ --DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ --DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8 \ --DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 -make && make install - -if [ -d "$mysql_install_dir" ];then - echo -e "\033[32mMySQL install successfully! \033[0m" -else - echo -e "\033[31mMySQL install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -/bin/cp support-files/mysql.server /etc/init.d/mysqld -chmod +x /etc/init.d/mysqld -OS_CentOS='chkconfig --add mysqld \n -chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' -OS_command -cd .. - -# my.cf -cat > /etc/my.cnf << EOF -[mysqld] -basedir = $mysql_install_dir -datadir = $mysql_data_dir -pid-file = $mysql_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci -user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 -bind-address = 0.0.0.0 - -# name-resolve -skip-name-resolve -skip-host-cache - -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 - -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M - -# LOG -log_error = $mysql_data_dir/mysql-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = $mysql_data_dir/mysql-slow.log - -# Oher -#max_connections = 1000 -open_files_limit = 65535 -explicit_defaults_for_timestamp = true - -[client] -port = 3306 -EOF - -$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - -chown mysql.mysql -R $mysql_data_dir -service mysqld start -export PATH=$PATH:$mysql_install_dir/bin -echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile -. /etc/profile - -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -cd ../ -sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf -sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf -service mysqld stop -} diff --git a/functions/php.sh b/functions/php.sh deleted file mode 100755 index e2db97e0..00000000 --- a/functions/php.sh +++ /dev/null @@ -1,214 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -Install_PHP() -{ -cd $lnmp_dir/src -. ../functions/download.sh -. ../functions/check_os.sh -. ../options.conf - -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src - -tar xzf libiconv-1.14.tar.gz -cd libiconv-1.14 -./configure --prefix=/usr/local -make && make install -cd ../ - -tar xzf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8 -./configure -make && make install -ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -tar xzf mhash-0.9.9.9.tar.gz -cd mhash-0.9.9.9 -./configure -make && make install -cd ../ - -tar xzf ImageMagick-6.8.6-8.tar.gz -cd ImageMagick-6.8.6-8 -./configure -make && make install -cd ../ - -# linked library -cat >> /etc/ld.so.conf.d/local.conf <> /etc/ld.so.conf.d/mysql.conf < $php_install_dir/etc/php-fpm.conf < Date: Sun, 25 Aug 2013 16:14:32 +0800 Subject: [PATCH 146/617] update --- lnmp_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index cab1c2ff..47ad6b1e 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -33,6 +33,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} if [ ! -d "$db_install_dir" ];then while : do + echo 'Please select the database version:' echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" @@ -55,9 +56,10 @@ fi if [ ! -d "$php_install_dir" ];then while : do + echo 'Please select the php version:' echo -e "\t\033[32m1\033[0m. Install php-5.5" - echo -e "\t\033[32m1\033[0m. Install php-5.4" - echo -e "\t\033[32m1\033[0m. Install php-5.3" + echo -e "\t\033[32m2\033[0m. Install php-5.4" + echo -e "\t\033[32m3\033[0m. Install php-5.3" read -p "Please input a number:(Default 1 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then From 7ac0f70198983ea18ff4df5d116ce1227320edab Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 25 Aug 2013 17:40:01 +0800 Subject: [PATCH 147/617] update --- init/init_Ubuntu.sh | 8 -------- lnmp_install.sh | 2 ++ test.sh | 18 ------------------ 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 test.sh diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index b0a2d24c..65ec908e 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -4,14 +4,6 @@ apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-b dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y upgrade -cat > /etc/ldap.conf << EOF -base dc=example,dc=net -uri ldapi:/// -ldap_version 3 -rootbinddn cn=manager,dc=example,dc=net -pam_password md5 -EOF - # Install needed packages apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev vim zip unzip tmux htop wget diff --git a/lnmp_install.sh b/lnmp_install.sh index 47ad6b1e..31a45d92 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -38,6 +38,7 @@ if [ ! -d "$db_install_dir" ];then echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" read -p "Please input a number:(Default 1 press Enter) " DB_version + echo '' [ -z "$DB_version" ] && DB_version=1 if [ $DB_version != 1 ] && [ $DB_version != 2 ] && [ $DB_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" @@ -61,6 +62,7 @@ if [ ! -d "$php_install_dir" ];then echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.3" read -p "Please input a number:(Default 1 press Enter) " PHP_version + echo '' [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" diff --git a/test.sh b/test.sh deleted file mode 100644 index b77839c3..00000000 --- a/test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -. ./options.conf -if [ ! -d "$php_install_dir" ];then - while : - do - echo -e "\t\033[32m1\033[0m. Install php-5.5" - echo -e "\t\033[32m1\033[0m. Install php-5.4" - echo -e "\t\033[32m1\033[0m. Install php-5.3" - read -p "Please input a number:(Default 1) " PHP_version - [ -z "$PHP_version" ] && PHP_version=1 - if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then - echo -e "\033[31minput error! Please input 1 2 3 \033[0m" - else - break - fi - done -fi -echo $PHP_version From f2473b15ec352c7a33b53697e8efe6b6568dc311 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 09:42:04 +0800 Subject: [PATCH 148/617] update --- functions/eaccelerator.sh | 13 +++++++++++++ options.conf | 9 ++++----- 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 functions/eaccelerator.sh diff --git a/functions/eaccelerator.sh b/functions/eaccelerator.sh new file mode 100644 index 00000000..7f945e2c --- /dev/null +++ b/functions/eaccelerator.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Redis() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 && Download_src +} diff --git a/options.conf b/options.conf index 86c5843d..a2384cc0 100644 --- a/options.conf +++ b/options.conf @@ -15,15 +15,14 @@ memcached_install_dir=/usr/local/memcached redis_install_dir=/usr/local/redis -# -home_dir=/home/wwwroot -# Nginx Generate a log storage directory, you can customize -wwwlogs_dir=/home/wwwlogs - # Database data storage directory, you can customize mysql_data_dir=/data/mysql mariadb_data_dir=/data/mariadb +# +home_dir=/home/wwwroot +# Nginx Generate a log storage directory, you can customize +wwwlogs_dir=/home/wwwlogs # db_install_dir= # From 8899975590a6f67b24cd311310fab07003e61638 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 23:07:54 +0800 Subject: [PATCH 149/617] update redis and imagemagick --- README.md | 27 +++++++++-------- functions/eaccelerator.sh | 33 ++++++++++++++++++++- functions/memcached.sh | 60 ++++++++++++++++++++++++++++++++++++++ functions/ngx_pagespeed.sh | 7 ++--- functions/php-5.3.sh | 6 ++-- functions/php-5.4.sh | 6 ++-- functions/php-5.5.sh | 6 ++-- functions/redis.sh | 6 ++-- init/init_Ubuntu.sh | 2 +- lnmp_install.sh | 48 +++++++++++++++++++++--------- options.conf | 22 ++++++++++---- vhost.sh | 21 +++++++++++++ 12 files changed, 194 insertions(+), 50 deletions(-) mode change 100644 => 100755 functions/eaccelerator.sh create mode 100755 functions/memcached.sh diff --git a/README.md b/README.md index c84bd44d..3def9761 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,30 @@ -## Introduction + This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat and Ubuntu. - `Linux`+`Nginx`+`MySQL` (Can Choose to install `MariaDB`)+`PHP` (Can Choose whether to install `Pureftpd`+`User manager for PureFTPd`+`phpMyAdmin`), Can choose to install ngx_pagespeed after installing lnmp, Installing the module execute scripts `/root/lnmp/install_ngx_pagespeed.sh`. Add a virtual host with ngx_pagespeed module, Please use the script `/root/lnmp/vhost_ngx_pagespeed.sh` (Must be installed ngx_pagespeed module). Do not ngx_pagespeed module, can run the script `/root/lnmp/vhost.sh` Add a virtual host.
- The script is the new software package using stable version, Fixes some security issues, (Before installation will be performed, Initialize security script) For CentOS/RadHat >=5 or Ubuntu >=12 .
- - Features include: + Script features: - Constant updates -- Source compiler, Almost all of source packages is the latest stable version and downloaded from the official website +- Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues -- Choose to install MySQL or MariaDB database -- Choose whether to install Pureftpd, phpMyAdmin -- Choose whether to install memcache or redis -- Support ngx_pagespeed module (after installing lnmp) +- You can freely choose to install MySQL database (MySQL-5.5, MySQL-5.6) or MariaDB (MariaDB-5.5) +- You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) +- According to their needs can choose to install Pureftpd, phpMyAdmin +- According to their needs can choose to install memcached, redis +- According to their needs can choose to install ngx_pagespeed +- According to their needs can choose to install eAccelerator (php-5.4, php-5.3) - Add a virtual host script provided ## How to use ```bash - # Please ensure that the downloaded script in the root directory. - yum -y install wget screen + yum -y install wget screen # for CentOS/Redhat + #apt-get -y install wget screen # for Ubuntu wget http://blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz + #or wget http://blog.linuxeye.com/wp-content/uploads/lnmp-full.tar.gz # include source packages tar xzf lnmp.tar.gz cd lnmp chmod +x lnmp_install.sh # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. + # Если сеть не работает, вы можете выполнять команды `srceen -r lnmp` сети подключить установку окна. + # 如果网路出现中断,可以执行命令`srceen -r lnmp`重新连接安装窗口 screen -S lnmp ./lnmp_install.sh ``` @@ -38,3 +40,4 @@ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) + provided support:[nightgod](http://odvps.ml) diff --git a/functions/eaccelerator.sh b/functions/eaccelerator.sh old mode 100644 new mode 100755 index 7f945e2c..cfaf1835 --- a/functions/eaccelerator.sh +++ b/functions/eaccelerator.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_Redis() +Install_eAccelerator() { cd $lnmp_dir/src . ../functions/download.sh @@ -10,4 +10,35 @@ cd $lnmp_dir/src . ../options.conf src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 && Download_src +tar jxf eaccelerator-0.9.6.1.tar.bz2 +cd eaccelerator-0.9.6.1 +make clean +$php_install_dir/bin/phpize +./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config +make && make install +cd ../ + +mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache +cat >> $php_install_dir/etc/php.ini << EOF +[eaccelerator] +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" +eaccelerator.shm_size="64" +eaccelerator.cache_dir="/var/eaccelerator_cache" +eaccelerator.enable="1" +eaccelerator.optimizer="1" +eaccelerator.check_mtime="1" +eaccelerator.debug="0" +eaccelerator.filter="" +eaccelerator.shm_max="0" +eaccelerator.shm_ttl="0" +eaccelerator.shm_prune_period="0" +eaccelerator.shm_only="0" +eaccelerator.compress="0" +eaccelerator.compress_level="9" +eaccelerator.keys = "disk_only" +eaccelerator.sessions = "disk_only" +eaccelerator.content = "disk_only" +EOF + +service php-fpm restart } diff --git a/functions/memcached.sh b/functions/memcached.sh new file mode 100755 index 00000000..18061fe3 --- /dev/null +++ b/functions/memcached.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_memcached() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz && Download_src +src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src +src_url=http://pecl.php.net/get/memcached-2.1.0.tgz && Download_src + +# memcached server +useradd -M -s /sbin/nologin memcached +tar xzf memcached-1.4.15.tar.gz +cd memcached-1.4.15 +./configure --prefix=$memcached_install_dir +make && make install +cd ../ +if [ -d "$memcached_install_dir" ];then + echo -e "\033[32mmemcached install successfully! \033[0m" +else + echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached +OS_CentOS='/bin/cp init/Memcached-init-CentOS /etc/init.d/memcached \n +chkconfig --add memcached \n +chkconfig memcached on' +OS_Ubuntu='/bin/cp init/Memcached-init-Ubuntu /etc/init.d/memcached \n +update-rc.d memcached defaults' +OS_command +sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached +service memcached start + +# php memcached extension +tar xzf libmemcached-1.0.16.tar.gz +cd libmemcached-1.0.16 +./configure --with-memcached=$memcached_install_dir +make && make install +cd .. + +tar xzf memcached-2.1.0.tgz +cd memcached-2.1.0 +make clean +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini +else + echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" +fi +service php-fpm restart +cd ../ +} diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index a0b901cf..46f6228e 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -32,13 +32,10 @@ if [ -f "objs/nginx" ];then kill -USR2 `cat /var/run/nginx.pid` kill -QUIT `cat /var/run/nginx.pid.oldbin` mkdir /var/ngx_pagespeed_cache - chown www.www /var/ngx_pagespeed_cache - /bin/cp $lnmp_dir/vhost.sh $lnmp_dir/vhost_ngx_pagespeed.sh - sed -i 's@root $vhostdir;@root $vhostdir;\n\tpagespeed on;\n\tpagespeed FileCachePath /var/ngx_pagespeed_cache;\n\tpagespeed RewriteLevel CoreFilters;\n\tpagespeed EnableFilters local_storage_cache;\n\tpagespeed EnableFilters collapse_whitespace,remove_comments;\n\tpagespeed EnableFilters outline_css;\n\tpagespeed EnableFilters flatten_css_imports;\n\tpagespeed EnableFilters move_css_above_scripts;\n\tpagespeed EnableFilters move_css_to_head;\n\tpagespeed EnableFilters outline_javascript;\n\tpagespeed EnableFilters combine_javascript;\n\tpagespeed EnableFilters combine_css;\n\tpagespeed EnableFilters rewrite_javascript;\n\tpagespeed EnableFilters rewrite_css,sprite_images;\n\tpagespeed EnableFilters rewrite_style_attributes;\n\tpagespeed EnableFilters recompress_images;\n\tpagespeed EnableFilters resize_images;\n\tpagespeed EnableFilters convert_meta_tags;\n\tlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\n\tlocation ~ "^/ngx_pagespeed_static/" { }\n\tlocation ~ "^/ngx_pagespeed_beacon$" { }\n\tlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\n\tlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }@' $lnmp_dir/vhost_ngx_pagespeed.sh + chown -R www.www /var/ngx_pagespeed_cache echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" - echo -e "`printf "%-40s" "add ngx_pagespeed Virtual Hosts:"`\033[32m$lnmp_dir/vhost_ngx_pagespeed.sh\033[0m" else - echo -e "`printf "%-40s" "add Virtual Hosts:"`\033[31minstall ngx_pagespeed failed\033[0m" + echo -e "\033[31minstall ngx_pagespeed failed\033[0m" kill -9 $$ fi } diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index c7470211..d9253e1a 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.3.27.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src @@ -40,8 +40,8 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-8.tar.gz -cd ImageMagick-6.8.6-8 +tar xzf ImageMagick-6.8.6-9.tar.gz +cd ImageMagick-6.8.6-9 ./configure make && make install cd ../ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 12abcdc5..398fcb62 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.4.19.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src @@ -40,8 +40,8 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-8.tar.gz -cd ImageMagick-6.8.6-8 +tar xzf ImageMagick-6.8.6-9.tar.gz +cd ImageMagick-6.8.6-9 ./configure make && make install cd ../ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index f7ef8cdc..5efc5003 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-8.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src @@ -40,8 +40,8 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-8.tar.gz -cd ImageMagick-6.8.6-8 +tar xzf ImageMagick-6.8.6-9.tar.gz +cd ImageMagick-6.8.6-9 ./configure make && make install cd ../ diff --git a/functions/redis.sh b/functions/redis.sh index b37606e5..8c1e73b2 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.3.tgz && Download_src -src_url=http://redis.googlecode.com/files/redis-2.6.14.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.6.15.tar.gz && Download_src tar xzf redis-2.2.3.tgz cd redis-2.2.3 @@ -26,8 +26,8 @@ fi service php-fpm restart cd .. -tar xzf redis-2.6.14.tar.gz -cd redis-2.6.14 +tar xzf redis-2.6.15.tar.gz +cd redis-2.6.15 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 65ec908e..700dea66 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -5,7 +5,7 @@ dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common l apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev libcloog-ppl0 vim zip unzip tmux htop wget # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts diff --git a/lnmp_install.sh b/lnmp_install.sh index 31a45d92..722fe9eb 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -33,12 +33,12 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} if [ ! -d "$db_install_dir" ];then while : do - echo 'Please select the database version:' + echo 'Please select the database version:' echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" read -p "Please input a number:(Default 1 press Enter) " DB_version - echo '' + echo '' [ -z "$DB_version" ] && DB_version=1 if [ $DB_version != 1 ] && [ $DB_version != 2 ] && [ $DB_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" @@ -54,19 +54,30 @@ if [ ! -d "$db_install_dir" ];then fi # check PHP -if [ ! -d "$php_install_dir" ];then +if [ ! -d "$php_insall_dir" ];then while : do - echo 'Please select the php version:' + echo 'Please select the php version:' echo -e "\t\033[32m1\033[0m. Install php-5.5" echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.3" read -p "Please input a number:(Default 1 press Enter) " PHP_version - echo '' + echo '' [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" else + if [ $PHP_version != 1 ];then + while : + do + read -p "Do you want to install php eAccelerator module? (y/n)" eAccelerator_yn + if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi + done + fi break fi done @@ -80,11 +91,17 @@ do if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else - if [ "$FTP_yn" == 'y' ];then + + if [ "$FTP_yn" == 'y' ];then while : do read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd - (( ${#ftpmanagerpwd} >= 5 )) && sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf && break || echo -e "\033[31mFtp manager password least 5 characters! \033[0m" + if (( ${#ftpmanagerpwd} >= 5 ));then + sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf + break + else + echo -e "\033[31mFtp manager password least 5 characters! \033[0m" + fi done fi break @@ -118,12 +135,12 @@ if [ ! -d "$redis_install_dir" ];then done fi -# check memcache +# check memcached if [ ! -d "$memcached_install_dir" ];then while : do - read -p "Do you want to install Memcache? (y/n)" memcache_yn - if [ "$memcache_yn" != 'y' ] && [ "$memcache_yn" != 'n' ];then + read -p "Do you want to install memcached? (y/n)" memcached_yn + if [ "$memcached_yn" != 'y' ] && [ "$memcached_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else break @@ -194,6 +211,11 @@ else kill -9 $$ fi +if [ "$eAccelerator_yn" ];then + . functions/eaccelerator.sh + Install_eAccelerator 2>&1 | tee -a $lnmp_dir/lnmp_install.log +fi + if [ ! -d "$nginx_install_dir" ];then . functions/nginx.sh Install_Nginx 2>&1 | tee -a $lnmp_dir/lnmp_install.log @@ -217,9 +239,9 @@ if [ "$redis_yn" == 'y' ];then Install_Redis 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi -if [ "$memcache_yn" == 'y' ];then - . functions/memcache.sh - Install_Memcache 2>&1 | tee -a $lnmp_dir/lnmp_install.log +if [ "$memcached_yn" == 'y' ];then + . functions/memcached.sh + Install_memcached 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ ! -f "$home_dir/default/index.html" ];then diff --git a/options.conf b/options.conf index a2384cc0..cf840695 100644 --- a/options.conf +++ b/options.conf @@ -1,7 +1,9 @@ -# Run with DIR as the current working directory +# Operating environment for the current working directory +# Операционная среда для, текущий рабочий каталог +# 运行环境为当前的工作目录 lnmp_dir= -# +# install directory nginx_install_dir=/usr/local/nginx mysql_install_dir=/usr/local/mysql @@ -15,20 +17,28 @@ memcached_install_dir=/usr/local/memcached redis_install_dir=/usr/local/redis -# Database data storage directory, you can customize +# Database data storage directory,You can freely specify +# База данных для хранения данных каталога, вы можете свободно указать +# 数据库数据存储目录,你可以自由指定 mysql_data_dir=/data/mysql mariadb_data_dir=/data/mariadb -# +# Web directory, you can customize,Which default directory to store ftp.(User_manager_for-PureFTPd Proposal to modify the name for security) +# Веб-каталог, вы можете настроить, какой по умолчанию каталог для хранения FTP. (User_manager_for-PureFTPd предложение об изменении названия для безопасности) +# 网站目录可以自行定义,其中default 目录存放ftp (User_manager_for-PureFTPd 建议修改名称为了安全) home_dir=/home/wwwroot -# Nginx Generate a log storage directory, you can customize + +# Nginx Generate a log storage directory, you can freely specify. +# Nginx создать каталог для хранения журнала, вы можете свободно указать +# Nginx生成日志存放目录,你可以自由指定 wwwlogs_dir=/home/wwwlogs + # db_install_dir= # db_data_dir= -# +# database password dbrootpwd= # ftpmanagerpwd= diff --git a/vhost.sh b/vhost.sh index b7bfa1ab..424efe2f 100755 --- a/vhost.sh +++ b/vhost.sh @@ -56,6 +56,26 @@ if [ "$moredomainame_yn" == 'y' ]; then done fi +# check ngx_pagespeed and add ngx_pagespeed +script -c "/usr/local/nginx/sbin/nginx -V" -f /tmp/typescript > /dev/null 2>&1 +if [ ! -z "`cat /tmp/typescript | grep ngx_pagespeed`" ];then + rm -rf /tmp/typescript + while : + do + read -p "Do you want to use ngx_pagespeed module? (y/n)" ngx_pagespeed_yn + if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then + echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + else + if [ "$ngx_pagespeed_yn" == 'y' ];then + ngx_pagespeed='pagespeed on;\npagespeed FileCachePath /var/ngx_pagespeed_cache;\npagespeed RewriteLevel CoreFilters;\npagespeed EnableFilters local_storage_cache;\npagespeed EnableFilters collapse_whitespace,remove_comments;\npagespeed EnableFilters outline_css;\npagespeed EnableFilters flatten_css_imports;\npagespeed EnableFilters move_css_above_scripts;\npagespeed EnableFilters move_css_to_head;\npagespeed EnableFilters outline_javascript;\npagespeed EnableFilters combine_javascript;\npagespeed EnableFilters combine_css;\npagespeed EnableFilters rewrite_javascript;\npagespeed EnableFilters rewrite_css,sprite_images;\npagespeed EnableFilters rewrite_style_attributes;\npagespeed EnableFilters recompress_images;\npagespeed EnableFilters resize_images;\npagespeed EnableFilters convert_meta_tags;\nlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\nlocation ~ "^/ngx_pagespeed_static/" { }\nlocation ~ "^/ngx_pagespeed_beacon$" { }\nlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\nlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }' + else + ngx_pagespeed= + fi + break + fi + done +fi + while : do read -p "Do you want to add hotlink protection? (y/n)" anti_hotlinking_yn @@ -161,6 +181,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ return 404; } $anti_hotlinking +`echo -e $ngx_pagespeed` location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; From 7c13ba170e2ffdd8e9b041b6c7396e8cfd2ebd26 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 23:08:31 +0800 Subject: [PATCH 150/617] update redis and imagemagick --- functions/memcache.sh | 51 ------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100755 functions/memcache.sh diff --git a/functions/memcache.sh b/functions/memcache.sh deleted file mode 100755 index 5b156a4f..00000000 --- a/functions/memcache.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -Install_Memcache() -{ -cd $lnmp_dir/src -. ../functions/download.sh -. ../functions/check_os.sh -. ../options.conf - -src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src -src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz && Download_src - -tar xzf memcache-2.2.7.tgz -cd memcache-2.2.7 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini -else - echo -e "\033[31mPHP Memcache module install failed, Please contact the author! \033[0m" -fi -service php-fpm restart -cd ../ - -useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.15.tar.gz -cd memcached-1.4.15 -./configure --prefix=$memcached_install_dir -make && make install -cd ../../ -if [ -d "$memcached_install_dir" ];then - echo -e "\033[32mmemcached install successfully! \033[0m" -else - echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached -OS_CentOS='/bin/cp init/Memcached-init-CentOS /etc/init.d/memcached \n -chkconfig --add memcached \n -chkconfig memcached on' -OS_Ubuntu='/bin/cp init/Memcached-init-Ubuntu /etc/init.d/memcached \n -update-rc.d memcached defaults' -OS_command -sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached -service memcached start -} From c085d97a22adb73b9f38df100fa3d121c585caea Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 23:27:14 +0800 Subject: [PATCH 151/617] error --- functions/memcached.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 18061fe3..e3500854 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -28,10 +28,10 @@ else fi ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached -OS_CentOS='/bin/cp init/Memcached-init-CentOS /etc/init.d/memcached \n +OS_CentOS='/bin/cp ../init/Memcached-init-CentOS /etc/init.d/memcached \n chkconfig --add memcached \n chkconfig memcached on' -OS_Ubuntu='/bin/cp init/Memcached-init-Ubuntu /etc/init.d/memcached \n +OS_Ubuntu='/bin/cp ../init/Memcached-init-Ubuntu /etc/init.d/memcached \n update-rc.d memcached defaults' OS_command sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached From 403eedc9f33bc90a744773c83c8cd9211dfa7de5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 23:30:27 +0800 Subject: [PATCH 152/617] error: tr1/cinttypes: No such file or directory --- functions/memcached.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/memcached.sh b/functions/memcached.sh index e3500854..9d9a5f05 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -40,6 +40,7 @@ service memcached start # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 +yum -y install gcc44 ./configure --with-memcached=$memcached_install_dir make && make install cd .. From 6fd514ee4e719bfc4077fe44d28880248bde6e2a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 26 Aug 2013 23:41:42 +0800 Subject: [PATCH 153/617] tr1/cinttypes: No such file or directory --- functions/memcached.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 9d9a5f05..d1f05645 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -40,7 +40,10 @@ service memcached start # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 -yum -y install gcc44 +OS_CentOS='yum -y install gcc44 gcc44-c++ libstdc++44-devel \n +export CC=/usr/bin/gcc44 \n +export CXX=/usr/bin/g++44' +OS_command ./configure --with-memcached=$memcached_install_dir make && make install cd .. From f896411ec338127e147f2c4b43b72f61941adb9e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 27 Aug 2013 11:34:16 +0800 Subject: [PATCH 154/617] php-5.4 and eaccelerator error --- README.md | 2 +- .../{eaccelerator.sh => eaccelerator-0.9.sh} | 3 +- functions/eaccelerator-1.0-dev.sh | 44 ++++++++++++++++++ functions/memcached.sh | 8 ++-- functions/nginx.sh | 1 + lnmp_install.sh | 45 ++++++++++++------- vhost.sh | 7 ++- 7 files changed, 85 insertions(+), 25 deletions(-) rename functions/{eaccelerator.sh => eaccelerator-0.9.sh} (96%) create mode 100755 functions/eaccelerator-1.0-dev.sh diff --git a/README.md b/README.md index 3def9761..6840a4f8 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,4 @@ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) - provided support:[nightgod](http://odvps.ml) + [nightgod](http://odvps.ml) diff --git a/functions/eaccelerator.sh b/functions/eaccelerator-0.9.sh similarity index 96% rename from functions/eaccelerator.sh rename to functions/eaccelerator-0.9.sh index cfaf1835..0e25b566 100755 --- a/functions/eaccelerator.sh +++ b/functions/eaccelerator-0.9.sh @@ -2,11 +2,10 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_eAccelerator() +Install_eAccelerator-0.9() { cd $lnmp_dir/src . ../functions/download.sh -. ../functions/check_os.sh . ../options.conf src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 && Download_src diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh new file mode 100755 index 00000000..61732023 --- /dev/null +++ b/functions/eaccelerator-1.0-dev.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_eAccelerator-1.0-dev() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src +/bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz +tar xzf eaccelerator-eaccelerator-42067ac.tar.gz +cd eaccelerator-eaccelerator-42067ac +make clean +$php_install_dir/bin/phpize +./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config +make && make install +cd ../ + +mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache +cat >> $php_install_dir/etc/php.ini << EOF +[eaccelerator] +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" +eaccelerator.shm_size="64" +eaccelerator.cache_dir="/var/eaccelerator_cache" +eaccelerator.enable="1" +eaccelerator.optimizer="1" +eaccelerator.check_mtime="1" +eaccelerator.debug="0" +eaccelerator.filter="" +eaccelerator.shm_max="0" +eaccelerator.shm_ttl="0" +eaccelerator.shm_prune_period="0" +eaccelerator.shm_only="0" +eaccelerator.compress="0" +eaccelerator.compress_level="9" +eaccelerator.keys = "disk_only" +eaccelerator.sessions = "disk_only" +eaccelerator.content = "disk_only" +EOF + +service php-fpm restart +} diff --git a/functions/memcached.sh b/functions/memcached.sh index d1f05645..0d9a783b 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -40,9 +40,11 @@ service memcached start # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 -OS_CentOS='yum -y install gcc44 gcc44-c++ libstdc++44-devel \n -export CC=/usr/bin/gcc44 \n -export CXX=/usr/bin/g++44' +OS_CentOS='if [ -z "`rpm -q gcc | grep 'gcc-4\.4'`" ];then \n + yum -y install gcc44 gcc44-c++ libstdc++44-devel \n + export CC=/usr/bin/gcc44 \n + export CXX=/usr/bin/g++44 \n +fi' OS_command ./configure --with-memcached=$memcached_install_dir make && make install diff --git a/functions/nginx.sh b/functions/nginx.sh index f370b0b7..7cbadf30 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -39,6 +39,7 @@ sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf +sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` diff --git a/lnmp_install.sh b/lnmp_install.sh index 722fe9eb..3d8962a8 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.2 21-Aug-2013 lj2007331 AT gmail.com +# Version: 0.3 27-Aug-2013 lj2007331 AT gmail.com # Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ # # This script's project home is: @@ -67,17 +67,28 @@ if [ ! -d "$php_insall_dir" ];then if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" else - if [ $PHP_version != 1 ];then - while : - do - read -p "Do you want to install php eAccelerator module? (y/n)" eAccelerator_yn - if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi - done - fi + if [ $PHP_version == 2 ];then + while : + do + read -p "Do you want to install php eAccelerator-1.0-dev module? (y/n)" eAccelerator_yn + if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi + done + fi + if [ $PHP_version == 3 ];then + while : + do + read -p "Do you want to install php eAccelerator-0.9 module? (y/n)" eAccelerator_yn + if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi + done + fi break fi done @@ -211,9 +222,13 @@ else kill -9 $$ fi -if [ "$eAccelerator_yn" ];then - . functions/eaccelerator.sh - Install_eAccelerator 2>&1 | tee -a $lnmp_dir/lnmp_install.log +if [ "$eAccelerator_yn" == 'y' -a $PHP_version == 2 ];then + . functions/eaccelerator-1.0-dev.sh + Install_eAccelerator-1.0-dev 2>&1 | tee -a $lnmp_dir/lnmp_install.log + echo functions/eaccelerator-0.9.sh +elif [ "$eAccelerator_yn" == 'y' -a $PHP_version == 3 ];then + . functions/eaccelerator-0.9.sh + Install_eAccelerator-0.9 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ ! -d "$nginx_install_dir" ];then diff --git a/vhost.sh b/vhost.sh index 424efe2f..f159b021 100755 --- a/vhost.sh +++ b/vhost.sh @@ -57,9 +57,8 @@ if [ "$moredomainame_yn" == 'y' ]; then fi # check ngx_pagespeed and add ngx_pagespeed -script -c "/usr/local/nginx/sbin/nginx -V" -f /tmp/typescript > /dev/null 2>&1 -if [ ! -z "`cat /tmp/typescript | grep ngx_pagespeed`" ];then - rm -rf /tmp/typescript +/usr/local/nginx/sbin/nginx -V &> $$ +if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then while : do read -p "Do you want to use ngx_pagespeed module? (y/n)" ngx_pagespeed_yn @@ -208,7 +207,7 @@ echo "# LNMP for CentOS/RadHat 5/6 #" echo "# For more information please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' -echo -e "`printf "%-32s" "Your domain"`:\033[32m$domain\033[0m" +echo -e "`printf "%-32s" "Your domain:"`\033[32m$domain\033[0m" echo -e "`printf "%-32s" "Virtualhost conf:"`\033[32m/usr/local/nginx/conf/vhost/$domain.conf\033[0m" echo -e "`printf "%-32s" "Directory of:"`\033[32m$vhostdir\033[0m" [ "$rewrite_yn" == 'y' ] && echo -e "`printf "%-32s" "Rewrite rule:"`\033[32m$rewrite\033[0m" From 5ea0d38f09821fa92334f29fcef16ee015a47023 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 27 Aug 2013 15:33:27 +0800 Subject: [PATCH 155/617] add Zend OPcache --- README.md | 11 ++-- functions/eaccelerator-0.9.sh | 13 +++-- functions/eaccelerator-1.0-dev.sh | 14 ++--- functions/mariadb-5.5.sh | 2 +- functions/memcached.sh | 31 +++++------ functions/mysql-5.5.sh | 2 +- functions/ngx_pagespeed.sh | 6 +-- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/pureftpd.sh | 87 ++++++++++++++++--------------- functions/redis.sh | 37 +++++++------ functions/zendopcache.sh | 34 ++++++++++++ lnmp_install.sh | 35 +++++++++---- 14 files changed, 164 insertions(+), 114 deletions(-) create mode 100755 functions/zendopcache.sh diff --git a/README.md b/README.md index 6840a4f8..62346562 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ - Fixes some security issues - You can freely choose to install MySQL database (MySQL-5.5, MySQL-5.6) or MariaDB (MariaDB-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) +- According to their needs can choose to install ZendOPcache,eAccelerator (php-5.4, php-5.3) - According to their needs can choose to install Pureftpd, phpMyAdmin - According to their needs can choose to install memcached, redis - According to their needs can choose to install ngx_pagespeed -- According to their needs can choose to install eAccelerator (php-5.4, php-5.3) - Add a virtual host script provided ## How to use @@ -17,8 +17,8 @@ ```bash yum -y install wget screen # for CentOS/Redhat #apt-get -y install wget screen # for Ubuntu - wget http://blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz - #or wget http://blog.linuxeye.com/wp-content/uploads/lnmp-full.tar.gz # include source packages + wget http://blog.linuxeye.com/lnmp.tar.gz + #or wget http://blog.linuxeye.com/lnmp-full.tar.gz # include source packages tar xzf lnmp.tar.gz cd lnmp chmod +x lnmp_install.sh @@ -32,12 +32,9 @@ ## How to add a virtual host ```bash - # Does not have ngx_pagespeed function add a virtual host ,You need to run ./vhost.sh - # Add a virtual host with ngx_pagespeed functionality ,you need to run (must be installed ngx_pagespeed) - ./vhost_ngx_pagespeed.sh ``` For feedback, questions, and to follow the progress of the project (Chinese):
- [lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html) + [lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
[nightgod](http://odvps.ml) diff --git a/functions/eaccelerator-0.9.sh b/functions/eaccelerator-0.9.sh index 0e25b566..5da06ed6 100755 --- a/functions/eaccelerator-0.9.sh +++ b/functions/eaccelerator-0.9.sh @@ -15,10 +15,10 @@ make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config make && make install -cd ../ -mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache -cat >> $php_install_dir/etc/php.ini << EOF +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" ];then + mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache + cat >> $php_install_dir/etc/php.ini << EOF [eaccelerator] zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" eaccelerator.shm_size="64" @@ -38,6 +38,9 @@ eaccelerator.keys = "disk_only" eaccelerator.sessions = "disk_only" eaccelerator.content = "disk_only" EOF - -service php-fpm restart + service php-fpm restart +else + echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" +fi +cd ../../ } diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh index 61732023..288a3e86 100755 --- a/functions/eaccelerator-1.0-dev.sh +++ b/functions/eaccelerator-1.0-dev.sh @@ -16,10 +16,9 @@ make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config make && make install -cd ../ - -mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache -cat >> $php_install_dir/etc/php.ini << EOF +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" ];then + mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache + cat >> $php_install_dir/etc/php.ini << EOF [eaccelerator] zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" eaccelerator.shm_size="64" @@ -39,6 +38,9 @@ eaccelerator.keys = "disk_only" eaccelerator.sessions = "disk_only" eaccelerator.content = "disk_only" EOF - -service php-fpm restart + service php-fpm restart +else + echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" +fi +cd ../../ } diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 887bb92e..c6dc5f6f 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -57,7 +57,6 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Ubuntu='update-rc.d mysqld defaults' OS_command -cd .. # my.cf cat > /etc/my.cnf << EOF @@ -128,4 +127,5 @@ cd ../ sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir$mariadb_data_dir@" options.conf service mysqld stop +cd ../../ } diff --git a/functions/memcached.sh b/functions/memcached.sh index 0d9a783b..166b8586 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -22,29 +22,29 @@ make && make install cd ../ if [ -d "$memcached_install_dir" ];then echo -e "\033[32mmemcached install successfully! \033[0m" -else - echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached -OS_CentOS='/bin/cp ../init/Memcached-init-CentOS /etc/init.d/memcached \n + ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached + OS_CentOS='/bin/cp ../init/Memcached-init-CentOS /etc/init.d/memcached \n chkconfig --add memcached \n chkconfig memcached on' -OS_Ubuntu='/bin/cp ../init/Memcached-init-Ubuntu /etc/init.d/memcached \n + OS_Ubuntu='/bin/cp ../init/Memcached-init-Ubuntu /etc/init.d/memcached \n update-rc.d memcached defaults' -OS_command -sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached -service memcached start + OS_command + sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached + service memcached start +else + echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" +fi # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 OS_CentOS='if [ -z "`rpm -q gcc | grep 'gcc-4\.4'`" ];then \n yum -y install gcc44 gcc44-c++ libstdc++44-devel \n - export CC=/usr/bin/gcc44 \n - export CXX=/usr/bin/g++44 \n fi' +if [ -f "`which gcc44`" ];then + export CC=`which gcc44` + export CXX=`which g++44` +fi OS_command ./configure --with-memcached=$memcached_install_dir make && make install @@ -58,9 +58,10 @@ $php_install_dir/bin/phpize make && make install if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini + service php-fpm restart else echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" fi -service php-fpm restart -cd ../ + +cd ../../ } diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 66eb9ceb..17da5ea9 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -52,7 +52,6 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Ubuntu='update-rc.d mysqld defaults' OS_command -cd .. # my.cf cat > /etc/my.cnf << EOF @@ -123,4 +122,5 @@ cd ../ sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf service mysqld stop +cd ../../ } diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 46f6228e..aa561e09 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,11 +17,11 @@ tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta cd nginx-1.4.2/ make clean if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ;then -./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ --add-module=../ngx_pagespeed-release-1.6.29.5-beta \ --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else -./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ --add-module=../ngx_pagespeed-release-1.6.29.5-beta \ --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi @@ -36,6 +36,6 @@ if [ -f "objs/nginx" ];then echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" else echo -e "\033[31minstall ngx_pagespeed failed\033[0m" - kill -9 $$ fi +cd ../../ } diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index d9253e1a..39c80ade 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -129,7 +129,6 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install -cd ../../ # Modify php.ini sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini @@ -204,4 +203,5 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF service php-fpm start +cd ../../ } diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 398fcb62..e345f0cd 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -129,7 +129,6 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install -cd ../../ # Modify php.ini sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini @@ -204,4 +203,5 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF service php-fpm start +cd ../../ } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 5efc5003..eba377a2 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -129,7 +129,6 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install -cd ../../ # Modify php.ini sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini @@ -213,4 +212,5 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF service php-fpm start +cd ../../ } diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index 7071817a..34a9db6e 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -19,52 +19,53 @@ cd pure-ftpd-1.0.36 make && make install if [ -d "$pureftpd_install_dir" ];then echo -e "\033[32mPure-Ftp install successfully! \033[0m" -else - echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" - kill -9 $$ -fi -cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin -chmod +x $pureftpd_install_dir/sbin/pure-config.pl -cp contrib/redhat.init /etc/init.d/pureftpd -cd ../../ -sed -i "s@fullpath=.*@fullpath=$pureftpd_install_dir/sbin/\$prog@" /etc/init.d/pureftpd -sed -i "s@pureftpwho=.*@pureftpwho=$pureftpd_install_dir/sbin/pure-ftpwho@" /etc/init.d/pureftpd -sed -i "s@/etc/pure-ftpd.conf@$pureftpd_install_dir/pure-ftpd.conf@" /etc/init.d/pureftpd -chmod +x /etc/init.d/pureftpd -OS_CentOS='chkconfig --add pureftpd \n + cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin + chmod +x $pureftpd_install_dir/sbin/pure-config.pl + cp contrib/redhat.init /etc/init.d/pureftpd + cd ../../ + sed -i "s@fullpath=.*@fullpath=$pureftpd_install_dir/sbin/\$prog@" /etc/init.d/pureftpd + sed -i "s@pureftpwho=.*@pureftpwho=$pureftpd_install_dir/sbin/pure-ftpwho@" /etc/init.d/pureftpd + sed -i "s@/etc/pure-ftpd.conf@$pureftpd_install_dir/pure-ftpd.conf@" /etc/init.d/pureftpd + chmod +x /etc/init.d/pureftpd + OS_CentOS='chkconfig --add pureftpd \n chkconfig pureftpd on' -OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n + OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n update-rc.d pureftpd defaults" -OS_command + OS_command -/bin/cp conf/pure-ftpd.conf $pureftpd_install_dir/ -/bin/cp conf/pureftpd-mysql.conf $pureftpd_install_dir/ -conn_ftpusers_dbpwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` -sed -i "s@^conn_ftpusers_dbpwd.*@conn_ftpusers_dbpwd=$conn_ftpusers_dbpwd@" options.conf -sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/g' $pureftpd_install_dir/pureftpd-mysql.conf -sed -i 's/conn_ftpusers_dbpwd/'$conn_ftpusers_dbpwd'/g' conf/script.mysql -sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' conf/script.mysql -service mysqld restart -$db_install_dir/bin/mysql -uroot -p$dbrootpwd < conf/script.mysql -service pureftpd start + /bin/cp conf/pure-ftpd.conf $pureftpd_install_dir/ + /bin/cp conf/pureftpd-mysql.conf $pureftpd_install_dir/ + conn_ftpusers_dbpwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` + sed -i "s@^conn_ftpusers_dbpwd.*@conn_ftpusers_dbpwd=$conn_ftpusers_dbpwd@" options.conf + sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/g' $pureftpd_install_dir/pureftpd-mysql.conf + sed -i 's/conn_ftpusers_dbpwd/'$conn_ftpusers_dbpwd'/g' conf/script.mysql + sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' conf/script.mysql + service mysqld restart + $db_install_dir/bin/mysql -uroot -p$dbrootpwd < conf/script.mysql + service pureftpd start -cd src -tar xzf ftp_v2.1.tar.gz -sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/' ftp/config.php -sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php -sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php -sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php -sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php -/bin/cp ../conf/chinese.php ftp/language/ -sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php -rm -rf ftp/install.php -mv ftp $home_dir/default -cd ../ + cd src + tar xzf ftp_v2.1.tar.gz + sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/' ftp/config.php + sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php + sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php + sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php + sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php + /bin/cp ../conf/chinese.php ftp/language/ + sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php + rm -rf ftp/install.php + mv ftp $home_dir/default -# iptables Ftp -iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT -iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT -OS_CentOS='service iptables save' -OS_Ubuntu='iptables-save > /etc/iptables.up.rules' -OS_command + # iptables Ftp + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT + iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT + OS_CentOS='service iptables save' + OS_Ubuntu='iptables-save > /etc/iptables.up.rules' + OS_command +else + echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +cd ../../ } diff --git a/functions/redis.sh b/functions/redis.sh index 8c1e73b2..96affd0d 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -20,10 +20,10 @@ $php_install_dir/bin/phpize make && make install if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini + service php-fpm restart else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -service php-fpm restart cd .. tar xzf redis-2.6.15.tar.gz @@ -39,27 +39,26 @@ if [ -f "src/redis-server" ];then mkdir -p $redis_install_dir/{bin,etc,var} /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ /bin/cp redis.conf $redis_install_dir/etc/ -else - echo -e "\033[31mRedis install failed, Please contact the author! \033[0m" - kill -9 $$ -fi -cd ../../ - -ln -s $redis_install_dir/bin/* /usr/local/bin/ -sed -i 's@pidfile.*$@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf -sed -i "s@logfile.*$@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf -sed -i "s@^dir.*$@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf -sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf -OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n + ln -s $redis_install_dir/bin/* /usr/local/bin/ + sed -i 's@pidfile.*$@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf + sed -i "s@logfile.*$@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf + sed -i "s@^dir.*$@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf + sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf + OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n chkconfig redis-server on' -OS_Ubuntu='useradd -M -s /sbin/nologin redis \n + OS_Ubuntu='useradd -M -s /sbin/nologin redis \n chown -R redis:redis $redis_install_dir/var/ \n /bin/cp init/Redis-server-init-Ubuntu /etc/init.d/redis-server \n update-rc.d redis-server defaults' -OS_command -sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server -echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf -sysctl -p -service redis-server start + OS_command + sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server + echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf + sysctl -p + service redis-server start +else + echo -e "\033[31mRedis install failed, Please contact the author! \033[0m" +fi + +cd ../../ } diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh new file mode 100755 index 00000000..aacbbf52 --- /dev/null +++ b/functions/zendopcache.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_ZendOPcache() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=https://github.com/zendtech/ZendOptimizerPlus/tarball/master && Download_src +/bin/mv master zendtech-ZendOptimizerPlus-8eeb372.tar.gz +tar xzf zendtech-ZendOptimizerPlus-8eeb372.tar.gz +cd zendtech-ZendOptimizerPlus-8eeb372 +make clean +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" ];then + cat >> $php_install_dir/etc/php.ini << EOF +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.fast_shutdown=1 +opcache.enable_cli=1 +EOF + service php-fpm restart +else + echo -e "\033[31meZend OPcache module install failed, Please contact the author! \033[0m" +fi +cd ../../ +} diff --git a/lnmp_install.sh b/lnmp_install.sh index 3d8962a8..cc15d907 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -70,9 +70,14 @@ if [ ! -d "$php_insall_dir" ];then if [ $PHP_version == 2 ];then while : do - read -p "Do you want to install php eAccelerator-1.0-dev module? (y/n)" eAccelerator_yn - if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + echo 'Please select the PHP opcode cache:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + echo '' + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then + echo -e "\033[31minput error! Please input 1 or 2\033[0m" else break fi @@ -81,9 +86,14 @@ if [ ! -d "$php_insall_dir" ];then if [ $PHP_version == 3 ];then while : do - read -p "Do you want to install php eAccelerator-0.9 module? (y/n)" eAccelerator_yn - if [ "$eAccelerator_yn" != 'y' ] && [ "$eAccelerator_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + echo 'Please select the PHP opcode cache:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + echo '' + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then + echo -e "\033[31minput error! Please input 1 or 2\033[0m" else break fi @@ -222,12 +232,15 @@ else kill -9 $$ fi -if [ "$eAccelerator_yn" == 'y' -a $PHP_version == 2 ];then - . functions/eaccelerator-1.0-dev.sh +# PHP opcode cache (php <= 5.4) +if [ $PHP_cache == 1 ];then + . functions/zendopcache.sh + Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/lnmp_install.log +elif [ $PHP_cache == 2 -a $PHP_version == 2 ];then + . functions/eaccelerator-1.0-dev.sh Install_eAccelerator-1.0-dev 2>&1 | tee -a $lnmp_dir/lnmp_install.log - echo functions/eaccelerator-0.9.sh -elif [ "$eAccelerator_yn" == 'y' -a $PHP_version == 3 ];then - . functions/eaccelerator-0.9.sh +elif [ $PHP_cache == 2 -a $PHP_version == 3 ];then + . functions/eaccelerator-0.9.sh Install_eAccelerator-0.9 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi From c46b1a63606808330f1a829e35ed7ffa7acd0093 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 27 Aug 2013 23:13:47 +0800 Subject: [PATCH 156/617] ip China, 163 yum --- README.md | 2 +- functions/get_ip_area.py | 14 +++++++ init/init_CentOS.sh | 80 +++++++++++++++++++++++----------------- init/init_Ubuntu.sh | 46 ++++++++++++----------- lnmp_install.sh | 22 +++++++++-- 5 files changed, 104 insertions(+), 60 deletions(-) create mode 100755 functions/get_ip_area.py diff --git a/README.md b/README.md index 62346562..f7011c14 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
- [nightgod](http://odvps.ml) + [odvps](http://odvps.ml) diff --git a/functions/get_ip_area.py b/functions/get_ip_area.py new file mode 100755 index 00000000..440d535e --- /dev/null +++ b/functions/get_ip_area.py @@ -0,0 +1,14 @@ +#!/usr/bin/python +#coding:utf-8 +try: + import sys,urllib2,json + apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] + content = urllib2.urlopen(apiurl).read() + data = json.loads(content)['data'] + code = json.loads(content)['code'] + if code == 0: + print data['country_id'] + else: + print data +except: + print "Usage:%s IP" % sys.argv[0] diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 872b0150..25d57fe1 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Configure yum source + cd /tmp wget -c http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz tar zxf yum-3.4.3.tar.gz @@ -10,6 +10,13 @@ rm -rf yum-3.4.3* sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all +if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then + cd /etc/yum.repos.d/ + mv CentOS-Base.repo CentOS-Base.repo_bk + wget -c http://mirrors.163.com/.help/CentOS-Base-163.repo + yum makecache +fi + # Remove obsolete rpm package if [ -z "$(cat /etc/redhat-release | grep '5\.')" ];then yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" @@ -19,7 +26,10 @@ fi # update rpm packages yum check-update -yum -y update +yum -y upgrade + +# check upgrade OS +[ "$upgrade_yn" == 'y' ] && yum -y update # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail @@ -36,29 +46,20 @@ chkconfig iptables on chkconfig sendmail on service sendmail restart -# /etc/hosts -[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts - # Close SELINUX setenforce 0 sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config # initdefault sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab -/sbin/init q +init q + # PS1 echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile -# Record command +# history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bash_profile - -# Wrong password five times locked 180s -sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth - -# alias vi -sed -i "s@alias mv=.*@alias mv='mv -i'\nalias vi=vim@" /root/.bashrc -echo 'syntax on' >> /etc/vimrc +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bashrc # /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local +# /etc/hosts +[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts + +# Set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +# Set OpenDNS +if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF +fi + +# Wrong password five times locked 180s +sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth + +# alias vi +sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" /root/.bashrc +echo 'syntax on' >> /etc/vimrc + # /etc/sysctl.conf sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf cat >> /etc/sysctl.conf << EOF @@ -90,24 +113,12 @@ else sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf fi -/sbin/init q - -# Set timezone -rm -rf /etc/localtime -ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -# Set OpenDNS -if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then -cat > /etc/resolv.conf << EOF -nameserver 208.67.222.222 -nameserver 208.67.220.220 -EOF -fi +init q # Update time -/usr/sbin/ntpdate pool.ntp.org +ntpdate pool.ntp.org echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root -/sbin/service crond restart +service crond restart # iptables cat > /etc/sysconfig/iptables << EOF @@ -130,10 +141,9 @@ cat > /etc/sysconfig/iptables << EOF -A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF -/sbin/service iptables restart -. /etc/profile +service iptables restart -###install tmux +# install tmux mkdir tmux cd tmux wget -c http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz @@ -157,7 +167,7 @@ else ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 fi -###install htop +# install htop mkdir htop cd htop wget -c http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz @@ -167,3 +177,5 @@ cd htop-1.0.2 make && make install cd ../../ rm -rf htop + +. /etc/profile diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 700dea66..72bfc0bc 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -1,25 +1,20 @@ -#! /bin/sh +#!/bin/bash + apt-get -y update apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev libcloog-ppl0 vim zip unzip tmux htop wget - -# /etc/hosts -[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev libcloog-ppl0 vim zip unzip tmux htop wget # PS1 -echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$'" >> /etc/profile +echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /etc/profile -# Record command +# history size sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /root/.bashrc echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bashrc -# alias vi -sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" /root/.bashrc - # /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local +# /etc/hosts +[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts + +# Set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +# Set OpenDNS +if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF +fi + +# alias vi +sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" /root/.bashrc + # /etc/sysctl.conf cat >> /etc/sysctl.conf << EOF net.ipv4.tcp_syncookies = 1 @@ -44,18 +57,6 @@ sed -i 's@^@#@g' /etc/init/tty[3-6].conf echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local sed -i 's@^@#@g' /etc/init/control-alt-delete.conf -# Set timezone -rm -rf /etc/localtime -ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -# Set OpenDNS -if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then -cat > /etc/resolv.conf << EOF -nameserver 208.67.222.222 -nameserver 208.67.220.220 -EOF -fi - # Update time ntpdate pool.ntp.org echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root @@ -83,4 +84,5 @@ cat > /etc/iptables.up.rules << EOF COMMIT EOF iptables-restore < /etc/iptables.up.rules + . /etc/profile diff --git a/lnmp_install.sh b/lnmp_install.sh index cc15d907..26160e0f 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -22,23 +22,34 @@ echo '' #get pwd sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" options.conf -# get ipv4 +# get ipv4 . functions/get_ipv4.sh # Definition Directory . ./options.conf mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} +# choice upgrade OS +while : +do + read -p "Do you want to upgrade operating system ? (y/n)" upgrade_yn + if [ "$upgrade_yn" != 'y' ] && [ "$upgrade_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi +done + # choice database if [ ! -d "$db_install_dir" ];then while : do + echo '' echo 'Please select the database version:' echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" read -p "Please input a number:(Default 1 press Enter) " DB_version - echo '' [ -z "$DB_version" ] && DB_version=1 if [ $DB_version != 1 ] && [ $DB_version != 2 ] && [ $DB_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" @@ -57,12 +68,12 @@ fi if [ ! -d "$php_insall_dir" ];then while : do + echo '' echo 'Please select the php version:' echo -e "\t\033[32m1\033[0m. Install php-5.5" echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.3" read -p "Please input a number:(Default 1 press Enter) " PHP_version - echo '' [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then echo -e "\033[31minput error! Please input 1 2 3 \033[0m" @@ -134,6 +145,7 @@ fi if [ ! -d "$wwwroot/default/phpMyAdmin" ];then while : do + echo '' read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" @@ -147,6 +159,7 @@ fi if [ ! -d "$redis_install_dir" ];then while : do + echo '' read -p "Do you want to install Redis? (y/n)" redis_yn if [ "$redis_yn" != 'y' ] && [ "$redis_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" @@ -160,6 +173,7 @@ fi if [ ! -d "$memcached_install_dir" ];then while : do + echo '' read -p "Do you want to install memcached? (y/n)" memcached_yn if [ "$memcached_yn" != 'y' ] && [ "$memcached_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" @@ -172,6 +186,7 @@ fi # check ngx_pagespeed while : do + echo '' read -p "Do you want to install ngx_pagespeed? (y/n)" ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" @@ -184,6 +199,7 @@ chmod +x functions/*.sh init/* *.sh # init . functions/check_os.sh +export IP upgrade_yn OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_CentOS.sh init/init_CentOS.ed' OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n From 4865fb2d1c9faf3809c79cd9a099a2ad7a3035e7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 27 Aug 2013 23:43:16 +0800 Subject: [PATCH 157/617] libmemcached error --- functions/memcached.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 166b8586..326b1106 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -41,11 +41,11 @@ cd libmemcached-1.0.16 OS_CentOS='if [ -z "`rpm -q gcc | grep 'gcc-4\.4'`" ];then \n yum -y install gcc44 gcc44-c++ libstdc++44-devel \n fi' +OS_command if [ -f "`which gcc44`" ];then export CC=`which gcc44` export CXX=`which g++44` fi -OS_command ./configure --with-memcached=$memcached_install_dir make && make install cd .. From 3290835a1f21b8c101287fac97c276eb3002b67d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 27 Aug 2013 23:52:46 +0800 Subject: [PATCH 158/617] init redis-server --- functions/redis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/redis.sh b/functions/redis.sh index 96affd0d..a8b20db0 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -44,6 +44,7 @@ if [ -f "src/redis-server" ];then sed -i "s@logfile.*$@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf sed -i "s@^dir.*$@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf + cd ../../ OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n chkconfig redis-server on' @@ -60,5 +61,4 @@ else echo -e "\033[31mRedis install failed, Please contact the author! \033[0m" fi -cd ../../ } From 4926d2b55d867a8df604b5960f8b4ec5b90f5be7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 28 Aug 2013 12:06:53 +0800 Subject: [PATCH 159/617] Adjust format --- README.md | 10 +++++----- lnmp_install.sh | 25 +++++++++++++------------ vhost.sh | 42 ++++++++++++++++++++---------------------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index f7011c14..91129380 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ - Constant updates - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues -- You can freely choose to install MySQL database (MySQL-5.5, MySQL-5.6) or MariaDB (MariaDB-5.5) +- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) -- According to their needs can choose to install ZendOPcache,eAccelerator (php-5.4, php-5.3) -- According to their needs can choose to install Pureftpd, phpMyAdmin -- According to their needs can choose to install memcached, redis -- According to their needs can choose to install ngx_pagespeed +- According to their needs can to install ZendOPcache,eAccelerator (php-5.4, php-5.3) +- According to their needs can to install Pureftpd, phpMyAdmin +- According to their needs can to install memcached, redis +- According to their needs can to install ngx_pagespeed - Add a virtual host script provided ## How to use diff --git a/lnmp_install.sh b/lnmp_install.sh index 26160e0f..fd9f2b70 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -32,7 +32,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS while : do - read -p "Do you want to upgrade operating system ? (y/n)" upgrade_yn + read -p "Do you want to upgrade operating system ? (y/n) " upgrade_yn if [ "$upgrade_yn" != 'y' ] && [ "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -45,7 +45,7 @@ if [ ! -d "$db_install_dir" ];then while : do echo '' - echo 'Please select the database version:' + echo 'Please select a version of the Database:' echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" @@ -56,7 +56,7 @@ if [ ! -d "$db_install_dir" ];then else while : do - read -p "Please input database root password:" dbrootpwd + read -p "Please input the root password of database: " dbrootpwd (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" done break @@ -69,7 +69,7 @@ if [ ! -d "$php_insall_dir" ];then while : do echo '' - echo 'Please select the php version:' + echo 'Please select a version of the PHP:' echo -e "\t\033[32m1\033[0m. Install php-5.5" echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.3" @@ -81,7 +81,7 @@ if [ ! -d "$php_insall_dir" ];then if [ $PHP_version == 2 ];then while : do - echo 'Please select the PHP opcode cache:' + echo 'Please select a opcode cache of the PHP:' echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" read -p "Please input a number:(Default 1 press Enter) " PHP_cache @@ -97,7 +97,7 @@ if [ ! -d "$php_insall_dir" ];then if [ $PHP_version == 3 ];then while : do - echo 'Please select the PHP opcode cache:' + echo 'Please select a opcode cache of the PHP:' echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" read -p "Please input a number:(Default 1 press Enter) " PHP_cache @@ -119,7 +119,8 @@ fi if [ ! -d "$pureftpd_install_dir" ];then while : do - read -p "Do you want to install Pure-FTPd? (y/n)" FTP_yn + echo '' + read -p "Do you want to install Pure-FTPd? (y/n) " FTP_yn if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -127,7 +128,7 @@ do if [ "$FTP_yn" == 'y' ];then while : do - read -p "Please input the manager password of Pureftpd:" ftpmanagerpwd + read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd if (( ${#ftpmanagerpwd} >= 5 ));then sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf break @@ -146,7 +147,7 @@ if [ ! -d "$wwwroot/default/phpMyAdmin" ];then while : do echo '' - read -p "Do you want to install phpMyAdmin? (y/n)" phpMyAdmin_yn + read -p "Do you want to install phpMyAdmin? (y/n) " phpMyAdmin_yn if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -160,7 +161,7 @@ if [ ! -d "$redis_install_dir" ];then while : do echo '' - read -p "Do you want to install Redis? (y/n)" redis_yn + read -p "Do you want to install Redis? (y/n) " redis_yn if [ "$redis_yn" != 'y' ] && [ "$redis_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -174,7 +175,7 @@ if [ ! -d "$memcached_install_dir" ];then while : do echo '' - read -p "Do you want to install memcached? (y/n)" memcached_yn + read -p "Do you want to install memcached? (y/n) " memcached_yn if [ "$memcached_yn" != 'y' ] && [ "$memcached_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -187,7 +188,7 @@ fi while : do echo '' - read -p "Do you want to install ngx_pagespeed? (y/n)" ngx_pagespeed_yn + read -p "Do you want to install ngx_pagespeed? (y/n) " ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else diff --git a/vhost.sh b/vhost.sh index f159b021..96a19c2f 100755 --- a/vhost.sh +++ b/vhost.sh @@ -13,7 +13,7 @@ echo '' while : do - read -p "Please input domain(example: www.linuxeye.com linuxeye.com):" domain + read -p "Please input domain(example: www.linuxeye.com linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo -e "\033[31minput error\033[0m" else @@ -21,19 +21,16 @@ do fi done if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then - echo "################################" echo "domain=$domain" - echo "################################" else - echo "################################" echo "$domain is exist!" - echo "################################" exit 1 fi while : do - read -p "Do you want to add more domain name? (y/n)" moredomainame_yn + echo '' + read -p "Do you want to add more domain name? (y/n) " moredomainame_yn if [ "$moredomainame_yn" != 'y' ] && [ "$moredomainame_yn" != 'n' ];then echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" else @@ -43,13 +40,12 @@ done if [ "$moredomainame_yn" == 'y' ]; then while : do - read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com):" moredomain + echo '' + read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com): " moredomain if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then echo -e "\033[31minput error\033[0m" else - echo "################################" echo -e "domain list=\033[32m$moredomain\033[0m" - echo "################################" moredomainame=" $moredomain" break fi @@ -61,7 +57,8 @@ fi if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then while : do - read -p "Do you want to use ngx_pagespeed module? (y/n)" ngx_pagespeed_yn + echo '' + read -p "Do you want to use ngx_pagespeed module? (y/n) " ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" else @@ -73,11 +70,13 @@ if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then break fi done + rm -rf $$ fi while : do - read -p "Do you want to add hotlink protection? (y/n)" anti_hotlinking_yn + echo '' + read -p "Do you want to add hotlink protection? (y/n) " anti_hotlinking_yn if [ "$anti_hotlinking_yn" != 'y' ] && [ "$anti_hotlinking_yn" != 'n' ];then echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" else @@ -102,18 +101,18 @@ else anti_hotlinking= fi +echo '' echo "Please input the directory for the domain:$domain :" -read -p "(Default directory: /home/wwwroot/$domain):" vhostdir +read -p "(Default directory: /home/wwwroot/$domain): " vhostdir if [ -z "$vhostdir" ]; then vhostdir="/home/wwwroot/$domain" - echo "################################" echo -e "Virtual Host Directory=\033[32m$vhostdir\033[0m" - echo "################################" fi while : do - read -p "Allow Rewrite rule? (y/n)" rewrite_yn + echo '' + read -p "Allow Rewrite rule? (y/n) " rewrite_yn if [ "$rewrite_yn" != 'y' ] && [ "$rewrite_yn" != 'n' ];then echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" else @@ -124,17 +123,16 @@ if [ "$rewrite_yn" == 'n' ];then rewrite="none" touch "/usr/local/nginx/conf/$rewrite.conf" else + echo '' echo "Please input the rewrite of programme :" echo -e "\033[32mwordpress\033[0m,\033[32mdiscuz\033[0m,\033[32mphpwind\033[0m,\033[32mtypecho\033[0m,\033[32mecshop\033[0m,\033[32mdrupal\033[0m rewrite was exist." read -p "(Default rewrite: other):" rewrite if [ "$rewrite" == "" ]; then rewrite="other" fi - echo "################################" echo -e "You choose rewrite=\033[32m$rewrite\033[0m" - echo "################################" - if [ -s "/root/lnmp/conf/$rewrite.conf" ];then - /bin/cp /root/lnmp/conf/$rewrite.conf /usr/local/nginx/conf/$rewrite.conf + if [ -s "conf/$rewrite.conf" ];then + /bin/cp conf/$rewrite.conf /usr/local/nginx/conf/$rewrite.conf else touch "/usr/local/nginx/conf/$rewrite.conf" fi @@ -143,7 +141,8 @@ fi while : do - read -p "Allow access_log? (y/n)" access_yn + echo '' + read -p "Allow access_log? (y/n) " access_yn if [ "$access_yn" != 'y' ] && [ "$access_yn" != 'n' ];then echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" else @@ -154,9 +153,8 @@ if [ "$access_yn" == 'n' ]; then al="access_log off;" else al="access_log /home/wwwlogs/$domain.log combined;" - echo "################################" echo -e "You access log file=\033[32m/home/wwwlogs/$domain.log\033[0m" - echo "################################" + echo '' fi From 1493b65e10fc9da3db397728255f75a75aa2e4e5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 28 Aug 2013 22:31:38 +0800 Subject: [PATCH 160/617] add php extension memcache --- functions/memcached.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/functions/memcached.sh b/functions/memcached.sh index 326b1106..f39779b3 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -12,6 +12,7 @@ cd $lnmp_dir/src src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.1.0.tgz && Download_src +src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server useradd -M -s /sbin/nologin memcached @@ -35,6 +36,20 @@ else echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" fi +# php memcache extension +tar xzf memcache-2.2.7.tgz +cd memcache-2.2.7 +make clean +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini + service php-fpm restart +else + echo -e "\033[31mPHP memcache module install failed, Please contact the author! \033[0m" +fi +cd .. # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 From 2bd54f17d34eefe3cdea03bacea5da72b46459ad Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Aug 2013 16:06:57 +0800 Subject: [PATCH 161/617] =?UTF-8?q?add=20tcmalloc=20optimize=20MySQL=EF=20?= =?UTF-8?q?Nginx=20Redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/eaccelerator-0.9.sh | 2 ++ functions/eaccelerator-1.0-dev.sh | 2 ++ functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/nginx.sh | 10 ++++++++- functions/ngx_pagespeed.sh | 21 +++++++++++-------- functions/php-5.3.sh | 1 + functions/php-5.4.sh | 3 +++ functions/php-5.5.sh | 1 + functions/pureftpd.sh | 4 ++-- functions/redis.sh | 4 ++-- functions/tcmalloc.sh | 34 +++++++++++++++++++++++++++++++ init/init_Ubuntu.sh | 19 +++++++++++++---- lnmp_install.sh | 34 +++++++++++++++++-------------- 15 files changed, 112 insertions(+), 41 deletions(-) create mode 100755 functions/tcmalloc.sh diff --git a/functions/eaccelerator-0.9.sh b/functions/eaccelerator-0.9.sh index 5da06ed6..095047ba 100755 --- a/functions/eaccelerator-0.9.sh +++ b/functions/eaccelerator-0.9.sh @@ -38,6 +38,8 @@ eaccelerator.keys = "disk_only" eaccelerator.sessions = "disk_only" eaccelerator.content = "disk_only" EOF + echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p service php-fpm restart else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh index 288a3e86..a17cb1bc 100755 --- a/functions/eaccelerator-1.0-dev.sh +++ b/functions/eaccelerator-1.0-dev.sh @@ -38,6 +38,8 @@ eaccelerator.keys = "disk_only" eaccelerator.sessions = "disk_only" eaccelerator.content = "disk_only" EOF + echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p service php-fpm restart else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index c6dc5f6f..2dde22ca 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -57,6 +57,7 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Ubuntu='update-rc.d mysqld defaults' OS_command +cd ../../ # my.cf cat > /etc/my.cnf << EOF @@ -123,9 +124,8 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user wh $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -cd ../ sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf -sed -i "s@^db_data_dir.*@db_data_dir$mariadb_data_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf service mysqld stop -cd ../../ +[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe } diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 17da5ea9..8b787e6c 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -52,6 +52,7 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Ubuntu='update-rc.d mysqld defaults' OS_command +cd ../../ # my.cf cat > /etc/my.cnf << EOF @@ -118,9 +119,8 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user wher $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -cd ../ sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf -sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf service mysqld stop -cd ../../ +[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe } diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index a90d9a45..2afecc02 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -53,7 +53,7 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Ubuntu='update-rc.d mysqld defaults' OS_command -cd .. +cd ../../ # my.cf cat > /etc/my.cnf << EOF @@ -120,8 +120,8 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user wher $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" -cd ../ sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf -sed -i "s@^db_data_dir.*@db_data_dir$mysql_data_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf service mysqld stop +[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe } diff --git a/functions/nginx.sh b/functions/nginx.sh index 7cbadf30..feaac717 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -25,7 +25,15 @@ cd nginx-1.4.2 sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@g' src/core/nginx.h sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@g' src/core/nginx.h -./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module +if [ "Stcmalloc_yn" == 'y' ];then + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module + mkdir /tmp/tcmalloc + chown -R www.www /tmp/tcmalloc + sed -i 's@^pid\(.*)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' ../../conf/nginx.conf +else + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module +fi + make && make install cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index aa561e09..94a7025e 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -16,15 +16,20 @@ unzip -q release-1.6.29.5-beta tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta cd nginx-1.4.2/ make clean -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ;then - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ ---add-module=../ngx_pagespeed-release-1.6.29.5-beta \ ---with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then + if [ "$tcmalloc_yn" == 'y' ];then + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + else + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + fi else - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module \ ---add-module=../ngx_pagespeed-release-1.6.29.5-beta \ ---with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + if [ "$tcmalloc_yn" == 'y' ];then + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + else + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + fi fi + make if [ -f "objs/nginx" ];then /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) @@ -37,5 +42,5 @@ if [ -f "objs/nginx" ];then else echo -e "\033[31minstall ngx_pagespeed failed\033[0m" fi -cd ../../ +cd ../ } diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 39c80ade..6d9e494f 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -21,6 +21,7 @@ src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local +[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index e345f0cd..03f453b0 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -21,6 +21,7 @@ src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local +[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ @@ -65,8 +66,10 @@ else \n fi' OS_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n + ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/ \n else \n ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n + ln -s /usr/lib/i386-linux-gnu/liblber.so /usr/lib/ \n fi' OS_command diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index eba377a2..e4fb1477 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -21,6 +21,7 @@ src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local +[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index 34a9db6e..8f85a6aa 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -55,6 +55,7 @@ update-rc.d pureftpd defaults" sed -i 's@\$LANG.*;@\$LANG = "chinese";@' ftp/config.php rm -rf ftp/install.php mv ftp $home_dir/default + cd .. # iptables Ftp iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT @@ -63,9 +64,8 @@ update-rc.d pureftpd defaults" OS_Ubuntu='iptables-save > /etc/iptables.up.rules' OS_command else + cd ../../ echo -e "\033[31mPure-Ftp install failed, Please contact the author! \033[0m" kill -9 $$ fi - -cd ../../ } diff --git a/functions/redis.sh b/functions/redis.sh index a8b20db0..bd684de1 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -33,7 +33,7 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings fi -make +[ "$tcmalloc_yn" == 'y' ] && make USE_TCMALLOC=yes FORCE_LIBC_MALLOC=yes || make if [ -f "src/redis-server" ];then mkdir -p $redis_install_dir/{bin,etc,var} @@ -58,7 +58,7 @@ update-rc.d redis-server defaults' sysctl -p service redis-server start else + cd ../../ echo -e "\033[31mRedis install failed, Please contact the author! \033[0m" fi - } diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh new file mode 100755 index 00000000..9db5737e --- /dev/null +++ b/functions/tcmalloc.sh @@ -0,0 +1,34 @@ +#!/bin/bash +cd $lnmp_dir/src +. ../functions/download.sh + +src_url=http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz && Download_src +src_url=http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz && Download_src + +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then + tar xzf libunwind-1.1.tar.gz + cd libunwind-1.1 + CFLAGS=-fPIC ./configure + make CFLAGS=-fPIC + make CFLAGS=-fPIC install + cd .. + tar xzf gperftools-2.1.tar.gz + cd gperftools-2.1 + ./configure + make && make install + cd .. +else + tar xzf gperftools-2.1.tar.gz + cd gperftools-2.1 + ./configure --enable-frame-pointers + make && make install + cd .. +fi +if [ -f "/usr/local/lib/libtcmalloc.so" ];then + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig +else + echo -e "\033[31mgperftools install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cd .. diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 72bfc0bc..82d515fc 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -1,15 +1,26 @@ #!/bin/bash -apt-get -y update apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd + +apt-get -y update +# update packages apt-get -y upgrade +# check upgrade OS +[ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade + # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap libguile-ltdl-1 bison libsasl2-dev libxslt-dev libcloog-ppl0 vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev vim zip unzip tmux htop wget + +if [ ! -z "`cat /etc/issue | grep 13`" ];then + apt-get -y install libxslt1-dev libcloog-ppl1 +if [ ! -z "`cat /etc/issue | grep 12`" ];then + apt-get -y install libxslt-dev libcloog-ppl0 +fi # PS1 -echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /etc/profile +echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /root/.bashrc # history size sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /root/.bashrc @@ -85,4 +96,4 @@ COMMIT EOF iptables-restore < /etc/iptables.up.rules -. /etc/profile +. /root/.bashrc diff --git a/lnmp_install.sh b/lnmp_install.sh index fd9f2b70..ed6a7888 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -85,7 +85,6 @@ if [ ! -d "$php_insall_dir" ];then echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" read -p "Please input a number:(Default 1 press Enter) " PHP_cache - echo '' [ -z "$PHP_cache" ] && PHP_cache=1 if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then echo -e "\033[31minput error! Please input 1 or 2\033[0m" @@ -101,7 +100,6 @@ if [ ! -d "$php_insall_dir" ];then echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" read -p "Please input a number:(Default 1 press Enter) " PHP_cache - echo '' [ -z "$PHP_cache" ] && PHP_cache=1 if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then echo -e "\033[31minput error! Please input 1 or 2\033[0m" @@ -196,39 +194,45 @@ do fi done +# check tcmalloc +while : +do + echo '' + read -p "Do you want to optimize the system with tcmalloc? (y/n) " tcmalloc_yn + if [ "$tcmalloc_yn" != 'y' ] && [ "$tcmalloc_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi +done + chmod +x functions/*.sh init/* *.sh # init . functions/check_os.sh -export IP upgrade_yn +export IP upgrade_yn tcmalloc_yn OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_CentOS.sh init/init_CentOS.ed' OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' OS_command +# tcmalloc +[ "$tcmalloc_yn" == 'y' ] && ./functions/tcmalloc.sh | tee -a $lnmp_dir/lnmp_install.log + # Database if [ $DB_version == 1 ];then cd $lnmp_dir . functions/mysql-5.6.sh Install_MySQL-5.6 2>&1 | tee -a $lnmp_dir/lnmp_install.log - db_install_dir=$mysql_install_dir - sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf - sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf elif [ $DB_version == 2 ];then cd $lnmp_dir . functions/mysql-5.5.sh Install_MySQL-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log - db_install_dir=$mysql_install_dir - sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf - sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf elif [ $DB_version == 3 ];then cd $lnmp_dir . functions/mariadb-5.5.sh Install_MariaDB-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log - db_install_dir=$mariadb_install_dir - sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf - sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf else echo -e "\033[31mdatabase install failed, Please contact the author! \033[0m" kill -9 $$ @@ -305,7 +309,7 @@ echo '' echo "The path of some dirs:" echo -e "`printf "%-32s" "Nginx dir":`\033[32m$nginx_install_dir\033[0m" echo -e "`printf "%-32s" "PHP dir:"`\033[32m$php_install_dir\033[0m" -echo -e "`printf "%-32s" "$Choice_DB dir:"`\033[32m$db_install_dir\033[0m" -echo -e "`printf "%-32s" "$Choice_DB User:"`\033[32mroot\033[0m" -echo -e "`printf "%-32s" "$Choice_DB Password:"`\033[32m${dbrootpwd}\033[0m" +echo -e "`printf "%-32s" "Database Install dir:"`\033[32m$db_install_dir\033[0m" +echo -e "`printf "%-32s" "Database User:"`\033[32mroot\033[0m" +echo -e "`printf "%-32s" "Database Password:"`\033[32m${dbrootpwd}\033[0m" echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" From c16e1018484a487e7b61b9efb5b208258211b2cc Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Aug 2013 18:34:12 +0800 Subject: [PATCH 162/617] sed nginx.conf error --- README.md | 1 + functions/nginx.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91129380..0fec1a6f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to install ngx_pagespeed +- According to their needs can to optimize MySQL,Nginx and Redis with tcmalloc - Add a virtual host script provided ## How to use diff --git a/functions/nginx.sh b/functions/nginx.sh index feaac717..bd7cb402 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -29,7 +29,7 @@ if [ "Stcmalloc_yn" == 'y' ];then ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc - sed -i 's@^pid\(.*)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' ../../conf/nginx.conf + sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' ../../conf/nginx.conf else ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module fi From 973323843647a91c243df33d26ade2fabbabb729 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Aug 2013 20:36:49 +0800 Subject: [PATCH 163/617] get db_install_dir --- lnmp_install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index ed6a7888..82affa63 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -238,6 +238,9 @@ else kill -9 $$ fi +# get db_install_dir +. ./options.conf + # PHP if [ $PHP_version == 1 ];then . functions/php-5.5.sh @@ -302,7 +305,6 @@ if [ "$ngx_pagespeed_yn" == 'y' ];then . functions/ngx_pagespeed.sh Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi - echo "################Congratulations####################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo '' From 5213a735acca3da3591b403df79a1fd3157495f4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Aug 2013 20:57:52 +0800 Subject: [PATCH 164/617] tcmalloc --- lnmp_install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lnmp_install.sh b/lnmp_install.sh index 82affa63..45e15b8b 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -218,7 +218,9 @@ OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n OS_command # tcmalloc -[ "$tcmalloc_yn" == 'y' ] && ./functions/tcmalloc.sh | tee -a $lnmp_dir/lnmp_install.log +if [ "$tcmalloc_yn" == 'y' ];then + . functions/tcmalloc.sh | tee -a $lnmp_dir/lnmp_install.log +fi # Database if [ $DB_version == 1 ];then From eb2cb299f679c4d96965ffecbc19ee133c295298 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Aug 2013 21:11:54 +0800 Subject: [PATCH 165/617] TCMalloc --- functions/tcmalloc.sh | 3 +++ lnmp_install.sh | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 9db5737e..666f9c77 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -1,4 +1,6 @@ #!/bin/bash +TCMalloc() +{ cd $lnmp_dir/src . ../functions/download.sh @@ -32,3 +34,4 @@ else kill -9 $$ fi cd .. +} diff --git a/lnmp_install.sh b/lnmp_install.sh index 45e15b8b..5ade8fa7 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -218,9 +218,8 @@ OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n OS_command # tcmalloc -if [ "$tcmalloc_yn" == 'y' ];then - . functions/tcmalloc.sh | tee -a $lnmp_dir/lnmp_install.log -fi +. functions/tcmalloc.sh +[ "$tcmalloc_yn" == 'y' ] && TCMalloc | tee -a $lnmp_dir/lnmp_install.log # Database if [ $DB_version == 1 ];then From 9f7b5ada431e6e2ecec6ce7711086f6f8f5f4754 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 10:58:00 +0800 Subject: [PATCH 166/617] mariadb dir erro --- README.md | 2 +- conf/index.html | 2 +- functions/mariadb-5.5.sh | 2 +- functions/redis.sh | 2 +- functions/tcmalloc.sh | 2 +- lnmp_install.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0fec1a6f..8c24410a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to install ngx_pagespeed -- According to their needs can to optimize MySQL,Nginx and Redis with tcmalloc +- According to their needs can to optimize MySQL and Nginx with tcmalloc - Add a virtual host script provided ## How to use diff --git a/conf/index.html b/conf/index.html index dbe35218..1b3a8775 100644 --- a/conf/index.html +++ b/conf/index.html @@ -24,7 +24,7 @@

Congratulations, lnmp安装成功!

-

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin,添加虚拟主机请执行/root/lnmp/vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Ubuntu 12+

+

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Ubuntu 12+

Github地址:https://github.com/lj2007331/lnmp

查看本地环境:探针 phpinfo FTP Manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 2dde22ca..4e795fc3 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -127,5 +127,5 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf service mysqld stop -[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe +[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe } diff --git a/functions/redis.sh b/functions/redis.sh index bd684de1..56019f0d 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -33,7 +33,7 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings fi -[ "$tcmalloc_yn" == 'y' ] && make USE_TCMALLOC=yes FORCE_LIBC_MALLOC=yes || make +make if [ -f "src/redis-server" ];then mkdir -p $redis_install_dir/{bin,etc,var} diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 666f9c77..533fe4c0 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -1,5 +1,5 @@ #!/bin/bash -TCMalloc() +Install_TCMalloc() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/lnmp_install.sh b/lnmp_install.sh index 5ade8fa7..cb99765f 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -219,7 +219,7 @@ OS_command # tcmalloc . functions/tcmalloc.sh -[ "$tcmalloc_yn" == 'y' ] && TCMalloc | tee -a $lnmp_dir/lnmp_install.log +[ "$tcmalloc_yn" == 'y' ] && Install_TCMalloc | tee -a $lnmp_dir/lnmp_install.log # Database if [ $DB_version == 1 ];then From 869cd20b6fca02468c62a12b22225d52305938fc Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 11:00:57 +0800 Subject: [PATCH 167/617] update redis-2.6.16 --- functions/redis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 56019f0d..5d1602c1 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.3.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.6.15.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.6.16.tar.gz && Download_src tar xzf redis-2.2.3.tgz cd redis-2.2.3 @@ -26,8 +26,8 @@ else fi cd .. -tar xzf redis-2.6.15.tar.gz -cd redis-2.6.15 +tar xzf redis-2.6.16.tar.gz +cd redis-2.6.16 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings From 95ae89ec402dd0cd343e1ddc7a9e2a50f03468e4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 11:58:34 +0800 Subject: [PATCH 168/617] not a valid identifier --- functions/eaccelerator-0.9.sh | 2 +- functions/eaccelerator-1.0-dev.sh | 2 +- functions/mariadb-5.5.sh | 2 +- functions/mysql-5.5.sh | 2 +- functions/mysql-5.6.sh | 2 +- functions/nginx.sh | 5 +++-- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/pureftpd.sh | 2 +- functions/redis.sh | 2 +- init/init_CentOS.sh | 2 +- lnmp_install.sh | 20 ++++++++++---------- 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/functions/eaccelerator-0.9.sh b/functions/eaccelerator-0.9.sh index 095047ba..70ce7a2a 100755 --- a/functions/eaccelerator-0.9.sh +++ b/functions/eaccelerator-0.9.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_eAccelerator-0.9() +Install_eAccelerator-0-9() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh index a17cb1bc..80f2c4df 100755 --- a/functions/eaccelerator-1.0-dev.sh +++ b/functions/eaccelerator-1.0-dev.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_eAccelerator-1.0-dev() +Install_eAccelerator-1-0-dev() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 4e795fc3..64d2ab53 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_MariaDB-5.5() +Install_MariaDB-5-5() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 8b787e6c..0904b4cb 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -1,7 +1,7 @@ #!/bin/bash # Author: yeho # Blog: http://blog.linuxeye.com -Install_MySQL-5.5() +Install_MySQL-5-5() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 2afecc02..df1b8450 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_MySQL-5.6() +Install_MySQL-5-6() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/nginx.sh b/functions/nginx.sh index bd7cb402..9aa6d887 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -22,8 +22,9 @@ tar xzf nginx-1.4.2.tar.gz cd nginx-1.4.2 # Modify Nginx version -sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@g' src/core/nginx.h -sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@g' src/core/nginx.h +sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h +sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h +sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c if [ "Stcmalloc_yn" == 'y' ];then ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 6d9e494f..178f7c37 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_PHP-5.3() +Install_PHP-5-3() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 03f453b0..c3b4bf61 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_PHP-5.4() +Install_PHP-5-4() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index e4fb1477..b55e7704 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_PHP-5.5() +Install_PHP-5-5() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index 8f85a6aa..a23051a8 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_Pureftpd() +Install_PureFTPd() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/functions/redis.sh b/functions/redis.sh index 5d1602c1..dfa78a02 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com -Install_Redis() +Install_redis() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 25d57fe1..2d91f9c0 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -18,7 +18,7 @@ if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then fi # Remove obsolete rpm package -if [ -z "$(cat /etc/redhat-release | grep '5\.')" ];then +if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" else yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "Ruby Support" "X Window System" "Printing client" "Desktop*" diff --git a/lnmp_install.sh b/lnmp_install.sh index cb99765f..39c01c3b 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -225,15 +225,15 @@ OS_command if [ $DB_version == 1 ];then cd $lnmp_dir . functions/mysql-5.6.sh - Install_MySQL-5.6 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_MySQL-5-6 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $DB_version == 2 ];then cd $lnmp_dir . functions/mysql-5.5.sh - Install_MySQL-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_MySQL-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $DB_version == 3 ];then cd $lnmp_dir . functions/mariadb-5.5.sh - Install_MariaDB-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log else echo -e "\033[31mdatabase install failed, Please contact the author! \033[0m" kill -9 $$ @@ -245,13 +245,13 @@ fi # PHP if [ $PHP_version == 1 ];then . functions/php-5.5.sh - Install_PHP-5.5 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_PHP-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $PHP_version == 2 ];then . functions/php-5.4.sh - Install_PHP-5.4 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_PHP-5-4 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $PHP_version == 3 ];then . functions/php-5.3.sh - Install_PHP-5.3 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/lnmp_install.log else echo -e "\033[31mPHP install failed, Please contact the author! \033[0m" kill -9 $$ @@ -263,10 +263,10 @@ if [ $PHP_cache == 1 ];then Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $PHP_cache == 2 -a $PHP_version == 2 ];then . functions/eaccelerator-1.0-dev.sh - Install_eAccelerator-1.0-dev 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_eAccelerator-1-0-dev 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $PHP_cache == 2 -a $PHP_version == 3 ];then . functions/eaccelerator-0.9.sh - Install_eAccelerator-0.9 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ ! -d "$nginx_install_dir" ];then @@ -279,7 +279,7 @@ fi if [ "$FTP_yn" == 'y' ];then . functions/pureftpd.sh - Install_Pureftpd 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_PureFTPd 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ "$phpMyAdmin_yn" == 'y' ];then @@ -289,7 +289,7 @@ fi if [ "$redis_yn" == 'y' ];then . functions/redis.sh - Install_Redis 2>&1 | tee -a $lnmp_dir/lnmp_install.log + Install_redis 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ "$memcached_yn" == 'y' ];then From eacd7f7eecf15be9cc94811cd254599371d9f534 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 12:21:06 +0800 Subject: [PATCH 169/617] null --- init/.init_CentOS.sh.swp | Bin 0 -> 16384 bytes lnmp_install.sh | 5 +---- options.conf | 16 +++++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 init/.init_CentOS.sh.swp diff --git a/init/.init_CentOS.sh.swp b/init/.init_CentOS.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..e3afacaefecd6baf3fa0caf2f7f0d6f77b8017ed GIT binary patch literal 16384 zcmeHOTWlOx8J?yo5ZZD{5fT-xPR351xS5&V^`&N0S9a}n;?}o%?YONsSV9=JRpctCA=sZ@awLa2y>xCo>cmG7V1uGdb| z79NT;>wG(NZvQ#wJGcM;&!(0;H#^VnlM4bq9}tA!eTXgJ^ocu!mmU@b&v62ZzR|}t zMm|=M@HkCt2)K)V6iOw%^Qfxk~0P}2Hq9}w+lms ze2$9tiO1L-M_1pLl&nz3K*m7EK*m7EK*m7EK*m7EK*qrTCj)_dNO%fOKNL5=8b5F9 zdA<>U&c*Q?J?U{Udt?k`3}g&s3}g&s3}g&s3}g&s3}g&s3}g&s47>vwP<26AL%aS= z20!lq6Z`+~?-zu>0e=LZ1Fiy}227w1tNZ#@C@)tpae_+ceT*MNTjPXSK?Hc$j+Z$X=ZQ@}02Uk?ky zuYsQf-v_=2JPmvXcmfcBH*OY$zW^@*UkAPhd=WSYi~)B8hXDcjH=Hc511|y|a0#db zB5*Ts2%vFzHF3V6*#G#`#}poDir@CNz?3z|t_uR!nhqQA+jgMtFvlKX4?Ga%+A=Ip z6MU{S$zY;Cp_+#3Giz(SazY-goa_qcD|VE)WsIZLgvgZew;pm$^_!5<$C6|rkvA}` zGPM;nS^V+%rIz8LuJGfkRy9yfvt5vVhw0pIkB_jHZ93X!H83nbo*&B%M6E%HlYFqOhyTM%5_qQESXLVzXGb-jYl7LE3+z0uFP+FW3Y!xZo+u|N8psTxrw z=$~p*R|U^vl2`AIjbu{>l7e-|#Qqaa#}9}E8s{gNy1mH;F1wy#2dqDTW#FX9j*T-h zU${@s;V+MNvU~1foq2H~O^PQ*8pc>|B*HgXB~KHB<{!oR=x0|TnucP_G%O=vQu!!=PaL5K3n9!N+)D4qIIfX&yJN2M9F3RV6j@FZ{D=Hk!cr<;kwLBwe zD`7+YWLRlblf`pDj(8P`e8+XXfGsUA&M&Q0rxxeuCl{v22QD+qZ;V&KwBZMi*JgR} ze3^M%)!7bfpJw42tn}mU%E{9$Oh(GQ-E>sTIGLuN(A9vmig@qw$E4$ybX;f0&lZo* z7mt@K;>lvApUM?08}7DV*-#KholL@qMY5P`F_LyAq%^>9uPW)_R5s+wMpPeO<5o)H zk_lAH9f*cu&zg?Mf52BRoSiMNlxH6=jmv}mN*c)La!RsBy>OtwU_yXz>~fauJxk^M zxL8@Q@b#hlP7mj-%K7yuRER>A)}F+PN|QwqBXRm#7^H&dE0z8@aVSa@I~y8?oaPIf zff@yYes#t!r5h4DV(3Nc0vy zy5Xxelk15TpPPo=+EHlxH5#Zt;8@L`##s)Mr%cD^EG|p3y)6StKDTvCHB3wzKTy3u z(3+c(fKHNQcf}emT54j;+Y^g@(sUY#V|~%@?Ud!Sr8zdzRnXg)hmCe6`+ig3E7Rry zw%N_Sk%o7vrkbjartfKhhON1$yd;@e7Ck$U*y*2$ZHS4?sn^9T7)++n+)b0IEPgb2 zTB#W}HppwFCcEK5ML~Kh4Rf;H!p_;o2!m(SWDQLtNZP&kGE3d$bZR-oJTr~jMVB{{ zr=;^OZc@m_;S)XLxVp!A&~`aXUOIVqEVDqF=^4lFBFN|~4ma?MHqduhOd*U(%G7oZ zx4^>hIFF5e%*XJ@&o~y5CZn%7%nNlN%c9}4^es-=^lBsVD{3}$n_7uS9OvM8@_m!V z&o~xQRZ~~pFnZ5RS22p0G}FNEJuy2WCyad$}dmuXg;#tyiX;Tho5Z5+YoSQA;+)i_Z0>YryL?$UM6TL9cwYn;W zQgS3N+VGr~>v7A0`XbJ(EI}_IEk$JF5)M#k5amba*tCjuu42oG7`;Yf#4Zx&+j|OK zD?Syr#%rBw7wdJ}i^?qn2a$?(yyQ80OACxGoR|>4+^V&a>e3;I;G=BKuytpfl|$`} znnqfMf#s3PpXUB%;JAaLz)hdOiLS5koj{@v>lnCzd)R#-II75JGo%k(k0#_@;M;yD z&t5{145f=LkT#Tx*~7uKp_(n1Ekv6h^`+C{dD@`UV#EgIMWiV`RF$0;_#+O_89H~6 zZ$Dd)vNAN9ZRmV#n)VjQwXhVBHKnmrHK~g;YRxk=pOuIgC~%k*)7Tw7qt*%x#}>Qw z(*6@&imBdI1IgniS5YL3*qFx*SbJrv`NwM^^W=4OQuI*3u5CshH=&k?jVw zSV?2eAaIL{Vi}(2c)pw;9fDG2DRPsWt`Z$W(u1g2q7?dNxDc8E__DTGS9+MXFQQu8 zO!I4cq)}q|gqeL922r2I4OywTY|K>0_7ya&YPePKs>*Jg_0KLr`KHA^wSd(fDdEw2 z1tT_W7Zb;DXax=U6Bqc7X0~)b(U-i$N)FW;T2%2_gRnFt56eS?0vaaEf~+74XShw3 zCdUh+aN1CgG{1oJo$c<_J25h1t{33vf`9{36H954*r4crAB1^xtE|2senumJK0lz<#S{(!^4 zFWw9P0q_uT82B-K0#5<6z+vEL@CEz`_#yC3;2XeI;A!9!zyR<(d;s4Do&`PyTmmiv z2Ji?#{(?8)3wQ7e-cI#bH$*$b9r6*gs55HFnCL!#?2A84ZC}_|{t_2E7jlM$B;cHY&ERrR43)ZG? zcwwDTP?G~E>RKgL4?S9#+oX_D2$~eokS$#9Jl06O`JUgP{>O#L}AINq7P0^ zDtgNkidqWAApW9GgduuKXH<_+&2(D2jQ`2kY}G<#E}gdNpzeQ>Xga06NkwC!Q04Jt z4PQHxH4H-eihLlcOC#}tkXMeJY_ltZG|Aw?mg=VCKvTQOmP-$nrdHtp@;EIUX&a4Y zhGw}E87ET9hVrL1Ltgh5by=XfOtN5ShMq_`C+In(z%vMOVMwaMwhq{6RME=n@&eUA zyRfv18n0J3IX)$<06vA$4)n-H@RJ1i+QIzx#0TT|-LDAm%OX1c~M^o(rWl zk{tC<5B;QL|E+*R;lLJHY;V=erMbzK()6iPd1dm!x!LmB()5Al4BQWNB@|PVnZ(v} z#oT$JxVXAPqa0C}M9wTOuT3sb_ryk|PA@Mm#rX!|eS~F(&3In5TPitX;10HoU6t$- zIJj5<|0u32V8h~RI|00Xu$5r-!7(AD+zhTrw#h4%95hkMZFsEVL}akOa72jQ8@x`9Qj`J~c+9j(lx-c443OP0y|3$YGk)9=InTdhxbYTxd`>g~W#!MyIu=h2=YniKQHnEF35tw5&#ThW8#q z?A9eeN|)7!3E>43ebFPf*eE9**?|W)60S|)BqGZ;vf{c6Pfo4Oo-4thzffMBE0yKJ ziJqA8uzx|&Ue8N~^AoZBE|O8xk=Vo0Y1G{0!Wr@uPlPWbx2vmVd39w*8WSfP`(@BK zxxz4RlyW)T5+*sZwN-=dD%NaU!xBcO1JZCy6QHq)$ literal 0 HcmV?d00001 diff --git a/lnmp_install.sh b/lnmp_install.sh index 39c01c3b..559d20a4 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -20,7 +20,7 @@ echo "#######################################################################" echo '' #get pwd -sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" options.conf +sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" ./options.conf # get ipv4 . functions/get_ipv4.sh @@ -223,15 +223,12 @@ OS_command # Database if [ $DB_version == 1 ];then - cd $lnmp_dir . functions/mysql-5.6.sh Install_MySQL-5-6 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $DB_version == 2 ];then - cd $lnmp_dir . functions/mysql-5.5.sh Install_MySQL-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log elif [ $DB_version == 3 ];then - cd $lnmp_dir . functions/mariadb-5.5.sh Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log else diff --git a/options.conf b/options.conf index cf840695..856ea6b2 100644 --- a/options.conf +++ b/options.conf @@ -1,9 +1,9 @@ # Operating environment for the current working directory # Операционная среда для, текущий рабочий каталог -# 运行环境为当前的工作目录 +# 运行环境为当前的工作目录,自动生成 lnmp_dir= -# install directory +# 预定义目录 nginx_install_dir=/usr/local/nginx mysql_install_dir=/usr/local/mysql @@ -33,15 +33,17 @@ home_dir=/home/wwwroot # Nginx生成日志存放目录,你可以自由指定 wwwlogs_dir=/home/wwwlogs -# +# 以下参数自动生成,不需要修改 +# 数据库安装路径,自动生成 db_install_dir= -# +# 数据库数据库目录,自动生成 db_data_dir= -# database password +# 数据库root密码,自动生成 dbrootpwd= -# + +# ftp web后台管理员密码,自动生成 ftpmanagerpwd= -# +# 连接ftpusers数据库密码,自动生成 conn_ftpusers_dbpwd= From 3e815063e238f36b8536fecf4c635e863ae26de0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 12:22:15 +0800 Subject: [PATCH 170/617] null --- init/.init_CentOS.sh.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 init/.init_CentOS.sh.swp diff --git a/init/.init_CentOS.sh.swp b/init/.init_CentOS.sh.swp deleted file mode 100644 index e3afacaefecd6baf3fa0caf2f7f0d6f77b8017ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOTWlOx8J?yo5ZZD{5fT-xPR351xS5&V^`&N0S9a}n;?}o%?YONsSV9=JRpctCA=sZ@awLa2y>xCo>cmG7V1uGdb| z79NT;>wG(NZvQ#wJGcM;&!(0;H#^VnlM4bq9}tA!eTXgJ^ocu!mmU@b&v62ZzR|}t zMm|=M@HkCt2)K)V6iOw%^Qfxk~0P}2Hq9}w+lms ze2$9tiO1L-M_1pLl&nz3K*m7EK*m7EK*m7EK*m7EK*qrTCj)_dNO%fOKNL5=8b5F9 zdA<>U&c*Q?J?U{Udt?k`3}g&s3}g&s3}g&s3}g&s3}g&s3}g&s47>vwP<26AL%aS= z20!lq6Z`+~?-zu>0e=LZ1Fiy}227w1tNZ#@C@)tpae_+ceT*MNTjPXSK?Hc$j+Z$X=ZQ@}02Uk?ky zuYsQf-v_=2JPmvXcmfcBH*OY$zW^@*UkAPhd=WSYi~)B8hXDcjH=Hc511|y|a0#db zB5*Ts2%vFzHF3V6*#G#`#}poDir@CNz?3z|t_uR!nhqQA+jgMtFvlKX4?Ga%+A=Ip z6MU{S$zY;Cp_+#3Giz(SazY-goa_qcD|VE)WsIZLgvgZew;pm$^_!5<$C6|rkvA}` zGPM;nS^V+%rIz8LuJGfkRy9yfvt5vVhw0pIkB_jHZ93X!H83nbo*&B%M6E%HlYFqOhyTM%5_qQESXLVzXGb-jYl7LE3+z0uFP+FW3Y!xZo+u|N8psTxrw z=$~p*R|U^vl2`AIjbu{>l7e-|#Qqaa#}9}E8s{gNy1mH;F1wy#2dqDTW#FX9j*T-h zU${@s;V+MNvU~1foq2H~O^PQ*8pc>|B*HgXB~KHB<{!oR=x0|TnucP_G%O=vQu!!=PaL5K3n9!N+)D4qIIfX&yJN2M9F3RV6j@FZ{D=Hk!cr<;kwLBwe zD`7+YWLRlblf`pDj(8P`e8+XXfGsUA&M&Q0rxxeuCl{v22QD+qZ;V&KwBZMi*JgR} ze3^M%)!7bfpJw42tn}mU%E{9$Oh(GQ-E>sTIGLuN(A9vmig@qw$E4$ybX;f0&lZo* z7mt@K;>lvApUM?08}7DV*-#KholL@qMY5P`F_LyAq%^>9uPW)_R5s+wMpPeO<5o)H zk_lAH9f*cu&zg?Mf52BRoSiMNlxH6=jmv}mN*c)La!RsBy>OtwU_yXz>~fauJxk^M zxL8@Q@b#hlP7mj-%K7yuRER>A)}F+PN|QwqBXRm#7^H&dE0z8@aVSa@I~y8?oaPIf zff@yYes#t!r5h4DV(3Nc0vy zy5Xxelk15TpPPo=+EHlxH5#Zt;8@L`##s)Mr%cD^EG|p3y)6StKDTvCHB3wzKTy3u z(3+c(fKHNQcf}emT54j;+Y^g@(sUY#V|~%@?Ud!Sr8zdzRnXg)hmCe6`+ig3E7Rry zw%N_Sk%o7vrkbjartfKhhON1$yd;@e7Ck$U*y*2$ZHS4?sn^9T7)++n+)b0IEPgb2 zTB#W}HppwFCcEK5ML~Kh4Rf;H!p_;o2!m(SWDQLtNZP&kGE3d$bZR-oJTr~jMVB{{ zr=;^OZc@m_;S)XLxVp!A&~`aXUOIVqEVDqF=^4lFBFN|~4ma?MHqduhOd*U(%G7oZ zx4^>hIFF5e%*XJ@&o~y5CZn%7%nNlN%c9}4^es-=^lBsVD{3}$n_7uS9OvM8@_m!V z&o~xQRZ~~pFnZ5RS22p0G}FNEJuy2WCyad$}dmuXg;#tyiX;Tho5Z5+YoSQA;+)i_Z0>YryL?$UM6TL9cwYn;W zQgS3N+VGr~>v7A0`XbJ(EI}_IEk$JF5)M#k5amba*tCjuu42oG7`;Yf#4Zx&+j|OK zD?Syr#%rBw7wdJ}i^?qn2a$?(yyQ80OACxGoR|>4+^V&a>e3;I;G=BKuytpfl|$`} znnqfMf#s3PpXUB%;JAaLz)hdOiLS5koj{@v>lnCzd)R#-II75JGo%k(k0#_@;M;yD z&t5{145f=LkT#Tx*~7uKp_(n1Ekv6h^`+C{dD@`UV#EgIMWiV`RF$0;_#+O_89H~6 zZ$Dd)vNAN9ZRmV#n)VjQwXhVBHKnmrHK~g;YRxk=pOuIgC~%k*)7Tw7qt*%x#}>Qw z(*6@&imBdI1IgniS5YL3*qFx*SbJrv`NwM^^W=4OQuI*3u5CshH=&k?jVw zSV?2eAaIL{Vi}(2c)pw;9fDG2DRPsWt`Z$W(u1g2q7?dNxDc8E__DTGS9+MXFQQu8 zO!I4cq)}q|gqeL922r2I4OywTY|K>0_7ya&YPePKs>*Jg_0KLr`KHA^wSd(fDdEw2 z1tT_W7Zb;DXax=U6Bqc7X0~)b(U-i$N)FW;T2%2_gRnFt56eS?0vaaEf~+74XShw3 zCdUh+aN1CgG{1oJo$c<_J25h1t{33vf`9{36H954*r4crAB1^xtE|2senumJK0lz<#S{(!^4 zFWw9P0q_uT82B-K0#5<6z+vEL@CEz`_#yC3;2XeI;A!9!zyR<(d;s4Do&`PyTmmiv z2Ji?#{(?8)3wQ7e-cI#bH$*$b9r6*gs55HFnCL!#?2A84ZC}_|{t_2E7jlM$B;cHY&ERrR43)ZG? zcwwDTP?G~E>RKgL4?S9#+oX_D2$~eokS$#9Jl06O`JUgP{>O#L}AINq7P0^ zDtgNkidqWAApW9GgduuKXH<_+&2(D2jQ`2kY}G<#E}gdNpzeQ>Xga06NkwC!Q04Jt z4PQHxH4H-eihLlcOC#}tkXMeJY_ltZG|Aw?mg=VCKvTQOmP-$nrdHtp@;EIUX&a4Y zhGw}E87ET9hVrL1Ltgh5by=XfOtN5ShMq_`C+In(z%vMOVMwaMwhq{6RME=n@&eUA zyRfv18n0J3IX)$<06vA$4)n-H@RJ1i+QIzx#0TT|-LDAm%OX1c~M^o(rWl zk{tC<5B;QL|E+*R;lLJHY;V=erMbzK()6iPd1dm!x!LmB()5Al4BQWNB@|PVnZ(v} z#oT$JxVXAPqa0C}M9wTOuT3sb_ryk|PA@Mm#rX!|eS~F(&3In5TPitX;10HoU6t$- zIJj5<|0u32V8h~RI|00Xu$5r-!7(AD+zhTrw#h4%95hkMZFsEVL}akOa72jQ8@x`9Qj`J~c+9j(lx-c443OP0y|3$YGk)9=InTdhxbYTxd`>g~W#!MyIu=h2=YniKQHnEF35tw5&#ThW8#q z?A9eeN|)7!3E>43ebFPf*eE9**?|W)60S|)BqGZ;vf{c6Pfo4Oo-4thzffMBE0yKJ ziJqA8uzx|&Ue8N~^AoZBE|O8xk=Vo0Y1G{0!Wr@uPlPWbx2vmVd39w*8WSfP`(@BK zxxz4RlyW)T5+*sZwN-=dD%NaU!xBcO1JZCy6QHq)$ From c5d4e3df8d74c37e3115ccd7c5b8fa47fd58c38e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 14:13:32 +0800 Subject: [PATCH 171/617] InnoDB: Error: pthread_create returned --- functions/nginx.sh | 2 +- functions/pureftpd.sh | 1 + init/init_CentOS.sh | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index 9aa6d887..d9375ce7 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -30,7 +30,6 @@ if [ "Stcmalloc_yn" == 'y' ];then ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc - sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' ../../conf/nginx.conf else ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module fi @@ -49,6 +48,7 @@ mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf +[ "Stcmalloc_yn" == 'y' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index a23051a8..5670a0ff 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -40,6 +40,7 @@ update-rc.d pureftpd defaults" sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/g' $pureftpd_install_dir/pureftpd-mysql.conf sed -i 's/conn_ftpusers_dbpwd/'$conn_ftpusers_dbpwd'/g' conf/script.mysql sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' conf/script.mysql + ulimit -s unlimited service mysqld restart $db_install_dir/bin/mysql -uroot -p$dbrootpwd < conf/script.mysql service pureftpd start diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 2d91f9c0..d7db9942 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -1,6 +1,5 @@ #!/bin/bash -cd /tmp wget -c http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz tar zxf yum-3.4.3.tar.gz cd yum-3.4.3 @@ -17,7 +16,8 @@ if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then yum makecache fi -# Remove obsolete rpm package +# closed Unnecessary services and remove obsolete rpm package +chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" else @@ -35,7 +35,6 @@ yum -y upgrade yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail # chkconfig -chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh chkconfig crond on chkconfig irqbalance on chkconfig network on From 0940856619feb43121e0101f33b4d61b2d40ea46 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 15:13:22 +0800 Subject: [PATCH 172/617] tcmalloc nginx --- functions/nginx.sh | 4 ++-- init/init_CentOS.sh | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index d9375ce7..bea47abf 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -26,7 +26,7 @@ sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/n sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c -if [ "Stcmalloc_yn" == 'y' ];then +if [ "$tcmalloc_yn" == 'y' ];then ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc @@ -48,7 +48,7 @@ mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf -[ "Stcmalloc_yn" == 'y' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf +[ "$tcmalloc_yn" == 'y' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index d7db9942..c9b2ab85 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -16,8 +16,6 @@ if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then yum makecache fi -# closed Unnecessary services and remove obsolete rpm package -chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" else @@ -34,14 +32,15 @@ yum -y upgrade # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail -# chkconfig +# closed Unnecessary services and remove obsolete rpm package +chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh +chkconfig sshd on chkconfig crond on chkconfig irqbalance on chkconfig network on -chkconfig sshd on -chkconfig rsyslog on #CentOS 6 -chkconfig syslog on #CentOS/RHEL 5 chkconfig iptables on +chkconfig rsyslog on #CentOS 6 +chkconfig syslog on #CentOS 5 chkconfig sendmail on service sendmail restart From 4cf8c2ce556cad495c98a6ad2e1f14c3278e6ba7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 16:32:17 +0800 Subject: [PATCH 173/617] Static load tcmalloc compile MySQL or MariaDB --- functions/mariadb-5.5.sh | 7 ++++++- functions/mysql-5.5.sh | 7 ++++++- functions/mysql-5.6.sh | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 64d2ab53..dcf1592f 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -21,12 +21,18 @@ make && make install cd .. tar zxf mariadb-5.5.32.tar.gz cd mariadb-5.5.32 +if [ "$tcmalloc_yn" == 'y' ];then + EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` +else + EXE_LINKER=\\ +fi cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mariadb_data_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ +$EXE_LINKER -DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ @@ -127,5 +133,4 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf service mysqld stop -[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe } diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 0904b4cb..875a61e3 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -20,12 +20,18 @@ make && make install cd .. tar zxf mysql-5.5.33.tar.gz cd mysql-5.5.33 +if [ "$tcmalloc_yn" == 'y' ];then + EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` +else + EXE_LINKER=\\ +fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ +$EXE_LINKER -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ @@ -122,5 +128,4 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf service mysqld stop -[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe } diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index df1b8450..e170c258 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -21,12 +21,18 @@ make && make install cd .. tar zxf mysql-5.6.13.tar.gz cd mysql-5.6.13 +if [ "$tcmalloc_yn" == 'y' ];then + EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` +else + EXE_LINKER=\\ +fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ +$EXE_LINKER -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ @@ -123,5 +129,4 @@ $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf sed -i "s@^db_data_dir.*@db_data_dir=$mysql_data_dir@" options.conf service mysqld stop -[ "$tcmalloc_yn" == 'y' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe } From af2a9babe61bde7fac11947ef62e4fd22ce36429 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 17:15:10 +0800 Subject: [PATCH 174/617] Static load tcmalloc compile MySQL or MariaDB --- functions/mariadb-5.5.sh | 8 ++++---- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index dcf1592f..43241b2d 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -22,9 +22,9 @@ cd .. tar zxf mariadb-5.5.32.tar.gz cd mariadb-5.5.32 if [ "$tcmalloc_yn" == 'y' ];then - EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else - EXE_LINKER=\\ + EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ @@ -32,7 +32,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -$EXE_LINKER -DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ @@ -46,7 +45,8 @@ $EXE_LINKER -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 +-DWITH_DEBUG=0 \ +$EXE_LINKER make && make install if [ -d "$mariadb_install_dir" ];then diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 875a61e3..ce5a77ac 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -21,9 +21,9 @@ cd .. tar zxf mysql-5.5.33.tar.gz cd mysql-5.5.33 if [ "$tcmalloc_yn" == 'y' ];then - EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else - EXE_LINKER=\\ + EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ @@ -31,7 +31,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -$EXE_LINKER -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ @@ -42,7 +41,8 @@ $EXE_LINKER -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 +-DWITH_DEBUG=0 \ +$EXE_LINKER make && make install if [ -d "$mysql_install_dir" ];then diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index e170c258..7d0f1cc7 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -22,9 +22,9 @@ cd .. tar zxf mysql-5.6.13.tar.gz cd mysql-5.6.13 if [ "$tcmalloc_yn" == 'y' ];then - EXE_LINKER=`echo -e '-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF \\'` + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else - EXE_LINKER=\\ + EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ @@ -32,7 +32,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -$EXE_LINKER -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ @@ -43,7 +42,8 @@ $EXE_LINKER -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 +-DWITH_DEBUG=0 \ +$EXE_LINKER make && make install if [ -d "$mysql_install_dir" ];then From 4b5877bd064506d830431a48482bdb289a26e092 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Aug 2013 22:09:59 +0800 Subject: [PATCH 175/617] add jemalloc --- README.md | 2 +- functions/jemalloc.sh | 24 ++++++++++++++++++++++++ functions/mariadb-5.5.sh | 4 +++- functions/mysql-5.5.sh | 4 +++- functions/mysql-5.6.sh | 4 +++- functions/nginx.sh | 11 +++++++---- functions/ngx_pagespeed.sh | 21 +++++++++++---------- functions/tcmalloc.sh | 5 ++++- init/init_Ubuntu.sh | 4 +++- lnmp_install.sh | 34 +++++++++++++++++++++++++++------- 10 files changed, 86 insertions(+), 27 deletions(-) create mode 100755 functions/jemalloc.sh diff --git a/README.md b/README.md index 8c24410a..83ef808c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to install ngx_pagespeed -- According to their needs can to optimize MySQL and Nginx with tcmalloc +- According to their needs can to optimize MySQL and Nginx with tcmalloc or jemalloc - Add a virtual host script provided ## How to use diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh new file mode 100755 index 00000000..b61e7f03 --- /dev/null +++ b/functions/jemalloc.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_jemalloc() +{ +cd $lnmp_dir/src +. ../functions/download.sh + +src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.4.0.tar.bz2 && Download_src + +tar xjf jemalloc-3.4.0.tar.bz2 +cd jemalloc-3.4.0 +./configure +make && make install +if [ -f "/usr/local/lib/libjemalloc.so" ];then + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig +else + echo -e "\033[31mjemalloc install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cd ../../ +} diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 43241b2d..fedd0e83 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -21,8 +21,10 @@ make && make install cd .. tar zxf mariadb-5.5.32.tar.gz cd mariadb-5.5.32 -if [ "$tcmalloc_yn" == 'y' ];then +if [ "$tc_je_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$tc_je_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index ce5a77ac..93272466 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -20,8 +20,10 @@ make && make install cd .. tar zxf mysql-5.5.33.tar.gz cd mysql-5.5.33 -if [ "$tcmalloc_yn" == 'y' ];then +if [ "$tc_je_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$tc_je_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 7d0f1cc7..0cdc91b9 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -21,8 +21,10 @@ make && make install cd .. tar zxf mysql-5.6.13.tar.gz cd mysql-5.6.13 -if [ "$tcmalloc_yn" == 'y' ];then +if [ "$tc_je_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$tc_je_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/nginx.sh b/functions/nginx.sh index bea47abf..3329ac76 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -26,14 +26,17 @@ sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/n sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c -if [ "$tcmalloc_yn" == 'y' ];then - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module +if [ "$tc_je_malloc" == '1' ];then + malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc +elif [ "$tc_je_malloc" == '2' ];then + malloc_module='--with-ld-opt="-ljemalloc"' else - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module + malloc_module= fi +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module $malloc_module make && make install cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n @@ -48,7 +51,7 @@ mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf -[ "$tcmalloc_yn" == 'y' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf +[ "$tc_je_malloc" == '1' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 94a7025e..df8e5966 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -16,18 +16,19 @@ unzip -q release-1.6.29.5-beta tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta cd nginx-1.4.2/ make clean + +if [ "$tc_je_malloc" == '1' ];then + malloc_module='--with-google_perftools_module' +elif [ "$tc_je_malloc" == '2' ];then + malloc_module='--with-ld-opt="-ljemalloc"' +else + malloc_module= +fi + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - if [ "$tcmalloc_yn" == 'y' ];then - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' - else - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' - fi + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module else - if [ "$tcmalloc_yn" == 'y' ];then - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-google_perftools_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' - else - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' - fi + ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module fi make diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 533fe4c0..5d645f5f 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -1,5 +1,8 @@ #!/bin/bash -Install_TCMalloc() +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_tcmalloc() { cd $lnmp_dir/src . ../functions/download.sh diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 82d515fc..636ef6f2 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -13,8 +13,10 @@ apt-get -y upgrade # Install needed packages apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev vim zip unzip tmux htop wget +apt-get -y install libxslt1-dev + if [ ! -z "`cat /etc/issue | grep 13`" ];then - apt-get -y install libxslt1-dev libcloog-ppl1 + apt-get -y install libcloog-ppl1 if [ ! -z "`cat /etc/issue | grep 12`" ];then apt-get -y install libxslt-dev libcloog-ppl0 fi diff --git a/lnmp_install.sh b/lnmp_install.sh index 559d20a4..9e5de1ac 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -194,14 +194,29 @@ do fi done -# check tcmalloc +# check tcmalloc or jemalloc while : do echo '' - read -p "Do you want to optimize the system with tcmalloc? (y/n) " tcmalloc_yn - if [ "$tcmalloc_yn" != 'y' ] && [ "$tcmalloc_yn" != 'n' ];then + read -p "Do you want to use tcmalloc or jemalloc optimize MySQL and Nginx? (y/n) " tc_je_malloc_yn + if [ "$tc_je_malloc_yn" != 'y' ] && [ "$tc_je_malloc_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else + if [ "$tc_je_malloc_yn" == 'y' ];then + echo 'Please select tcmalloc or jemalloc:' + echo -e "\t\033[32m1\033[0m. tcmalloc" + echo -e "\t\033[32m2\033[0m. jemalloc" + while : + do + read -p "Please input a number:(Default 1 press Enter) " tc_je_malloc + [ -z "$tc_je_malloc" ] && tc_je_malloc=1 + if [ $tc_je_malloc != 1 ] && [ $tc_je_malloc != 2 ];then + echo -e "\033[31minput error! Please input 1 2\033[0m" + else + break + fi + done + fi break fi done @@ -210,16 +225,21 @@ chmod +x functions/*.sh init/* *.sh # init . functions/check_os.sh -export IP upgrade_yn tcmalloc_yn +export IP upgrade_yn tc_je_malloc OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_CentOS.sh init/init_CentOS.ed' OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' OS_command -# tcmalloc -. functions/tcmalloc.sh -[ "$tcmalloc_yn" == 'y' ] && Install_TCMalloc | tee -a $lnmp_dir/lnmp_install.log +# tcmalloc or jemalloc +if [ "$tc_je_malloc_yn" == 'y' -a "$tc_je_malloc" == '1' ];then + . functions/tcmalloc.sh + Install_tcmalloc | tee -a $lnmp_dir/lnmp_install.log +elif [ "$tc_je_malloc_yn" == 'y' -a "$tc_je_malloc" == '2' ];then + . functions/jemalloc.sh + Install_jemalloc | tee -a $lnmp_dir/lnmp_install.log +fi # Database if [ $DB_version == 1 ];then From 573b9def189533d7e8dfd3e7199719044c3aefa9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 31 Aug 2013 10:16:14 +0800 Subject: [PATCH 176/617] zendopcache no found --- functions/zendopcache.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index aacbbf52..9e5be77f 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -9,9 +9,9 @@ cd $lnmp_dir/src . ../options.conf src_url=https://github.com/zendtech/ZendOptimizerPlus/tarball/master && Download_src -/bin/mv master zendtech-ZendOptimizerPlus-8eeb372.tar.gz -tar xzf zendtech-ZendOptimizerPlus-8eeb372.tar.gz -cd zendtech-ZendOptimizerPlus-8eeb372 +/bin/mv master zendtech-ZendOptimizerPlus.tar.gz +tar xzf zendtech-ZendOptimizerPlus.tar.gz +cd zendtech-ZendOptimizerPlus* make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config From 9a5690341f04f8145210ee52070d21db914569f7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 2 Sep 2013 22:54:49 +0800 Subject: [PATCH 177/617] update phpredis --- functions/redis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index dfa78a02..742579c4 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://pecl.php.net/get/redis-2.2.3.tgz && Download_src +src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src src_url=http://download.redis.io/releases/redis-2.6.16.tar.gz && Download_src -tar xzf redis-2.2.3.tgz -cd redis-2.2.3 +tar xzf redis-2.2.4.tgz +cd redis-2.2.4 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config From cc5be8f91901c7d855f3aa4d3a56f625470850c3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 3 Sep 2013 21:19:07 +0800 Subject: [PATCH 178/617] default jemalloc --- README.md | 2 +- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/nginx.sh | 8 ++++---- functions/ngx_pagespeed.sh | 6 +++--- lnmp_install.sh | 32 ++++++++++++++++---------------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 83ef808c..a50d8685 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to install ngx_pagespeed -- According to their needs can to optimize MySQL and Nginx with tcmalloc or jemalloc +- According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc - Add a virtual host script provided ## How to use diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index fedd0e83..760e076e 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -21,10 +21,10 @@ make && make install cd .. tar zxf mariadb-5.5.32.tar.gz cd mariadb-5.5.32 -if [ "$tc_je_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -elif [ "$tc_je_malloc" == '2' ];then +if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$je_tc_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 93272466..a6f493d7 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -20,10 +20,10 @@ make && make install cd .. tar zxf mysql-5.5.33.tar.gz cd mysql-5.5.33 -if [ "$tc_je_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -elif [ "$tc_je_malloc" == '2' ];then +if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$je_tc_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 0cdc91b9..91f91191 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -21,10 +21,10 @@ make && make install cd .. tar zxf mysql-5.6.13.tar.gz cd mysql-5.6.13 -if [ "$tc_je_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -elif [ "$tc_je_malloc" == '2' ];then +if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" +elif [ "$je_tc_malloc" == '2' ];then + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" else EXE_LINKER= fi diff --git a/functions/nginx.sh b/functions/nginx.sh index 3329ac76..f47ea7af 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -26,12 +26,12 @@ sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/n sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c -if [ "$tc_je_malloc" == '1' ];then +if [ "$je_tc_malloc" == '1' ];then + malloc_module='--with-ld-opt="-ljemalloc"' +elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc -elif [ "$tc_je_malloc" == '2' ];then - malloc_module='--with-ld-opt="-ljemalloc"' else malloc_module= fi @@ -51,7 +51,7 @@ mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf -[ "$tc_je_malloc" == '1' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index df8e5966..d9cf34c4 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,10 +17,10 @@ tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta cd nginx-1.4.2/ make clean -if [ "$tc_je_malloc" == '1' ];then - malloc_module='--with-google_perftools_module' -elif [ "$tc_je_malloc" == '2' ];then +if [ "$je_tc_malloc" == '1' ];then malloc_module='--with-ld-opt="-ljemalloc"' +elif [ "$je_tc_malloc" == '2' ];then + malloc_module='--with-google_perftools_module' else malloc_module= fi diff --git a/lnmp_install.sh b/lnmp_install.sh index 9e5de1ac..1ea93d57 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -194,23 +194,23 @@ do fi done -# check tcmalloc or jemalloc +# check jemalloc or tcmalloc while : do echo '' - read -p "Do you want to use tcmalloc or jemalloc optimize MySQL and Nginx? (y/n) " tc_je_malloc_yn - if [ "$tc_je_malloc_yn" != 'y' ] && [ "$tc_je_malloc_yn" != 'n' ];then + read -p "Do you want to use tcmalloc or jemalloc optimize MySQL and Nginx? (y/n) " je_tc_malloc_yn + if [ "$je_tc_malloc_yn" != 'y' ] && [ "$je_tc_malloc_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else - if [ "$tc_je_malloc_yn" == 'y' ];then - echo 'Please select tcmalloc or jemalloc:' - echo -e "\t\033[32m1\033[0m. tcmalloc" - echo -e "\t\033[32m2\033[0m. jemalloc" + if [ "$je_tc_malloc_yn" == 'y' ];then + echo 'Please select jemalloc or tcmalloc:' + echo -e "\t\033[32m1\033[0m. jemalloc" + echo -e "\t\033[32m2\033[0m. tcmalloc" while : do - read -p "Please input a number:(Default 1 press Enter) " tc_je_malloc - [ -z "$tc_je_malloc" ] && tc_je_malloc=1 - if [ $tc_je_malloc != 1 ] && [ $tc_je_malloc != 2 ];then + read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc + [ -z "$je_tc_malloc" ] && je_tc_malloc=1 + if [ $je_tc_malloc != 1 ] && [ $je_tc_malloc != 2 ];then echo -e "\033[31minput error! Please input 1 2\033[0m" else break @@ -225,20 +225,20 @@ chmod +x functions/*.sh init/* *.sh # init . functions/check_os.sh -export IP upgrade_yn tc_je_malloc +export IP upgrade_yn je_tc_malloc OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_CentOS.sh init/init_CentOS.ed' OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' OS_command -# tcmalloc or jemalloc -if [ "$tc_je_malloc_yn" == 'y' -a "$tc_je_malloc" == '1' ];then - . functions/tcmalloc.sh - Install_tcmalloc | tee -a $lnmp_dir/lnmp_install.log -elif [ "$tc_je_malloc_yn" == 'y' -a "$tc_je_malloc" == '2' ];then +# jemalloc or tcmalloc +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then . functions/jemalloc.sh Install_jemalloc | tee -a $lnmp_dir/lnmp_install.log +elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' ];then + . functions/tcmalloc.sh + Install_tcmalloc | tee -a $lnmp_dir/lnmp_install.log fi # Database From 27aa60c5021f327b1b5278140e0e578de7736af2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 4 Sep 2013 15:31:41 +0800 Subject: [PATCH 179/617] add Tengine --- README.md | 5 ++- functions/nginx.sh | 4 ++ functions/ngx_pagespeed.sh | 20 +++++++--- functions/tengine.sh | 80 ++++++++++++++++++++++++++++++++++++++ init/init_Ubuntu.sh | 8 ++-- lnmp_install.sh | 80 ++++++++++++++++++++++++-------------- options.conf | 7 ++++ 7 files changed, 161 insertions(+), 43 deletions(-) create mode 100755 functions/tengine.sh diff --git a/README.md b/README.md index a50d8685..0faf29a4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat and Ubuntu. + This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat and Ubuntu. Script features: - Constant updates @@ -6,10 +6,11 @@ - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) +- You can freely choose to install Nginx or Tengine +- According to their needs can to install ngx_pagespeed - According to their needs can to install ZendOPcache,eAccelerator (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis -- According to their needs can to install ngx_pagespeed - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc - Add a virtual host script provided diff --git a/functions/nginx.sh b/functions/nginx.sh index f47ea7af..7d1c5a66 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -86,5 +86,9 @@ postrotate endscript } EOF +sed -i "s@^web_install_dir.*@web_install_dir=$nginx_install_dir@" options.conf +sed -i "s@/usr/local/nginx@$nginx_install_dir@g" vhost.sh +sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh +sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh service nginx start } diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index d9cf34c4..6f4ac3a5 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -14,27 +14,35 @@ src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz && Download_src unzip -q release-1.6.29.5-beta tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta -cd nginx-1.4.2/ +[ "$Web_server" == '1' ] && cd nginx-1.4.2/ +[ "$Web_server" == '2' ] && cd tengine-1.5.1/ make clean if [ "$je_tc_malloc" == '1' ];then - malloc_module='--with-ld-opt="-ljemalloc"' + [ "$Web_server" == '1' ] && malloc_module='--with-ld-opt="-ljemalloc"' + [ "$Web_server" == '2' ] && malloc_module='--with-jemalloc' elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' else malloc_module= fi +if [ "$Web_server" == '2' ];then + tengine_options='--with-http_concat_module=shared --with-http_sysguard_module=shared' +else + tengine_options= +fi + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module + ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module $tengine_options else - ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module + ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module $tengine_options fi make if [ -f "objs/nginx" ];then - /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) - /bin/cp objs/nginx $nginx_install_dir/sbin/nginx + /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $web_install_dir/sbin/nginx kill -USR2 `cat /var/run/nginx.pid` kill -QUIT `cat /var/run/nginx.pid.oldbin` mkdir /var/ngx_pagespeed_cache diff --git a/functions/tengine.sh b/functions/tengine.sh new file mode 100755 index 00000000..b4b6c168 --- /dev/null +++ b/functions/tengine.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Tengine() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz && Download_src +src_url=http://tengine.taobao.org/download/tengine-1.5.1.tar.gz && Download_src + +tar xzf pcre-8.33.tar.gz +cd pcre-8.33 +./configure +make && make install +cd ../ + +tar xzf tengine-1.5.1.tar.gz +cd tengine-1.5.1 + +# Modify Tengine version +sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h + +# disabled debug +sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + +if [ "$je_tc_malloc" == '1' ];then + malloc_module='--with-jemalloc' +elif [ "$je_tc_malloc" == '2' ];then + malloc_module='--with-google_perftools_module' + mkdir /tmp/tcmalloc + chown -R www.www /tmp/tcmalloc +else + malloc_module= +fi + +./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module +make && make install +cd ../../ +OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n +chkconfig --add nginx \n +chkconfig nginx on' +OS_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n +update-rc.d nginx defaults' +OS_command +sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx + +mv $tengine_install_dir/conf/nginx.conf $tengine_install_dir/conf/nginx.conf_bk +sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf +/bin/cp conf/nginx.conf $tengine_install_dir/conf/nginx.conf +sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf + +# worker_cpu_affinity +sed -i "s@^worker_processes.*@worker_processes auto;\nworker_cpu_affinity auto;\ndso {\n\tload ngx_http_concat_module.so;\n\tload ngx_http_sysguard_module.so;\n}@" $tengine_install_dir/conf/nginx.conf + +# logrotate nginx log +cat > /etc/logrotate.d/nginx << EOF +$wwwlogs_dir/*.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate + [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` +endscript +} +EOF +sed -i "s@^web_install_dir.*@web_install_dir=$tengine_install_dir@" options.conf +sed -i "s@/usr/local/nginx@$tengine_install_dir@g" vhost.sh +sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh +sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh +service nginx start +} diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 636ef6f2..d582ce75 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -11,14 +11,12 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev vim zip unzip tmux htop wget - -apt-get -y install libxslt1-dev +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget if [ ! -z "`cat /etc/issue | grep 13`" ];then - apt-get -y install libcloog-ppl1 + apt-get -y install libcloog-ppl1 if [ ! -z "`cat /etc/issue | grep 12`" ];then - apt-get -y install libxslt-dev libcloog-ppl0 + apt-get -y install libcloog-ppl0 fi # PS1 diff --git a/lnmp_install.sh b/lnmp_install.sh index 1ea93d57..797a5a56 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.3 27-Aug-2013 lj2007331 AT gmail.com +# Version: 0.3 04-Sep-2013 lj2007331 AT gmail.com # Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ # # This script's project home is: @@ -40,6 +40,33 @@ do fi done +# choice Web server +if [ ! -d "$web_install_dir" ];then + while : + do + echo '' + echo 'Please select Web server:' + echo -e "\t\033[32m1\033[0m. Install Nginx" + echo -e "\t\033[32m2\033[0m. Install Tengine" + read -p "Please input a number:(Default 1 press Enter) " Web_server + [ -z "$Web_server" ] && Web_server=1 + if [ $Web_server != 1 ] && [ $Web_server != 2 ];then + echo -e "\033[31minput error! Please input 1 2\033[0m" + else + while : + do + read -p "Do you want to install ngx_pagespeed? (y/n) " ngx_pagespeed_yn + if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then + echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" + else + break + fi + done + break + fi + done +fi + # choice database if [ ! -d "$db_install_dir" ];then while : @@ -182,23 +209,11 @@ if [ ! -d "$memcached_install_dir" ];then done fi -# check ngx_pagespeed -while : -do - echo '' - read -p "Do you want to install ngx_pagespeed? (y/n) " ngx_pagespeed_yn - if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi -done - # check jemalloc or tcmalloc while : do echo '' - read -p "Do you want to use tcmalloc or jemalloc optimize MySQL and Nginx? (y/n) " je_tc_malloc_yn + read -p "Do you want to use jemalloc or tcmalloc optimize Web server and Database? (y/n) " je_tc_malloc_yn if [ "$je_tc_malloc_yn" != 'y' ] && [ "$je_tc_malloc_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -225,7 +240,7 @@ chmod +x functions/*.sh init/* *.sh # init . functions/check_os.sh -export IP upgrade_yn je_tc_malloc +export IP upgrade_yn Web_server je_tc_malloc OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n /bin/mv init/init_CentOS.sh init/init_CentOS.ed' OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n @@ -252,13 +267,10 @@ elif [ $DB_version == 3 ];then . functions/mariadb-5.5.sh Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log else - echo -e "\033[31mdatabase install failed, Please contact the author! \033[0m" + echo -e "\033[31mDatabase install failed, Please contact the author! \033[0m" kill -9 $$ fi -# get db_install_dir -. ./options.conf - # PHP if [ $PHP_version == 1 ];then . functions/php-5.5.sh @@ -286,12 +298,21 @@ elif [ $PHP_cache == 2 -a $PHP_version == 3 ];then Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi -if [ ! -d "$nginx_install_dir" ];then - . functions/nginx.sh - Install_Nginx 2>&1 | tee -a $lnmp_dir/lnmp_install.log - sed -i "s@/usr/local/nginx@$nginx_install_dir@g" vhost.sh - sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh - sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh +# Web server +if [ $Web_server == 1 ];then + . functions/nginx.sh + Install_Nginx 2>&1 | tee -a $lnmp_dir/lnmp_install.log +elif [ $Web_server == 2 ];then + . functions/tengine.sh + Install_Tengine 2>&1 | tee -a $lnmp_dir/lnmp_install.log +else + echo -e "\033[31mWeb server install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +if [ "$ngx_pagespeed_yn" == 'y' ];then + . functions/ngx_pagespeed.sh + Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi if [ "$FTP_yn" == 'y' ];then @@ -319,15 +340,14 @@ if [ ! -f "$home_dir/default/index.html" ];then TEST 2>&1 | tee -a $lnmp_dir/lnmp_install.log fi -if [ "$ngx_pagespeed_yn" == 'y' ];then - . functions/ngx_pagespeed.sh - Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi +# get db_install_dir and web_install_dir +. ./options.conf + echo "################Congratulations####################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo '' echo "The path of some dirs:" -echo -e "`printf "%-32s" "Nginx dir":`\033[32m$nginx_install_dir\033[0m" +echo -e "`printf "%-32s" "Web dir":`\033[32m$web_install_dir\033[0m" echo -e "`printf "%-32s" "PHP dir:"`\033[32m$php_install_dir\033[0m" echo -e "`printf "%-32s" "Database Install dir:"`\033[32m$db_install_dir\033[0m" echo -e "`printf "%-32s" "Database User:"`\033[32mroot\033[0m" diff --git a/options.conf b/options.conf index 856ea6b2..45b6095c 100644 --- a/options.conf +++ b/options.conf @@ -5,6 +5,7 @@ lnmp_dir= # 预定义目录 nginx_install_dir=/usr/local/nginx +tengine_install_dir=/usr/local/nginx mysql_install_dir=/usr/local/mysql mariadb_install_dir=/usr/local/mariadb @@ -17,6 +18,7 @@ memcached_install_dir=/usr/local/memcached redis_install_dir=/usr/local/redis +############################################################################# # Database data storage directory,You can freely specify # База данных для хранения данных каталога, вы можете свободно указать # 数据库数据存储目录,你可以自由指定 @@ -33,9 +35,14 @@ home_dir=/home/wwwroot # Nginx生成日志存放目录,你可以自由指定 wwwlogs_dir=/home/wwwlogs +############################################################################# # 以下参数自动生成,不需要修改 +# Web服务器安装目录,自动生成 +web_install_dir= + # 数据库安装路径,自动生成 db_install_dir= + # 数据库数据库目录,自动生成 db_data_dir= From 7fab032e95f4d627d21739963c18f94705474a23 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 5 Sep 2013 09:22:54 +0800 Subject: [PATCH 180/617] support Debian --- README.md | 4 +- conf/index.html | 5 +- functions/check_os.sh | 6 ++- functions/mariadb-5.5.sh | 2 +- functions/memcached.sh | 2 +- functions/mysql-5.5.sh | 2 +- functions/mysql-5.6.sh | 2 +- functions/nginx.sh | 4 +- functions/ngx_pagespeed.sh | 2 +- functions/php-5.3.sh | 4 +- functions/php-5.4.sh | 4 +- functions/php-5.5.sh | 4 +- functions/pureftpd.sh | 4 +- functions/redis.sh | 2 +- functions/tengine.sh | 2 +- init/init_CentOS.sh | 6 ++- init/init_Debian.sh | 101 +++++++++++++++++++++++++++++++++++++ init/init_Ubuntu.sh | 14 ++--- lnmp_install.sh | 23 +++++---- vhost.sh | 4 +- 20 files changed, 153 insertions(+), 44 deletions(-) create mode 100755 init/init_Debian.sh diff --git a/README.md b/README.md index 0faf29a4..a2072890 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat and Ubuntu. + This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat Debian and Ubuntu. Script features: - Constant updates @@ -18,7 +18,7 @@ ```bash yum -y install wget screen # for CentOS/Redhat - #apt-get -y install wget screen # for Ubuntu + #apt-get -y install wget screen # for Debian/Ubuntu wget http://blog.linuxeye.com/lnmp.tar.gz #or wget http://blog.linuxeye.com/lnmp-full.tar.gz # include source packages tar xzf lnmp.tar.gz diff --git a/conf/index.html b/conf/index.html index 1b3a8775..7780e0a8 100644 --- a/conf/index.html +++ b/conf/index.html @@ -24,14 +24,11 @@

Congratulations, lnmp安装成功!

-

LNMP最新源码一键安装脚本 Linux+Nginx+MySQL+MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Ubuntu 12+

- +

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Debian 6+、Ubuntu 12+

Github地址:https://github.com/lj2007331/lnmp

查看本地环境:探针 phpinfo FTP Manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

-

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

-
diff --git a/functions/check_os.sh b/functions/check_os.sh index b7f4a9ad..d4d07edc 100755 --- a/functions/check_os.sh +++ b/functions/check_os.sh @@ -4,6 +4,8 @@ if [ -f /etc/redhat-release ];then OS=CentOS +elif [ ! -z "`cat /etc/issue | grep Debian`" ];then + OS=Debian elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then OS=Ubuntu else @@ -15,8 +17,8 @@ OS_command() { if [ $OS == 'CentOS' ];then echo -e $OS_CentOS | bash - elif [ $OS == 'Ubuntu' ];then - echo -e $OS_Ubuntu | bash + elif [ $OS == 'Debian' -o $OS == 'Ubuntu' ];then + echo -e $OS_Debian_Ubuntu | bash else echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" kill -9 $$ diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 760e076e..e1004e47 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -63,7 +63,7 @@ fi chmod +x /etc/init.d/mysqld OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd ../../ diff --git a/functions/memcached.sh b/functions/memcached.sh index f39779b3..02449610 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -27,7 +27,7 @@ if [ -d "$memcached_install_dir" ];then OS_CentOS='/bin/cp ../init/Memcached-init-CentOS /etc/init.d/memcached \n chkconfig --add memcached \n chkconfig memcached on' - OS_Ubuntu='/bin/cp ../init/Memcached-init-Ubuntu /etc/init.d/memcached \n + OS_Debian_Ubuntu='/bin/cp ../init/Memcached-init-Ubuntu /etc/init.d/memcached \n update-rc.d memcached defaults' OS_command sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index a6f493d7..ddd416d0 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -58,7 +58,7 @@ fi chmod +x /etc/init.d/mysqld OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd ../../ diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 91f91191..97e52e8d 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -59,7 +59,7 @@ fi chmod +x /etc/init.d/mysqld OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' -OS_Ubuntu='update-rc.d mysqld defaults' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd ../../ diff --git a/functions/nginx.sh b/functions/nginx.sh index 7d1c5a66..f8b076a8 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -27,7 +27,7 @@ sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c if [ "$je_tc_malloc" == '1' ];then - malloc_module='--with-ld-opt="-ljemalloc"' + malloc_module="--with-ld-opt='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc @@ -42,7 +42,7 @@ cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n chkconfig nginx on' -OS_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n +OS_Debian_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n update-rc.d nginx defaults' OS_command sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 6f4ac3a5..b8b7dfad 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -19,7 +19,7 @@ tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta make clean if [ "$je_tc_malloc" == '1' ];then - [ "$Web_server" == '1' ] && malloc_module='--with-ld-opt="-ljemalloc"' + [ "$Web_server" == '1' ] && malloc_module="--with-ld-opt='-ljemalloc'" [ "$Web_server" == '2' ] && malloc_module='--with-jemalloc' elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 178f7c37..26756f69 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -64,7 +64,7 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n +OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n else \n ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n @@ -110,7 +110,7 @@ fi chmod +x /etc/init.d/php-fpm OS_CentOS='chkconfig --add php-fpm \n chkconfig php-fpm on' -OS_Ubuntu='update-rc.d php-fpm defaults' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index c3b4bf61..1ccfefb0 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -64,7 +64,7 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n +OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/ \n else \n @@ -112,7 +112,7 @@ fi chmod +x /etc/init.d/php-fpm OS_CentOS='chkconfig --add php-fpm \n chkconfig php-fpm on' -OS_Ubuntu='update-rc.d php-fpm defaults' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index b55e7704..5602314c 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -64,7 +64,7 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n +OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n else \n ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n @@ -110,7 +110,7 @@ fi chmod +x /etc/init.d/php-fpm OS_CentOS='chkconfig --add php-fpm \n chkconfig php-fpm on' -OS_Ubuntu='update-rc.d php-fpm defaults' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index 5670a0ff..ba05dd08 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -29,7 +29,7 @@ if [ -d "$pureftpd_install_dir" ];then chmod +x /etc/init.d/pureftpd OS_CentOS='chkconfig --add pureftpd \n chkconfig pureftpd on' - OS_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n + OS_Debian_Ubuntu="sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd \n update-rc.d pureftpd defaults" OS_command @@ -62,7 +62,7 @@ update-rc.d pureftpd defaults" iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT OS_CentOS='service iptables save' - OS_Ubuntu='iptables-save > /etc/iptables.up.rules' + OS_Debian_Ubuntu='iptables-save > /etc/iptables.up.rules' OS_command else cd ../../ diff --git a/functions/redis.sh b/functions/redis.sh index 742579c4..08226242 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -48,7 +48,7 @@ if [ -f "src/redis-server" ];then OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n chkconfig redis-server on' - OS_Ubuntu='useradd -M -s /sbin/nologin redis \n + OS_Debian_Ubuntu='useradd -M -s /sbin/nologin redis \n chown -R redis:redis $redis_install_dir/var/ \n /bin/cp init/Redis-server-init-Ubuntu /etc/init.d/redis-server \n update-rc.d redis-server defaults' diff --git a/functions/tengine.sh b/functions/tengine.sh index b4b6c168..c9e057a0 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -43,7 +43,7 @@ cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n chkconfig nginx on' -OS_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n +OS_Debian_Ubuntu='/bin/cp init/Nginx-init-Ubuntu /etc/init.d/nginx \n update-rc.d nginx defaults' OS_command sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c9b2ab85..c57aadab 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com wget -c http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz tar zxf yum-3.4.3.tar.gz @@ -57,7 +59,7 @@ echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\ # history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bashrc +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/vimrc # /etc/sysctl.conf diff --git a/init/init_Debian.sh b/init/init_Debian.sh new file mode 100755 index 00000000..4f008b60 --- /dev/null +++ b/init/init_Debian.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd + +apt-get -y update +# update packages +apt-get -y upgrade + +# check upgrade OS +[ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade + +# Install needed packages +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget locales libcloog-ppl0 + +# PS1 +echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc + +# history size +echo 'HISTSIZE=100' >> ~/.bashrc +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc + +# /etc/security/limits.conf +cat >> /etc/security/limits.conf <> /etc/rc.local + +# /etc/hosts +[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts + +# Set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +# Set OpenDNS +if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +cat > /etc/resolv.conf << EOF +nameserver 208.67.222.222 +nameserver 208.67.220.220 +EOF +fi + +# alias vi +sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +echo 'syntax on' >> /etc/vim/vimrc +sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc + +# /etc/sysctl.conf +cat >> /etc/sysctl.conf << EOF +net.ipv4.tcp_syncookies = 1 +fs.file-max=65535 +net.ipv4.tcp_tw_reuse = 1 +net.ipv4.tcp_tw_recycle = 1 +net.ipv4.ip_local_port_range = 1024 65000 +EOF +sysctl -p + +sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup +sed -i 's@^3:23:respawn@#3:23:respawn@' /etc/inittab +sed -i 's@^4:23:respawn@#4:23:respawn@' /etc/inittab +sed -i 's@^5:23:respawn@#5:23:respawn@' /etc/inittab +sed -i 's@^6:23:respawn@#6:23:respawn@' /etc/inittab +sed -i "s@^ctrlaltdel@#ctrlaltdel@" /etc/inittab +sed -i 's@^# en_US.UTF-8@en_US.UTF-8@' /etc/locale.gen +init q + +# Update time +ntpdate pool.ntp.org +echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +service cron restart + +# iptables +cat > /etc/iptables.up.rules << EOF +# Firewall configuration written by system-config-securitylevel +# Manual customization of this file is not recommended. +*filter +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:syn-flood - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood +-A INPUT -j REJECT --reject-with icmp-host-prohibited +-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN +-A syn-flood -j REJECT --reject-with icmp-port-unreachable +COMMIT +EOF +iptables-restore < /etc/iptables.up.rules + +. ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index d582ce75..ae927996 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd @@ -11,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-2.0-5 libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget if [ ! -z "`cat /etc/issue | grep 13`" ];then apt-get -y install libcloog-ppl1 @@ -20,11 +22,11 @@ if [ ! -z "`cat /etc/issue | grep 12`" ];then fi # PS1 -echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /root/.bashrc +echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history size -sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' /root/.bashrc -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> /root/.bashrc +sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc +echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/sysctl.conf << EOF @@ -96,4 +98,4 @@ COMMIT EOF iptables-restore < /etc/iptables.up.rules -. /root/.bashrc +. ~/.bashrc diff --git a/lnmp_install.sh b/lnmp_install.sh index 797a5a56..2807774e 100755 --- a/lnmp_install.sh +++ b/lnmp_install.sh @@ -3,7 +3,7 @@ # Blog: http://blog.linuxeye.com # # Version: 0.3 04-Sep-2013 lj2007331 AT gmail.com -# Notes: LNMP for CentOS/RadHat 5+ and Ubuntu 12+ +# Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: # https://github.com/lj2007331/lnmp @@ -14,7 +14,7 @@ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" echo "# For more information Please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' @@ -55,7 +55,7 @@ if [ ! -d "$web_install_dir" ];then else while : do - read -p "Do you want to install ngx_pagespeed? (y/n) " ngx_pagespeed_yn + read -p "Do you want to install ngx_pagespeed module? (y/n) " ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" else @@ -239,13 +239,18 @@ done chmod +x functions/*.sh init/* *.sh # init -. functions/check_os.sh export IP upgrade_yn Web_server je_tc_malloc -OS_CentOS='init/init_CentOS.sh 2>&1 | tee -a lnmp_install.log \n -/bin/mv init/init_CentOS.sh init/init_CentOS.ed' -OS_Ubuntu='init/init_Ubuntu.sh 2>&1 | tee -a lnmp_install.log \n -/bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed' -OS_command +. functions/check_os.sh +if [ "$OS" == 'CentOS' ];then + ./init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log + /bin/mv init/init_CentOS.sh init/init_CentOS.ed +elif [ "$OS" == 'Debian' ];then + ./init/init_Debian.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log + /bin/mv init/init_Debian.sh init/init_Debian.ed +elif [ "$OS" == 'Ubuntu' ];then + ./init/init_Ubuntu.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log + /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed +fi # jemalloc or tcmalloc if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then diff --git a/vhost.sh b/vhost.sh index 96a19c2f..5dd7be9b 100755 --- a/vhost.sh +++ b/vhost.sh @@ -6,7 +6,7 @@ [ $(id -u) != "0" ] && echo "Error: You must be root to run this script, please use root to create vhost" && exit 1 echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ and Ubuntu 12+ #" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" echo "# For more information please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' @@ -201,7 +201,7 @@ echo "Restart Nginx......" /usr/local/nginx/sbin/nginx -s reload echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5/6 #" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" echo "# For more information please visit http://blog.linuxeye.com/31.html #" echo "#######################################################################" echo '' From bee258c35b10f125271ffe87eb095a689abdfe53 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 5 Sep 2013 09:44:29 +0800 Subject: [PATCH 181/617] init debian alias --- init/init_Debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 4f008b60..e75824c2 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -50,6 +50,7 @@ fi sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc echo 'syntax on' >> /etc/vim/vimrc sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc +sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf cat >> /etc/sysctl.conf << EOF From 3c3877c0e1f4230a4a3240ddb2633b18f2a05da7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 5 Sep 2013 17:14:06 +0800 Subject: [PATCH 182/617] chown redis error --- README.md | 1 - functions/nginx.sh | 6 +++--- functions/redis.sh | 4 ++-- functions/tengine.sh | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a2072890..90538cfb 100644 --- a/README.md +++ b/README.md @@ -39,4 +39,3 @@ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
- [odvps](http://odvps.ml) diff --git a/functions/nginx.sh b/functions/nginx.sh index f8b076a8..c79dc78b 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -22,9 +22,9 @@ tar xzf nginx-1.4.2.tar.gz cd nginx-1.4.2 # Modify Nginx version -sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h -sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h -sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c +#sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h +#sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h +#sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c if [ "$je_tc_malloc" == '1' ];then malloc_module="--with-ld-opt='-ljemalloc'" diff --git a/functions/redis.sh b/functions/redis.sh index 08226242..eebd42c1 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -48,10 +48,10 @@ if [ -f "src/redis-server" ];then OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n chkconfig redis-server on' - OS_Debian_Ubuntu='useradd -M -s /sbin/nologin redis \n + OS_Debian_Ubuntu="useradd -M -s /sbin/nologin redis \n chown -R redis:redis $redis_install_dir/var/ \n /bin/cp init/Redis-server-init-Ubuntu /etc/init.d/redis-server \n -update-rc.d redis-server defaults' +update-rc.d redis-server defaults" OS_command sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf diff --git a/functions/tengine.sh b/functions/tengine.sh index c9e057a0..6bc34027 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -22,7 +22,7 @@ tar xzf tengine-1.5.1.tar.gz cd tengine-1.5.1 # Modify Tengine version -sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h +#sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h # disabled debug sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc From 7209ce2611b75e7c465c028163e1f6a1d0e0802f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 7 Sep 2013 17:33:09 +0800 Subject: [PATCH 183/617] update phpmyadmin to 4.0.6 --- README.md | 4 +- conf/index.html | 4 +- functions/mariadb-5.5.sh | 2 - functions/memcached.sh | 6 +- functions/mysql-5.5.sh | 2 - functions/mysql-5.6.sh | 2 - functions/nginx.sh | 13 +- functions/ngx_pagespeed.sh | 8 +- functions/php-5.3.sh | 13 +- functions/php-5.4.sh | 13 +- functions/php-5.5.sh | 13 +- functions/phpmyadmin.sh | 6 +- functions/redis.sh | 2 +- functions/tengine.sh | 12 +- init/init_CentOS.sh | 4 +- install.sh | 405 +++++++++++++++++++++++++++++++++++++ vhost.sh | 24 +-- 17 files changed, 467 insertions(+), 66 deletions(-) create mode 100755 install.sh diff --git a/README.md b/README.md index 90538cfb..8e84ce5f 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,12 @@ #or wget http://blog.linuxeye.com/lnmp-full.tar.gz # include source packages tar xzf lnmp.tar.gz cd lnmp - chmod +x lnmp_install.sh + chmod +x install.sh # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. # Если сеть не работает, вы можете выполнять команды `srceen -r lnmp` сети подключить установку окна. # 如果网路出现中断,可以执行命令`srceen -r lnmp`重新连接安装窗口 screen -S lnmp - ./lnmp_install.sh + ./install.sh ``` ## How to add a virtual host diff --git a/conf/index.html b/conf/index.html index 7780e0a8..8413ca6d 100644 --- a/conf/index.html +++ b/conf/index.html @@ -23,8 +23,8 @@

-

Congratulations, lnmp安装成功!

-

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RadHat 5+、Debian 6+、Ubuntu 12+

+

Congratulations, LNMP安装成功!

+

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RedHat 5+、Debian 6+、Ubuntu 12+

Github地址:https://github.com/lj2007331/lnmp

查看本地环境:探针 phpinfo FTP Manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index e1004e47..28cc68b5 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -25,8 +25,6 @@ if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -else - EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ diff --git a/functions/memcached.sh b/functions/memcached.sh index 02449610..2d6431f6 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -43,13 +43,14 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install +cd .. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini service php-fpm restart else echo -e "\033[31mPHP memcache module install failed, Please contact the author! \033[0m" fi -cd .. + # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 @@ -71,6 +72,7 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install +cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini service php-fpm restart @@ -78,5 +80,5 @@ else echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" fi -cd ../../ +cd ../ } diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index ddd416d0..ec6ed394 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -24,8 +24,6 @@ if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -else - EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 97e52e8d..043e4a79 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -25,8 +25,6 @@ if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" -else - EXE_LINKER= fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ diff --git a/functions/nginx.sh b/functions/nginx.sh index c79dc78b..9341104f 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -19,6 +19,7 @@ make && make install cd ../ tar xzf nginx-1.4.2.tar.gz +useradd -M -s /sbin/nologin www cd nginx-1.4.2 # Modify Nginx version @@ -26,18 +27,25 @@ cd nginx-1.4.2 #sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h #sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c +# close debug +sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + if [ "$je_tc_malloc" == '1' ];then malloc_module="--with-ld-opt='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc -else - malloc_module= fi ./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module $malloc_module make && make install +if [ -d "$nginx_install_dir" ];then + echo -e "\033[32mNginx install successfully! \033[0m" +else + echo -e "\033[31mNginx install failed, Please Contact the author! \033[0m" + kill -9 $$ +fi cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n @@ -90,5 +98,6 @@ sed -i "s@^web_install_dir.*@web_install_dir=$nginx_install_dir@" options.conf sed -i "s@/usr/local/nginx@$nginx_install_dir@g" vhost.sh sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh +ldconfig service nginx start } diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index b8b7dfad..e41d9ca4 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -23,15 +23,9 @@ if [ "$je_tc_malloc" == '1' ];then [ "$Web_server" == '2' ] && malloc_module='--with-jemalloc' elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' -else - malloc_module= fi -if [ "$Web_server" == '2' ];then - tengine_options='--with-http_concat_module=shared --with-http_sysguard_module=shared' -else - tengine_options= -fi +[ "$Web_server" == '2' ] && tengine_options='--with-http_concat_module=shared --with-http_sysguard_module=shared' if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module $tengine_options diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 26756f69..9cb68c9f 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -48,12 +48,8 @@ make && make install cd ../ # linked library -cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < /etc/ld.so.conf.d/local.conf +[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -81,9 +77,10 @@ cd ../ tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.27 +make clean +[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo $php_mysql_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 1ccfefb0..70045d75 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -48,12 +48,8 @@ make && make install cd ../ # linked library -cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < /etc/ld.so.conf.d/local.conf +[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -83,9 +79,10 @@ cd ../ tar xzf php-5.4.19.tar.gz useradd -M -s /sbin/nologin www cd php-5.4.19 +make clean +[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo $php_mysql_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 5602314c..e9068b44 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -48,12 +48,8 @@ make && make install cd ../ # linked library -cat > /etc/ld.so.conf.d/local.conf < /etc/ld.so.conf.d/mysql.conf < /etc/ld.so.conf.d/local.conf +[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -81,9 +77,10 @@ cd ../ tar xzf php-5.5.3.tar.gz useradd -M -s /sbin/nologin www cd php-5.5.3 +make clean +[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo $php_mysql_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index eac08ca9..9d102712 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.5/phpMyAdmin-4.0.5-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.6/phpMyAdmin-4.0.6-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.0.5-all-languages.tar.gz -/bin/mv phpMyAdmin-4.0.5-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.0.6-all-languages.tar.gz +/bin/mv phpMyAdmin-4.0.6-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } diff --git a/functions/redis.sh b/functions/redis.sh index eebd42c1..9f383215 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -18,13 +18,13 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install +cd .. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini service php-fpm restart else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -cd .. tar xzf redis-2.6.16.tar.gz cd redis-2.6.16 diff --git a/functions/tengine.sh b/functions/tengine.sh index 6bc34027..bb2f9fc0 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -19,12 +19,13 @@ make && make install cd ../ tar xzf tengine-1.5.1.tar.gz +useradd -M -s /sbin/nologin www cd tengine-1.5.1 # Modify Tengine version #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h -# disabled debug +# close debug sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc if [ "$je_tc_malloc" == '1' ];then @@ -33,12 +34,16 @@ elif [ "$je_tc_malloc" == '2' ];then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R www.www /tmp/tcmalloc -else - malloc_module= fi ./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module make && make install +if [ -d "$tengine_install_dir" ];then + echo -e "\033[32mTengine install successfully! \033[0m" +else + echo -e "\033[31mTengine install failed, Please Contact the author! \033[0m" + kill -9 $$ +fi cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n @@ -76,5 +81,6 @@ sed -i "s@^web_install_dir.*@web_install_dir=$tengine_install_dir@" options.conf sed -i "s@/usr/local/nginx@$tengine_install_dir@g" vhost.sh sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh +ldconfig service nginx start } diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c57aadab..cb575766 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -26,10 +26,10 @@ fi # update rpm packages yum check-update -yum -y upgrade +yum -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && yum -y update +[ "$upgrade_yn" == 'y' ] && yum -y upgrade # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..2c7a46d9 --- /dev/null +++ b/install.sh @@ -0,0 +1,405 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +# +# Version: 0.3 07-Sep-2013 lj2007331 AT gmail.com +# Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# This script's project home is: +# https://github.com/lj2007331/lnmp + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, Please use root to install lnmp" && kill -9 $$ + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +#get pwd +sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" ./options.conf + +# get ipv4 +. functions/get_ipv4.sh + +# Definition Directory +. ./options.conf +mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} + +# choice upgrade OS +while : +do + echo + read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn + if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && echo -e "\033[31mYour system is already upgraded! \033[0m" && upgrade_yn=n && break + break + fi +done + +# check Web server +while : +do + echo + read -p "Do you want to install Web server? [y/n]: " Web_yn + if [ "$Web_yn" != 'y' -a "$Web_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$Web_yn" == 'y' ];then + [ -d "$web_install_dir" ] && echo -e "\033[31mThe web service already installed! \033[0m" && Web_yn=n && break + while : + do + echo + echo 'Please select Web server:' + echo -e "\t\033[32m1\033[0m. Install Nginx" + echo -e "\t\033[32m2\033[0m. Install Tengine" + read -p "Please input a number:(Default 1 press Enter) " Web_server + [ -z "$Web_server" ] && Web_server=1 + if [ $Web_server != 1 -a $Web_server != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + while : + do + read -p "Do you want to install ngx_pagespeed module? [y/n]: " ngx_pagespeed_yn + if [ "$ngx_pagespeed_yn" != 'y' -a "$ngx_pagespeed_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + break + fi + done + fi + break + fi +done + +# choice database +while : +do + echo + read -p "Do you want to install Database? [y/n]: " DB_yn + if [ "$DB_yn" != 'y' -a "$DB_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$DB_yn" == 'y' ];then + [ -d "$db_install_dir" ] && echo -e "\033[31mThe database already installed! \033[0m" && DB_yn=n && break + while : + do + echo + echo 'Please select a version of the Database:' + echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" + echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" + echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" + read -p "Please input a number:(Default 1 press Enter) " DB_version + [ -z "$DB_version" ] && DB_version=1 + if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" + else + while : + do + read -p "Please input the root password of database: " dbrootpwd + (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" + done + break + fi + done + fi + break + fi +done + +# check PHP +while : +do + echo + read -p "Do you want to install PHP? [y/n]: " PHP_yn + if [ "$PHP_yn" != 'y' -a "$PHP_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$PHP_yn" == 'y' ];then + [ -d "$php_install_dir" ] && echo -e "\033[31mThe php already installed! \033[0m" && PHP_yn=n && break + while : + do + echo + echo 'Please select a version of the PHP:' + echo -e "\t\033[32m1\033[0m. Install php-5.5" + echo -e "\t\033[32m2\033[0m. Install php-5.4" + echo -e "\t\033[32m3\033[0m. Install php-5.3" + read -p "Please input a number:(Default 1 press Enter) " PHP_version + [ -z "$PHP_version" ] && PHP_version=1 + if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" + else + if [ $PHP_version == 2 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 -a $PHP_cache != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + break + fi + done + fi + if [ $PHP_version == 3 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 -a $PHP_cache != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + break + fi + done + fi + fi + break + done + fi + break + fi +done + +# check Pureftpd +while : +do + echo + read -p "Do you want to install Pure-FTPd? [y/n]: " FTP_yn + if [ "$FTP_yn" != 'y' -a "$FTP_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + + if [ "$FTP_yn" == 'y' ];then + [ -d "$pureftpd_install_dir" ] && echo -e "\033[31mThe FTP service already installed! \033[0m" && FTP_yn=n && break + while : + do + read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd + if (( ${#ftpmanagerpwd} >= 5 ));then + sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf + break + else + echo -e "\033[31mFtp manager password least 5 characters! \033[0m" + fi + done + fi + break + fi +done + +# check phpMyAdmin +while : +do + echo + read -p "Do you want to install phpMyAdmin? [y/n]: " phpMyAdmin_yn + if [ "$phpMyAdmin_yn" != 'y' -a "$phpMyAdmin_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$phpMyAdmin_yn" == 'y' ];then + [ -d "$home_dir/default/phpMyAdmin" ] && echo -e "\033[31mThe phpMyAdmin already installed! \033[0m" && phpMyAdmin_yn=n && break + fi + break + fi +done + +# check redis +while : +do + echo + read -p "Do you want to install redis? [y/n]: " redis_yn + if [ "$redis_yn" != 'y' -a "$redis_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$redis_yn" == 'y' ];then + [ -d "$redis_install_dir" ] && echo -e "\033[31mThe redis already installed! \033[0m" && redis_yn=n && break + fi + break + fi +done + +# check memcached +while : +do + echo + read -p "Do you want to install memcached? [y/n]: " memcached_yn + if [ "$memcached_yn" != 'y' -a "$memcached_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$memcached_yn" == 'y' ];then + [ -d "$memcached_install_dir" ] && echo -e "\033[31mThe memcached already installed! \033[0m" && memcached_yn=n && break + fi + break + fi +done + +# check jemalloc or tcmalloc +if [ ! -d "$db_install_dir" -o ! -d "$web_install_dir" ];then + while : + do + echo + 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' -a "$je_tc_malloc_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$je_tc_malloc_yn" == 'y' ];then + echo 'Please select jemalloc or tcmalloc:' + echo -e "\t\033[32m1\033[0m. jemalloc" + echo -e "\t\033[32m2\033[0m. tcmalloc" + while : + do + read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc + [ -z "$je_tc_malloc" ] && je_tc_malloc=1 + if [ $je_tc_malloc != 1 -a $je_tc_malloc != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + break + fi + done + fi + break + fi + done +fi + +chmod +x functions/*.sh init/* *.sh + +# init +. functions/check_os.sh +if [ "$OS" == 'CentOS' ];then + . init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/install.log + /bin/mv init/init_CentOS.sh init/init_CentOS.ed +elif [ "$OS" == 'Debian' ];then + . init/init_Debian.sh 2>&1 | tee -a $lnmp_dir/install.log + /bin/mv init/init_Debian.sh init/init_Debian.ed +elif [ "$OS" == 'Ubuntu' ];then + . init/init_Ubuntu.sh 2>&1 | tee -a $lnmp_dir/install.log + /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed +fi + +# jemalloc or tcmalloc +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then + . functions/jemalloc.sh + Install_jemalloc | tee -a $lnmp_dir/install.log +elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' ];then + . functions/tcmalloc.sh + Install_tcmalloc | tee -a $lnmp_dir/install.log +fi + +# Database +if [ "$DB_version" == '1' ];then + . functions/mysql-5.6.sh + Install_MySQL-5-6 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '2' ];then + . functions/mysql-5.5.sh + Install_MySQL-5-5 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '3' ];then + . functions/mariadb-5.5.sh + Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/install.log +fi + +# PHP +if [ "$PHP_version" == '1' ];then + . functions/php-5.5.sh + Install_PHP-5-5 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_version" == '2' ];then + . functions/php-5.4.sh + Install_PHP-5-4 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_version" == '3' ];then + . functions/php-5.3.sh + Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/install.log +fi + +# PHP opcode cache (php <= 5.4) +if [ "$PHP_cache" == '1' ];then + . functions/zendopcache.sh + Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_cache" == '2' -a "$PHP_version" == '2' ];then + . functions/eaccelerator-1.0-dev.sh + Install_eAccelerator-1-0-dev 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_cache" == '2' -a "$PHP_version" == '3' ];then + . functions/eaccelerator-0.9.sh + Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log +fi + +# Web server +if [ "$Web_server" == '1' ];then + . functions/nginx.sh + Install_Nginx 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$Web_server" == '2' ];then + . functions/tengine.sh + Install_Tengine 2>&1 | tee -a $lnmp_dir/install.log +fi + +# ngx_pagespeed +if [ "$ngx_pagespeed_yn" == 'y' ];then + . functions/ngx_pagespeed.sh + Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/install.log +fi + +# Pure-FTPd +if [ "$Web_yn" == 'y' -a "$DB_yn" == 'y' -a "$FTP_yn" == 'y' ];then + . functions/pureftpd.sh + Install_PureFTPd 2>&1 | tee -a $lnmp_dir/install.log +fi + +if [ "$PHP_yn" == 'y' ];then + # phpMyAdmin + if [ "$phpMyAdmin_yn" == 'y' ];then + . functions/phpmyadmin.sh + Install_phpMyAdmin 2>&1 | tee -a $lnmp_dir/install.log + fi + + # redis + if [ "$redis_yn" == 'y' ];then + . functions/redis.sh + Install_redis 2>&1 | tee -a $lnmp_dir/install.log + fi + + # memcached + if [ "$memcached_yn" == 'y' ];then + . functions/memcached.sh + Install_memcached 2>&1 | tee -a $lnmp_dir/install.log + fi +fi + +# index example +if [ ! -e "$home_dir/default/index.html" -a -d "$web_install_dir" ];then + . functions/test.sh + TEST 2>&1 | tee -a $lnmp_dir/install.log +fi + +# get db_install_dir and web_install_dir +. ./options.conf + +echo "################Congratulations####################" +echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" +echo +echo "The path of some dirs:" +[ "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" +[ "$PHP_yn" == 'y' ] && echo -e "`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "pureftpd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" +[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin dir:"`\033[32m$home_dir/default/phpMyAdmin\033[0m" +[ "$redis_yn" == 'y' ] && echo -e "`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" +[ "$memcached_yn" == 'y' ] && echo -e "`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" +echo +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database User:"`\033[32mroot\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database Password:"`\033[32m${dbrootpwd}\033[0m" +echo +[ "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "index url:"`\033[32mhttp://$IP/\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "ftp web manager url:"`\033[32mhttp://$IP/ftp\033[0m" +[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin url:"`\033[32mhttp://$IP/phpMyAdmin\033[0m" diff --git a/vhost.sh b/vhost.sh index 5dd7be9b..2117601a 100755 --- a/vhost.sh +++ b/vhost.sh @@ -15,7 +15,7 @@ while : do read -p "Please input domain(example: www.linuxeye.com linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then - echo -e "\033[31minput error\033[0m" + echo -e "\033[31minput error! \033[0m" else break fi @@ -30,9 +30,9 @@ fi while : do echo '' - read -p "Do you want to add more domain name? (y/n) " moredomainame_yn + read -p "Do you want to add more domain name? [y/n]: " moredomainame_yn if [ "$moredomainame_yn" != 'y' ] && [ "$moredomainame_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi @@ -43,7 +43,7 @@ if [ "$moredomainame_yn" == 'y' ]; then echo '' read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com): " moredomain if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then - echo -e "\033[31minput error\033[0m" + echo -e "\033[31minput error! \033[0m" else echo -e "domain list=\033[32m$moredomain\033[0m" moredomainame=" $moredomain" @@ -58,9 +58,9 @@ if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then while : do echo '' - read -p "Do you want to use ngx_pagespeed module? (y/n) " ngx_pagespeed_yn + read -p "Do you want to use ngx_pagespeed module? [y/n]: " ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$ngx_pagespeed_yn" == 'y' ];then ngx_pagespeed='pagespeed on;\npagespeed FileCachePath /var/ngx_pagespeed_cache;\npagespeed RewriteLevel CoreFilters;\npagespeed EnableFilters local_storage_cache;\npagespeed EnableFilters collapse_whitespace,remove_comments;\npagespeed EnableFilters outline_css;\npagespeed EnableFilters flatten_css_imports;\npagespeed EnableFilters move_css_above_scripts;\npagespeed EnableFilters move_css_to_head;\npagespeed EnableFilters outline_javascript;\npagespeed EnableFilters combine_javascript;\npagespeed EnableFilters combine_css;\npagespeed EnableFilters rewrite_javascript;\npagespeed EnableFilters rewrite_css,sprite_images;\npagespeed EnableFilters rewrite_style_attributes;\npagespeed EnableFilters recompress_images;\npagespeed EnableFilters resize_images;\npagespeed EnableFilters convert_meta_tags;\nlocation ~ "\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+" { add_header "" ""; }\nlocation ~ "^/ngx_pagespeed_static/" { }\nlocation ~ "^/ngx_pagespeed_beacon$" { }\nlocation /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }\nlocation /ngx_pagespeed_message { allow 127.0.0.1; deny all; }' @@ -76,9 +76,9 @@ fi while : do echo '' - read -p "Do you want to add hotlink protection? (y/n) " anti_hotlinking_yn + read -p "Do you want to add hotlink protection? [y/n]: " anti_hotlinking_yn if [ "$anti_hotlinking_yn" != 'y' ] && [ "$anti_hotlinking_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi @@ -112,9 +112,9 @@ fi while : do echo '' - read -p "Allow Rewrite rule? (y/n) " rewrite_yn + read -p "Allow Rewrite rule? [y/n]: " rewrite_yn if [ "$rewrite_yn" != 'y' ] && [ "$rewrite_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi @@ -142,9 +142,9 @@ fi while : do echo '' - read -p "Allow access_log? (y/n) " access_yn + read -p "Allow access_log? [y/n]: " access_yn if [ "$access_yn" != 'y' ] && [ "$access_yn" != 'n' ];then - echo -e "\033[31minput error! please input 'y' or 'n'\033[0m" + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi From 44b59329f3f38201b9bfcf5ecaecea74d320f54b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 7 Sep 2013 17:33:38 +0800 Subject: [PATCH 184/617] update phpmyadmin to 4.0.6 --- lnmp_install.sh | 360 ------------------------------------------------ 1 file changed, 360 deletions(-) delete mode 100755 lnmp_install.sh diff --git a/lnmp_install.sh b/lnmp_install.sh deleted file mode 100755 index 2807774e..00000000 --- a/lnmp_install.sh +++ /dev/null @@ -1,360 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com -# -# Version: 0.3 04-Sep-2013 lj2007331 AT gmail.com -# Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# -# This script's project home is: -# https://github.com/lj2007331/lnmp - -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script, Please use root to install lnmp" && kill -9 $$ - -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# For more information Please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" -echo '' - -#get pwd -sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" ./options.conf - -# get ipv4 -. functions/get_ipv4.sh - -# Definition Directory -. ./options.conf -mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} - -# choice upgrade OS -while : -do - read -p "Do you want to upgrade operating system ? (y/n) " upgrade_yn - if [ "$upgrade_yn" != 'y' ] && [ "$upgrade_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi -done - -# choice Web server -if [ ! -d "$web_install_dir" ];then - while : - do - echo '' - echo 'Please select Web server:' - echo -e "\t\033[32m1\033[0m. Install Nginx" - echo -e "\t\033[32m2\033[0m. Install Tengine" - read -p "Please input a number:(Default 1 press Enter) " Web_server - [ -z "$Web_server" ] && Web_server=1 - if [ $Web_server != 1 ] && [ $Web_server != 2 ];then - echo -e "\033[31minput error! Please input 1 2\033[0m" - else - while : - do - read -p "Do you want to install ngx_pagespeed module? (y/n) " ngx_pagespeed_yn - if [ "$ngx_pagespeed_yn" != 'y' ] && [ "$ngx_pagespeed_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi - done - break - fi - done -fi - -# choice database -if [ ! -d "$db_install_dir" ];then - while : - do - echo '' - echo 'Please select a version of the Database:' - echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" - echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" - echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" - read -p "Please input a number:(Default 1 press Enter) " DB_version - [ -z "$DB_version" ] && DB_version=1 - if [ $DB_version != 1 ] && [ $DB_version != 2 ] && [ $DB_version != 3 ];then - echo -e "\033[31minput error! Please input 1 2 3 \033[0m" - else - while : - do - read -p "Please input the root password of database: " dbrootpwd - (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" - done - break - fi - done -fi - -# check PHP -if [ ! -d "$php_insall_dir" ];then - while : - do - echo '' - echo 'Please select a version of the PHP:' - echo -e "\t\033[32m1\033[0m. Install php-5.5" - echo -e "\t\033[32m2\033[0m. Install php-5.4" - echo -e "\t\033[32m3\033[0m. Install php-5.3" - read -p "Please input a number:(Default 1 press Enter) " PHP_version - [ -z "$PHP_version" ] && PHP_version=1 - if [ $PHP_version != 1 ] && [ $PHP_version != 2 ] && [ $PHP_version != 3 ];then - echo -e "\033[31minput error! Please input 1 2 3 \033[0m" - else - if [ $PHP_version == 2 ];then - while : - do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t\033[32m1\033[0m. Install Zend OPcache" - echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then - echo -e "\033[31minput error! Please input 1 or 2\033[0m" - else - break - fi - done - fi - if [ $PHP_version == 3 ];then - while : - do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t\033[32m1\033[0m. Install Zend OPcache" - echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [ "$PHP_cache" != 1 ] && [ "$PHP_cache" != 2 ];then - echo -e "\033[31minput error! Please input 1 or 2\033[0m" - else - break - fi - done - fi - break - fi - done -fi - -# check Pureftpd -if [ ! -d "$pureftpd_install_dir" ];then -while : -do - echo '' - read -p "Do you want to install Pure-FTPd? (y/n) " FTP_yn - if [ "$FTP_yn" != 'y' ] && [ "$FTP_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - - if [ "$FTP_yn" == 'y' ];then - while : - do - read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd - if (( ${#ftpmanagerpwd} >= 5 ));then - sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf - break - else - echo -e "\033[31mFtp manager password least 5 characters! \033[0m" - fi - done - fi - break - fi -done -fi - -# check phpMyAdmin -if [ ! -d "$wwwroot/default/phpMyAdmin" ];then -while : -do - echo '' - read -p "Do you want to install phpMyAdmin? (y/n) " phpMyAdmin_yn - if [ "$phpMyAdmin_yn" != 'y' ] && [ "$phpMyAdmin_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi -done -fi - -# check redis -if [ ! -d "$redis_install_dir" ];then - while : - do - echo '' - read -p "Do you want to install Redis? (y/n) " redis_yn - if [ "$redis_yn" != 'y' ] && [ "$redis_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi - done -fi - -# check memcached -if [ ! -d "$memcached_install_dir" ];then - while : - do - echo '' - read -p "Do you want to install memcached? (y/n) " memcached_yn - if [ "$memcached_yn" != 'y' ] && [ "$memcached_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - break - fi - done -fi - -# check jemalloc or tcmalloc -while : -do - echo '' - read -p "Do you want to use jemalloc or tcmalloc optimize Web server and Database? (y/n) " je_tc_malloc_yn - if [ "$je_tc_malloc_yn" != 'y' ] && [ "$je_tc_malloc_yn" != 'n' ];then - echo -e "\033[31minput error! Please input 'y' or 'n'\033[0m" - else - if [ "$je_tc_malloc_yn" == 'y' ];then - echo 'Please select jemalloc or tcmalloc:' - echo -e "\t\033[32m1\033[0m. jemalloc" - echo -e "\t\033[32m2\033[0m. tcmalloc" - while : - do - read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc - [ -z "$je_tc_malloc" ] && je_tc_malloc=1 - if [ $je_tc_malloc != 1 ] && [ $je_tc_malloc != 2 ];then - echo -e "\033[31minput error! Please input 1 2\033[0m" - else - break - fi - done - fi - break - fi -done - -chmod +x functions/*.sh init/* *.sh - -# init -export IP upgrade_yn Web_server je_tc_malloc -. functions/check_os.sh -if [ "$OS" == 'CentOS' ];then - ./init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log - /bin/mv init/init_CentOS.sh init/init_CentOS.ed -elif [ "$OS" == 'Debian' ];then - ./init/init_Debian.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log - /bin/mv init/init_Debian.sh init/init_Debian.ed -elif [ "$OS" == 'Ubuntu' ];then - ./init/init_Ubuntu.sh 2>&1 | tee -a $lnmp_dir/lnmp_install.log - /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed -fi - -# jemalloc or tcmalloc -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then - . functions/jemalloc.sh - Install_jemalloc | tee -a $lnmp_dir/lnmp_install.log -elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' ];then - . functions/tcmalloc.sh - Install_tcmalloc | tee -a $lnmp_dir/lnmp_install.log -fi - -# Database -if [ $DB_version == 1 ];then - . functions/mysql-5.6.sh - Install_MySQL-5-6 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $DB_version == 2 ];then - . functions/mysql-5.5.sh - Install_MySQL-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $DB_version == 3 ];then - . functions/mariadb-5.5.sh - Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log -else - echo -e "\033[31mDatabase install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -# PHP -if [ $PHP_version == 1 ];then - . functions/php-5.5.sh - Install_PHP-5-5 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $PHP_version == 2 ];then - . functions/php-5.4.sh - Install_PHP-5-4 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $PHP_version == 3 ];then - . functions/php-5.3.sh - Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/lnmp_install.log -else - echo -e "\033[31mPHP install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -# PHP opcode cache (php <= 5.4) -if [ $PHP_cache == 1 ];then - . functions/zendopcache.sh - Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $PHP_cache == 2 -a $PHP_version == 2 ];then - . functions/eaccelerator-1.0-dev.sh - Install_eAccelerator-1-0-dev 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $PHP_cache == 2 -a $PHP_version == 3 ];then - . functions/eaccelerator-0.9.sh - Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -# Web server -if [ $Web_server == 1 ];then - . functions/nginx.sh - Install_Nginx 2>&1 | tee -a $lnmp_dir/lnmp_install.log -elif [ $Web_server == 2 ];then - . functions/tengine.sh - Install_Tengine 2>&1 | tee -a $lnmp_dir/lnmp_install.log -else - echo -e "\033[31mWeb server install failed, Please contact the author! \033[0m" - kill -9 $$ -fi - -if [ "$ngx_pagespeed_yn" == 'y' ];then - . functions/ngx_pagespeed.sh - Install_ngx_pagespeed 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -if [ "$FTP_yn" == 'y' ];then - . functions/pureftpd.sh - Install_PureFTPd 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -if [ "$phpMyAdmin_yn" == 'y' ];then - . functions/phpmyadmin.sh - Install_phpMyAdmin 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -if [ "$redis_yn" == 'y' ];then - . functions/redis.sh - Install_redis 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -if [ "$memcached_yn" == 'y' ];then - . functions/memcached.sh - Install_memcached 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -if [ ! -f "$home_dir/default/index.html" ];then - . functions/test.sh - TEST 2>&1 | tee -a $lnmp_dir/lnmp_install.log -fi - -# get db_install_dir and web_install_dir -. ./options.conf - -echo "################Congratulations####################" -echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" -echo '' -echo "The path of some dirs:" -echo -e "`printf "%-32s" "Web dir":`\033[32m$web_install_dir\033[0m" -echo -e "`printf "%-32s" "PHP dir:"`\033[32m$php_install_dir\033[0m" -echo -e "`printf "%-32s" "Database Install dir:"`\033[32m$db_install_dir\033[0m" -echo -e "`printf "%-32s" "Database User:"`\033[32mroot\033[0m" -echo -e "`printf "%-32s" "Database Password:"`\033[32m${dbrootpwd}\033[0m" -echo -e "`printf "%-32s" "Manager url:"`\033[32mhttp://$IP/\033[0m" From a3029eabed80997cc06718a88ddf64663e998c92 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 9 Sep 2013 10:55:34 +0800 Subject: [PATCH 185/617] no install libcloog-ppl0 --- functions/php-5.3.sh | 1 - functions/php-5.4.sh | 1 - functions/php-5.5.sh | 1 - init/init_Ubuntu.sh | 2 +- install.sh | 2 +- vhost.sh | 2 +- 6 files changed, 3 insertions(+), 6 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 9cb68c9f..fcd06697 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -142,7 +142,6 @@ sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.in sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini -sed -i 's@^pdo_mysql.default_socket.*@pdo_mysql.default_socket = /tmp/mysql.sock@' $php_install_dir/etc/php.ini sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' $php_install_dir/etc/php.ini cat > $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < Date: Mon, 9 Sep 2013 16:29:54 +0800 Subject: [PATCH 186/617] install PHP MySQL Clent --- functions/php-5.3.sh | 9 +++++---- functions/php-5.4.sh | 9 +++++---- functions/php-5.5.sh | 9 +++++---- functions/php-mysql-client.sh | 28 ++++++++++++++++++++++++++++ install.sh | 6 ++++++ 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100755 functions/php-mysql-client.sh diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index fcd06697..f96ce055 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -48,8 +48,9 @@ make && make install cd ../ # linked library +[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -78,9 +79,9 @@ tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.27 make clean -[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo $php_mysql_options \ +./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ +--with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index b35b5b52..87ba74c3 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -48,8 +48,9 @@ make && make install cd ../ # linked library +[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -80,9 +81,9 @@ tar xzf php-5.4.19.tar.gz useradd -M -s /sbin/nologin www cd php-5.4.19 make clean -[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo $php_mysql_options \ +./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ +--with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 2488392c..2ad342bf 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -48,8 +48,9 @@ make && make install cd ../ # linked library +[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -[ "$DB_yn" == 'y' ] && echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n @@ -78,9 +79,9 @@ tar xzf php-5.5.3.tar.gz useradd -M -s /sbin/nologin www cd php-5.5.3 make clean -[ "$DB_yn" == 'y' ] && php_mysql_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo $php_mysql_options \ +./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ +--with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh new file mode 100755 index 00000000..2c22ab76 --- /dev/null +++ b/functions/php-mysql-client.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +Install_PHP-MySQL-Client() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz && Download_src + +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. + +tar zxf mysql-5.5.33.tar.gz +cd mysql-5.5.33 +cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir +make mysqlclient libmysql +mkdir -p $mysql_install_dir/{lib,bin} +/bin/cp libmysql/libmysqlclient* $mysql_install_dir/lib +/bin/cp scripts/mysql_config $mysql_install_dir/bin +/bin/cp -R include $mysql_install_dir +cd ../../ +} diff --git a/install.sh b/install.sh index dd3dd5bc..73d53c2b 100755 --- a/install.sh +++ b/install.sh @@ -310,6 +310,12 @@ elif [ "$DB_version" == '3' ];then Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/install.log fi +# PHP MySQL Client +if [ "$DB" == 'n' -a "$PHP_yn" == 'y' ];then + . functions/php-mysql-client.sh 2>&1 | tee -a $lnmp_dir/install.log + Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log +fi + # PHP if [ "$PHP_version" == '1' ];then . functions/php-5.5.sh From d36e5d1ce9c27a6de554d38daf618a68f744be80 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Sep 2013 12:26:05 +0800 Subject: [PATCH 187/617] add xcache --- README.md | 2 +- conf/index.html | 2 +- functions/xcache.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++ install.sh | 49 ++++++++++++++++++++++------------ options.conf | 2 +- 5 files changed, 99 insertions(+), 20 deletions(-) create mode 100755 functions/xcache.sh diff --git a/README.md b/README.md index 8e84ce5f..a46595ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache,eAccelerator (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, eAccelerator, xcache (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc diff --git a/conf/index.html b/conf/index.html index 8413ca6d..6eaf0065 100644 --- a/conf/index.html +++ b/conf/index.html @@ -26,7 +26,7 @@

Congratulations, LNMP安装成功!

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RedHat 5+、Debian 6+、Ubuntu 12+

Github地址:https://github.com/lj2007331/lnmp

-

查看本地环境:探针 phpinfo FTP Manager phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

+

查看本地环境:探针 phpinfo FTP Manager xcache phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

diff --git a/functions/xcache.sh b/functions/xcache.sh new file mode 100755 index 00000000..7e7c228e --- /dev/null +++ b/functions/xcache.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_XCache() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://xcache.lighttpd.net/pub/Releases/3.0.3/xcache-3.0.3.tar.gz && Download_src +tar xzf xcache-3.0.3.tar.gz +cd xcache-3.0.3 +make clean +$php_install_dir/bin/phpize +./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/xcache.so" ];then + /bin/cp -R htdocs $home_dir/default/xcache + chown -R www.www $home_dir/default/xcache + touch /tmp/xcache;chown www.www /tmp/xcache + cat >> $php_install_dir/etc/php.ini << EOF +[xcache-common] +extension_dir = "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/" +extension = xcache.so +[xcache.admin] +xcache.admin.enable_auth = On +xcache.admin.user = "admin" +xcache.admin.pass = "$xcache_admin_md5_pass" + +[xcache] +xcache.cacher = On +xcache.size = 20M +xcache.count = `cat /proc/cpuinfo | grep -c processor` +xcache.slots = 8K +xcache.ttl = 3600 +xcache.gc_interval = 300 +xcache.var_size = 4M +xcache.var_count = 1 +xcache.var_slots = 8K +xcache.var_ttl = 0 +xcache.var_maxttl = 0 +xcache.var_gc_interval = 300 +xcache.test = Off +xcache.readonly_protection = On +xcache.mmap_path = "/tmp/xcache" +xcache.coredump_directory = "" +xcache.cacher = On +xcache.stat = On +xcache.optimizer = Off + +[xcache.coverager] +; enabling this feature will impact performance +; enable only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value" +; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions +xcache.coverager = On +xcache.coveragedump_directory = "" +EOF + service php-fpm restart +else + echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" +fi +cd ../../ +} diff --git a/install.sh b/install.sh index 73d53c2b..4c46d9b9 100755 --- a/install.sh +++ b/install.sh @@ -142,10 +142,12 @@ do echo 'Please select a opcode cache of the PHP:' echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" + echo -e "\t\033[32m3\033[0m. Install XCache" read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 -a $PHP_cache != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2\033[0m" + if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[ +0m" else break fi @@ -157,15 +159,24 @@ do echo 'Please select a opcode cache of the PHP:' echo -e "\t\033[32m1\033[0m. Install Zend OPcache" echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" + echo -e "\t\033[32m3\033[0m. Install XCache" read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 -a $PHP_cache != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2\033[0m" + if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2 +\033[0m" else break fi done fi + if [ "$PHP_cache" == '3' ];then + while : + do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" + done + fi fi break done @@ -338,6 +349,9 @@ elif [ "$PHP_cache" == '2' -a "$PHP_version" == '2' ];then elif [ "$PHP_cache" == '2' -a "$PHP_version" == '3' ];then . functions/eaccelerator-0.9.sh Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_cache" == '3' ];then + . functions/xcache.sh + Install_XCache 2>&1 | tee -a $lnmp_dir/install.log fi # Web server @@ -390,22 +404,23 @@ fi # get db_install_dir and web_install_dir . ./options.conf -echo "################Congratulations####################" +echo "####################Congratulations########################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo -echo "The path of some dirs:" [ "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" -[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" -[ "$PHP_yn" == 'y' ] && echo -e "`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" -[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" +[ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web dir:"`\033[32m$home_dir/default/xcache\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$IP/xcache\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "pureftpd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" -[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin dir:"`\033[32m$home_dir/default/phpMyAdmin\033[0m" -[ "$redis_yn" == 'y' ] && echo -e "`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" -[ "$memcached_yn" == 'y' ] && echo -e "`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" -echo -[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database User:"`\033[32mroot\033[0m" -[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database Password:"`\033[32m${dbrootpwd}\033[0m" -echo -[ "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "index url:"`\033[32mhttp://$IP/\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "ftp web manager url:"`\033[32mhttp://$IP/ftp\033[0m" +[ "$phpMyAdmin_yn" == 'y' ] && echo -e "\n`printf "%-32s" "phpMyAdmin dir:"`\033[32m$home_dir/default/phpMyAdmin\033[0m" [ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin url:"`\033[32mhttp://$IP/phpMyAdmin\033[0m" +[ "$redis_yn" == 'y' ] && echo -e "\n`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" +[ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" +[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`\033[32mhttp://$IP/\033[0m" diff --git a/options.conf b/options.conf index 45b6095c..e3ff301f 100644 --- a/options.conf +++ b/options.conf @@ -5,7 +5,7 @@ lnmp_dir= # 预定义目录 nginx_install_dir=/usr/local/nginx -tengine_install_dir=/usr/local/nginx +tengine_install_dir=/usr/local/tengine mysql_install_dir=/usr/local/mysql mariadb_install_dir=/usr/local/mariadb From 9c9866ab57e107d5a792d7e6866e9ebe98891482 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Sep 2013 14:19:33 +0800 Subject: [PATCH 188/617] get web_install_dir --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 4c46d9b9..06e2509b 100755 --- a/install.sh +++ b/install.sh @@ -395,15 +395,15 @@ if [ "$PHP_yn" == 'y' ];then fi fi +# get db_install_dir and web_install_dir +. ./options.conf + # index example if [ ! -e "$home_dir/default/index.html" -a -d "$web_install_dir" ];then . functions/test.sh TEST 2>&1 | tee -a $lnmp_dir/install.log fi -# get db_install_dir and web_install_dir -. ./options.conf - echo "####################Congratulations########################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" echo From 1277eea651152f798ea0169603806a18375b730c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Sep 2013 16:52:04 +0800 Subject: [PATCH 189/617] install php mysql client error --- functions/php-mysql-client.sh | 1 + install.sh | 42 ++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 2c22ab76..8a8000e7 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -1,6 +1,7 @@ #!/bin/bash # Author: yeho # Blog: http://blog.linuxeye.com + Install_PHP-MySQL-Client() { cd $lnmp_dir/src diff --git a/install.sh b/install.sh index 06e2509b..62d5f8be 100755 --- a/install.sh +++ b/install.sh @@ -185,6 +185,7 @@ do fi done +if [ "$Web_yn" == 'y' -a "$DB_yn" == 'y' -a "$PHP_yn" == 'y' ];then # check Pureftpd while : do @@ -225,7 +226,9 @@ do break fi done +fi +if [ "$PHP_yn" == 'y' ];then # check redis while : do @@ -255,9 +258,10 @@ do break fi done +fi # check jemalloc or tcmalloc -if [ ! -d "$db_install_dir" -o ! -d "$web_install_dir" ];then +if [ "$Web_yn" == 'y' -o "$DB_yn" == 'y' ];then while : do echo @@ -322,8 +326,8 @@ elif [ "$DB_version" == '3' ];then fi # PHP MySQL Client -if [ "$DB" == 'n' -a "$PHP_yn" == 'y' ];then - . functions/php-mysql-client.sh 2>&1 | tee -a $lnmp_dir/install.log +if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' ];then + . functions/php-mysql-client.sh Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log fi @@ -370,29 +374,27 @@ if [ "$ngx_pagespeed_yn" == 'y' ];then fi # Pure-FTPd -if [ "$Web_yn" == 'y' -a "$DB_yn" == 'y' -a "$FTP_yn" == 'y' ];then +if [ "$FTP_yn" == 'y' ];then . functions/pureftpd.sh Install_PureFTPd 2>&1 | tee -a $lnmp_dir/install.log fi -if [ "$PHP_yn" == 'y' ];then - # phpMyAdmin - if [ "$phpMyAdmin_yn" == 'y' ];then - . functions/phpmyadmin.sh - Install_phpMyAdmin 2>&1 | tee -a $lnmp_dir/install.log - fi +# phpMyAdmin +if [ "$phpMyAdmin_yn" == 'y' ];then + . functions/phpmyadmin.sh + Install_phpMyAdmin 2>&1 | tee -a $lnmp_dir/install.log +fi - # redis - if [ "$redis_yn" == 'y' ];then - . functions/redis.sh - Install_redis 2>&1 | tee -a $lnmp_dir/install.log - fi +# redis +if [ "$redis_yn" == 'y' ];then + . functions/redis.sh + Install_redis 2>&1 | tee -a $lnmp_dir/install.log +fi - # memcached - if [ "$memcached_yn" == 'y' ];then - . functions/memcached.sh - Install_memcached 2>&1 | tee -a $lnmp_dir/install.log - fi +# memcached +if [ "$memcached_yn" == 'y' ];then + . functions/memcached.sh + Install_memcached 2>&1 | tee -a $lnmp_dir/install.log fi # get db_install_dir and web_install_dir From 4b73e6396a9ecfdfd00add8a454a751a1653eb27 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 12 Sep 2013 11:31:44 +0800 Subject: [PATCH 190/617] To build ngx_pagespeed.so for Tengine --- conf/nginx.conf | 16 ++++----- functions/ngx_pagespeed.sh | 67 +++++++++++++++++++++----------------- install.sh | 5 ++- vhost.sh | 8 ++--- 4 files changed, 51 insertions(+), 45 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 358074f4..ad08c26c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -68,17 +68,17 @@ http { index index.html index.php; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; - } + } + location ~ .*\.(php|php5)?$ { - #fastcgi_pass unix:/tmp/php-cgi.sock; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - include fastcgi.conf; - } + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi.conf; + } location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { - expires 30d; - } + expires 30d; + } location ~ .*\.(js|css)?$ { expires 1h; diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index e41d9ca4..489cd95d 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -8,42 +8,49 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -rm -rf release* ngx_pagespeed-release* +rm -rf ngx_pagespeed* src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz && Download_src -[ -s "release-1.6.29.5-beta" ] && echo "release-1.6.29.5-beta found" || wget -c --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-1.6.29.5-beta.zip +[ -s "release-1.6.29.5-beta.zip" ] && echo "release-1.6.29.5-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-master.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q release-1.6.29.5-beta +unzip -q ngx_pagespeed-master.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-release-1.6.29.5-beta tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta -[ "$Web_server" == '1' ] && cd nginx-1.4.2/ -[ "$Web_server" == '2' ] && cd tengine-1.5.1/ -make clean -if [ "$je_tc_malloc" == '1' ];then - [ "$Web_server" == '1' ] && malloc_module="--with-ld-opt='-ljemalloc'" - [ "$Web_server" == '2' ] && malloc_module='--with-jemalloc' -elif [ "$je_tc_malloc" == '2' ];then - malloc_module='--with-google_perftools_module' -fi +if [ "$Web_server" == '1' ];then + cd nginx-1.4.2 + make clean -[ "$Web_server" == '2' ] && tengine_options='--with-http_concat_module=shared --with-http_sysguard_module=shared' + if [ "$je_tc_malloc" == '1' ];then + malloc_module="--with-ld-opt='-ljemalloc'" + elif [ "$je_tc_malloc" == '2' ];then + malloc_module='--with-google_perftools_module' + fi -if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module $tengine_options -else - ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module $tengine_options -fi + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then + ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module + else + ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module + fi -make -if [ -f "objs/nginx" ];then - /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) - /bin/cp objs/nginx $web_install_dir/sbin/nginx - kill -USR2 `cat /var/run/nginx.pid` - kill -QUIT `cat /var/run/nginx.pid.oldbin` - mkdir /var/ngx_pagespeed_cache - chown -R www.www /var/ngx_pagespeed_cache - echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" -else - echo -e "\033[31minstall ngx_pagespeed failed\033[0m" + make + if [ -f "objs/nginx" ];then + /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $web_install_dir/sbin/nginx + mkdir /var/ngx_pagespeed_cache + chown -R www.www /var/ngx_pagespeed_cache + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo -e "\033[32minstall ngx_pagespeed module successfully! \033[0m" + else + echo -e "\033[31minstall ngx_pagespeed failed\033[0m" + fi + cd ../ +elif [ "$Web_server" == '2' ];then + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.5-beta + if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then + sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf + kill -HUP `cat /var/run/nginx.pid` + fi fi -cd ../ +cd .. } diff --git a/install.sh b/install.sh index 62d5f8be..8740ae52 100755 --- a/install.sh +++ b/install.sh @@ -408,14 +408,13 @@ fi echo "####################Congratulations########################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" -echo -[ "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" +[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web dir:"`\033[32m$home_dir/default/xcache\033[0m" -[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$IP/xcache\033[0m" +[ "$PHP_cache" == '3' -a "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$IP/xcache\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" diff --git a/vhost.sh b/vhost.sh index c22a808f..d0c696ef 100755 --- a/vhost.sh +++ b/vhost.sh @@ -176,13 +176,13 @@ root $vhostdir; #error_page 404 /404.html; if ( \$query_string ~* ".*[\;'\<\>].*" ){ return 404; -} + } $anti_hotlinking `echo -e $ngx_pagespeed` location ~ .*\.(php|php5)?$ { - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - include fastcgi.conf; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi.conf; } location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { expires 30d; From b9eaed676a643bdb9aa4e409a1c92c6d20104017 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Sep 2013 15:04:32 +0800 Subject: [PATCH 191/617] update imagick to 3.1.0 and add GraphicsMagick --- functions/GraphicsMagick.sh | 41 +++++++++++++++++++++++++++++++++++++ functions/ImageMagick.sh | 38 ++++++++++++++++++++++++++++++++++ functions/pecl_http.sh | 25 ++++++++++++++++++++++ functions/php-5.3.sh | 28 ------------------------- functions/php-5.4.sh | 28 ------------------------- functions/php-5.5.sh | 28 ------------------------- functions/xcache.sh | 3 +-- install.sh | 39 +++++++++++++++++++++++++++++++++++ 8 files changed, 144 insertions(+), 86 deletions(-) create mode 100755 functions/GraphicsMagick.sh create mode 100755 functions/ImageMagick.sh create mode 100755 functions/pecl_http.sh diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh new file mode 100755 index 00000000..b1604280 --- /dev/null +++ b/functions/GraphicsMagick.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_GraphicsMagick() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.2RC1.tgz && Download_src + +tar xzf GraphicsMagick-1.3.18.tar.gz +cd GraphicsMagick-1.3.18 +./configure --enable-shared +make && make install +cd ../ + +tar xzf gmagick-1.1.2RC1.tgz +cd gmagick-1.1.2RC1 +make clean +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +cd ../ + +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/gmagick.so" ];then + if [ -z "`cat $php_install_dir/etc/php.ini | grep ^extension_dir`" ];then + sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"gmagick.so\"@" $php_install_dir/etc/php.ini + else + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini + fi + service php-fpm restart +else + echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" +fi + +cd ../ +} diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh new file mode 100755 index 00000000..fc6d5d76 --- /dev/null +++ b/functions/ImageMagick.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_ImageMagick() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.0.tgz && Download_src + +tar xzf ImageMagick-6.8.6-9.tar.gz +cd ImageMagick-6.8.6-9 +./configure +make && make install +cd ../ +ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick + +tar xzf imagick-3.1.0.tgz +cd imagick-3.1.0 +make clean +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +cd ../ + +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then + sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"@" $php_install_dir/etc/php.ini + service php-fpm restart +else + echo -e "\033[31mPHP imagick module install failed, Please contact the author! \033[0m" +fi + +cd ../ +} diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh new file mode 100755 index 00000000..8b47322d --- /dev/null +++ b/functions/pecl_http.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_pecl_http() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src +tar xzf pecl_http-1.7.6.tgz +cd pecl_http-1.7.6 +make clean +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/http.so" ];then + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "http.so"@' $php_install_dir/etc/php.ini + service php-fpm restart +else + echo -e "\033[31mPHP pecl_http module install failed, Please contact the author! \033[0m" +fi +cd ../../ +} diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index f96ce055..3a2d8f17 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -12,11 +12,8 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.3.27.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -41,18 +38,11 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-9.tar.gz -cd ImageMagick-6.8.6-9 -./configure -make && make install -cd ../ - # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig -ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n @@ -112,25 +102,7 @@ OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ -tar xzf imagick-3.1.0RC2.tgz -cd imagick-3.1.0RC2 -make clean -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install - # Modify php.ini -sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 87ba74c3..c27a3b4c 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -12,11 +12,8 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.4.19.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -41,18 +38,11 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-9.tar.gz -cd ImageMagick-6.8.6-9 -./configure -make && make install -cd ../ - # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig -ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n @@ -114,25 +104,7 @@ OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ -tar xzf imagick-3.1.0RC2.tgz -cd imagick-3.1.0RC2 -make clean -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install - # Modify php.ini -sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 2ad342bf..7ba4a8a0 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -12,11 +12,8 @@ cd $lnmp_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.0RC2.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -41,18 +38,11 @@ cd mhash-0.9.9.9 make && make install cd ../ -tar xzf ImageMagick-6.8.6-9.tar.gz -cd ImageMagick-6.8.6-9 -./configure -make && make install -cd ../ - # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig -ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n @@ -112,25 +102,7 @@ OS_Debian_Ubuntu='update-rc.d php-fpm defaults' OS_command cd ../ -tar xzf imagick-3.1.0RC2.tgz -cd imagick-3.1.0RC2 -make clean -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ - -# Support HTTP request curls -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install - # Modify php.ini -sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"\nextension = \"http.so\"@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini diff --git a/functions/xcache.sh b/functions/xcache.sh index 7e7c228e..a5c43578 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -21,8 +21,7 @@ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extens touch /tmp/xcache;chown www.www /tmp/xcache cat >> $php_install_dir/etc/php.ini << EOF [xcache-common] -extension_dir = "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/" -extension = xcache.so +extension = "xcache.so" [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "admin" diff --git a/install.sh b/install.sh index 8740ae52..fefaa4d2 100755 --- a/install.sh +++ b/install.sh @@ -177,6 +177,30 @@ do (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" done fi + while : + do + echo + echo 'Please select ImageMagick or GraphicsMagick:' + echo -e "\t\033[32m1\033[0m. Install ImageMagick" + echo -e "\t\033[32m2\033[0m. Install GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [ $Magick != 1 -a $Magick != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2 \033[0m" + else + break + fi + done + while : + do + echo + read -p "Do you want to install pecl_http PHP extension(Support HTTP request curls)? [y/n]: " pecl_http_yn + if [ "$pecl_http_yn" != 'y' -a "$pecl_http_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done fi break done @@ -343,6 +367,21 @@ elif [ "$PHP_version" == '3' ];then Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/install.log fi +# ImageMagick or GraphicsMagick +if [ "$Magick" == '1' ];then + . functions/ImageMagick.sh + Install_ImageMagick 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$Magick" == '2' ];then + . functions/GraphicsMagick.sh + Install_GraphicsMagick 2>&1 | tee -a $lnmp_dir/install.log +fi + +# Support HTTP request curls +if [ "$pecl_http_yn" == 'y' ];then + . functions/pecl_http.sh + Install_pecl_http 2>&1 | tee -a $lnmp_dir/install.log +fi + # PHP opcode cache (php <= 5.4) if [ "$PHP_cache" == '1' ];then . functions/zendopcache.sh From 5b5039f344ecc30a1ed4a42c2219cab54766a94c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Sep 2013 17:25:22 +0800 Subject: [PATCH 192/617] mkdir /var/ngx_pagespeed --- functions/ngx_pagespeed.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 489cd95d..b6baaa22 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -49,6 +49,8 @@ elif [ "$Web_server" == '2' ];then $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.5-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf + mkdir /var/ngx_pagespeed_cache + chown -R www.www /var/ngx_pagespeed_cache kill -HUP `cat /var/run/nginx.pid` fi fi From 3e7efcd1637d1779dd57796444699c2615c6bc86 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Sep 2013 22:24:24 +0800 Subject: [PATCH 193/617] yum 163 error --- init/init_CentOS.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index cb575766..229b9bc4 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,9 +12,9 @@ sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then - cd /etc/yum.repos.d/ - mv CentOS-Base.repo CentOS-Base.repo_bk - wget -c http://mirrors.163.com/.help/CentOS-Base-163.repo + mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk + [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ] && wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ] && wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d yum makecache fi From 4ddb0ef855ca55162de49224c73509042c5247c8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 14 Sep 2013 17:00:05 +0800 Subject: [PATCH 194/617] add Percona-5.5 --- functions/mariadb-5.5.sh | 6 +- functions/mysql-5.5.sh | 4 +- functions/mysql-5.6.sh | 5 +- functions/percona-5.5.sh | 128 +++++++++++++++++++++++++++++++++++++++ install.sh | 9 ++- options.conf | 2 + 6 files changed, 140 insertions(+), 14 deletions(-) create mode 100755 functions/percona-5.5.sh diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 28cc68b5..9a31aaed 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -29,8 +29,6 @@ fi cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mariadb_data_dir \ --DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ @@ -43,9 +41,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ --DWITH_DEBUG=0 \ +-DWITH_EXTRA_CHARSETS=all \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index ec6ed394..73d570a2 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -29,7 +29,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ @@ -39,8 +38,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ +-DWITH_EXTRA_CHARSETS=all \ -DWITH_DEBUG=0 \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 043e4a79..d6b4dc77 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -30,18 +30,15 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ --DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DEXTRA_CHARSETS=all \ --DWITH_BIG_TABLES=1 \ +-DWITH_EXTRA_CHARSETS=all \ -DWITH_DEBUG=0 \ $EXE_LINKER make && make install diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh new file mode 100755 index 00000000..079198a0 --- /dev/null +++ b/functions/percona-5.5.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +Install_Percona-5-5() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.33-31.1/source/Percona-Server-5.5.33-rel31.1.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir +tar xzf cmake-2.8.11.2.tar.gz +cd cmake-2.8.11.2 +./configure +make && make install +cd .. +tar zxf Percona-Server-5.5.33-rel31.1.tar.gz +cd Percona-Server-5.5.33-rel31.1 +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 +cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$percona_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DWITH_EXTRA_CHARSETS=all \ +$EXE_LINKER +make && make install + +if [ -d "$percona_install_dir" ];then + echo -e "\033[32mPercona install successfully! \033[0m" +else + echo -e "\033[31mPercona install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd ../../ + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $percona_install_dir +datadir = $percona_data_dir +pid-file = $percona_data_dir/mysql.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $percona_data_dir/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $percona_data_dir/mysql-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir + +chown mysql.mysql -R $percona_data_dir +service mysqld start +export PATH=$PATH:$percona_install_dir/bin +echo "export PATH=\$PATH:$percona_install_dir/bin" >> /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 "delete from mysql.user where Password='';" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +sed -i "s@^db_install_dir.*@db_install_dir=$percona_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$percona_data_dir@" options.conf +service mysqld stop +} diff --git a/install.sh b/install.sh index fefaa4d2..103e4e4a 100755 --- a/install.sh +++ b/install.sh @@ -96,10 +96,11 @@ do echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" + echo -e "\t\033[32m4\033[0m. Install Percona-5.5" read -p "Please input a number:(Default 1 press Enter) " DB_version [ -z "$DB_version" ] && DB_version=1 - if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" + if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 -a $DB_version != 4 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4 \033[0m" else while : do @@ -347,6 +348,9 @@ elif [ "$DB_version" == '2' ];then elif [ "$DB_version" == '3' ];then . functions/mariadb-5.5.sh Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '4' ];then + . functions/percona-5.5.sh + Install_Percona-5-5 2>&1 | tee -a $lnmp_dir/install.log fi # PHP MySQL Client @@ -449,6 +453,7 @@ echo "####################Congratulations########################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database data dir:"`\033[32m$db_data_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" diff --git a/options.conf b/options.conf index e3ff301f..6a19b0a4 100644 --- a/options.conf +++ b/options.conf @@ -9,6 +9,7 @@ tengine_install_dir=/usr/local/tengine mysql_install_dir=/usr/local/mysql mariadb_install_dir=/usr/local/mariadb +percona_install_dir=/usr/localm/percona php_install_dir=/usr/local/php @@ -24,6 +25,7 @@ redis_install_dir=/usr/local/redis # 数据库数据存储目录,你可以自由指定 mysql_data_dir=/data/mysql mariadb_data_dir=/data/mariadb +percona_data_dir=/data/percona # Web directory, you can customize,Which default directory to store ftp.(User_manager_for-PureFTPd Proposal to modify the name for security) # Веб-каталог, вы можете настроить, какой по умолчанию каталог для хранения FTP. (User_manager_for-PureFTPd предложение об изменении названия для безопасности) From 6cfff1106c85740dd0525b3ce396a61591db9eb1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 20 Sep 2013 16:24:55 +0800 Subject: [PATCH 195/617] update ImageMagick to 6.8.6-10 --- README.md | 2 +- functions/ImageMagick.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a46595ee..811b9e60 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - Constant updates - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues -- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5) +- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5, Percona-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine - According to their needs can to install ngx_pagespeed diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index fc6d5d76..ae5a7214 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-9.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-10.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.0.tgz && Download_src -tar xzf ImageMagick-6.8.6-9.tar.gz -cd ImageMagick-6.8.6-9 +tar xzf ImageMagick-6.8.6-10.tar.gz +cd ImageMagick-6.8.6-10 ./configure make && make install cd ../ From da678b573845bc50878b102fd27ab81a489ffe3b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 20 Sep 2013 16:46:27 +0800 Subject: [PATCH 196/617] update php and mysql --- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/php-5.4.sh | 6 +++--- functions/php-5.5.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 73d570a2..a5457d8f 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -18,8 +18,8 @@ cd cmake-2.8.11.2 ./configure make && make install cd .. -tar zxf mysql-5.5.33.tar.gz -cd mysql-5.5.33 +tar zxf mysql-5.5.34.tar.gz +cd mysql-5.5.34 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index d6b4dc77..b7660ccf 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -19,8 +19,8 @@ cd cmake-2.8.11.2 ./configure make && make install cd .. -tar zxf mysql-5.6.13.tar.gz -cd mysql-5.6.13 +tar zxf mysql-5.6.14.tar.gz +cd mysql-5.6.14 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index c27a3b4c..b403164e 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.4.19.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.4.20.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -67,9 +67,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.19.tar.gz +tar xzf php-5.4.20.tar.gz useradd -M -s /sbin/nologin www -cd php-5.4.19 +cd php-5.4.20 make clean ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 7ba4a8a0..d82a9097 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.5.3.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.5.4.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -65,9 +65,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.3.tar.gz +tar xzf php-5.5.4.tar.gz useradd -M -s /sbin/nologin www -cd php-5.5.3 +cd php-5.5.4 make clean ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 8a8000e7..4d472e59 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 @@ -17,8 +17,8 @@ cd cmake-2.8.11.2 make && make install cd .. -tar zxf mysql-5.5.33.tar.gz -cd mysql-5.5.33 +tar zxf mysql-5.5.34.tar.gz +cd mysql-5.5.34 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} From 859e5925245ba6d5b8cd5ed5c6a62774e581ac69 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 23 Sep 2013 16:40:54 +0800 Subject: [PATCH 197/617] add uninstall script and update sendmail --- README.md | 6 +++ functions/mysql-5.6.sh | 4 +- functions/ngx_pagespeed.sh | 13 +++---- functions/php-5.3.sh | 1 + functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- options.conf | 2 +- uninstall.sh | 77 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 94 insertions(+), 13 deletions(-) create mode 100755 uninstall.sh diff --git a/README.md b/README.md index 811b9e60..3e9570ff 100644 --- a/README.md +++ b/README.md @@ -37,5 +37,11 @@ ./vhost.sh ``` +## How to uninstall + +```bash + ./uninstall.sh +``` + For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index b7660ccf..39763d53 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -22,9 +22,9 @@ cd .. tar zxf mysql-5.6.14.tar.gz cd mysql-5.6.14 if [ "$je_tc_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index b6baaa22..2aac2229 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -19,17 +19,14 @@ tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta if [ "$Web_server" == '1' ];then cd nginx-1.4.2 make clean - - if [ "$je_tc_malloc" == '1' ];then - malloc_module="--with-ld-opt='-ljemalloc'" - elif [ "$je_tc_malloc" == '2' ];then - malloc_module='--with-google_perftools_module' - fi + $web_install_dir/sbin/nginx -V &> $$ + nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' $malloc_module + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure --prefix=$web_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' $malloc_module + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 3a2d8f17..95e8ed8b 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -116,6 +116,7 @@ sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/ sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' $php_install_dir/etc/php.ini +[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini cat > $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && kill -9 $$ + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +. ./options.conf +Uninstall() +{ +[ -e "$db_install_dir" ] && service mysqld stop +[ -e "$php_install_dir" ] && service php-fpm stop +[ -e "$web_install_dir" ] && service nginx stop +[ -e "$pureftpd_install_dir" ] && service pureftpd stop +[ -e "$redis_install_dir" ] && service redis-server stop +[ -e "$memcached_install_dir" ] && service memcached stop + +for D in `cat ./options.conf | grep dir= | grep -v lnmp | awk -F'=' '{print $2}' | sort | uniq` +do + [ -e "$D" ] && rm -rf $D +done + +[ -e "$web_install_dir" ] && rm -rf /etc/logrotate.d/nginx +[ -e "$db_install_dir" ] && rm -rf /etc/my.cnf /etc/ld.so.conf.d/mysql.conf +sed -i 's@^lnmp_dir=.*@lnmp_dir=@' ./options.conf +sed -i 's@^web_install_dir=.*@web_install_dir=@' ./options.conf +sed -i 's@^db_install_dir=.*@db_install_dir=@' ./options.conf +sed -i 's@^db_data_dir=.*@db_data_dir=@' ./options.conf +sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf +sed -i 's@^ftpmanagerpwd=.*@ftpmanagerpwd=@' ./options.conf +sed -i 's@^conn_ftpusers_dbpwd=.*@conn_ftpusers_dbpwd=@' ./options.conf +echo -e "\033[32mUninstall completed.\033[0m" +} + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} + +clear +echo +echo -e "\033[31mYou will uninstall LNMP, Please backup your configure files and DB data! \033[0m" +echo +echo -e "\033[33mThe following directory or files will be remove: \033[0m" +for D in `cat ./options.conf | grep dir= | grep -v lnmp | awk -F'=' '{print $2}' | sort | uniq` +do + [ -e "$D" ] && echo $D +done +[ -e "$web_install_dir" ] && echo -e "/etc/init.d/nginx\n/etc/logrotate.d/nginx" +[ -e "$db_install_dir" ] && echo -e "/etc/init.d/mysqld\n/etc/my.cnf\n/etc/ld.so.conf.d/mysql.conf" +[ -e "$php_install_dir" ] && echo '/etc/init.d/php-fpm' +[ -e "$pureftpd_install_dir" ] && echo '/etc/init.d/pureftpd' +[ -e "$memcached_install_dir" ] && echo '/etc/init.d/memcached' +[ -e "$redis_install_dir" ] && echo '/etc/init.d/redis-server' +echo +echo -e "\033[33mPress any key to continue\033[0m..." +char=`get_char` + +while : +do + echo + read -p "Do you want to uninstall LNMP? [y/n]: " uninstall_yn + if [ "$uninstall_yn" != 'y' -a "$uninstall_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi +done + +[ "$uninstall_yn" == 'y' ] && Uninstall From 51670d101db82e7904bc3a3d4ea6c7cbaa21099f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 24 Sep 2013 15:22:26 +0800 Subject: [PATCH 198/617] update mariadb to 5.5.33a --- functions/mariadb-5.5.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 9a31aaed..7c251b04 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -19,8 +19,8 @@ cd cmake-2.8.11.2 ./configure make && make install cd .. -tar zxf mariadb-5.5.32.tar.gz -cd mariadb-5.5.32 +tar zxf mariadb-5.5.33a.tar.gz +cd mariadb-5.5.33a if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" elif [ "$je_tc_malloc" == '2' ];then From 34fbaf9df5ab3cea14ec7f451a95ba75b49a8b76 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 24 Sep 2013 15:29:54 +0800 Subject: [PATCH 199/617] update phpMyAdmin to 4.0.7 --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 9d102712..d7a2e9da 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.6/phpMyAdmin-4.0.6-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.7/phpMyAdmin-4.0.7-all-languages.zip && Download_src -tar xzf phpMyAdmin-4.0.6-all-languages.tar.gz -/bin/mv phpMyAdmin-4.0.6-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.0.7-all-languages.tar.gz +/bin/mv phpMyAdmin-4.0.7-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } From bbebe7842a846a2ad18e103fe1e142f8823398d8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Sep 2013 12:43:51 +0800 Subject: [PATCH 200/617] sendmail and vhost.sh --- functions/nginx.sh | 1 - functions/tengine.sh | 1 - init/init_CentOS.sh | 5 ++++- init/init_Ubuntu.sh | 3 +++ install.sh | 12 ++++++++++++ vhost.sh | 21 +++++++++++---------- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index 9341104f..375d0f0d 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -95,7 +95,6 @@ endscript } EOF sed -i "s@^web_install_dir.*@web_install_dir=$nginx_install_dir@" options.conf -sed -i "s@/usr/local/nginx@$nginx_install_dir@g" vhost.sh sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh ldconfig diff --git a/functions/tengine.sh b/functions/tengine.sh index bb2f9fc0..5a19bef7 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -78,7 +78,6 @@ endscript } EOF sed -i "s@^web_install_dir.*@web_install_dir=$tengine_install_dir@" options.conf -sed -i "s@/usr/local/nginx@$tengine_install_dir@g" vhost.sh sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh ldconfig diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 229b9bc4..5799f6a7 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -32,7 +32,10 @@ yum -y update [ "$upgrade_yn" == 'y' ] && yum -y upgrade # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip sendmail +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip + +# check sendmail +[ "$sendmail_yn" == 'y' ] && yum -y install sendmail # closed Unnecessary services and remove obsolete rpm package chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 205b59cf..9d72307a 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -21,6 +21,9 @@ elif [ ! -z "`cat /etc/issue | grep 12`" ];then apt-get -y install libcloog-ppl0 fi +# check sendmail +[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail + # PS1 echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc diff --git a/install.sh b/install.sh index 103e4e4a..947ad62c 100755 --- a/install.sh +++ b/install.sh @@ -41,6 +41,18 @@ do fi done +# check sendmail +while : +do + echo + read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi +done + # check Web server while : do diff --git a/vhost.sh b/vhost.sh index d0c696ef..b7e56efe 100755 --- a/vhost.sh +++ b/vhost.sh @@ -20,7 +20,8 @@ do break fi done -if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then +. ./options.conf +if [ ! -f "$web_install_dir/conf/vhost/$domain.conf" ]; then echo "domain=$domain" else echo "$domain is exist!" @@ -53,7 +54,7 @@ if [ "$moredomainame_yn" == 'y' ]; then fi # check ngx_pagespeed and add ngx_pagespeed -/usr/local/nginx/sbin/nginx -V &> $$ +$web_install_dir/sbin/nginx -V &> $$ if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then while : do @@ -121,7 +122,7 @@ do done if [ "$rewrite_yn" == 'n' ];then rewrite="none" - touch "/usr/local/nginx/conf/$rewrite.conf" + touch "$web_install_dir/conf/$rewrite.conf" else echo '' echo "Please input the rewrite of programme :" @@ -132,9 +133,9 @@ else fi echo -e "You choose rewrite=\033[32m$rewrite\033[0m" if [ -s "conf/$rewrite.conf" ];then - /bin/cp conf/$rewrite.conf /usr/local/nginx/conf/$rewrite.conf + /bin/cp conf/$rewrite.conf $web_install_dir/conf/$rewrite.conf else - touch "/usr/local/nginx/conf/$rewrite.conf" + touch "$web_install_dir/conf/$rewrite.conf" fi fi @@ -158,14 +159,14 @@ else fi -[ ! -d /usr/local/nginx/conf/vhost ] && mkdir /usr/local/nginx/conf/vhost +[ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost echo "Create Virtul Host directory......" mkdir -p $vhostdir echo "set permissions of Virtual Host directory......" chown -R www.www $vhostdir -cat >/usr/local/nginx/conf/vhost/$domain.conf<$web_install_dir/conf/vhost/$domain.conf< Date: Wed, 25 Sep 2013 15:17:43 +0800 Subject: [PATCH 201/617] uninstall del ngx_pagepeed_cache dir --- uninstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uninstall.sh b/uninstall.sh index 20f5e42f..889444b6 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -21,7 +21,7 @@ do [ -e "$D" ] && rm -rf $D done -[ -e "$web_install_dir" ] && rm -rf /etc/logrotate.d/nginx +[ -e "$web_install_dir" ] && rm -rf /etc/logrotate.d/nginx && [ -e "/var/ngx_pagespeed_cache" ] && rm -rf /var/ngx_pagespeed_cache [ -e "$db_install_dir" ] && rm -rf /etc/my.cnf /etc/ld.so.conf.d/mysql.conf sed -i 's@^lnmp_dir=.*@lnmp_dir=@' ./options.conf sed -i 's@^web_install_dir=.*@web_install_dir=@' ./options.conf @@ -53,7 +53,7 @@ for D in `cat ./options.conf | grep dir= | grep -v lnmp | awk -F'=' '{print $2}' do [ -e "$D" ] && echo $D done -[ -e "$web_install_dir" ] && echo -e "/etc/init.d/nginx\n/etc/logrotate.d/nginx" +[ -e "$web_install_dir" ] && echo -e "/etc/init.d/nginx\n/etc/logrotate.d/nginx" && [ -e "/var/ngx_pagespeed_cache" ] && echo '/var/ngx_pagespeed_cache' [ -e "$db_install_dir" ] && echo -e "/etc/init.d/mysqld\n/etc/my.cnf\n/etc/ld.so.conf.d/mysql.conf" [ -e "$php_install_dir" ] && echo '/etc/init.d/php-fpm' [ -e "$pureftpd_install_dir" ] && echo '/etc/init.d/pureftpd' From 2cdbfcf097d7f63b0940911968605047799a7a0e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Sep 2013 20:08:09 +0800 Subject: [PATCH 202/617] phpMyAdmin error --- functions/phpmyadmin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index d7a2e9da..edfb2e7b 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,7 +8,7 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.7/phpMyAdmin-4.0.7-all-languages.zip && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.7/phpMyAdmin-4.0.7-all-languages.tar.gz && Download_src tar xzf phpMyAdmin-4.0.7-all-languages.tar.gz /bin/mv phpMyAdmin-4.0.7-all-languages $home_dir/default/phpMyAdmin From f764e78ed745d04c9dfc1f728ff12336abdb15f3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Sep 2013 20:19:08 +0800 Subject: [PATCH 203/617] update imagick to 3.1.2 --- functions/ImageMagick.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index ae5a7214..5bbe17b4 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-10.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.0.tgz && Download_src +src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src tar xzf ImageMagick-6.8.6-10.tar.gz cd ImageMagick-6.8.6-10 @@ -18,8 +18,8 @@ make && make install cd ../ ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick -tar xzf imagick-3.1.0.tgz -cd imagick-3.1.0 +tar xzf imagick-3.1.2.tgz +cd imagick-3.1.2 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize From 5ff5c992bd00b56131154b5aeb5d0bbde967ade7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 26 Sep 2013 16:09:04 +0800 Subject: [PATCH 204/617] use gcc-4.4 and update ImageMagick to 6.8.7-0 --- functions/ImageMagick.sh | 6 +++--- functions/memcached.sh | 8 -------- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- init/init_CentOS.sh | 6 ++++++ install.sh | 25 +++++++++++++------------ 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 5bbe17b4..5b040e99 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.6-10.tar.gz && Download_src +src_url=http://www.imagemagick.org/download/ImageMagick-6.8.7-0.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.6-10.tar.gz -cd ImageMagick-6.8.6-10 +tar xzf ImageMagick-6.8.7-0.tar.gz +cd ImageMagick-6.8.7-0 ./configure make && make install cd ../ diff --git a/functions/memcached.sh b/functions/memcached.sh index 2d6431f6..4aee7224 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -54,14 +54,6 @@ fi # php memcached extension tar xzf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 -OS_CentOS='if [ -z "`rpm -q gcc | grep 'gcc-4\.4'`" ];then \n - yum -y install gcc44 gcc44-c++ libstdc++44-devel \n -fi' -OS_command -if [ -f "`which gcc44`" ];then - export CC=`which gcc44` - export CXX=`which g++44` -fi ./configure --with-memcached=$memcached_install_dir make && make install cd .. diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 95e8ed8b..869dbf06 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -40,11 +40,11 @@ cd ../ # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +ln -s $db_install_dir/include /usr/include/mysql echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n -ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n ln -s /usr/lib64/libldap* /usr/lib \n diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 228d8c7a..c4db8bab 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -40,11 +40,11 @@ cd ../ # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +ln -s $db_install_dir/include /usr/include/mysql echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n -ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n ln -s /usr/lib64/libldap* /usr/lib \n diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index abe02494..736bb56a 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -40,11 +40,11 @@ cd ../ # linked library [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir +ln -s $db_install_dir/include /usr/include/mysql echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n -ln -s $db_install_dir/include/* /usr/local/include/ \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n ln -s /usr/lib64/libldap* /usr/lib \n diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 5799f6a7..055fb3fb 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -34,6 +34,12 @@ yum -y update # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip +# use gcc-4.4 +if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then + yum -y install gcc44 gcc44-c++ libstdc++44-devel + export CC="gcc44" CXX="g++44" +fi + # check sendmail [ "$sendmail_yn" == 'y' ] && yum -y install sendmail diff --git a/install.sh b/install.sh index 947ad62c..885fc41b 100755 --- a/install.sh +++ b/install.sh @@ -37,18 +37,18 @@ do echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && echo -e "\033[31mYour system is already upgraded! \033[0m" && upgrade_yn=n && break - break - fi -done - -# check sendmail -while : -do - echo - read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn - if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else + # check sendmail + while : + do + echo + read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + [ -e /usr/sbin/sendmail ] && echo -e "\033[31msendmail already installed! \033[0m" && sendmail_yn=n && break + break + fi + done break fi done @@ -333,6 +333,7 @@ chmod +x functions/*.sh init/* *.sh if [ "$OS" == 'CentOS' ];then . init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/install.log /bin/mv init/init_CentOS.sh init/init_CentOS.ed + [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ] && export CC="gcc44" CXX="g++44" elif [ "$OS" == 'Debian' ];then . init/init_Debian.sh 2>&1 | tee -a $lnmp_dir/install.log /bin/mv init/init_Debian.sh init/init_Debian.ed From 36364b865af90aa92f55fc5048ab8219f20a0858 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 27 Sep 2013 18:02:31 +0800 Subject: [PATCH 205/617] Optimization compiled code using safe, sane CFLAGS and CXXFLAGS --- functions/ImageMagick.sh | 2 +- init/init_CentOS.sh | 83 ++++++++++++++++++++-------------------- init/init_Debian.sh | 16 ++++---- init/init_Ubuntu.sh | 12 +++--- install.sh | 13 ++++++- uninstall.sh | 4 +- 6 files changed, 70 insertions(+), 60 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 5b040e99..4885e6b5 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,7 +8,7 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.imagemagick.org/download/ImageMagick-6.8.7-0.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/imagemagick/6.8.7-sources/ImageMagick-6.8.7-0.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src tar xzf ImageMagick-6.8.7-0.tar.gz diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 055fb3fb..286d3293 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -2,16 +2,17 @@ # Author: yeho # Blog: http://blog.linuxeye.com -wget -c http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz +cd src +. ../functions/download.sh +src_url=http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz && Download_src tar zxf yum-3.4.3.tar.gz cd yum-3.4.3 ./yummain.py install yum -y cd .. -rm -rf yum-3.4.3* sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -if [ "`./functions/get_ip_area.py $IP`" == 'CN' ];then +if [ "`../functions/get_ip_area.py $IP`" == 'CN' ];then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ] && wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ] && wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d @@ -64,20 +65,20 @@ sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab init q # PS1 -echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> /etc/profile +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> ~/.bashrc # history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf -cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local +[ -z "`cat /etc/rc.local | grep 'ulimit -SH 65535'`" ] && echo "ulimit -SH 65535" >> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -95,15 +96,14 @@ EOF fi # Wrong password five times locked 180s -sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth +[ -z "`cat /etc/pam.d/system-auth | grep 'pam_tally2.so'`" ] && sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth # alias vi -sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc -echo 'syntax on' >> /etc/vimrc +[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc # /etc/sysctl.conf sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf -cat >> /etc/sysctl.conf << EOF +[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 @@ -153,38 +153,37 @@ EOF service iptables restart # install tmux -mkdir tmux -cd tmux -wget -c http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz -wget -c http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz -tar xzf libevent-2.0.21-stable.tar.gz -cd libevent-2.0.21-stable -./configure -make && make install -cd ../ - -tar xzf tmux-1.8.tar.gz -cd tmux-1.8 -CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure -make && make install -cd ../../ -rm -rf tmux - -if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 -else - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 +if [ ! -e "`which tmux`" ];then + src_url=http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz && Download_src + tar xzf libevent-2.0.21-stable.tar.gz + cd libevent-2.0.21-stable + ./configure + make && make install + cd .. + + tar xzf tmux-1.8.tar.gz + cd tmux-1.8 + CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure + make && make install + cd .. + + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 + else + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 + fi fi # install htop -mkdir htop -cd htop -wget -c http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz -tar xzf htop-1.0.2.tar.gz -cd htop-1.0.2 -./configure -make && make install -cd ../../ -rm -rf htop - +if [ ! -e "`which htop`" ];then + src_url=http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz && Download_src + tar xzf htop-1.0.2.tar.gz + cd htop-1.0.2 + ./configure + make && make install + cd .. +fi +cd .. . /etc/profile +. ~/.bashrc diff --git a/init/init_Debian.sh b/init/init_Debian.sh index e75824c2..ec6f2843 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -16,20 +16,20 @@ apt-get -y upgrade apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget locales libcloog-ppl0 # PS1 -echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history size -echo 'HISTSIZE=100' >> ~/.bashrc -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^HISTSIZE`" ] && echo 'HISTSIZE=100' >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf -cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local +[ -z "`cat /etc/rc.local | grep 'ulimit -SH 65535'`" ] && echo "ulimit -SH 65535" >> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -47,13 +47,13 @@ EOF fi # alias vi -sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc -echo 'syntax on' >> /etc/vim/vimrc +[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +[ -z "`cat /etc/vim/vimrc | grep 'syntax on'`" ] && echo 'syntax on' >> /etc/vim/vimrc sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf -cat >> /etc/sysctl.conf << EOF +[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF net.ipv4.tcp_syncookies = 1 fs.file-max=65535 net.ipv4.tcp_tw_reuse = 1 diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 9d72307a..2240564b 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -25,20 +25,20 @@ fi [ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail # PS1 -echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history size sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc -echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf -cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local +[ -z "`cat /etc/rc.local | grep 'ulimit -SH 65535'`" ] && echo "ulimit -SH 65535" >> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -56,10 +56,10 @@ EOF fi # alias vi -sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc # /etc/sysctl.conf -cat >> /etc/sysctl.conf << EOF +[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF net.ipv4.tcp_syncookies = 1 fs.file-max=65535 net.ipv4.tcp_tw_reuse = 1 diff --git a/install.sh b/install.sh index 885fc41b..0a5c0314 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.3 07-Sep-2013 lj2007331 AT gmail.com +# Version: 0.4 27-Sep-2013 lj2007331 AT gmail.com # Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: @@ -342,6 +342,17 @@ elif [ "$OS" == 'Ubuntu' ];then /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed fi +# gcc options +if [ ! -z "`cat /proc/cpuinfo | grep 'model name' | grep -E 'Intel|AMD'`" ];then + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then + export CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" + export CXXFLAGS="${CFLAGS}" + elif [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then + export CHOST="i686-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" + export CXXFLAGS="${CFLAGS}" + fi +fi + # jemalloc or tcmalloc if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then . functions/jemalloc.sh diff --git a/uninstall.sh b/uninstall.sh index 889444b6..be7f8ec5 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -22,7 +22,7 @@ do done [ -e "$web_install_dir" ] && rm -rf /etc/logrotate.d/nginx && [ -e "/var/ngx_pagespeed_cache" ] && rm -rf /var/ngx_pagespeed_cache -[ -e "$db_install_dir" ] && rm -rf /etc/my.cnf /etc/ld.so.conf.d/mysql.conf +[ -e "$db_install_dir" ] && rm -rf /etc/my.cnf /etc/ld.so.conf.d/mysql.conf /usr/include/mysql sed -i 's@^lnmp_dir=.*@lnmp_dir=@' ./options.conf sed -i 's@^web_install_dir=.*@web_install_dir=@' ./options.conf sed -i 's@^db_install_dir=.*@db_install_dir=@' ./options.conf @@ -54,7 +54,7 @@ do [ -e "$D" ] && echo $D done [ -e "$web_install_dir" ] && echo -e "/etc/init.d/nginx\n/etc/logrotate.d/nginx" && [ -e "/var/ngx_pagespeed_cache" ] && echo '/var/ngx_pagespeed_cache' -[ -e "$db_install_dir" ] && echo -e "/etc/init.d/mysqld\n/etc/my.cnf\n/etc/ld.so.conf.d/mysql.conf" +[ -e "$db_install_dir" ] && echo -e "/etc/init.d/mysqld\n/etc/my.cnf\n/etc/ld.so.conf.d/mysql.conf\n/usr/include/mysql" [ -e "$php_install_dir" ] && echo '/etc/init.d/php-fpm' [ -e "$pureftpd_install_dir" ] && echo '/etc/init.d/pureftpd' [ -e "$memcached_install_dir" ] && echo '/etc/init.d/memcached' From a9fbe0096672a2c92a182c86456b145b4f1cb862 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 27 Sep 2013 20:49:24 +0800 Subject: [PATCH 206/617] Optimization compiled code using safe, sane CFLAGS and CXXFLAGS --- functions/tcmalloc.sh | 5 ++--- install.sh | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 5d645f5f..c9ebfb1e 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -13,9 +13,8 @@ src_url=http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz && Download if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then tar xzf libunwind-1.1.tar.gz cd libunwind-1.1 - CFLAGS=-fPIC ./configure - make CFLAGS=-fPIC - make CFLAGS=-fPIC install + CFLAGS="$CFLAGS -fPIC" ./configure + make && make install cd .. tar xzf gperftools-2.1.tar.gz cd gperftools-2.1 diff --git a/install.sh b/install.sh index 0a5c0314..8c002e7e 100755 --- a/install.sh +++ b/install.sh @@ -297,6 +297,19 @@ do done fi +# gcc sane CFLAGS and CXXFLAGS +while : +do + echo + read -p "Do you want to optimizing compiled code using safe, sane CFLAGS and CXXFLAGS? [y/n]: " gcc_sane_yn + if [ "$gcc_sane_yn" != 'y' -a "$gcc_sane_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + [ "$gcc_sane_yn" == 'y' -a -z "`cat /proc/cpuinfo | grep 'model name' | grep -E 'Intel|AMD'`" ] && echo -e "Unknown CPU model" && gcc_sane_yn=n && break + break + fi +done + # check jemalloc or tcmalloc if [ "$Web_yn" == 'y' -o "$DB_yn" == 'y' ];then while : @@ -342,15 +355,15 @@ elif [ "$OS" == 'Ubuntu' ];then /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed fi -# gcc options -if [ ! -z "`cat /proc/cpuinfo | grep 'model name' | grep -E 'Intel|AMD'`" ];then - if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then - export CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" - export CXXFLAGS="${CFLAGS}" - elif [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then - export CHOST="i686-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" - export CXXFLAGS="${CFLAGS}" - fi +# Optimization compiled code using safe, sane CFLAGS and CXXFLAGS +if [ "$gcc_sane_yn" == 'y' ];then + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then + export CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" + export CXXFLAGS="${CFLAGS}" + elif [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then + export CHOST="i686-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer" + export CXXFLAGS="${CFLAGS}" + fi fi # jemalloc or tcmalloc From 3c8a6d5e9431f91646d912d92d19acfdccfebfe5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 29 Sep 2013 10:25:54 +0800 Subject: [PATCH 207/617] upgrade OS issue --- init/init_CentOS.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 286d3293..c6c7212c 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -25,12 +25,10 @@ else yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "Ruby Support" "X Window System" "Printing client" "Desktop*" fi -# update rpm packages yum check-update -yum -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && yum -y upgrade +[ "$upgrade_yn" == 'y' ] && yum -y update # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip From 92a1b3d6526d5c9b6a08c83a28cf8a675083f728 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 29 Sep 2013 12:46:34 +0800 Subject: [PATCH 208/617] yum grouplist issue --- init/init_CentOS.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c6c7212c..93d2e229 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -20,9 +20,9 @@ if [ "`../functions/get_ip_area.py $IP`" == 'CN' ];then fi if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then + yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "X Window System" "Printing client" "Desktop*" +elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" -else - yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "Ruby Support" "X Window System" "Printing client" "Desktop*" fi yum check-update @@ -40,7 +40,7 @@ if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then fi # check sendmail -[ "$sendmail_yn" == 'y' ] && yum -y install sendmail +[ "$sendmail_yn" == 'y' ] && yum -y install sendmail && service sendmail restart # closed Unnecessary services and remove obsolete rpm package chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh @@ -52,7 +52,6 @@ chkconfig iptables on chkconfig rsyslog on #CentOS 6 chkconfig syslog on #CentOS 5 chkconfig sendmail on -service sendmail restart # Close SELINUX setenforce 0 From 379453e09f88126ce8cbf34180009def5613ad0d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 1 Oct 2013 15:28:00 +0800 Subject: [PATCH 209/617] cmake CFLAGS error --- functions/mariadb-5.5.sh | 4 ++-- functions/mysql-5.5.sh | 4 ++-- functions/mysql-5.6.sh | 4 ++-- functions/percona-5.5.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 7c251b04..a64dbadf 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -16,8 +16,8 @@ useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 -./configure -make && make install +CFLAGS= CXXFLAGS= ./configure +make && make install cd .. tar zxf mariadb-5.5.33a.tar.gz cd mariadb-5.5.33a diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index a5457d8f..8d7df597 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -15,8 +15,8 @@ useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 -./configure -make && make install +CFLAGS= CXXFLAGS= ./configure +make && make install cd .. tar zxf mysql-5.5.34.tar.gz cd mysql-5.5.34 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 39763d53..53edb218 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -16,8 +16,8 @@ useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 -./configure -make && make install +CFLAGS= CXXFLAGS= ./configure +make && make install cd .. tar zxf mysql-5.6.14.tar.gz cd mysql-5.6.14 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 079198a0..4056ceb7 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -15,8 +15,8 @@ useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 -./configure -make && make install +CFLAGS= CXXFLAGS= ./configure +make && make install cd .. tar zxf Percona-Server-5.5.33-rel31.1.tar.gz cd Percona-Server-5.5.33-rel31.1 From 72afb7ed5654bb5924b2e5f767c49f5bf3cf7e20 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 1 Oct 2013 18:36:25 +0800 Subject: [PATCH 210/617] php CFLAGS error --- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/php-mysql-client.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 869dbf06..8ddacc03 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -69,7 +69,7 @@ tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.27 make clean -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index c4db8bab..1f064211 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -71,7 +71,7 @@ tar xzf php-5.4.20.tar.gz useradd -M -s /sbin/nologin www cd php-5.4.20 make clean -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 736bb56a..22c0f58d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -69,7 +69,7 @@ tar xzf php-5.5.4.tar.gz useradd -M -s /sbin/nologin www cd php-5.5.4 make clean -./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 4d472e59..1d001d73 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -13,7 +13,7 @@ src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 -./configure +CFLAGS= CXXFLAGS= ./configure make && make install cd .. From ef9e5c0db07f6500fadf9acfcb02c1738d232b20 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 1 Oct 2013 20:49:58 +0800 Subject: [PATCH 211/617] closed CFLAGS --- install.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 8c002e7e..23a032c2 100755 --- a/install.sh +++ b/install.sh @@ -298,17 +298,17 @@ done fi # gcc sane CFLAGS and CXXFLAGS -while : -do - echo - read -p "Do you want to optimizing compiled code using safe, sane CFLAGS and CXXFLAGS? [y/n]: " gcc_sane_yn - if [ "$gcc_sane_yn" != 'y' -a "$gcc_sane_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - [ "$gcc_sane_yn" == 'y' -a -z "`cat /proc/cpuinfo | grep 'model name' | grep -E 'Intel|AMD'`" ] && echo -e "Unknown CPU model" && gcc_sane_yn=n && break - break - fi -done +#while : +#do +# echo +# read -p "Do you want to optimizing compiled code using safe, sane CFLAGS and CXXFLAGS? [y/n]: " gcc_sane_yn +# if [ "$gcc_sane_yn" != 'y' -a "$gcc_sane_yn" != 'n' ];then +# echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" +# else +# [ "$gcc_sane_yn" == 'y' -a -z "`cat /proc/cpuinfo | grep 'model name' | grep -E 'Intel|AMD'`" ] && echo -e "Unknown CPU model" && gcc_sane_yn=n && break +# break +# fi +#done # check jemalloc or tcmalloc if [ "$Web_yn" == 'y' -o "$DB_yn" == 'y' ];then From 5039466492520f1c5fcf9ac47470acec78eef66d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 2 Oct 2013 12:38:36 +0800 Subject: [PATCH 212/617] closed gcc --- install.sh | 3 +-- options.conf | 32 ++++++++++---------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/install.sh b/install.sh index 23a032c2..6cb1b851 100755 --- a/install.sh +++ b/install.sh @@ -45,7 +45,6 @@ do if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else - [ -e /usr/sbin/sendmail ] && echo -e "\033[31msendmail already installed! \033[0m" && sendmail_yn=n && break break fi done @@ -117,7 +116,7 @@ do while : do read -p "Please input the root password of database: " dbrootpwd - (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" + (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" ./options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" done break fi diff --git a/options.conf b/options.conf index c1d19d7d..f0c0cb80 100644 --- a/options.conf +++ b/options.conf @@ -1,11 +1,10 @@ -# Operating environment for the current working directory -# Операционная среда для, текущий рабочий каталог -# 运行环境为当前的工作目录,自动生成 +# operating environment for the current working directory lnmp_dir= -# 预定义目录 +# set the default install path, you can freely specify nginx_install_dir=/usr/local/nginx tengine_install_dir=/usr/local/tengine +apache_install_dir=/usr/local/apache mysql_install_dir=/usr/local/mysql mariadb_install_dir=/usr/local/mariadb @@ -19,40 +18,29 @@ memcached_install_dir=/usr/local/memcached redis_install_dir=/usr/local/redis -############################################################################# -# Database data storage directory,You can freely specify -# База данных для хранения данных каталога, вы можете свободно указать -# 数据库数据存储目录,你可以自由指定 +######################################################################### +# database data storage directory, you can freely specify mysql_data_dir=/data/mysql mariadb_data_dir=/data/mariadb percona_data_dir=/data/percona -# Web directory, you can customize,Which default directory to store ftp.(User_manager_for-PureFTPd Proposal to modify the name for security) -# Веб-каталог, вы можете настроить, какой по умолчанию каталог для хранения FTP. (User_manager_for-PureFTPd предложение об изменении названия для безопасности) -# 网站目录可以自行定义,其中default 目录存放ftp (User_manager_for-PureFTPd 建议修改名称为了安全) +# web directory, you can customize, which default directory to store ftp. +# (User_manager_for-PureFTPd Proposal to modify the name for security) home_dir=/home/wwwroot -# Nginx Generate a log storage directory, you can freely specify. -# Nginx создать каталог для хранения журнала, вы можете свободно указать -# Nginx生成日志存放目录,你可以自由指定 +# nginx Generate a log storage directory, you can freely specify. wwwlogs_dir=/home/wwwlogs -############################################################################# -# 以下参数自动生成,不需要修改 -# Web服务器安装目录,自动生成 +######################################################################### +# automatically generated, You can't change web_install_dir= -# 数据库安装路径,自动生成 db_install_dir= -# 数据库数据库目录,自动生成 db_data_dir= -# 数据库root密码,自动生成 dbrootpwd= -# ftp web后台管理员密码,自动生成 ftpmanagerpwd= -# 连接ftpusers数据库密码,自动生成 conn_ftpusers_dbpwd= From 5459f41f29003439104f88826f99e8fb2d1f0635 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 9 Oct 2013 10:29:47 +0800 Subject: [PATCH 213/617] update nginx to 1.4.3 and phpMyAdmin to 4.0.8 --- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- functions/phpmyadmin.sh | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index 375d0f0d..a3e36a05 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.2.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.3.tar.gz && Download_src tar xzf pcre-8.33.tar.gz cd pcre-8.33 @@ -18,9 +18,9 @@ cd pcre-8.33 make && make install cd ../ -tar xzf nginx-1.4.2.tar.gz +tar xzf nginx-1.4.3.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.2 +cd nginx-1.4.3 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 2aac2229..b1212f34 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-master.zip tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta if [ "$Web_server" == '1' ];then - cd nginx-1.4.2 + cd nginx-1.4.3 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index edfb2e7b..cc958a4a 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.7/phpMyAdmin-4.0.7-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.8/phpMyAdmin-4.0.8-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.0.7-all-languages.tar.gz -/bin/mv phpMyAdmin-4.0.7-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.0.8-all-languages.tar.gz +/bin/mv phpMyAdmin-4.0.8-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } From 30afcea893b1d8f30e02086b78cf30d0f5de0e34 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 9 Oct 2013 13:04:04 +0800 Subject: [PATCH 214/617] use php socket --- conf/nginx.conf | 3 ++- functions/php-5.3.sh | 4 ++-- functions/php-5.4.sh | 4 ++-- functions/php-5.5.sh | 4 ++-- vhost.sh | 3 ++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index ad08c26c..1ac6a767 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -71,7 +71,8 @@ http { } location ~ .*\.(php|php5)?$ { - fastcgi_pass 127.0.0.1:9000; + #fastcgi_pass remote_php_ip:9000; + fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 8ddacc03..605d6604 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -142,8 +142,7 @@ daemonize = yes ;;;;;;;;;;;;;;;;;;;; [www] - -listen = 127.0.0.1:9000 +listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www @@ -173,6 +172,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 1f064211..a3cfda23 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -143,8 +143,7 @@ daemonize = yes ;;;;;;;;;;;;;;;;;;;; [www] - -listen = 127.0.0.1:9000 +listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www @@ -174,6 +173,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 22c0f58d..4c8c1182 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -150,8 +150,7 @@ daemonize = yes ;;;;;;;;;;;;;;;;;;;; [www] - -listen = 127.0.0.1:9000 +listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www @@ -181,6 +180,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/vhost.sh b/vhost.sh index b7e56efe..5666c344 100755 --- a/vhost.sh +++ b/vhost.sh @@ -181,7 +181,8 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ $anti_hotlinking `echo -e $ngx_pagespeed` location ~ .*\.(php|php5)?$ { - fastcgi_pass 127.0.0.1:9000; + #fastcgi_pass remote_php_ip:9000; + fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } From a6eb9723f1b5a553fb128c5fc52d92c5ba9c9e27 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 11 Oct 2013 16:56:08 +0800 Subject: [PATCH 215/617] update xcache to 3.1.0 --- functions/mysql-5.5.sh | 5 +++-- functions/percona-5.5.sh | 1 + functions/php-5.3.sh | 1 - functions/xcache.sh | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 8d7df597..3b28f82e 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -21,9 +21,9 @@ cd .. tar zxf mysql-5.5.34.tar.gz cd mysql-5.5.34 if [ "$je_tc_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ @@ -34,6 +34,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 4056ceb7..55fbb6a0 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -34,6 +34,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 605d6604..ad20072a 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -115,7 +115,6 @@ sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.in sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini -sed -i 's@#sendmail_path.*@#sendmail_path = /usr/sbin/sendmail -t@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini cat > $php_install_dir/etc/php-fpm.conf < Date: Tue, 15 Oct 2013 16:13:17 +0800 Subject: [PATCH 216/617] use 163 yum for RHEL --- init/init_CentOS.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 93d2e229..2283cb79 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,8 +14,22 @@ yum clean all if [ "`../functions/get_ip_area.py $IP`" == 'CN' ];then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk - [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ] && wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d - [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ] && wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then + wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo + fi + fi + + if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then + wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo + fi + fi + yum makecache fi From d09b80726dcbdd85e6b0c1779681cbb0fb22b018 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 18 Oct 2013 10:30:56 +0800 Subject: [PATCH 217/617] update php to 5.5.5 and 5.4.21 --- functions/php-5.4.sh | 6 +++--- functions/php-5.5.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index a3cfda23..fb1e0376 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.4.20.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.4.21.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -67,9 +67,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.20.tar.gz +tar xzf php-5.4.21.tar.gz useradd -M -s /sbin/nologin www -cd php-5.4.20 +cd php-5.4.21 make clean CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 4c8c1182..4ce55bb0 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.5.4.tar.gz && Download_src +src_url=http://kr1.php.net/distributions/php-5.5.5.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -65,9 +65,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.4.tar.gz +tar xzf php-5.5.5.tar.gz useradd -M -s /sbin/nologin www -cd php-5.5.4 +cd php-5.5.5 make clean CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-opcache --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ From 8399cc26e242d709ba7ed95473de62d7a82739c0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 18 Oct 2013 22:13:05 +0800 Subject: [PATCH 218/617] add upgrade script --- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/test.sh | 2 +- install.sh | 2 +- upgrade_nginx.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++ upgrade_php.sh | 69 ++++++++++++++++++++++++++++++++++++++++ upgrade_tengine.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 224 insertions(+), 5 deletions(-) create mode 100755 upgrade_nginx.sh create mode 100755 upgrade_php.sh create mode 100755 upgrade_tengine.sh diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index ad20072a..10535d79 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.3.27.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.3.27.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index fb1e0376..ead8e32e 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.4.21.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.21.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 4ce55bb0..d1541555 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://kr1.php.net/distributions/php-5.5.5.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.5.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/test.sh b/functions/test.sh index 4e3f8546..29d27c94 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -14,6 +14,6 @@ echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default unzip -q tz.zip -d $home_dir/default chown -R www.www $home_dir/default -service mysqld restart +[ "$DB_yn" == 'y' ]service mysqld restart cd .. } diff --git a/install.sh b/install.sh index 6cb1b851..e7094cba 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ # https://github.com/lj2007331/lnmp # Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && kill -9 $$ +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin clear diff --git a/upgrade_nginx.sh b/upgrade_nginx.sh new file mode 100755 index 00000000..40ce9f3d --- /dev/null +++ b/upgrade_nginx.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade Nginx for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf +[ ! -e "$nginx_install_dir" -o -e "$nginx_install_dir/sbin/dso_tool" ] && echo -e "\033[31mThe Nginx is not installed on your system!\033[0m " && exit 1 +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} + +echo +Old_nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` +Old_nginx_version=${Old_nginx_version_tmp##*/} +echo -e "Current Nginx Version: \033[32m$Old_nginx_version\033[0m" +while : +do + echo + read -p "Please input upgrade Nginx Version(example: 1.4.3): " nginx_version + if [ "$nginx_version" != "$Old_nginx_version" ];then + [ ! -e "nginx-$nginx_version.tar.gz" ] && wget -c http://nginx.org/download/nginx-$nginx_version.tar.gz > /dev/null 2>&1 + if [ -e "nginx-$nginx_version.tar.gz" ];then + echo -e "Download \033[32mnginx-$nginx_version.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mIt does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade Nginx version is the same as the old version\033[0m" + fi +done + +if [ -e "nginx-$nginx_version.tar.gz" ];then + echo -e "\033[32mnginx-$nginx_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf nginx-$nginx_version.tar.gz + cd nginx-$nginx_version + make clean + $nginx_install_dir/sbin/nginx -V &> $$ + nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ + ./configure $nginx_configure_arguments + make + if [ -f "objs/nginx" ];then + /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $nginx_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_nginx_version\033[0m to \033[32m$nginx_version\033[0m" + echo "Restarting Nginx..." + /etc/init.d/nginx restart + else + echo -e "\033[31mupgrade Nginx failed! \033[0m" + fi + cd .. +fi diff --git a/upgrade_php.sh b/upgrade_php.sh new file mode 100755 index 00000000..79367481 --- /dev/null +++ b/upgrade_php.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade PHP for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf +[ ! -e "$php_install_dir" ] && echo -e "\033[31mThe PHP is not installed on your system!\033[0m " && exit 1 + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} + +echo +Old_php_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` +echo -e "Current PHP Version: \033[32m$Old_php_version\033[0m" +while : +do + echo + read -p "Please input upgrade PHP Version: " php_version + if [ "${php_version%.*}" == "${Old_php_version%.*}" ]; then + if [ "${php_version##*.}" -gt "${Old_php_version##*.}" ]; then + [ ! -e "php-$php_version.tar.gz" ] && wget -c http://www.php.net/distributions/php-$php_version.tar.gz > /dev/null 2>&1 + if [ -e "php-$php_version.tar.gz" ];then + echo -e "Download \033[32mphp-$php_version.tar.gz\033[0m successfully! " + else + echo -e "\033[31mIt does not exist!\033[0m" + fi + break + else + echo -e "Error: You must input PHP version greater than \033[32m$Old_php_version\033[0m!! " + fi + else + echo -e "\033[31minput error!\033[0m Please only input '\033[32m${Old_php_version%.*}.xx' \033[0m" + fi +done + +if [ -e "php-$php_version.tar.gz" ];then + echo -e "\033[32mphp-$php_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf php-$php_version.tar.gz + cd php-$php_version + make clean + $php_install_dir/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash + make ZEND_EXTRA_LIBS='-liconv' + make install + cd .. + echo "Restarting php-fpm..." + /etc/init.d/php-fpm restart + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_php_version\033[0m to \033[32m$php_version\033[0m" +fi diff --git a/upgrade_tengine.sh b/upgrade_tengine.sh new file mode 100755 index 00000000..9c8d6deb --- /dev/null +++ b/upgrade_tengine.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade Tengine for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf +[ ! -e "$tengine_install_dir" -o ! -e "$tengine_install_dir/sbin/dso_tool" ] && echo -e "\033[31mThe Tengine is not installed on your system!\033[0m " && exit 1 +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} + +echo +Old_tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` +Old_tengine_version="`echo ${Old_tengine_version_tmp#*/} | awk '{print $1}'`" +echo -e "Current Tengine Version: \033[32m$Old_tengine_version\033[0m" +while : +do + echo + read -p "Please input upgrade Tengine Version(example: 1.5.1): " tengine_version + if [ "$tengine_version" != "$Old_tengine_version" ];then + [ ! -e "tengine-$tengine_version.tar.gz" ] && wget -c http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz > /dev/null 2>&1 + if [ -e "tengine-$tengine_version.tar.gz" ];then + echo -e "Download \033[32mtengine-$tengine_version.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mIt does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade Tengine version is the same as the old version\033[0m" + fi +done + +if [ -e "tengine-$tengine_version.tar.gz" ];then + echo -e "\033[32mtengine-$tengine_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf tengine-$tengine_version.tar.gz + cd tengine-$tengine_version + make clean + $tengine_install_dir/sbin/nginx -V &> $$ + tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ + ./configure $tengine_configure_arguments + make + if [ -f "objs/nginx" ];then + /bin/mv $tengine_install_dir/sbin/nginx $tengine_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $tengine_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_tengine_version\033[0m to \033[32m$tengine_version\033[0m" + echo "Restarting Tengine..." + /etc/init.d/nginx restart + else + echo -e "\033[31mupgrade Tengine failed! \033[0m" + fi + cd .. +fi From 321af78a60fa9bd00c703de73473d52105bb8040 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 18 Oct 2013 22:14:26 +0800 Subject: [PATCH 219/617] test error --- functions/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/test.sh b/functions/test.sh index 29d27c94..2b4d1159 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -14,6 +14,6 @@ echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default unzip -q tz.zip -d $home_dir/default chown -R www.www $home_dir/default -[ "$DB_yn" == 'y' ]service mysqld restart +[ "$DB_yn" == 'y' ] && service mysqld restart cd .. } From 5e07ca10380ecfe64b59e9067c1c743cb23a26cd Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 19 Oct 2013 11:13:28 +0800 Subject: [PATCH 220/617] add upgrade Nginx/Tengine script --- upgrade_nginx.sh | 75 ------------------------- upgrade_tengine.sh | 75 ------------------------- upgrade_web.sh | 135 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 150 deletions(-) delete mode 100755 upgrade_nginx.sh delete mode 100755 upgrade_tengine.sh create mode 100755 upgrade_web.sh diff --git a/upgrade_nginx.sh b/upgrade_nginx.sh deleted file mode 100755 index 40ce9f3d..00000000 --- a/upgrade_nginx.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 - -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -clear -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# Upgrade Nginx for LNMP #" -echo "# For more information Please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" - -cd src -. ../options.conf -[ ! -e "$nginx_install_dir" -o -e "$nginx_install_dir/sbin/dso_tool" ] && echo -e "\033[31mThe Nginx is not installed on your system!\033[0m " && exit 1 -get_char() -{ -SAVEDSTTY=`stty -g` -stty -echo -stty cbreak -dd if=/dev/tty bs=1 count=1 2> /dev/null -stty -raw -stty echo -stty $SAVEDSTTY -} - -echo -Old_nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` -Old_nginx_version=${Old_nginx_version_tmp##*/} -echo -e "Current Nginx Version: \033[32m$Old_nginx_version\033[0m" -while : -do - echo - read -p "Please input upgrade Nginx Version(example: 1.4.3): " nginx_version - if [ "$nginx_version" != "$Old_nginx_version" ];then - [ ! -e "nginx-$nginx_version.tar.gz" ] && wget -c http://nginx.org/download/nginx-$nginx_version.tar.gz > /dev/null 2>&1 - if [ -e "nginx-$nginx_version.tar.gz" ];then - echo -e "Download \033[32mnginx-$nginx_version.tar.gz\033[0m successfully! " - break - else - echo -e "\033[31mIt does not exist!\033[0m" - fi - else - echo -e "\033[31minput error! The upgrade Nginx version is the same as the old version\033[0m" - fi -done - -if [ -e "nginx-$nginx_version.tar.gz" ];then - echo -e "\033[32mnginx-$nginx_version.tar.gz\033[0m [found]" - echo "Press Ctrl+c to cancel or Press any key to continue..." - char=`get_char` - tar xzf nginx-$nginx_version.tar.gz - cd nginx-$nginx_version - make clean - $nginx_install_dir/sbin/nginx -V &> $$ - nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` - rm -rf $$ - ./configure $nginx_configure_arguments - make - if [ -f "objs/nginx" ];then - /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) - /bin/cp objs/nginx $nginx_install_dir/sbin/nginx - kill -USR2 `cat /var/run/nginx.pid` - kill -QUIT `cat /var/run/nginx.pid.oldbin` - echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_nginx_version\033[0m to \033[32m$nginx_version\033[0m" - echo "Restarting Nginx..." - /etc/init.d/nginx restart - else - echo -e "\033[31mupgrade Nginx failed! \033[0m" - fi - cd .. -fi diff --git a/upgrade_tengine.sh b/upgrade_tengine.sh deleted file mode 100755 index 9c8d6deb..00000000 --- a/upgrade_tengine.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -# Check if user is root -[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 - -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -clear -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# Upgrade Tengine for LNMP #" -echo "# For more information Please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" - -cd src -. ../options.conf -[ ! -e "$tengine_install_dir" -o ! -e "$tengine_install_dir/sbin/dso_tool" ] && echo -e "\033[31mThe Tengine is not installed on your system!\033[0m " && exit 1 -get_char() -{ -SAVEDSTTY=`stty -g` -stty -echo -stty cbreak -dd if=/dev/tty bs=1 count=1 2> /dev/null -stty -raw -stty echo -stty $SAVEDSTTY -} - -echo -Old_tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` -Old_tengine_version="`echo ${Old_tengine_version_tmp#*/} | awk '{print $1}'`" -echo -e "Current Tengine Version: \033[32m$Old_tengine_version\033[0m" -while : -do - echo - read -p "Please input upgrade Tengine Version(example: 1.5.1): " tengine_version - if [ "$tengine_version" != "$Old_tengine_version" ];then - [ ! -e "tengine-$tengine_version.tar.gz" ] && wget -c http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz > /dev/null 2>&1 - if [ -e "tengine-$tengine_version.tar.gz" ];then - echo -e "Download \033[32mtengine-$tengine_version.tar.gz\033[0m successfully! " - break - else - echo -e "\033[31mIt does not exist!\033[0m" - fi - else - echo -e "\033[31minput error! The upgrade Tengine version is the same as the old version\033[0m" - fi -done - -if [ -e "tengine-$tengine_version.tar.gz" ];then - echo -e "\033[32mtengine-$tengine_version.tar.gz\033[0m [found]" - echo "Press Ctrl+c to cancel or Press any key to continue..." - char=`get_char` - tar xzf tengine-$tengine_version.tar.gz - cd tengine-$tengine_version - make clean - $tengine_install_dir/sbin/nginx -V &> $$ - tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` - rm -rf $$ - ./configure $tengine_configure_arguments - make - if [ -f "objs/nginx" ];then - /bin/mv $tengine_install_dir/sbin/nginx $tengine_install_dir/sbin/nginx$(date +%m%d) - /bin/cp objs/nginx $tengine_install_dir/sbin/nginx - kill -USR2 `cat /var/run/nginx.pid` - kill -QUIT `cat /var/run/nginx.pid.oldbin` - echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_tengine_version\033[0m to \033[32m$tengine_version\033[0m" - echo "Restarting Tengine..." - /etc/init.d/nginx restart - else - echo -e "\033[31mupgrade Tengine failed! \033[0m" - fi - cd .. -fi diff --git a/upgrade_web.sh b/upgrade_web.sh new file mode 100755 index 00000000..faa7977f --- /dev/null +++ b/upgrade_web.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade Nginx/Tengine for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf + +[ ! -e "$web_install_dir/sbin/nginx" ] && echo -e "\033[31mThe Nginx/Tengine is not installed on your system!\033[0m " && exit 1 + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} +echo + +Upgrade_Nginx() +{ +Old_nginx_version_tmp=`$web_install_dir/sbin/nginx -v 2>&1` +Old_nginx_version=${Old_nginx_version_tmp##*/} +echo -e "Current Nginx Version: \033[32m$Old_nginx_version\033[0m" +while : +do + echo + read -p "Please input upgrade Nginx Version(example: 1.4.3): " nginx_version + if [ "$nginx_version" != "$Old_nginx_version" ];then + [ ! -e "nginx-$nginx_version.tar.gz" ] && wget -c http://nginx.org/download/nginx-$nginx_version.tar.gz > /dev/null 2>&1 + if [ -e "nginx-$nginx_version.tar.gz" ];then + echo -e "Download \033[32mnginx-$nginx_version.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mNginx version does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade Nginx version is the same as the old version\033[0m" + fi +done + +if [ -e "nginx-$nginx_version.tar.gz" ];then + echo -e "\033[32mnginx-$nginx_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf nginx-$nginx_version.tar.gz + cd nginx-$nginx_version + make clean + $web_install_dir/sbin/nginx -V &> $$ + nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ + ./configure $nginx_configure_arguments + make + if [ -f "objs/nginx" ];then + /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $web_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_nginx_version\033[0m to \033[32m$nginx_version\033[0m" + echo "Restarting Nginx..." + /etc/init.d/nginx restart + else + echo -e "\033[31mUpgrade Nginx failed! \033[0m" + fi + cd .. +fi +} + +Upgrade_Tengine() +{ +Old_tengine_version_tmp=`$web_install_dir/sbin/nginx -v 2>&1` +Old_tengine_version="`echo ${Old_tengine_version_tmp#*/} | awk '{print $1}'`" +echo -e "Current Tengine Version: \033[32m$Old_tengine_version\033[0m" +while : +do + echo + read -p "Please input upgrade Tengine Version(example: 1.5.1): " tengine_version + if [ "$tengine_version" != "$Old_tengine_version" ];then + [ ! -e "tengine-$tengine_version.tar.gz" ] && wget -c http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz > /dev/null 2>&1 + if [ -e "tengine-$tengine_version.tar.gz" ];then + echo -e "Download \033[32mtengine-$tengine_version.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mTengine version does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade Tengine version is the same as the old version\033[0m" + fi +done + +if [ -e "tengine-$tengine_version.tar.gz" ];then + echo -e "\033[32mtengine-$tengine_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf tengine-$tengine_version.tar.gz + cd tengine-$tengine_version + make clean + $web_install_dir/sbin/nginx -V &> $$ + tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ + ./configure $tengine_configure_arguments + make + if [ -f "objs/nginx" ];then + /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) + /bin/cp objs/nginx $web_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_tengine_version\033[0m to \033[32m$tengine_version\033[0m" + echo "Restarting Tengine..." + /etc/init.d/nginx restart + else + echo -e "\033[31mUpgrade Tengine failed! \033[0m" + fi + cd .. +fi +} + +if [ ! -e "$web_install_dir/sbin/dso_tool" ];then + Upgrade_Nginx +elif [ -e "$web_install_dir/sbin/dso_tool" ];then + Upgrade_Tengine +fi From 2780eb3c374ef3f0ce014d7e77c4cc9019c576a0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 19 Oct 2013 21:16:26 +0800 Subject: [PATCH 221/617] Get IP Address with Python --- functions/get_ipv4.sh | 6 ------ functions/get_local_ip.py | 22 ++++++++++++++++++++++ functions/get_public_ip.py | 21 +++++++++++++++++++++ functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/pureftpd.sh | 2 +- init/init_CentOS.sh | 3 ++- install.sh | 12 ++++++------ uninstall.sh | 11 +++++++++-- 10 files changed, 64 insertions(+), 19 deletions(-) delete mode 100755 functions/get_ipv4.sh create mode 100755 functions/get_local_ip.py create mode 100755 functions/get_public_ip.py diff --git a/functions/get_ipv4.sh b/functions/get_ipv4.sh deleted file mode 100755 index 07ba626e..00000000 --- a/functions/get_ipv4.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^10\. | grep -v ^192\.168 | grep -v ^172\. | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` -[ ! -n "$IP" ] && IP=`ifconfig | grep 'inet addr:' | cut -d: -f2 | grep -v ^127\. | awk '{print $1}' | awk '{print;exit}'` diff --git a/functions/get_local_ip.py b/functions/get_local_ip.py new file mode 100755 index 00000000..ba47f1a5 --- /dev/null +++ b/functions/get_local_ip.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import socket +def Get_local_ip(): + """ + Returns the actual ip of the local machine. + This code figures out what source address would be used if some traffic + were to be sent out to some well known address on the Internet. In this + case, a Google DNS server is used, but the specific address does not + matter much. No traffic is actually sent. + """ + try: + csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + csock.connect(('8.8.8.8', 80)) + (addr, port) = csock.getsockname() + csock.close() + return addr + except socket.error: + return "127.0.0.1" + +if __name__ == "__main__": + local_IP = Get_local_ip() + print local_IP diff --git a/functions/get_public_ip.py b/functions/get_public_ip.py new file mode 100755 index 00000000..1439d319 --- /dev/null +++ b/functions/get_public_ip.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +import re,urllib2 +class Get_public_ip: + def getip(self): + try: + myip = self.visit("http://www.whereismyip.com/") + except: + try: + myip = self.visit("http://www.ip138.com/ip2city.asp") + except: + myip = "So sorry!!!" + return myip + def visit(self,url): + opener = urllib2.urlopen(url) + if url == opener.geturl(): + str = opener.read() + return re.search('\d+\.\d+\.\d+\.\d+',str).group(0) + +if __name__ == "__main__": + getmyip = Get_public_ip() + print getmyip.getip() diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 10535d79..274ee5cf 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -171,7 +171,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index ead8e32e..d23e3d80 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -173,7 +173,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index d1541555..25a91030 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -180,7 +180,7 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IP:9000@" $php_install_dir/etc/php-fpm.conf +[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start cd ../../ } diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index ba05dd08..ae912d41 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -48,7 +48,7 @@ update-rc.d pureftpd defaults" cd src tar xzf ftp_v2.1.tar.gz sed -i 's/tmppasswd/'$conn_ftpusers_dbpwd'/' ftp/config.php - sed -i "s/myipaddress.com/`echo $IP`/" ftp/config.php + sed -i "s/myipaddress.com/`echo $local_IP`/" ftp/config.php sed -i 's@\$DEFUserID.*;@\$DEFUserID = "501";@' ftp/config.php sed -i 's@\$DEFGroupID.*;@\$DEFGroupID = "501";@' ftp/config.php sed -i 's@iso-8859-1@UTF-8@' ftp/language/english.php diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 2283cb79..8eb62594 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,7 +12,8 @@ cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -if [ "`../functions/get_ip_area.py $IP`" == 'CN' ];then +public_IP=`../functions/get_public_ip.py` +if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d diff --git a/install.sh b/install.sh index e7094cba..113ae83a 100755 --- a/install.sh +++ b/install.sh @@ -21,8 +21,8 @@ echo "#######################################################################" #get pwd sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" ./options.conf -# get ipv4 -. functions/get_ipv4.sh +# get local ip address +local_IP=`./functions/get_local_ip.py` # Definition Directory . ./options.conf @@ -494,14 +494,14 @@ echo -e "\033[32mPlease restart the server and see if the services start up fine [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web dir:"`\033[32m$home_dir/default/xcache\033[0m" -[ "$PHP_cache" == '3' -a "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$IP/xcache\033[0m" +[ "$PHP_cache" == '3' -a "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$local_IP/xcache\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "pureftpd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" -[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "ftp web manager url:"`\033[32mhttp://$IP/ftp\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "ftp web manager url:"`\033[32mhttp://$local_IP/ftp\033[0m" [ "$phpMyAdmin_yn" == 'y' ] && echo -e "\n`printf "%-32s" "phpMyAdmin dir:"`\033[32m$home_dir/default/phpMyAdmin\033[0m" -[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin url:"`\033[32mhttp://$IP/phpMyAdmin\033[0m" +[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin url:"`\033[32mhttp://$local_IP/phpMyAdmin\033[0m" [ "$redis_yn" == 'y' ] && echo -e "\n`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" [ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" -[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`\033[32mhttp://$IP/\033[0m" +[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`\033[32mhttp://$local_IP/\033[0m" diff --git a/uninstall.sh b/uninstall.sh index be7f8ec5..34445102 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -6,7 +6,14 @@ [ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && kill -9 $$ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Uninstall LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" . ./options.conf + Uninstall() { [ -e "$db_install_dir" ] && service mysqld stop @@ -30,6 +37,7 @@ sed -i 's@^db_data_dir=.*@db_data_dir=@' ./options.conf sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf sed -i 's@^ftpmanagerpwd=.*@ftpmanagerpwd=@' ./options.conf sed -i 's@^conn_ftpusers_dbpwd=.*@conn_ftpusers_dbpwd=@' ./options.conf +sed -i "s@^export.*$db_install_dir.*@@g" /etc/profile && . /etc/profile echo -e "\033[32mUninstall completed.\033[0m" } @@ -44,7 +52,6 @@ stty echo stty $SAVEDSTTY } -clear echo echo -e "\033[31mYou will uninstall LNMP, Please backup your configure files and DB data! \033[0m" echo @@ -60,7 +67,7 @@ done [ -e "$memcached_install_dir" ] && echo '/etc/init.d/memcached' [ -e "$redis_install_dir" ] && echo '/etc/init.d/redis-server' echo -echo -e "\033[33mPress any key to continue\033[0m..." +echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` while : From df16c118204a6daa97f6b90da20663e324772f49 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 21 Oct 2013 10:15:40 +0800 Subject: [PATCH 222/617] update ImageMagick to 6.8.7-1 --- functions/GraphicsMagick.sh | 6 +++--- functions/ImageMagick.sh | 6 +++--- functions/get_ip_area.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index b1604280..624d80c2 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.2RC1.tgz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.4RC1.tgz && Download_src tar xzf GraphicsMagick-1.3.18.tar.gz cd GraphicsMagick-1.3.18 @@ -17,8 +17,8 @@ cd GraphicsMagick-1.3.18 make && make install cd ../ -tar xzf gmagick-1.1.2RC1.tgz -cd gmagick-1.1.2RC1 +tar xzf gmagick-1.1.4RC1.tgz +cd gmagick-1.1.4RC1 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 4885e6b5..5af58f37 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/imagemagick/6.8.7-sources/ImageMagick-6.8.7-0.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/imagemagick/6.8.7-sources/ImageMagick-6.8.7-1.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-0.tar.gz -cd ImageMagick-6.8.7-0 +tar xzf ImageMagick-6.8.7-1.tar.gz +cd ImageMagick-6.8.7-1 ./configure make && make install cd ../ diff --git a/functions/get_ip_area.py b/functions/get_ip_area.py index 440d535e..5536f3f1 100755 --- a/functions/get_ip_area.py +++ b/functions/get_ip_area.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python #coding:utf-8 try: import sys,urllib2,json From eec5338010d8a394ba5f6ed9daadab184304bdb0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 23 Oct 2013 20:46:18 +0800 Subject: [PATCH 223/617] add ZendGuardLoader (php-5.4, php-5.3) --- README.md | 8 +++++- conf/index.html | 6 ++-- functions/ImageMagick.sh | 2 +- functions/ZendGuardLoader.sh | 53 ++++++++++++++++++++++++++++++++++++ functions/nginx.sh | 2 +- functions/tengine.sh | 2 +- functions/test.sh | 5 +++- functions/zendopcache.sh | 1 + install.sh | 35 +++++++++++++++++++----- 9 files changed, 99 insertions(+), 15 deletions(-) create mode 100755 functions/ZendGuardLoader.sh diff --git a/README.md b/README.md index 3e9570ff..4a53800a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache, eAccelerator, xcache (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, eAccelerator, xcache, ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc @@ -37,6 +37,12 @@ ./vhost.sh ``` +## How to upgrade +```bash + ./upgrade_php.sh # upgrade PHP + ./upgrade_web.sh # upgrade Nginx/Tengine +``` + ## How to uninstall ```bash diff --git a/conf/index.html b/conf/index.html index 6eaf0065..8a34e3cf 100644 --- a/conf/index.html +++ b/conf/index.html @@ -25,11 +25,11 @@

Congratulations, LNMP安装成功!

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RedHat 5+、Debian 6+、Ubuntu 12+

-

Github地址:https://github.com/lj2007331/lnmp

-

查看本地环境:探针 phpinfo FTP Manager xcache phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

+

查看本地环境:探针 phpinfo FTP Manager xcache phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

+

Github项目地址:https://github.com/lj2007331/lnmp

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

- +
diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 5af58f37..01e00534 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,7 +8,7 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/imagemagick/6.8.7-sources/ImageMagick-6.8.7-1.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-1.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src tar xzf ImageMagick-6.8.7-1.tar.gz diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh new file mode 100755 index 00000000..b18830a5 --- /dev/null +++ b/functions/ZendGuardLoader.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_ZendGuardLoader() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +php_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` +PHP_version=${php_version%.*} + +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then + if [ "$PHP_version" == '5.4' ];then + src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + fi + + if [ "$PHP_version" == '5.3' ];then + src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + fi +else + if [ "$PHP_version" == '5.4' ];then + src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + fi + + if [ "$PHP_version" == '5.3' ];then + src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + fi +fi + +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ZendGuardLoader.so" ];then + cat >> $php_install_dir/etc/php.ini << EOF +[Zend Guard Loader] +zend_extension="/usr/local/php/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ZendGuardLoader.so" +zend_loader.enable=1 +zend_loader.disable_licensing=0 +zend_loader.obfuscation_level_support=3 +EOF + service php-fpm restart +else + echo -e "\033[31meZendGuardLoader module install failed, Please contact the author! \033[0m" +fi +cd ../ +} diff --git a/functions/nginx.sh b/functions/nginx.sh index a3e36a05..78cb0853 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src src_url=http://nginx.org/download/nginx-1.4.3.tar.gz && Download_src tar xzf pcre-8.33.tar.gz diff --git a/functions/tengine.sh b/functions/tengine.sh index 5a19bef7..091f8c52 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.33.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-1.5.1.tar.gz && Download_src tar xzf pcre-8.33.tar.gz diff --git a/functions/test.sh b/functions/test.sh index 2b4d1159..d39c3574 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -9,11 +9,14 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.yahei.net/tz/tz.zip && Download_src +src_url=https://gist.github.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default unzip -q tz.zip -d $home_dir/default +[ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html +[ "$PHP_cache" == '2' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html chown -R www.www $home_dir/default -[ "$DB_yn" == 'y' ] && service mysqld restart +[ ! -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld restart cd .. } diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 9e5be77f..41d840db 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -18,6 +18,7 @@ $php_install_dir/bin/phpize make && make install if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" ];then cat >> $php_install_dir/etc/php.ini << EOF +[opcache] zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" opcache.memory_consumption=128 opcache.interned_strings_buffer=8 diff --git a/install.sh b/install.sh index 113ae83a..1dd2d4b6 100755 --- a/install.sh +++ b/install.sh @@ -189,6 +189,18 @@ do (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" done fi + if [ "$PHP_version" == '2' -o "$PHP_version" == '3' ];then + while : + do + echo + read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn + if [ "$ZendGuardLoader_yn" != 'y' -a "$ZendGuardLoader_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + fi while : do echo @@ -213,8 +225,8 @@ do break fi done + break fi - break done fi break @@ -437,6 +449,12 @@ elif [ "$PHP_cache" == '3' ];then Install_XCache 2>&1 | tee -a $lnmp_dir/install.log fi +# ZendGuardLoader (php <= 5.4) +if [ "$ZendGuardLoader_yn" == 'y' ];then + . functions/ZendGuardLoader.sh + Install_ZendGuardLoader 2>&1 | tee -a $lnmp_dir/install.log +fi + # Web server if [ "$Web_server" == '1' ];then . functions/nginx.sh @@ -489,19 +507,22 @@ echo "####################Congratulations########################" echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" -[ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database data dir:"`\033[32m$db_data_dir\033[0m" +[ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database data dir:"`\033[32m$db_data_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" -[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache web dir:"`\033[32m$home_dir/default/xcache\033[0m" -[ "$PHP_cache" == '3' -a "$Web_yn" == 'y' ] && echo -e "`printf "%-32s" "xcache web manager url:"`\033[32mhttp://$local_IP/xcache\033[0m" +[ "$PHP_cache" == '1' ] && echo -e "`printf "%-32s" "Opcache Control Panel url:"`\033[32mhttp://$local_IP/ocp.php\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator Control Panel url:"`\033[32mhttp://$local_IP/control.php\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator user:"`\033[32madmin\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator password:"`\033[32meAccelerator\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache Control Panel url:"`\033[32mhttp://$local_IP/xcache\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" [ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" -[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "pureftpd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" -[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "ftp web manager url:"`\033[32mhttp://$local_IP/ftp\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Pure-FTPd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" +[ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Ftp User Control Panel url:"`\033[32mhttp://$local_IP/ftp\033[0m" [ "$phpMyAdmin_yn" == 'y' ] && echo -e "\n`printf "%-32s" "phpMyAdmin dir:"`\033[32m$home_dir/default/phpMyAdmin\033[0m" -[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin url:"`\033[32mhttp://$local_IP/phpMyAdmin\033[0m" +[ "$phpMyAdmin_yn" == 'y' ] && echo -e "`printf "%-32s" "phpMyAdmin Control Panel url:"`\033[32mhttp://$local_IP/phpMyAdmin\033[0m" [ "$redis_yn" == 'y' ] && echo -e "\n`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" [ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`\033[32mhttp://$local_IP/\033[0m" From 3e2911dbb57f77451b49e3eeee66ad3397b12d3d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 24 Oct 2013 22:41:55 +0800 Subject: [PATCH 224/617] add Percona-5.6 --- README.md | 4 +- functions/mariadb-5.5.sh | 6 +- functions/mysql-5.5.sh | 6 +- functions/mysql-5.6.sh | 6 +- functions/percona-5.5.sh | 8 +-- functions/percona-5.6.sh | 129 ++++++++++++++++++++++++++++++++++ functions/php-mysql-client.sh | 6 +- install.sh | 10 ++- options.conf | 2 +- 9 files changed, 155 insertions(+), 22 deletions(-) create mode 100755 functions/percona-5.6.sh diff --git a/README.md b/README.md index 4a53800a..c2fd1b3e 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ - Constant updates - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues -- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5, Percona-5.5) +- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5, Percona-5.5, Percona-5.6) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache, eAccelerator, xcache, ZendGuardLoader (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, eAccelerator, xcache and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index a64dbadf..67d82923 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,13 +9,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 3b28f82e..070612bf 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,13 +8,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 53edb218..5255d315 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,13 +9,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 55fbb6a0..67bfcdf5 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,13 +8,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.33-31.1/source/Percona-Server-5.5.33-rel31.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.33-31.1/source/Percona-Server-5.5.33-rel31.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh new file mode 100755 index 00000000..05e7d98c --- /dev/null +++ b/functions/percona-5.6.sh @@ -0,0 +1,129 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +Install_Percona-5-6() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.percona.com/downloads/Percona-Server-5.6/LATEST/release-5.6.14-62.0/483/source/Percona-Server-5.6.14-rel62.0.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 +CFLAGS= CXXFLAGS= ./configure +make && make install +cd .. +tar zxf Percona-Server-5.6.14-rel62.0.tar.gz +cd Percona-Server-5.6.14-rel62.0 +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 +cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ +-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ +-DMYSQL_DATADIR=$percona_data_dir \ +-DSYSCONFDIR=/etc \ +-DMYSQL_TCP_PORT=3306 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DWITH_EXTRA_CHARSETS=all \ +-DWITH_DEBUG=0 \ +$EXE_LINKER +make && make install + +if [ -d "$percona_install_dir" ];then + echo -e "\033[32mPercona install successfully! \033[0m" +else + echo -e "\033[31mPercona install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd ../../ + +# my.cf +cat > /etc/my.cnf << EOF +[mysqld] +basedir = $percona_install_dir +datadir = $percona_data_dir +pid-file = $percona_data_dir/mysql.pid +character-set-server = utf8 +collation-server = utf8_general_ci +user = mysql +port = 3306 +default_storage_engine = InnoDB +innodb_file_per_table = 1 +server_id = 1 +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 7 +bind-address = 0.0.0.0 + +# name-resolve +skip-name-resolve +skip-host-cache + +#lower_case_table_names = 1 +ft_min_word_len = 1 +query_cache_size = 64M +query_cache_type = 1 + +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# LOG +log_error = $percona_data_dir/mysql-error.log +long_query_time = 1 +slow_query_log +slow_query_log_file = $percona_data_dir/mysql-slow.log + +# Oher +#max_connections = 1000 +open_files_limit = 65535 + +[client] +port = 3306 +EOF + +$percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir + +chown mysql.mysql -R $percona_data_dir +service mysqld start +export PATH=$PATH:$percona_install_dir/bin +echo "export PATH=\$PATH:$percona_install_dir/bin" >> /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 "delete from mysql.user where Password='';" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" +$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" +sed -i "s@^db_install_dir.*@db_install_dir=$percona_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$percona_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 1d001d73..76a58714 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src -tar xzf cmake-2.8.11.2.tar.gz -cd cmake-2.8.11.2 +tar xzf cmake-2.8.12.tar.gz +cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/install.sh b/install.sh index 1dd2d4b6..1cf84ae0 100755 --- a/install.sh +++ b/install.sh @@ -108,10 +108,11 @@ do echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" echo -e "\t\033[32m4\033[0m. Install Percona-5.5" + echo -e "\t\033[32m5\033[0m. Install Percona-5.6" read -p "Please input a number:(Default 1 press Enter) " DB_version [ -z "$DB_version" ] && DB_version=1 - if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 -a $DB_version != 4 ];then - echo -e "\033[31minput error! Please only input number 1,2,3,4 \033[0m" + if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 -a $DB_version != 4 -a $DB_version != 5 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4,5 \033[0m" else while : do @@ -399,6 +400,9 @@ elif [ "$DB_version" == '3' ];then elif [ "$DB_version" == '4' ];then . functions/percona-5.5.sh Install_Percona-5-5 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '5' ];then + . functions/percona-5.6.sh + Install_Percona-5-6 2>&1 | tee -a $lnmp_dir/install.log fi # PHP MySQL Client @@ -511,7 +515,7 @@ echo -e "\033[32mPlease restart the server and see if the services start up fine [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" -[ "$PHP_cache" == '1' ] && echo -e "`printf "%-32s" "Opcache Control Panel url:"`\033[32mhttp://$local_IP/ocp.php\033[0m" +[ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && echo -e "`printf "%-32s" "Opcache Control Panel url:"`\033[32mhttp://$local_IP/ocp.php\033[0m" [ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator Control Panel url:"`\033[32mhttp://$local_IP/control.php\033[0m" [ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator user:"`\033[32madmin\033[0m" [ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator password:"`\033[32meAccelerator\033[0m" diff --git a/options.conf b/options.conf index f0c0cb80..bc959172 100644 --- a/options.conf +++ b/options.conf @@ -39,7 +39,7 @@ db_install_dir= db_data_dir= -dbrootpwd= +dbrootpwd=admin ftpmanagerpwd= From 8c21c660ad68f884adb9b137bb839f1f83ec2204 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 24 Oct 2013 22:43:41 +0800 Subject: [PATCH 225/617] rm dbrootpwd --- options.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options.conf b/options.conf index bc959172..f0c0cb80 100644 --- a/options.conf +++ b/options.conf @@ -39,7 +39,7 @@ db_install_dir= db_data_dir= -dbrootpwd=admin +dbrootpwd= ftpmanagerpwd= From 5164b5b22ef2d2a0d72c89c995b52be6da71f080 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 31 Oct 2013 10:01:47 +0800 Subject: [PATCH 226/617] updates source packages --- functions/ImageMagick.sh | 6 +++--- functions/ngx_pagespeed.sh | 14 +++++++------- functions/percona-5.5.sh | 6 +++--- init/init_Debian.sh | 1 + init/init_Ubuntu.sh | 1 + 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 01e00534..955c8801 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-1.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-3.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-1.tar.gz -cd ImageMagick-6.8.7-1 +tar xzf ImageMagick-6.8.7-3.tar.gz +cd ImageMagick-6.8.7-3 ./configure make && make install cd ../ diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index b1212f34..6cba4b9e 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz && Download_src -[ -s "release-1.6.29.5-beta.zip" ] && echo "release-1.6.29.5-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-master.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.7.tar.gz && Download_src +[ -s "release-1.6.29.7-beta.zip" ] && echo "release-1.6.29.7-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-master.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip unzip -q ngx_pagespeed-master.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-release-1.6.29.5-beta -tar xzf 1.6.29.5.tar.gz -C ngx_pagespeed-release-1.6.29.5-beta +/bin/mv ngx_pagespeed-master ngx_pagespeed-release-1.6.29.7-beta +tar xzf 1.6.29.7.tar.gz -C ngx_pagespeed-release-1.6.29.7-beta if [ "$Web_server" == '1' ];then cd nginx-1.4.3 @@ -24,9 +24,9 @@ if [ "$Web_server" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.7-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.5-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.7-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Web_server" == '1' ];then fi cd ../ elif [ "$Web_server" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.5-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.7-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 67bfcdf5..66274800 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src -src_url=http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.33-31.1/source/Percona-Server-5.5.33-rel31.1.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/release-5.5.34-32.0/591/source/Percona-Server-5.5.34-rel32.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -18,8 +18,8 @@ cd cmake-2.8.12 CFLAGS= CXXFLAGS= ./configure make && make install cd .. -tar zxf Percona-Server-5.5.33-rel31.1.tar.gz -cd Percona-Server-5.5.33-rel31.1 +tar zxf Percona-Server-5.5.34-rel32.0.tar.gz +cd Percona-Server-5.5.34-rel32.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/init/init_Debian.sh b/init/init_Debian.sh index ec6f2843..bcbb2f19 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -98,5 +98,6 @@ cat > /etc/iptables.up.rules << EOF COMMIT EOF iptables-restore < /etc/iptables.up.rules +echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces . ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 2240564b..b5f65198 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -100,5 +100,6 @@ cat > /etc/iptables.up.rules << EOF COMMIT EOF iptables-restore < /etc/iptables.up.rules +echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces . ~/.bashrc From d8e73f1eddc5c21b434cb529225f4cbca7ba6dfb Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 00:07:48 +0800 Subject: [PATCH 227/617] mysql shutdown bug --- functions/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/test.sh b/functions/test.sh index d39c3574..d1be5d8c 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -17,6 +17,6 @@ unzip -q tz.zip -d $home_dir/default [ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html [ "$PHP_cache" == '2' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html chown -R www.www $home_dir/default -[ ! -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld restart +[ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld restart cd .. } From 3929569760c690826a5408e9ae2e9eae94761cef Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 11:35:51 +0800 Subject: [PATCH 228/617] update ImageMagick to 6.8.7-4 --- functions/ImageMagick.sh | 6 +++--- functions/test.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 955c8801..52b0a038 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-3.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-4.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-3.tar.gz -cd ImageMagick-6.8.7-3 +tar xzf ImageMagick-6.8.7-4.tar.gz +cd ImageMagick-6.8.7-4 ./configure make && make install cd ../ diff --git a/functions/test.sh b/functions/test.sh index d1be5d8c..3cd612ec 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -17,6 +17,6 @@ unzip -q tz.zip -d $home_dir/default [ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html [ "$PHP_cache" == '2' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html chown -R www.www $home_dir/default -[ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld restart +[ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start cd .. } From 286773092a59d5580b3b9a93cc10cdfbdf2ebd87 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 14:54:22 +0800 Subject: [PATCH 229/617] Add some tips --- README.md | 13 ++++++++++--- functions/ngx_pagespeed.sh | 4 ++-- install.sh | 24 ++++++++++++++++++------ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c2fd1b3e..7ce6bc5c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB` and `PHP`) for CentOS/Redhat Debian and Ubuntu. + This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB`/`Percona` and `PHP`) for CentOS/Redhat Debian and Ubuntu. Script features: - Constant updates @@ -25,12 +25,19 @@ cd lnmp chmod +x install.sh # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. - # Если сеть не работает, вы можете выполнять команды `srceen -r lnmp` сети подключить установку окна. - # 如果网路出现中断,可以执行命令`srceen -r lnmp`重新连接安装窗口 screen -S lnmp ./install.sh ``` +## How to manage service + + Nginx/Tengine: `service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}` +MySQL/MariaDB/Percona: `service mysqld {start|stop|restart|reload|force-reload|status}` + PHP: `service php-fpm {start|stop|force-quit|restart|reload|status}` + Pure-Ftpd: `service pureftpd {start|stop|restart|condrestart|status}` + Redis: `service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload}` + Memcached: `service memcached {start|stop|status|restart|reload|force-reload}` + ## How to add a virtual host ```bash diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 6cba4b9e..520121d0 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -16,7 +16,7 @@ unzip -q ngx_pagespeed-master.zip /bin/mv ngx_pagespeed-master ngx_pagespeed-release-1.6.29.7-beta tar xzf 1.6.29.7.tar.gz -C ngx_pagespeed-release-1.6.29.7-beta -if [ "$Web_server" == '1' ];then +if [ "$Nginx_version" == '1' ];then cd nginx-1.4.3 make clean $web_install_dir/sbin/nginx -V &> $$ @@ -42,7 +42,7 @@ if [ "$Web_server" == '1' ];then echo -e "\033[31minstall ngx_pagespeed failed\033[0m" fi cd ../ -elif [ "$Web_server" == '2' ];then +elif [ "$Nginx_version" == '2' ];then $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.7-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf diff --git a/install.sh b/install.sh index 1cf84ae0..c6170a46 100755 --- a/install.sh +++ b/install.sh @@ -68,9 +68,9 @@ do echo 'Please select Web server:' echo -e "\t\033[32m1\033[0m. Install Nginx" echo -e "\t\033[32m2\033[0m. Install Tengine" - read -p "Please input a number:(Default 1 press Enter) " Web_server - [ -z "$Web_server" ] && Web_server=1 - if [ $Web_server != 1 -a $Web_server != 2 ];then + read -p "Please input a number:(Default 1 press Enter) " Nginx_version + [ -z "$Nginx_version" ] && Nginx_version=1 + if [ $Nginx_version != 1 -a $Nginx_version != 2 ];then echo -e "\033[31minput error! Please only input number 1,2\033[0m" else while : @@ -460,10 +460,10 @@ if [ "$ZendGuardLoader_yn" == 'y' ];then fi # Web server -if [ "$Web_server" == '1' ];then +if [ "$Nginx_version" == '1' ];then . functions/nginx.sh Install_Nginx 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$Web_server" == '2' ];then +elif [ "$Nginx_version" == '2' ];then . functions/tengine.sh Install_Tengine 2>&1 | tee -a $lnmp_dir/install.log fi @@ -508,7 +508,7 @@ if [ ! -e "$home_dir/default/index.html" -a -d "$web_install_dir" ];then fi echo "####################Congratulations########################" -echo -e "\033[32mPlease restart the server and see if the services start up fine.\033[0m" +echo [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database data dir:"`\033[32m$db_data_dir\033[0m" @@ -530,3 +530,15 @@ echo -e "\033[32mPlease restart the server and see if the services start up fine [ "$redis_yn" == 'y' ] && echo -e "\n`printf "%-32s" "redis install dir:"`\033[32m$redis_install_dir\033[0m" [ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`\033[32m$memcached_install_dir\033[0m" [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`\033[32mhttp://$local_IP/\033[0m" +while : +do + echo + echo -e "\033[31mPlease restart the server and see if the services start up fine.\033[0m" + read -p "Do you want to restart OS ? [y/n]: " restart_yn + if [ "$restart_yn" != 'y' -a "$restart_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi +done +[ "$restart_yn" == 'y' ] && reboot From f017036c0c854a22b35b13fc184dc8156199bd76 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 14:56:41 +0800 Subject: [PATCH 230/617] README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7ce6bc5c..fd2ee8bd 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,12 @@ ## How to manage service - Nginx/Tengine: `service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}` -MySQL/MariaDB/Percona: `service mysqld {start|stop|restart|reload|force-reload|status}` - PHP: `service php-fpm {start|stop|force-quit|restart|reload|status}` - Pure-Ftpd: `service pureftpd {start|stop|restart|condrestart|status}` - Redis: `service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload}` - Memcached: `service memcached {start|stop|status|restart|reload|force-reload}` + Nginx/Tengine: `service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}`
+MySQL/MariaDB/Percona: `service mysqld {start|stop|restart|reload|force-reload|status}`
+ PHP: `service php-fpm {start|stop|force-quit|restart|reload|status}`
+ Pure-Ftpd: `service pureftpd {start|stop|restart|condrestart|status}`
+ Redis: `service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload}`
+ Memcached: `service memcached {start|stop|status|restart|reload|force-reload}`
## How to add a virtual host From d329a75c43c481706e21dcfeff627019deb1db88 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 15:01:13 +0800 Subject: [PATCH 231/617] README --- README.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fd2ee8bd..688e23a4 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,31 @@ ``` ## How to manage service - - Nginx/Tengine: `service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}`
-MySQL/MariaDB/Percona: `service mysqld {start|stop|restart|reload|force-reload|status}`
- PHP: `service php-fpm {start|stop|force-quit|restart|reload|status}`
- Pure-Ftpd: `service pureftpd {start|stop|restart|condrestart|status}`
- Redis: `service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload}`
- Memcached: `service memcached {start|stop|status|restart|reload|force-reload}`
+Nginx/Tengine: +```bash + service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest} +``` +MySQL/MariaDB/Percona: +```bash + service mysqld {start|stop|restart|reload|force-reload|status} +``` +PHP: +```bash + service php-fpm {start|stop|force-quit|restart|reload|status} +``` +Pure-Ftpd: +```bash + service pureftpd {start|stop|restart|condrestart|status} +``` +Redis: +```bash + service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload} +``` +```bash +Memcached: +```bash + service memcached {start|stop|status|restart|reload|force-reload} +``` ## How to add a virtual host From b454dbc497eb637ecb1a00d6dc7f04b7536960b0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 2 Nov 2013 15:02:12 +0800 Subject: [PATCH 232/617] README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 688e23a4..be5f1f29 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,6 @@ Redis: ```bash service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload} ``` -```bash Memcached: ```bash service memcached {start|stop|status|restart|reload|force-reload} From dfbef67e1b223056cf7a12f170a367926ac7a691 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 8 Nov 2013 17:50:53 +0800 Subject: [PATCH 233/617] Add Apache-2.4 and Apache-2.2, You can freely choose to install lnmp,lamp,lanmp --- README.md | 7 +- conf/index.html | 2 +- conf/nginx.conf | 63 ++---- conf/nginx_apache.conf | 93 +++++++++ functions/GraphicsMagick.sh | 8 +- functions/ImageMagick.sh | 8 +- functions/ZendGuardLoader.sh | 2 +- functions/apache-2.2.sh | 113 ++++++++++ functions/apache-2.4.sh | 116 +++++++++++ functions/eaccelerator-0.9.sh | 2 +- functions/eaccelerator-1.0-dev.sh | 2 +- functions/mariadb-5.5.sh | 13 +- functions/memcached.sh | 4 +- functions/mysql-5.5.sh | 13 +- functions/mysql-5.6.sh | 13 +- functions/nginx.sh | 9 +- functions/pecl_http.sh | 2 +- functions/percona-5.5.sh | 13 +- functions/percona-5.6.sh | 13 +- functions/php-5.3.sh | 31 ++- functions/php-5.4.sh | 31 ++- functions/php-5.5.sh | 33 ++- functions/phpmyadmin.sh | 6 +- functions/redis.sh | 2 +- functions/tengine.sh | 9 +- functions/test.sh | 2 + functions/xcache.sh | 2 +- functions/zendopcache.sh | 2 +- install.sh | 52 +++-- uninstall.sh | 14 +- vhost.sh | 334 ++++++++++++++++++++++++------ 31 files changed, 813 insertions(+), 201 deletions(-) create mode 100644 conf/nginx_apache.conf create mode 100755 functions/apache-2.2.sh create mode 100755 functions/apache-2.4.sh diff --git a/README.md b/README.md index be5f1f29..07c1daf0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - This script is free collection of shell scripts for rapid deployment of lnmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB`/`Percona` and `PHP`) for CentOS/Redhat Debian and Ubuntu. + This script is free collection of shell scripts for rapid deployment of lnmp/lamp/lanmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB`/`Percona` and `PHP`) for CentOS/Redhat Debian and Ubuntu. Script features: - Constant updates @@ -7,6 +7,7 @@ - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5, Percona-5.5, Percona-5.6) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine +- You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ngx_pagespeed - According to their needs can to install ZendOPcache, eAccelerator, xcache and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin @@ -42,6 +43,10 @@ PHP: ```bash service php-fpm {start|stop|force-quit|restart|reload|status} ``` +Apache: +```bash + service httpd {start|restart|graceful|graceful-stop|stop} +``` Pure-Ftpd: ```bash service pureftpd {start|stop|restart|condrestart|status} diff --git a/conf/index.html b/conf/index.html index 8a34e3cf..cf16dfa7 100644 --- a/conf/index.html +++ b/conf/index.html @@ -24,7 +24,7 @@

Congratulations, LNMP安装成功!

-

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RedHat 5+、Debian 6+、Ubuntu 12+

+

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP+Pureftpd+User manager for PureFTPd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh)。适用于CentOS/RedHat 5+、Debian 6+、Ubuntu 12+

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

查看本地环境:探针 phpinfo FTP Manager xcache phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

Github项目地址:https://github.com/lj2007331/lnmp

diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ac6a767..d158a716 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,69 +1,50 @@ -user www www; -worker_processes 4; +user www www; +worker_processes 4; -error_log /home/wwwlogs/nginx_error.log crit; -pid /var/run/nginx.pid; +error_log /home/wwwlogs/error_nginx.log crit; +pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; - worker_connections 51200; -} + worker_connections 51200; + } http { - include mime.types; - default_type application/octet-stream; + include mime.types; + default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; - sendfile on; - tcp_nopush on; - keepalive_timeout 60; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; server_tokens off; tcp_nodelay on; -#tomcat proxy add start -# client_body_buffer_size 512k; -# proxy_connect_timeout 300; -# proxy_read_timeout 300; -# proxy_send_timeout 300; -# proxy_buffer_size 16k; -# proxy_buffers 4 64k; -# proxy_busy_buffers_size 128k; -# proxy_temp_file_write_size 128k; -# upstream tomcat_server { -# server 127.0.0.1:8080; -# } -#tomcat proxy add end - fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; + fastcgi_temp_file_write_size 256k; - gzip on; + gzip on; gzip_disable "msie6"; gzip_vary on; gzip_comp_level 2; - gzip_min_length 1k; - gzip_buffers 4 16k; + gzip_min_length 1k; + gzip_buffers 4 16k; gzip_http_version 1.1; - gzip_types text/plain application/x-javascript text/css application/xml; - - limit_rate_after 3m; - limit_rate 512k; + gzip_types text/plain application/x-javascript text/css application/xml; -# proxy_temp_path /tmp/proxy_temp_dir; -# proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=cache_one:50m inactive=1d max_size=1g; ###################pureftpd AND phpmyadmin############################ server { - listen 80; - server_name _; - access_log /home/wwwlogs/access.log combined; + listen 80; + server_name _; + access_log /home/wwwlogs/access_nginx.log combined; root /home/wwwroot/default; index index.html index.php; if ( $query_string ~* ".*[\;'\<\>].*" ){ @@ -71,18 +52,18 @@ http { } location ~ .*\.(php|php5)?$ { - #fastcgi_pass remote_php_ip:9000; + #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { - expires 30d; + expires 30d; } location ~ .*\.(js|css)?$ { - expires 1h; + expires 1h; } } diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf new file mode 100644 index 00000000..6026afb0 --- /dev/null +++ b/conf/nginx_apache.conf @@ -0,0 +1,93 @@ +user www www; +worker_processes 4; + +error_log /home/wwwlogs/error_nginx.log crit; +pid /var/run/nginx.pid; +worker_rlimit_nofile 51200; + +events { + use epoll; + worker_connections 51200; + } + +http { + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 8m; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; + server_tokens off; + tcp_nodelay on; + + proxy_connect_timeout 300s; + proxy_send_timeout 900; + proxy_read_timeout 900; + proxy_buffer_size 32k; + proxy_buffers 4 64k; + proxy_busy_buffers_size 128k; + proxy_redirect off; + proxy_hide_header Vary; + proxy_set_header Accept-Encoding ''; + proxy_set_header Host $host; + proxy_set_header Referer $http_referer; + proxy_set_header Cookie $http_cookie; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 256k; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_comp_level 2; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_types text/plain application/x-javascript text/css application/xml; + +###################pureftpd AND phpmyadmin############################ + server { + listen 80; + server_name _; + access_log /home/wwwlogs/access_nginx.log combined; + root /home/wwwroot/default; + index index.html index.php; + if ( $query_string ~* ".*[\;'\<\>].*" ){ + return 404; + } + + location / { + try_files $uri @apache; + } + + location @apache { + internal; + proxy_pass http://127.0.0.1:8080; + } + + location ~ .*\.(php|php5)?$ { + proxy_pass http://127.0.0.1:8080; + } + + location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { + expires 30d; + } + + location ~ .*\.(js|css)?$ { + expires 1h; + } + } + +##########################vhost##################################### + include vhost/*.conf; +} diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index 624d80c2..a39a470b 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.4RC1.tgz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.5RC1.tgz && Download_src tar xzf GraphicsMagick-1.3.18.tar.gz cd GraphicsMagick-1.3.18 @@ -17,8 +17,8 @@ cd GraphicsMagick-1.3.18 make && make install cd ../ -tar xzf gmagick-1.1.4RC1.tgz -cd gmagick-1.1.4RC1 +tar xzf gmagick-1.1.5RC1.tgz +cd gmagick-1.1.5RC1 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize @@ -32,7 +32,7 @@ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extens else sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini fi - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service php-fpm restart else echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" fi diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 52b0a038..da8acced 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-4.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-5.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-4.tar.gz -cd ImageMagick-6.8.7-4 +tar xzf ImageMagick-6.8.7-5.tar.gz +cd ImageMagick-6.8.7-5 ./configure make && make install cd ../ @@ -29,7 +29,7 @@ cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"@" $php_install_dir/etc/php.ini - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP imagick module install failed, Please contact the author! \033[0m" fi diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh index b18830a5..d50b1978 100755 --- a/functions/ZendGuardLoader.sh +++ b/functions/ZendGuardLoader.sh @@ -45,7 +45,7 @@ zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 EOF - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31meZendGuardLoader module install failed, Please contact the author! \033[0m" fi diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh new file mode 100755 index 00000000..5f3c4cc3 --- /dev/null +++ b/functions/apache-2.2.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Apache-2-2() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.apache.org/dist/httpd/httpd-2.2.25.tar.gz && Download_src + +useradd -M -s /sbin/nologin www +tar xzf httpd-2.2.25.tar.gz +cd httpd-2.2.25 +./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir +make && make install +if [ -d "$apache_install_dir" ];then + echo -e "\033[32mApache install successfully! \033[0m" +else + echo -e "\033[31mApache install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cd .. +/bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd +sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd +sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd +chmod +x /etc/init.d/httpd +OS_CentOS='chkconfig --add httpd \n +chkconfig httpd on' +OS_Debian_Ubuntu='update-rc.d httpd defaults' +OS_command + +sed -i 's/^User daemon/User www/' $apache_install_dir/conf/httpd.conf +sed -i 's/^Group daemon/Group www/' $apache_install_dir/conf/httpd.conf +if [ "$Nginx_version" == '3' ];then + sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf + TMP_PORT=80 + TMP_IP=$local_IP +elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then + sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:8080/' $apache_install_dir/conf/httpd.conf + sed -i 's@^Listen@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf + TMP_PORT=8080 + TMP_IP=127.0.0.1 +fi +sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf +sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf +sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf +sed -i "s@^DocumentRoot.*@DocumentRoot \"$home_dir/default\"@" $apache_install_dir/conf/httpd.conf +sed -i "s@^@@" $apache_install_dir/conf/httpd.conf +sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + +#logrotate apache log +cat > /etc/logrotate.d/apache << EOF +$wwwlogs_dir/*apache.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate +[ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` +endscript +} +EOF + +mkdir $apache_install_dir/conf/vhost +cat > $apache_install_dir/conf/vhost/default.conf << EOF +NameVirtualHost *:8080 + + ServerAdmin admin@linuxeye.com + DocumentRoot "$home_dir/default" + ServerName $TMP_IP + ErrorLog "$wwwlogs_dir/error_apache.log" + CustomLog "$wwwlogs_dir/access_apache.log" common + + SetOutputFilter DEFLATE + Options FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + + +EOF + +cat >> $apache_install_dir/conf/httpd.conf < $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF +LoadModule remoteip_module modules/mod_remoteip.so +RemoteIPHeader X-Forwarded-For +`ifconfig | awk -F"[: ]+" '/inet addr/{print "RemoteIPInternalProxy " $4}'` +EOF + sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf + cd .. +fi +cd .. +service httpd start +} diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh new file mode 100755 index 00000000..9e8a99a5 --- /dev/null +++ b/functions/apache-2.4.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_Apache-2-4() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.4.6.tar.gz && Download_src + +useradd -M -s /sbin/nologin www +tar xzf httpd-2.4.6.tar.gz +tar xzf apr-1.4.8.tar.gz +tar xzf apr-util-1.5.2.tar.gz +cd httpd-2.4.6 +/bin/cp -R ../apr-1.4.8 ./srclib/apr +/bin/cp -R ../apr-util-1.5.2 ./srclib/apr-util +./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir +make && make install +if [ -d "$apache_install_dir" ];then + echo -e "\033[32mApache install successfully! \033[0m" +else + echo -e "\033[31mApache install failed, Please contact the author! \033[0m" + kill -9 $$ +fi +cd .. +/bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd +sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd +sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd +chmod +x /etc/init.d/httpd +OS_CentOS='chkconfig --add httpd \n +chkconfig httpd on' +OS_Debian_Ubuntu='update-rc.d httpd defaults' +OS_command + +sed -i 's/^User daemon/User www/' $apache_install_dir/conf/httpd.conf +sed -i 's/^Group daemon/Group www/' $apache_install_dir/conf/httpd.conf +if [ "$Nginx_version" == '3' ];then + sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf + TMP_PORT=80 + TMP_IP=$local_IP +elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then + sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:8080/' $apache_install_dir/conf/httpd.conf + sed -i 's@^Listen@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf + TMP_PORT=8080 + TMP_IP=127.0.0.1 +fi +sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf +sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf +sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf +sed -i "s@^DocumentRoot.*@DocumentRoot \"$home_dir/default\"@" $apache_install_dir/conf/httpd.conf +sed -i "s@^@@" $apache_install_dir/conf/httpd.conf +sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + +#logrotate apache log +cat > /etc/logrotate.d/apache << EOF +$wwwlogs_dir/*apache.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate +[ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` +endscript +} +EOF + +mkdir $apache_install_dir/conf/vhost +cat > $apache_install_dir/conf/vhost/default.conf << EOF + + ServerAdmin admin@linuxeye.com + DocumentRoot "$home_dir/default" + ServerName $TMP_IP + ErrorLog "$wwwlogs_dir/error_apache.log" + CustomLog "$wwwlogs_dir/access_apache.log" common + + SetOutputFilter DEFLATE + Options FollowSymLinks + Require all granted + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + + +EOF + +cat >> $apache_install_dir/conf/httpd.conf < $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF +LoadModule remoteip_module modules/mod_remoteip.so +RemoteIPHeader X-Forwarded-For +`ifconfig | awk -F"[: ]+" '/inet addr/{print "RemoteIPInternalProxy " $4}'` +EOF + sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf + sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" $apache_install_dir/conf/httpd.conf +fi +cd .. +service httpd start +} diff --git a/functions/eaccelerator-0.9.sh b/functions/eaccelerator-0.9.sh index 70ce7a2a..4759b589 100755 --- a/functions/eaccelerator-0.9.sh +++ b/functions/eaccelerator-0.9.sh @@ -40,7 +40,7 @@ eaccelerator.content = "disk_only" EOF echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf sysctl -p - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" fi diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh index 80f2c4df..b41474a9 100755 --- a/functions/eaccelerator-1.0-dev.sh +++ b/functions/eaccelerator-1.0-dev.sh @@ -40,7 +40,7 @@ eaccelerator.content = "disk_only" EOF echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf sysctl -p - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" fi diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 67d82923..37a1009c 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -14,11 +14,13 @@ src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86 useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.tar.gz + cd cmake-2.8.12 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf mariadb-5.5.33a.tar.gz cd mariadb-5.5.33a if [ "$je_tc_malloc" == '1' ];then @@ -26,6 +28,7 @@ if [ "$je_tc_malloc" == '1' ];then elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" fi +make clean cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mariadb_data_dir \ diff --git a/functions/memcached.sh b/functions/memcached.sh index 4aee7224..3b449141 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -46,7 +46,7 @@ make && make install cd .. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP memcache module install failed, Please contact the author! \033[0m" fi @@ -67,7 +67,7 @@ make && make install cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" fi diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 070612bf..550f9c1d 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -13,11 +13,13 @@ src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.tar.gz + cd cmake-2.8.12 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf mysql-5.5.34.tar.gz cd mysql-5.5.34 if [ "$je_tc_malloc" == '1' ];then @@ -25,6 +27,7 @@ if [ "$je_tc_malloc" == '1' ];then elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi +make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 5255d315..882e7d03 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -14,11 +14,13 @@ src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz && Download useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.tar.gz + cd cmake-2.8.12 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf mysql-5.6.14.tar.gz cd mysql-5.6.14 if [ "$je_tc_malloc" == '1' ];then @@ -26,6 +28,7 @@ if [ "$je_tc_malloc" == '1' ];then elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi +make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ diff --git a/functions/nginx.sh b/functions/nginx.sh index 78cb0853..af01c5da 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -57,7 +57,11 @@ sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf -/bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf +if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then + /bin/cp conf/nginx_apache.conf $nginx_install_dir/conf/nginx.conf +else + /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf +fi sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf @@ -81,7 +85,7 @@ fi # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF -$wwwlogs_dir/*.log { +$wwwlogs_dir/*nginx.log { daily rotate 5 missingok @@ -94,6 +98,7 @@ postrotate endscript } EOF + sed -i "s@^web_install_dir.*@web_install_dir=$nginx_install_dir@" options.conf sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 8b47322d..8e4149c8 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -17,7 +17,7 @@ $php_install_dir/bin/phpize make && make install if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/http.so" ];then sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "http.so"@' $php_install_dir/etc/php.ini - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP pecl_http module install failed, Please contact the author! \033[0m" fi diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 66274800..95ee81f5 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -13,11 +13,13 @@ src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/release useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.tar.gz + cd cmake-2.8.12 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf Percona-Server-5.5.34-rel32.0.tar.gz cd Percona-Server-5.5.34-rel32.0 if [ "$je_tc_malloc" == '1' ];then @@ -25,6 +27,7 @@ if [ "$je_tc_malloc" == '1' ];then elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi +make clean cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$percona_data_dir \ diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 05e7d98c..f9d17151 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -13,11 +13,13 @@ src_url=http://www.percona.com/downloads/Percona-Server-5.6/LATEST/release-5.6.1 useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.tar.gz + cd cmake-2.8.12 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf Percona-Server-5.6.14-rel62.0.tar.gz cd Percona-Server-5.6.14-rel62.0 if [ "$je_tc_malloc" == '1' ];then @@ -25,6 +27,7 @@ if [ "$je_tc_malloc" == '1' ];then elif [ "$je_tc_malloc" == '2' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi +make clean cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$percona_data_dir \ diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 274ee5cf..33581dfb 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -69,6 +69,17 @@ tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www cd php-5.3.27 make clean +if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo --with-mysql=$db_install_dir \ +--with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ +--enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ @@ -78,6 +89,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ --enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +fi make ZEND_EXTRA_LIBS='-liconv' make install @@ -93,15 +105,6 @@ fi /bin/cp php.ini-production $php_install_dir/etc/php.ini -# php-fpm Init Script -/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm -chmod +x /etc/init.d/php-fpm -OS_CentOS='chkconfig --add php-fpm \n -chkconfig php-fpm on' -OS_Debian_Ubuntu='update-rc.d php-fpm defaults' -OS_command -cd ../ - # Modify php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini @@ -117,6 +120,15 @@ sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,c sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini +if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then +# php-fpm Init Script +/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +OS_CentOS='chkconfig --add php-fpm \n +chkconfig php-fpm on' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' +OS_command + cat > $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < /etc/logrotate.d/nginx << EOF -$wwwlogs_dir/*.log { +$wwwlogs_dir/*nginx.log { daily rotate 5 missingok @@ -77,6 +81,7 @@ postrotate endscript } EOF + sed -i "s@^web_install_dir.*@web_install_dir=$tengine_install_dir@" options.conf sed -i "s@/home/wwwroot@$home_dir@g" vhost.sh sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" vhost.sh diff --git a/functions/test.sh b/functions/test.sh index 3cd612ec..f528e1bb 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -16,6 +16,8 @@ echo '' > $home_dir/default/phpinfo.php unzip -q tz.zip -d $home_dir/default [ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html [ "$PHP_cache" == '2' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html +[ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LANMP@g' $home_dir/default/index.html +[ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LAMP@g' $home_dir/default/index.html chown -R www.www $home_dir/default [ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start cd .. diff --git a/functions/xcache.sh b/functions/xcache.sh index f73d2490..0fb5c80a 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -55,7 +55,7 @@ xcache.optimizer = Off xcache.coverager = On xcache.coveragedump_directory = "" EOF - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" fi diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 41d840db..ccc828c6 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -27,7 +27,7 @@ opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1 EOF - service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31meZend OPcache module install failed, Please contact the author! \033[0m" fi diff --git a/install.sh b/install.sh index c6170a46..371cfab0 100755 --- a/install.sh +++ b/install.sh @@ -13,10 +13,11 @@ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin clear -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# For more information Please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" +printf " +####################################################################### +# LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/31.html # +#######################################################################" #get pwd sed -i "s@^lnmp_dir.*@lnmp_dir=`pwd`@" ./options.conf @@ -31,7 +32,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS while : do - echo + echo -e "\033[32m \033[0m" read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" @@ -65,25 +66,40 @@ do while : do echo - echo 'Please select Web server:' + echo 'Please select Nginx server:' echo -e "\t\033[32m1\033[0m. Install Nginx" echo -e "\t\033[32m2\033[0m. Install Tengine" + echo -e "\t\033[32m3\033[0m. Do not install" read -p "Please input a number:(Default 1 press Enter) " Nginx_version [ -z "$Nginx_version" ] && Nginx_version=1 - if [ $Nginx_version != 1 -a $Nginx_version != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2\033[0m" + if [ $Nginx_version != 1 -a $Nginx_version != 2 -a $Nginx_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" else + if [ $Nginx_version = 1 -o $Nginx_version = 2 ];then while : do read -p "Do you want to install ngx_pagespeed module? [y/n]: " ngx_pagespeed_yn if [ "$ngx_pagespeed_yn" != 'y' -a "$ngx_pagespeed_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else - break + break fi done + fi + echo + echo 'Please select Apache server:' + echo -e "\t\033[32m1\033[0m. Install Apache-2.4" + echo -e "\t\033[32m2\033[0m. Install Apache-2.2" + echo -e "\t\033[32m3\033[0m. Do not install" + read -p "Please input a number:(Default 3 press Enter) " Apache_version + [ -z "$Apache_version" ] && Apache_version=3 + if [ $Apache_version != 1 -a $Apache_version != 2 -a $Apache_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" + else + break + fi break - fi + fi done fi break @@ -411,6 +427,15 @@ if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' ];then Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log fi +# Apache +if [ "$Apache_version" == '1' ];then + . functions/apache-2.4.sh + Install_Apache-2-4 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$Apache_version" == '2' ];then + . functions/apache-2.2.sh + Install_Apache-2-2 2>&1 | tee -a $lnmp_dir/install.log +fi + # PHP if [ "$PHP_version" == '1' ];then . functions/php-5.5.sh @@ -502,14 +527,15 @@ fi . ./options.conf # index example -if [ ! -e "$home_dir/default/index.html" -a -d "$web_install_dir" ];then +if [ ! -e "$home_dir/default/index.html" -a "$Web_yn" == 'y' ];then . functions/test.sh TEST 2>&1 | tee -a $lnmp_dir/install.log fi echo "####################Congratulations########################" -echo -[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Web install dir":`\033[32m$web_install_dir\033[0m" +[ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`\033[32m$web_install_dir\033[0m" +[ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`\033[32m$web_install_dir\033[0m\n`printf "%-32s" "Apache install dir":`\033[32m$apache_install_dir\033[0m" +[ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Apache install dir":`\033[32m$apache_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`\033[32m$db_install_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database data dir:"`\033[32m$db_data_dir\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" diff --git a/uninstall.sh b/uninstall.sh index 34445102..35c1578d 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -16,12 +16,13 @@ echo "#######################################################################" Uninstall() { -[ -e "$db_install_dir" ] && service mysqld stop -[ -e "$php_install_dir" ] && service php-fpm stop -[ -e "$web_install_dir" ] && service nginx stop -[ -e "$pureftpd_install_dir" ] && service pureftpd stop -[ -e "$redis_install_dir" ] && service redis-server stop -[ -e "$memcached_install_dir" ] && service memcached stop +[ -e "$db_install_dir" ] && service mysqld stop && rm -rf /etc/init.d/mysqld +[ -e "$apache_install_dir" ] && service httpd stop && rm -rf /etc/init.d/httpd +[ -e "$php_install_dir" ] && service php-fpm stop && rm -rf /etc/init.d/php-fpm +[ -e "$web_install_dir" ] && service nginx stop && rm -rf /etc/init.d/nginx +[ -e "$pureftpd_install_dir" ] && service pureftpd stop && rm -rf /etc/init.d/pureftpd +[ -e "$redis_install_dir" ] && service redis-server stop && rm -rf /etc/init.d/redis-server +[ -e "$memcached_install_dir" ] && service memcached stop && rm -rf /etc/init.d/memcached for D in `cat ./options.conf | grep dir= | grep -v lnmp | awk -F'=' '{print $2}' | sort | uniq` do @@ -61,6 +62,7 @@ do [ -e "$D" ] && echo $D done [ -e "$web_install_dir" ] && echo -e "/etc/init.d/nginx\n/etc/logrotate.d/nginx" && [ -e "/var/ngx_pagespeed_cache" ] && echo '/var/ngx_pagespeed_cache' +[ -e "$apache_install_dir" ] && echo '/etc/init.d/httpd' [ -e "$db_install_dir" ] && echo -e "/etc/init.d/mysqld\n/etc/my.cnf\n/etc/ld.so.conf.d/mysql.conf\n/usr/include/mysql" [ -e "$php_install_dir" ] && echo '/etc/init.d/php-fpm' [ -e "$pureftpd_install_dir" ] && echo '/etc/init.d/pureftpd' diff --git a/vhost.sh b/vhost.sh index 5666c344..ae4ea165 100755 --- a/vhost.sh +++ b/vhost.sh @@ -4,15 +4,21 @@ # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +printf " +####################################################################### +# LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/31.html # +####################################################################### +" +. ./options.conf -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# For more information please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" -echo '' - +Input_domain() +{ while : do + echo -e "\033[32m \033[0m" read -p "Please input domain(example: www.linuxeye.com linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo -e "\033[31minput error! \033[0m" @@ -20,12 +26,13 @@ do break fi done -. ./options.conf -if [ ! -f "$web_install_dir/conf/vhost/$domain.conf" ]; then - echo "domain=$domain" -else - echo "$domain is exist!" + +if [ -e "$web_install_dir/conf/vhost/$domain.conf" -o -e "$apache_install_dir/conf/vhost/$domain.conf" ]; then + [ -e "$web_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Nginx/Tengine already exist!\nYou can delete \033[32m$web_install_dir/conf/vhost/$domain.conf\033[0m and re-create" + [ -e "$apache_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Apache already exist!\nYou can delete \033[32m$apache_install_dir/conf/vhost/$domain.conf\033[0m and re-create" exit 1 +else + echo "domain=$domain" fi while : @@ -38,24 +45,44 @@ do break fi done + if [ "$moredomainame_yn" == 'y' ]; then - while : - do - echo '' - read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com): " moredomain - if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then - echo -e "\033[31minput error! \033[0m" - else - echo -e "domain list=\033[32m$moredomain\033[0m" - moredomainame=" $moredomain" - break - fi - done + while : + do + echo + read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com): " moredomain + if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then + echo -e "\033[31minput error\033[0m" + else + [ "$moredomain" == "$domain" ] && echo -e "\033[31mDomain name already exists! \033[0m" && continue + echo domain list="$moredomain" + moredomainame=" $moredomain" + break + fi + done + Domain_alias=ServerAlias$moredomainame +fi + +echo +echo "Please input the directory for the domain:$domain :" +read -p "(Default directory: /home/wwwroot/$domain): " vhostdir +if [ -z "$vhostdir" ]; then + vhostdir="/home/wwwroot/$domain" + echo -e "Virtual Host Directory=\033[32m$vhostdir\033[0m" fi +echo +echo "Create Virtul Host directory......" +mkdir -p $vhostdir +echo "set permissions of Virtual Host directory......" +chown -R www.www $vhostdir +} +Ngx_pagespeed() +{ # check ngx_pagespeed and add ngx_pagespeed -$web_install_dir/sbin/nginx -V &> $$ -if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then +$web_install_dir/sbin/nginx -V &> ngx_tmp +if [ ! -z "`cat ngx_tmp | grep ngx_pagespeed`" ];then + rm -rf ngx_tmp while : do echo '' @@ -71,9 +98,11 @@ if [ ! -z "`cat $$ | grep ngx_pagespeed`" ];then break fi done - rm -rf $$ fi +} +Nginx_anti_hotlinking() +{ while : do echo '' @@ -101,15 +130,10 @@ if [ "$anti_hotlinking_yn" == 'y' ];then else anti_hotlinking= fi +} -echo '' -echo "Please input the directory for the domain:$domain :" -read -p "(Default directory: /home/wwwroot/$domain): " vhostdir -if [ -z "$vhostdir" ]; then - vhostdir="/home/wwwroot/$domain" - echo -e "Virtual Host Directory=\033[32m$vhostdir\033[0m" -fi - +Nginx_rewrite() +{ while : do echo '' @@ -138,12 +162,14 @@ else touch "$web_install_dir/conf/$rewrite.conf" fi fi +} - +Nginx_log() +{ while : do echo '' - read -p "Allow access_log? [y/n]: " access_yn + read -p "Allow Nginx/Tengine access_log? [y/n]: " access_yn if [ "$access_yn" != 'y' ] && [ "$access_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else @@ -151,27 +177,22 @@ do fi done if [ "$access_yn" == 'n' ]; then - al="access_log off;" + N_log="access_log off;" else - al="access_log /home/wwwlogs/$domain.log combined;" - echo -e "You access log file=\033[32m/home/wwwlogs/$domain.log\033[0m" - echo '' + N_log="access_log /home/wwwlogs/${domain}_nginx.log combined;" + echo -e "You access log file=\033[32m/home/wwwlogs/${domain}_nginx.log\033[0m" fi +} - +Create_nginx_conf() +{ [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost - -echo "Create Virtul Host directory......" -mkdir -p $vhostdir -echo "set permissions of Virtual Host directory......" -chown -R www.www $vhostdir - -cat >$web_install_dir/conf/vhost/$domain.conf< $web_install_dir/conf/vhost/$domain.conf << EOF server { listen 80; server_name $domain$moredomainame; -$al -index index.html index.htm index.jsp index.php ; +$N_log +index index.html index.htm index.jsp index.php; include $rewrite.conf; root $vhostdir; #error_page 404 /404.html; @@ -181,7 +202,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ $anti_hotlinking `echo -e $ngx_pagespeed` location ~ .*\.(php|php5)?$ { - #fastcgi_pass remote_php_ip:9000; + #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; @@ -196,19 +217,208 @@ location ~ .*\.(js|css)?$ { } EOF -echo "Test Nginx configure file......" +echo $web_install_dir/sbin/nginx -t -echo "" -echo "Restart Nginx......" -$web_install_dir/sbin/nginx -s reload - -echo "#######################################################################" -echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" -echo "# For more information please visit http://blog.linuxeye.com/31.html #" -echo "#######################################################################" -echo '' +if [ $? == 0 ];then + echo "Restart Nginx......" + $web_install_dir/sbin/nginx -s reload +else + rm -rf $web_install_dir/conf/vhost/$domain.conf $vhostdir + echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" + exit 1 +fi + +printf " +####################################################################### +# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/31.html # +####################################################################### +" echo -e "`printf "%-32s" "Your domain:"`\033[32m$domain\033[0m" echo -e "`printf "%-32s" "Virtualhost conf:"`\033[32m$web_install_dir/conf/vhost/$domain.conf\033[0m" echo -e "`printf "%-32s" "Directory of:"`\033[32m$vhostdir\033[0m" [ "$rewrite_yn" == 'y' ] && echo -e "`printf "%-32s" "Rewrite rule:"`\033[32m$rewrite\033[0m" -echo '' +} + +Apache_log() +{ +while : +do + echo '' + read -p "Allow Apache access_log? [y/n]: " access_yn + if [ "$access_yn" != 'y' ] && [ "$access_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi +done + +if [ "$access_yn" == 'n' ]; then + A_log='CustomLog "/dev/null" common' +else + A_log="CustomLog \"/home/wwwlogs/${domain}_apache.log\" common" + echo "You access log file=/home/wwwlogs/${domain}_apache.log" +fi +} + +Create_apache_conf() +{ +[ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= +[ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost +cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + + ServerAdmin admin@linuxeye.com + DocumentRoot "$vhostdir" + ServerName $domain + $Domain_alias + ErrorLog "/home/wwwlogs/${domain}_error_apache.log" + $A_log + + SetOutputFilter DEFLATE + Options FollowSymLinks + $R_TMP + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + + +EOF + +echo +$apache_install_dir/bin/apachectl -t +if [ $? == 0 ];then + echo "Restart Apache......" + /etc/init.d/httpd restart +else + rm -rf $apache_install_dir/conf/vhost/$domain.conf $vhostdir + echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" + exit 1 +fi + +printf " +####################################################################### +# LAMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/82.html # +####################################################################### +" +echo -e "`printf "%-32s" "Your domain:"`\033[32m$domain\033[0m" +echo -e "`printf "%-32s" "Virtualhost conf:"`\033[32m$apache_install_dir/conf/vhost/$domain.conf\033[0m" +echo -e "`printf "%-32s" "Directory of $domain:"`\033[32m$vhostdir\033[0m" +} + +Create_nginx_apache_conf() +{ +# Nginx/Tengine +[ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost +cat > $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +$N_log +index index.html index.htm index.jsp index.php; +include $rewrite.conf; +root $vhostdir; +#error_page 404 /404.html; +if ( \$query_string ~* ".*[\;'\<\>].*" ){ + return 404; + } +$anti_hotlinking +`echo -e $ngx_pagespeed` +location / { + try_files \$uri @apache; + } + +location @apache { + internal; + proxy_pass http://127.0.0.1:8080; +} + +location ~ .*\.(php|php5)?$ { + proxy_pass http://127.0.0.1:8080; + } +location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { + expires 30d; + } + +location ~ .*\.(js|css)?$ { + expires 1h; + } +} +EOF + +echo +$web_install_dir/sbin/nginx -t +if [ $? == 0 ];then + echo "Restart Nginx......" + $web_install_dir/sbin/nginx -s reload +else + rm -rf $web_install_dir/conf/vhost/$domain.conf $vhostdir + echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" +fi + +# Apache +[ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= +[ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost +cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + + ServerAdmin admin@linuxeye.com + DocumentRoot "$vhostdir" + ServerName $domain + $Domain_alias + ErrorLog "/home/wwwlogs/${domain}_error_apache.log" + $A_log + + SetOutputFilter DEFLATE + Options FollowSymLinks + $R_TMP + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + + +EOF + +echo +$apache_install_dir/bin/apachectl -t +if [ $? == 0 ];then + echo "Restart Apache......" + /etc/init.d/httpd restart +else + rm -rf $apache_install_dir/conf/vhost/$domain.conf $vhostdir + exit 1 +fi +printf " +####################################################################### +# LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/31.html # +####################################################################### +" +echo -e "`printf "%-32s" "Your domain:"`\033[32m$domain\033[0m" +echo -e "`printf "%-32s" "Nginx Virtualhost conf:"`\033[32m$web_install_dir/conf/vhost/$domain.conf\033[0m" +echo -e "`printf "%-32s" "Apache Virtualhost conf:"`\033[32m$apache_install_dir/conf/vhost/$domain.conf\033[0m" +echo -e "`printf "%-32s" "Directory of:"`\033[32m$vhostdir\033[0m" +[ "$rewrite_yn" == 'y' ] && echo -e "`printf "%-32s" "Rewrite rule:"`\033[32m$rewrite\033[0m" +} + +if [ -d "$web_install_dir" -a ! -d "$apache_install_dir" ];then + Input_domain + Ngx_pagespeed + Nginx_anti_hotlinking + Nginx_rewrite + Nginx_log + Create_nginx_conf +elif [ ! -d "$web_install_dir" -a -d "$apache_install_dir" ];then + Input_domain + Apache_log + Create_apache_conf +elif [ -d "$web_install_dir" -a -d "$apache_install_dir" ];then + Input_domain + Ngx_pagespeed + Nginx_anti_hotlinking + Nginx_rewrite + Nginx_log + Apache_log + Create_nginx_apache_conf +fi From c2f1cb7894d60c8a06244484b1a7a614f0410269 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 9 Nov 2013 10:30:16 +0800 Subject: [PATCH 234/617] update ngx_pagespeed to 1.7.30.1-beta --- README.md | 2 +- functions/GraphicsMagick.sh | 2 +- functions/ngx_pagespeed.sh | 16 ++++++++-------- install.sh | 5 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 07c1daf0..15b82c45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - This script is free collection of shell scripts for rapid deployment of lnmp/lamp/lanmp stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB`/`Percona` and `PHP`) for CentOS/Redhat Debian and Ubuntu. + This script is free collection of shell scripts for rapid deployment of `LNMP`/`LAMP`/`LANMP` stacks (`Linux`, `Nginx`/`Tengine`, `MySQL`/`MariaDB`/`Percona` and `PHP`) for CentOS/Redhat Debian and Ubuntu. Script features: - Constant updates diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index a39a470b..bc33dc54 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -32,7 +32,7 @@ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extens else sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini fi - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service php-fpm restart + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" fi diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 520121d0..2cc260eb 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.6.29.7.tar.gz && Download_src -[ -s "release-1.6.29.7-beta.zip" ] && echo "release-1.6.29.7-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-master.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.1.tar.gz && Download_src +[ -s "ngx_pagespeed-1.7.30.1-beta.zip" ] && echo "ngx_pagespeed-1.7.30.1-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.1-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-master.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-release-1.6.29.7-beta -tar xzf 1.6.29.7.tar.gz -C ngx_pagespeed-release-1.6.29.7-beta +unzip -q ngx_pagespeed-1.7.30.1-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.1-beta +tar xzf 1.7.30.1.tar.gz -C ngx_pagespeed-1.7.30.1-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.4.3 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.7-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-release-1.6.29.7-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-release-1.6.29.7-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.1-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/install.sh b/install.sh index 371cfab0..b5e0c23a 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.4 27-Sep-2013 lj2007331 AT gmail.com +# Version: 0.5 09-Nov-2013 lj2007331 AT gmail.com # Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: @@ -13,6 +13,7 @@ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin clear +echo -e "\033[32m \033[0m" printf " ####################################################################### # LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # @@ -32,7 +33,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS while : do - echo -e "\033[32m \033[0m" + echo read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" From 4c75747977d406d7f07c4d965c6d43a2f07955e1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 9 Nov 2013 12:15:44 +0800 Subject: [PATCH 235/617] apache-2.4 eroor, install pcre --- functions/apache-2.4.sh | 7 +++++++ install.sh | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 9e8a99a5..41594c5f 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -9,10 +9,17 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.6.tar.gz && Download_src +tar xzf pcre-8.33.tar.gz +cd pcre-8.33 +./configure +make && make install +cd ../ + useradd -M -s /sbin/nologin www tar xzf httpd-2.4.6.tar.gz tar xzf apr-1.4.8.tar.gz diff --git a/install.sh b/install.sh index b5e0c23a..31343b87 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,6 @@ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin clear -echo -e "\033[32m \033[0m" printf " ####################################################################### # LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # @@ -33,7 +32,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS while : do - echo + echo -e "\033[32m \033[0m\n" read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" From ad545b0875ae2e7e1c842e55b61010779b0db723 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 15 Nov 2013 15:56:29 +0800 Subject: [PATCH 236/617] optimize MySQL and update php to 5.5.6 --- conf/nginx.conf | 4 +- conf/nginx_apache.conf | 8 +-- functions/mariadb-5.5.sh | 134 ++++++++++++++++++++++++++++---------- functions/mysql-5.5.sh | 132 +++++++++++++++++++++++++++++--------- functions/mysql-5.6.sh | 135 +++++++++++++++++++++++++++++---------- functions/percona-5.5.sh | 134 ++++++++++++++++++++++++++++---------- functions/percona-5.6.sh | 135 +++++++++++++++++++++++++++++---------- functions/php-5.5.sh | 6 +- vhost.sh | 9 +-- 9 files changed, 525 insertions(+), 172 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d158a716..2bf9f453 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -58,12 +58,12 @@ http { include fastcgi.conf; } - location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; } location ~ .*\.(js|css)?$ { - expires 1h; + expires 7d; } } diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index 6026afb0..da8f1787 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -79,12 +79,12 @@ http { proxy_pass http://127.0.0.1:8080; } - location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { - expires 30d; - } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; + } location ~ .*\.(js|css)?$ { - expires 1h; + expires 7d; } } diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 37a1009c..f6e1aab7 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -66,55 +66,124 @@ cd ../../ # my.cf cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + [mysqld] +port = 3306 +socket = /tmp/mysql.sock + basedir = $mariadb_install_dir datadir = $mariadb_data_dir -pid-file = $mariadb_data_dir/mariadb.pid -character-set-server = utf8 -collation-server = utf8_general_ci +pid-file = $mariadb_data_dir/mysql.pid user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 bind-address = 0.0.0.0 +server-id = 1 -# name-resolve skip-name-resolve -skip-host-cache +#skip-networking +back_log = 600 + +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 + +log_error = $mariadb_data_dir/mysql-error.log +slow_query_log = 1 +long_query_time = 1 +slow_query_log_file = $mariadb_data_dir/mysql-slow.log + +performance_schema = 0 #lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 -# LOG -log_error = $mariadb_data_dir/mariadb-error.log -long_query_time = 1 -slow_query_log -slow_query_log_file = $mariadb_data_dir/mariadb-slow.log +interactive_timeout = 28800 +wait_timeout = 28800 -# Oher -#max_connections = 1000 -open_files_limit = 65535 +[mysqldump] +quick +max_allowed_packet = 16M -[client] -port = 3306 +[myisamchk] +key_buffer_size = 8M +sort_buffer_size = 8M +read_buffer = 4M +write_buffer = 4M EOF +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtaltol -gt 1500 -a $Memtaltol -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 [ $Memtaltol -gt 2500 -a $Memtaltol -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 [ $Memtaltol -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 + $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir chown mysql.mysql -R $mariadb_data_dir @@ -127,6 +196,7 @@ $mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0. $mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 550f9c1d..c6717b8f 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -64,55 +64,124 @@ cd ../../ # my.cf cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + [mysqld] +port = 3306 +socket = /tmp/mysql.sock + basedir = $mysql_install_dir datadir = $mysql_data_dir pid-file = $mysql_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 bind-address = 0.0.0.0 +server-id = 1 -# name-resolve skip-name-resolve -skip-host-cache +#skip-networking +back_log = 600 -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 +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 -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 -# LOG log_error = $mysql_data_dir/mysql-error.log +slow_query_log = 1 long_query_time = 1 -slow_query_log slow_query_log_file = $mysql_data_dir/mysql-slow.log -# Oher -#max_connections = 1000 -open_files_limit = 65535 +performance_schema = 0 -[client] -port = 3306 +#lower_case_table_names = 1 + +skip-external-locking + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtaltol -gt 1500 -a $Memtaltol -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 [ $Memtaltol -gt 2500 -a $Memtaltol -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 [ $Memtaltol -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 + $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir chown mysql.mysql -R $mysql_data_dir @@ -125,6 +194,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 "delete from mysql.user where Password='';" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 882e7d03..f2cd3d27 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -63,55 +63,125 @@ cd ../../ # my.cf cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + [mysqld] -basedir = $mysql_install_dir +port = 3306 +socket = /tmp/mysql.sock + +basedir = $mysql_install_dir datadir = $mysql_data_dir pid-file = $mysql_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 bind-address = 0.0.0.0 +server-id = 1 -# name-resolve skip-name-resolve -skip-host-cache +#skip-networking +back_log = 600 -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 +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 -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 -# LOG log_error = $mysql_data_dir/mysql-error.log +slow_query_log = 1 long_query_time = 1 -slow_query_log slow_query_log_file = $mysql_data_dir/mysql-slow.log -# Oher -#max_connections = 1000 -open_files_limit = 65535 +performance_schema = 0 +explicit_defaults_for_timestamp -[client] -port = 3306 +#lower_case_table_names = 1 + +skip-external-locking + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtaltol -gt 1500 -a $Memtaltol -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 [ $Memtaltol -gt 2500 -a $Memtaltol -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 [ $Memtaltol -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 + $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir chown mysql.mysql -R $mysql_data_dir @@ -124,6 +194,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 "delete from mysql.user where Password='';" $mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$mysql_install_dir@" options.conf diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 95ee81f5..b79211e1 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/release-5.5.34-32.0/591/source/Percona-Server-5.5.34-rel32.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.34-rel32.0/source/Percona-Server-5.5.34-rel32.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -63,55 +63,124 @@ cd ../../ # my.cf cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + [mysqld] +port = 3306 +socket = /tmp/mysql.sock + basedir = $percona_install_dir datadir = $percona_data_dir pid-file = $percona_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 bind-address = 0.0.0.0 +server-id = 1 -# name-resolve skip-name-resolve -skip-host-cache +#skip-networking +back_log = 600 -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 +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 -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 -# LOG log_error = $percona_data_dir/mysql-error.log +slow_query_log = 1 long_query_time = 1 -slow_query_log slow_query_log_file = $percona_data_dir/mysql-slow.log -# Oher -#max_connections = 1000 -open_files_limit = 65535 +performance_schema = 0 -[client] -port = 3306 +#lower_case_table_names = 1 + +skip-external-locking + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtaltol -gt 1500 -a $Memtaltol -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 [ $Memtaltol -gt 2500 -a $Memtaltol -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 [ $Memtaltol -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/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir chown mysql.mysql -R $percona_data_dir @@ -124,6 +193,7 @@ $percona_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0. $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 "delete from mysql.user where Password='';" $percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$percona_install_dir@" options.conf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index f9d17151..cda892f5 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src -src_url=http://www.percona.com/downloads/Percona-Server-5.6/LATEST/release-5.6.14-62.0/483/source/Percona-Server-5.6.14-rel62.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/Percona-Server-5.6.14-rel62.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -63,55 +63,125 @@ cd ../../ # my.cf cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + [mysqld] +port = 3306 +socket = /tmp/mysql.sock + basedir = $percona_install_dir datadir = $percona_data_dir pid-file = $percona_data_dir/mysql.pid -character-set-server = utf8 -collation-server = utf8_general_ci user = mysql -port = 3306 -default_storage_engine = InnoDB -innodb_file_per_table = 1 -server_id = 1 -log_bin = mysql-bin -binlog_format = mixed -expire_logs_days = 7 bind-address = 0.0.0.0 +server-id = 1 -# name-resolve skip-name-resolve -skip-host-cache +#skip-networking +back_log = 600 -#lower_case_table_names = 1 -ft_min_word_len = 1 -query_cache_size = 64M -query_cache_type = 1 +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 -skip-external-locking -key_buffer_size = 16M -max_allowed_packet = 1M -table_open_cache = 64 -sort_buffer_size = 512K -net_buffer_length = 8K -read_buffer_size = 256K -read_rnd_buffer_size = 512K -myisam_sort_buffer_size = 8M +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 -# LOG log_error = $percona_data_dir/mysql-error.log +slow_query_log = 1 long_query_time = 1 -slow_query_log slow_query_log_file = $percona_data_dir/mysql-slow.log -# Oher -#max_connections = 1000 -open_files_limit = 65535 +performance_schema = 0 +explicit_defaults_for_timestamp -[client] -port = 3306 +#lower_case_table_names = 1 + +skip-external-locking + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtaltol -gt 1500 -a $Memtaltol -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 [ $Memtaltol -gt 2500 -a $Memtaltol -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 [ $Memtaltol -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/scripts/mysql_install_db --user=mysql --basedir=$percona_install_dir --datadir=$percona_data_dir chown mysql.mysql -R $percona_data_dir @@ -124,6 +194,7 @@ $percona_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0. $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 "delete from mysql.user where Password='';" $percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" sed -i "s@^db_install_dir.*@db_install_dir=$percona_install_dir@" options.conf diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index a615ae48..74870ca8 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.5.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.6.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -65,9 +65,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.5.tar.gz +tar xzf php-5.5.6.tar.gz useradd -M -s /sbin/nologin www -cd php-5.5.5 +cd php-5.5.6 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/vhost.sh b/vhost.sh index ae4ea165..1bde14c9 100755 --- a/vhost.sh +++ b/vhost.sh @@ -207,13 +207,14 @@ location ~ .*\.(php|php5)?$ { fastcgi_index index.php; include fastcgi.conf; } -location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { - expires 30d; + +location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; } location ~ .*\.(js|css)?$ { - expires 1h; - } + expires 7d; + } } EOF From 3a72d1daa67a870b19f733071e2798e9f7d1e802 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 15 Nov 2013 16:02:05 +0800 Subject: [PATCH 237/617] update php 5.4.21 to 5.4.22 --- functions/php-5.4.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index b87e395c..f291b9a9 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.21.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.22.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -67,9 +67,9 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.21.tar.gz +tar xzf php-5.4.22.tar.gz useradd -M -s /sbin/nologin www -cd php-5.4.21 +cd php-5.4.22 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ From f2d19ddcb4cf2fa4d822698af8a8c8ccee2c3e8a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 15 Nov 2013 16:40:03 +0800 Subject: [PATCH 238/617] Memtatal diff --- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index f6e1aab7..8ed23625 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -158,7 +158,7 @@ write_buffer = 4M EOF Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` -if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then +if [ $Memtatol -gt 1500 -a $Memtatol -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 @@ -166,7 +166,7 @@ if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then 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 [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then +elif [ $Memtatol -gt 2500 -a $Memtatol -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 @@ -174,7 +174,7 @@ elif [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then 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 [ $Memtaltol -gt 3500 ];then +elif [ $Memtatol -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 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index c6717b8f..e2113f14 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -156,7 +156,7 @@ write_buffer = 4M EOF Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` -if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then +if [ $Memtatol -gt 1500 -a $Memtatol -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 @@ -164,7 +164,7 @@ if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then 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 [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then +elif [ $Memtatol -gt 2500 -a $Memtatol -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 @@ -172,7 +172,7 @@ elif [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then 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 [ $Memtaltol -gt 3500 ];then +elif [ $Memtatol -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 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index f2cd3d27..29833947 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -156,7 +156,7 @@ write_buffer = 4M EOF Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` -if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then +if [ $Memtatol -gt 1500 -a $Memtatol -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 @@ -164,7 +164,7 @@ if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then 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 [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then +elif [ $Memtatol -gt 2500 -a $Memtatol -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 @@ -172,7 +172,7 @@ elif [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then 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 [ $Memtaltol -gt 3500 ];then +elif [ $Memtatol -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 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index b79211e1..0e65a7ad 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -155,7 +155,7 @@ write_buffer = 4M EOF Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` -if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then +if [ $Memtatol -gt 1500 -a $Memtatol -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 @@ -163,7 +163,7 @@ if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then 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 [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then +elif [ $Memtatol -gt 2500 -a $Memtatol -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 @@ -171,7 +171,7 @@ elif [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then 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 [ $Memtaltol -gt 3500 ];then +elif [ $Memtatol -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 diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index cda892f5..21470a21 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -156,7 +156,7 @@ write_buffer = 4M EOF Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` -if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then +if [ $Memtatol -gt 1500 -a $Memtatol -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 @@ -164,7 +164,7 @@ if [ $Memtaltol -gt 1500 -a $Memtaltol -le 2500 ];then 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 [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then +elif [ $Memtatol -gt 2500 -a $Memtatol -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 @@ -172,7 +172,7 @@ elif [ $Memtaltol -gt 2500 -a $Memtaltol -le 3500 ];then 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 [ $Memtaltol -gt 3500 ];then +elif [ $Memtatol -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 From 9c652b88b408bb77b5cdd555ac84b4f313bcea92 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 18 Nov 2013 12:30:10 +0800 Subject: [PATCH 239/617] php-fpm optimization --- functions/php-5.3.sh | 15 ++++++++++----- functions/php-5.4.sh | 15 ++++++++++----- functions/php-5.5.sh | 15 ++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 33581dfb..f2f78c0d 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -144,7 +144,7 @@ error_log = log/php-fpm.log log_level = notice emergency_restart_threshold = 30 -emergency_restart_interval = 1m +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -163,10 +163,10 @@ user = www group = www pm = dynamic -pm.max_children = 32 -pm.start_servers = 4 -pm.min_spare_servers = 4 -pm.max_spare_servers = 16 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 +pm.max_spare_servers = 12 pm.max_requests = 512 request_terminate_timeout = 0 @@ -183,6 +183,11 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +Mem=`free -m | awk '/Mem:/{print $2}'` +sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start fi diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index f291b9a9..ab5126c8 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -146,7 +146,7 @@ error_log = log/php-fpm.log log_level = notice emergency_restart_threshold = 30 -emergency_restart_interval = 1m +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -165,10 +165,10 @@ user = www group = www pm = dynamic -pm.max_children = 32 -pm.start_servers = 4 -pm.min_spare_servers = 4 -pm.max_spare_servers = 16 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 +pm.max_spare_servers = 12 pm.max_requests = 512 request_terminate_timeout = 0 @@ -185,6 +185,11 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +Mem=`free -m | awk '/Mem:/{print $2}'` +sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start fi diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 74870ca8..01bc8079 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -153,7 +153,7 @@ error_log = log/php-fpm.log log_level = notice emergency_restart_threshold = 30 -emergency_restart_interval = 1m +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -172,10 +172,10 @@ user = www group = www pm = dynamic -pm.max_children = 32 -pm.start_servers = 4 -pm.min_spare_servers = 4 -pm.max_spare_servers = 16 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 +pm.max_spare_servers = 12 pm.max_requests = 512 request_terminate_timeout = 0 @@ -192,6 +192,11 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +Mem=`free -m | awk '/Mem:/{print $2}'` +sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf +sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start fi From ccde56cdb383ef6597183a06b6b57e5b7dfa0ddf Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 20 Nov 2013 09:45:18 +0800 Subject: [PATCH 240/617] update nginx 1.4.3 to 1.4.4 --- functions/ImageMagick.sh | 6 +++--- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/nginx.sh | 6 +++--- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index da8acced..138f6ca3 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-5.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-6.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-5.tar.gz -cd ImageMagick-6.8.7-5 +tar xzf ImageMagick-6.8.7-6.tar.gz +cd ImageMagick-6.8.7-6 ./configure make && make install cd ../ diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 8ed23625..df742254 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,14 +9,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.tar.gz - cd cmake-2.8.12 + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index e2113f14..97940b9d 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.tar.gz - cd cmake-2.8.12 + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 29833947..6e5e067c 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,14 +9,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.tar.gz - cd cmake-2.8.12 + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/nginx.sh b/functions/nginx.sh index af01c5da..372f5d79 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.3.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.4.tar.gz && Download_src tar xzf pcre-8.33.tar.gz cd pcre-8.33 @@ -18,9 +18,9 @@ cd pcre-8.33 make && make install cd ../ -tar xzf nginx-1.4.3.tar.gz +tar xzf nginx-1.4.4.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.3 +cd nginx-1.4.4 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 0e65a7ad..bb31a1f1 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.34-rel32.0/source/Percona-Server-5.5.34-rel32.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.tar.gz - cd cmake-2.8.12 + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 21470a21..20532ef8 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/Percona-Server-5.6.14-rel62.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.tar.gz - cd cmake-2.8.12 + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 76a58714..108a9f73 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src -tar xzf cmake-2.8.12.tar.gz -cd cmake-2.8.12 +tar xzf cmake-2.8.12.1.tar.gz +cd cmake-2.8.12.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. From 97796730e05a90a059fe2cb5fae0002b9a952878 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 20 Nov 2013 09:57:05 +0800 Subject: [PATCH 241/617] ngx_pagespeed 1.4.4 --- functions/ngx_pagespeed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 2cc260eb..aa9167a5 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.7.30.1-beta.zip tar xzf 1.7.30.1.tar.gz -C ngx_pagespeed-1.7.30.1-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.4.3 + cd nginx-1.4.4 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` From 9ca5faf84b47e879e6349d08f81e0f05525628ea Mon Sep 17 00:00:00 2001 From: root Date: Thu, 21 Nov 2013 10:55:50 +0800 Subject: [PATCH 242/617] update Apache 2.2.25 to 2.2.26 --- functions/apache-2.2.sh | 6 +++--- uninstall.sh | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index 5f3c4cc3..9a5ab5ce 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.apache.org/dist/httpd/httpd-2.2.25.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.2.26.tar.gz && Download_src useradd -M -s /sbin/nologin www -tar xzf httpd-2.2.25.tar.gz -cd httpd-2.2.25 +tar xzf httpd-2.2.26.tar.gz +cd httpd-2.2.26 ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install if [ -d "$apache_install_dir" ];then diff --git a/uninstall.sh b/uninstall.sh index 35c1578d..90fd3290 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -16,10 +16,10 @@ echo "#######################################################################" Uninstall() { -[ -e "$db_install_dir" ] && service mysqld stop && rm -rf /etc/init.d/mysqld +[ -e "$db_install_dir" ] && service mysqld stop && rm -rf /etc/init.d/mysqld /etc/my.cnf /etc/ld.so.conf.d/mysql.conf /usr/include/mysql [ -e "$apache_install_dir" ] && service httpd stop && rm -rf /etc/init.d/httpd [ -e "$php_install_dir" ] && service php-fpm stop && rm -rf /etc/init.d/php-fpm -[ -e "$web_install_dir" ] && service nginx stop && rm -rf /etc/init.d/nginx +[ -e "$web_install_dir" ] && service nginx stop && rm -rf /etc/init.d/nginx /etc/logrotate.d/nginx /var/ngx_pagespeed_cache [ -e "$pureftpd_install_dir" ] && service pureftpd stop && rm -rf /etc/init.d/pureftpd [ -e "$redis_install_dir" ] && service redis-server stop && rm -rf /etc/init.d/redis-server [ -e "$memcached_install_dir" ] && service memcached stop && rm -rf /etc/init.d/memcached @@ -29,8 +29,6 @@ do [ -e "$D" ] && rm -rf $D done -[ -e "$web_install_dir" ] && rm -rf /etc/logrotate.d/nginx && [ -e "/var/ngx_pagespeed_cache" ] && rm -rf /var/ngx_pagespeed_cache -[ -e "$db_install_dir" ] && rm -rf /etc/my.cnf /etc/ld.so.conf.d/mysql.conf /usr/include/mysql sed -i 's@^lnmp_dir=.*@lnmp_dir=@' ./options.conf sed -i 's@^web_install_dir=.*@web_install_dir=@' ./options.conf sed -i 's@^db_install_dir=.*@db_install_dir=@' ./options.conf From 151fa80147a6b0b88ee4f4c3130366ccfc06bb49 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 22 Nov 2013 11:15:23 +0800 Subject: [PATCH 243/617] update mariadb 5.5.33a to 5.5.34 --- functions/mariadb-5.5.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index df742254..eb98f857 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.34/kvm-tarbake-jaunty-x86/mariadb-5.5.34.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,12 +21,12 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-5.5.33a.tar.gz -cd mariadb-5.5.33a +tar zxf mariadb-5.5.34.tar.gz +cd mariadb-5.5.34 if [ "$je_tc_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ From a2f5cb7ddd31d63ef5a0da4b996f2e783018cdf3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 23 Nov 2013 00:05:40 +0800 Subject: [PATCH 244/617] update Tengine 1.5.1 to 1.5.2 --- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 7 +++---- functions/mysql-5.6.sh | 7 +++---- functions/percona-5.5.sh | 5 ++--- functions/percona-5.6.sh | 6 ++---- functions/php-mysql-client.sh | 12 +++++++----- functions/tengine.sh | 6 +++--- install.sh | 32 +++++++++++++++++++++++--------- 8 files changed, 46 insertions(+), 35 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index eb98f857..688dc67b 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -30,21 +30,21 @@ elif [ "$je_tc_malloc" == '2' ];then fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mariadb_data_dir \ --DMYSQL_TCP_PORT=3306 \ -DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -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_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_EXTRA_CHARSETS=all \ +-DWITH_EMBEDDED_SERVER=1 \ +-DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 97940b9d..e5b89729 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -29,12 +29,11 @@ elif [ "$je_tc_malloc" == '2' ];then fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_TCP_PORT=3306 \ -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 \ @@ -42,8 +41,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_EXTRA_CHARSETS=all \ --DWITH_DEBUG=0 \ +-DWITH_EMBEDDED_SERVER=1 \ +-DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 6e5e067c..f1ca2701 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -30,19 +30,18 @@ elif [ "$je_tc_malloc" == '2' ];then fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_TCP_PORT=3306 \ -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 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_EXTRA_CHARSETS=all \ --DWITH_DEBUG=0 \ +-DWITH_EMBEDDED_SERVER=1 \ +-DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index bb31a1f1..c162695e 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -29,12 +29,11 @@ elif [ "$je_tc_malloc" == '2' ];then fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$percona_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_TCP_PORT=3306 \ -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 \ @@ -42,7 +41,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_EXTRA_CHARSETS=all \ +-DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 20532ef8..5a938c92 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -29,20 +29,18 @@ elif [ "$je_tc_malloc" == '2' ];then fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ --DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=$percona_data_dir \ -DSYSCONFDIR=/etc \ --DMYSQL_TCP_PORT=3306 \ -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 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_EXTRA_CHARSETS=all \ --DWITH_DEBUG=0 \ +-DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 108a9f73..31519ed2 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -11,11 +11,13 @@ cd $lnmp_dir/src src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src -tar xzf cmake-2.8.12.1.tar.gz -cd cmake-2.8.12.1 -CFLAGS= CXXFLAGS= ./configure -make && make install -cd .. +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.1.tar.gz + cd cmake-2.8.12.1 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi tar zxf mysql-5.5.34.tar.gz cd mysql-5.5.34 diff --git a/functions/tengine.sh b/functions/tengine.sh index 2aadf4c0..02ad4543 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src -src_url=http://tengine.taobao.org/download/tengine-1.5.1.tar.gz && Download_src +src_url=http://tengine.taobao.org/download/tengine-1.5.2.tar.gz && Download_src tar xzf pcre-8.33.tar.gz cd pcre-8.33 @@ -18,9 +18,9 @@ cd pcre-8.33 make && make install cd ../ -tar xzf tengine-1.5.1.tar.gz +tar xzf tengine-1.5.2.tar.gz useradd -M -s /sbin/nologin www -cd tengine-1.5.1 +cd tengine-1.5.2 # Modify Tengine version #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h diff --git a/install.sh b/install.sh index 31343b87..12e4a297 100755 --- a/install.sh +++ b/install.sh @@ -2,10 +2,11 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.5 09-Nov-2013 lj2007331 AT gmail.com -# Notes: LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# Version: 0.6 22-Nov-2013 lj2007331 AT gmail.com +# Notes: LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: +# http://blog.linuxeye.com/31.html # https://github.com/lj2007331/lnmp # Check if user is root @@ -218,20 +219,33 @@ do fi done fi + while : do echo - echo 'Please select ImageMagick or GraphicsMagick:' - echo -e "\t\033[32m1\033[0m. Install ImageMagick" - echo -e "\t\033[32m2\033[0m. Install GraphicsMagick" - read -p "Please input a number:(Default 1 press Enter) " Magick - [ -z "$Magick" ] && Magick=1 - if [ $Magick != 1 -a $Magick != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2 \033[0m" + read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn + if [ "$Magick_yn" != 'y' -a "$Magick_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi done + if [ "$Magick_yn" == 'y' ];then + while : + do + echo 'Please select ImageMagick or GraphicsMagick:' + echo -e "\t\033[32m1\033[0m. Install ImageMagick" + echo -e "\t\033[32m2\033[0m. Install GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [ $Magick != 1 -a $Magick != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2 \033[0m" + else + break + fi + done + fi + while : do echo From e82e1caa62a073b785b66031ee3261fda37b71ae Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 23 Nov 2013 13:20:18 +0800 Subject: [PATCH 245/617] update redis 2.6.16 to 2.8.0 --- functions/redis.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 54e8cdd3..de49325f 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.6.16.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.0.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -26,8 +26,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.6.16.tar.gz -cd redis-2.6.16 +tar xzf redis-2.8.0.tar.gz +cd redis-2.8.0 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -40,9 +40,9 @@ if [ -f "src/redis-server" ];then /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ /bin/cp redis.conf $redis_install_dir/etc/ ln -s $redis_install_dir/bin/* /usr/local/bin/ - sed -i 's@pidfile.*$@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf - sed -i "s@logfile.*$@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf - sed -i "s@^dir.*$@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf + sed -i 's@pidfile.*@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf + sed -i "s@logfile.*@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf + sed -i "s@^dir.*@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf cd ../../ OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n From 55c9a14dcab5ec4ee80830991d8fa6baf8592b64 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 25 Nov 2013 21:55:20 +0800 Subject: [PATCH 246/617] update redis 2.8.0 to 2.8.1 --- functions/ImageMagick.sh | 6 +++--- functions/redis.sh | 6 +++--- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 138f6ca3..376e8645 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-6.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-7.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-6.tar.gz -cd ImageMagick-6.8.7-6 +tar xzf ImageMagick-6.8.7-7.tar.gz +cd ImageMagick-6.8.7-7 ./configure make && make install cd ../ diff --git a/functions/redis.sh b/functions/redis.sh index de49325f..a30453ae 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.0.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.1.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -26,8 +26,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.0.tar.gz -cd redis-2.8.0 +tar xzf redis-2.8.1.tar.gz +cd redis-2.8.1 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_Debian.sh b/init/init_Debian.sh index bcbb2f19..a0a5ad88 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -3,7 +3,7 @@ # Blog: http://blog.linuxeye.com apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y update # update packages diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index b5f65198..6253c7b9 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -3,7 +3,7 @@ # Blog: http://blog.linuxeye.com apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -dpkg -p apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y update # update packages From 717688cad8842d44bf30fbacf34343df8feca8d0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 27 Nov 2013 19:18:47 +0800 Subject: [PATCH 247/617] update httpd 2.4.6 to 2.4.7 --- functions/apache-2.4.sh | 6 +++--- init/Nginx-init-CentOS | 2 +- init/Nginx-init-Ubuntu | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 41594c5f..f6091400 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src -src_url=http://www.apache.org/dist/httpd/httpd-2.4.6.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.4.7.tar.gz && Download_src tar xzf pcre-8.33.tar.gz cd pcre-8.33 @@ -21,10 +21,10 @@ make && make install cd ../ useradd -M -s /sbin/nologin www -tar xzf httpd-2.4.6.tar.gz +tar xzf httpd-2.4.7.tar.gz tar xzf apr-1.4.8.tar.gz tar xzf apr-util-1.5.2.tar.gz -cd httpd-2.4.6 +cd httpd-2.4.7 /bin/cp -R ../apr-1.4.8 ./srclib/apr /bin/cp -R ../apr-util-1.5.2 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir diff --git a/init/Nginx-init-CentOS b/init/Nginx-init-CentOS index 64f2066a..29f63321 100755 --- a/init/Nginx-init-CentOS +++ b/init/Nginx-init-CentOS @@ -69,7 +69,7 @@ stop() { restart() { configtest || return $? stop - sleep 1 + sleep 3 start } diff --git a/init/Nginx-init-Ubuntu b/init/Nginx-init-Ubuntu index 5cf16464..770a95db 100755 --- a/init/Nginx-init-Ubuntu +++ b/init/Nginx-init-Ubuntu @@ -304,7 +304,7 @@ case "$1" in ;; restart|force-reload) stop - sleep 1 + sleep 3 start ;; reload) From 106166882f6f386e9a15c9f8780644a9e3fed6ad Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 29 Nov 2013 23:53:19 +0800 Subject: [PATCH 248/617] update download php url --- functions/ImageMagick.sh | 6 +++--- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 376e8645..96db94a8 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-7.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-8.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-7.tar.gz -cd ImageMagick-6.8.7-7 +tar xzf ImageMagick-6.8.7-8.tar.gz +cd ImageMagick-6.8.7-8 ./configure make && make install cd ../ diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index f2f78c0d..80e0b9f1 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.3.27.tar.gz && Download_src +src_url=http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index ab5126c8..8d393ecd 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.22.tar.gz && Download_src +src_url=http://www.php.net/get/php-5.4.22.tar.gz/from/this/mirror && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 01bc8079..cccf013a 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.6.tar.gz && Download_src +src_url=http://www.php.net/get/php-5.5.6.tar.gz/from/this/mirror && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 From 4e79ebe71dca9934bdf8d6aeb8dda56a6fc1e711 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Nov 2013 11:57:43 +0800 Subject: [PATCH 249/617] 0m error --- functions/php-5.5.sh | 1 + functions/zendopcache.sh | 1 + install.sh | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index cccf013a..18c4624b 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -126,6 +126,7 @@ sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' $php_i sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index ccc828c6..d9ff8ae7 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -24,6 +24,7 @@ opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 +opcache.save_comments=0 opcache.fast_shutdown=1 opcache.enable_cli=1 EOF diff --git a/install.sh b/install.sh index 12e4a297..79113dc4 100755 --- a/install.sh +++ b/install.sh @@ -176,8 +176,7 @@ do read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2,3\033[ -0m" + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" else break fi From 62fab9e7582735f02664e828e4125b7f22bdeaee Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Nov 2013 12:11:53 +0800 Subject: [PATCH 250/617] 0m error --- install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 79113dc4..440f03c2 100755 --- a/install.sh +++ b/install.sh @@ -192,8 +192,7 @@ do read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2 -\033[0m" + echo -e "\033[31minput error! Please only input number 1,2\033[0m" else break fi From ac4cde31d7ff7a8fa1a1bb6266b720ae87511b79 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Nov 2013 15:42:35 +0800 Subject: [PATCH 251/617] update jemalloc 3.4.0 to 3.4.1 --- functions/jemalloc.sh | 6 +++--- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh index b61e7f03..af0e4182 100755 --- a/functions/jemalloc.sh +++ b/functions/jemalloc.sh @@ -7,10 +7,10 @@ Install_jemalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.4.0.tar.bz2 && Download_src +src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.4.1.tar.bz2 && Download_src -tar xjf jemalloc-3.4.0.tar.bz2 -cd jemalloc-3.4.0 +tar xjf jemalloc-3.4.1.tar.bz2 +cd jemalloc-3.4.1 ./configure make && make install if [ -f "/usr/local/lib/libjemalloc.so" ];then diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 80e0b9f1..025d70e1 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror && Download_src +[ -s "php-5.3.27.tar.gz" ] && echo "php-5.3.27.tar.gz found" || wget -c http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 8d393ecd..05cbe14a 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/get/php-5.4.22.tar.gz/from/this/mirror && Download_src +[ -s "php-5.4.22.tar.gz" ] && echo "php-5.4.22.tar.gz found" || wget -c http://www.php.net/get/php-5.4.22.tar.gz/from/this/mirror tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 18c4624b..0e69301d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/get/php-5.5.6.tar.gz/from/this/mirror && Download_src +[ -s "php-5.5.6.tar.gz" ] && echo "php-5.5.6.tar.gz found" || wget -c http://www.php.net/get/php-5.5.6.tar.gz/from/this/mirror tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 From 483a44ed13e62adedf4495ea6ca0da318fba0b5d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 3 Dec 2013 10:42:48 +0800 Subject: [PATCH 252/617] update redis 2.8.1 to 2.8.2 and yum address --- conf/wordpress.conf | 2 +- functions/redis.sh | 6 +++--- init/init_CentOS.sh | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/conf/wordpress.conf b/conf/wordpress.conf index 51716383..eccb216e 100644 --- a/conf/wordpress.conf +++ b/conf/wordpress.conf @@ -1,5 +1,5 @@ if (-f $request_filename/index.html){ -rewrite (.*) $1/index.html break; + rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ diff --git a/functions/redis.sh b/functions/redis.sh index a30453ae..e366d782 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.1.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.2.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -26,8 +26,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.1.tar.gz -cd redis-2.8.1 +tar xzf redis-2.8.2.tar.gz +cd redis-2.8.2 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 8eb62594..075db563 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -16,18 +16,24 @@ public_IP=`../functions/get_public_ip.py` if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + #wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo + #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo fi fi if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + #wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo + #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo fi fi From b9499c064ec91283a256394b6d396524af63b3a9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 4 Dec 2013 22:37:55 +0800 Subject: [PATCH 253/617] add php download address --- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/pecl_http.sh | 6 +++--- functions/php-5.3.sh | 1 + functions/php-5.4.sh | 1 + functions/php-5.5.sh | 1 + 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index e5b89729..05ab6572 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.35.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.5.34.tar.gz -cd mysql-5.5.34 +tar zxf mysql-5.5.35.tar.gz +cd mysql-5.5.35 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index f1ca2701..c23540eb 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.6.14.tar.gz -cd mysql-5.6.14 +tar zxf mysql-5.6.15.tar.gz +cd mysql-5.6.15 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 8e4149c8..0170a709 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -8,9 +8,9 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://pecl.php.net/get/pecl_http-1.7.6.tgz && Download_src -tar xzf pecl_http-1.7.6.tgz -cd pecl_http-1.7.6 +src_url=http://pecl.php.net/get/pecl_http-2.0.1.tgz && Download_src +tar xzf pecl_http-2.0.1.tgz +cd pecl_http-2.0.1 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 025d70e1..c805402b 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -14,6 +14,7 @@ src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcryp src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src [ -s "php-5.3.27.tar.gz" ] && echo "php-5.3.27.tar.gz found" || wget -c http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.3.27.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 05cbe14a..28e20531 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -14,6 +14,7 @@ src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcryp src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src [ -s "php-5.4.22.tar.gz" ] && echo "php-5.4.22.tar.gz found" || wget -c http://www.php.net/get/php-5.4.22.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.22.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 0e69301d..ede7966a 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -14,6 +14,7 @@ src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcryp src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src [ -s "php-5.5.6.tar.gz" ] && echo "php-5.5.6.tar.gz found" || wget -c http://www.php.net/get/php-5.5.6.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.6.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 From 666301a0f481b1efe35ad72e047de6bf18419a8c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 6 Dec 2013 21:53:42 +0800 Subject: [PATCH 254/617] apache-2.2 NameVirtualHost port error --- functions/apache-2.2.sh | 2 +- functions/php-5.3.sh | 2 ++ functions/php-5.4.sh | 2 ++ functions/php-5.5.sh | 2 ++ functions/phpmyadmin.sh | 6 +++--- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index 9a5ab5ce..1d276359 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -69,7 +69,7 @@ EOF mkdir $apache_install_dir/conf/vhost cat > $apache_install_dir/conf/vhost/default.conf << EOF -NameVirtualHost *:8080 +NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com DocumentRoot "$home_dir/default" diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index c805402b..f38b3ad4 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -191,6 +191,8 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +service httpd restart fi cd ../../ } diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 28e20531..9c1b78b1 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -193,6 +193,8 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +service httpd restart fi cd ../../ } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index ede7966a..3617a8dd 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -201,6 +201,8 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +service httpd restart fi cd ../../ } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index abbd6ac5..711d7818 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.9/phpMyAdmin-4.0.9-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.0.9-all-languages.tar.gz -/bin/mv phpMyAdmin-4.0.9-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.0.10-all-languages.tar.gz +/bin/mv phpMyAdmin-4.0.10-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } From c02cc582df81a602ff236cdf3a1d0282afec1606 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 8 Dec 2013 17:45:02 +0800 Subject: [PATCH 255/617] Install_PHP-5-*: command not found --- conf/wordpress.conf | 12 ++------- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- init/init_CentOS.sh | 58 ++++++++++++++++++++++---------------------- init/init_Debian.sh | 23 ++++++++++++------ init/init_Ubuntu.sh | 21 ++++++++++------ 7 files changed, 63 insertions(+), 57 deletions(-) diff --git a/conf/wordpress.conf b/conf/wordpress.conf index eccb216e..75e0905a 100644 --- a/conf/wordpress.conf +++ b/conf/wordpress.conf @@ -1,12 +1,4 @@ -if (-f $request_filename/index.html){ - rewrite (.*) $1/index.html break; - } - -if (-f $request_filename/index.php){ - rewrite (.*) $1/index.php; - } - -if (!-f $request_filename){ - rewrite (.*) /index.php; +location / { + try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index f38b3ad4..eddada76 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -191,7 +191,7 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd ../../ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 9c1b78b1..cef90b89 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -193,7 +193,7 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd ../../ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 3617a8dd..3115d1ec 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -201,7 +201,7 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_i sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ] +elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd ../../ diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 075db563..caca0437 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,26 +14,26 @@ yum clean all public_IP=`../functions/get_public_ip.py` if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bk + mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - #wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d - wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d + wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo + #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo fi fi if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - #wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d - wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d + wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo - sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo + #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo fi fi @@ -52,7 +52,7 @@ yum check-update [ "$upgrade_yn" == 'y' ] && yum -y update # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat # use gcc-4.4 if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then @@ -64,15 +64,8 @@ fi [ "$sendmail_yn" == 'y' ] && yum -y install sendmail && service sendmail restart # closed Unnecessary services and remove obsolete rpm package -chkconfig --list | awk '{print "chkconfig " $1 " off"}' > /tmp/chkconfiglist.sh;/bin/sh /tmp/chkconfiglist.sh;rm -rf /tmp/chkconfiglist.sh -chkconfig sshd on -chkconfig crond on -chkconfig irqbalance on -chkconfig network on -chkconfig iptables on -chkconfig rsyslog on #CentOS 6 -chkconfig syslog on #CentOS 5 -chkconfig sendmail on +for Service in `chkconfig --list | grep 3:on | awk '{print $1}'`;do chkconfig --level 3 $Service off;done +for Service in ssh network crond iptables irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 @@ -105,13 +98,11 @@ EOF rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -# Set OpenDNS -if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +# Set DNS cat > /etc/resolv.conf << EOF -nameserver 208.67.222.222 -nameserver 208.67.220.220 +nameserver 114.114.114.114 +nameserver 8.8.8.8 EOF -fi # Wrong password five times locked 180s [ -z "`cat /etc/pam.d/system-auth | grep 'pam_tally2.so'`" ] && sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth @@ -123,9 +114,18 @@ fi sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 +net.ipv4.tcp_fin_timeout = 2 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 +net.ipv4.tcp_max_syn_backlog = 16384 +net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.route.gc_timeout = 100 +net.ipv4.tcp_syn_retries = 1 +net.ipv4.tcp_synack_retries = 1 +net.core.somaxconn = 16384 +net.core.netdev_max_backlog = 16384 +net.ipv4.tcp_max_orphans = 16384 EOF sysctl -p @@ -144,7 +144,7 @@ init q # Update time ntpdate pool.ntp.org -echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/root;chmod 600 /var/spool/cron/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/root;chmod 600 /var/spool/cron/root service crond restart # iptables diff --git a/init/init_Debian.sh b/init/init_Debian.sh index a0a5ad88..32038bf9 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -13,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget locales libcloog-ppl0 +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 vim zip unzip tmux htop wget # PS1 [ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc @@ -38,13 +38,11 @@ EOF rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -# Set OpenDNS -if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +# Set DNS cat > /etc/resolv.conf << EOF -nameserver 208.67.222.222 -nameserver 208.67.220.220 +nameserver 114.114.114.114 +nameserver 8.8.8.8 EOF -fi # alias vi [ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc @@ -54,11 +52,20 @@ sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF -net.ipv4.tcp_syncookies = 1 fs.file-max=65535 +net.ipv4.tcp_syncookies = 1 +net.ipv4.tcp_fin_timeout = 2 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 +net.ipv4.tcp_max_syn_backlog = 16384 +net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.route.gc_timeout = 100 +net.ipv4.tcp_syn_retries = 1 +net.ipv4.tcp_synack_retries = 1 +net.core.somaxconn = 16384 +net.core.netdev_max_backlog = 16384 +net.ipv4.tcp_max_orphans = 16384 EOF sysctl -p @@ -73,7 +80,7 @@ init q # Update time ntpdate pool.ntp.org -echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root service cron restart # iptables diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 6253c7b9..3f4c2202 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -47,24 +47,31 @@ EOF rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -# Set OpenDNS -if [ ! -z "`cat /etc/resolv.conf | grep '8\.8\.8\.8'`" ];then +# Set DNS cat > /etc/resolv.conf << EOF -nameserver 208.67.222.222 -nameserver 208.67.220.220 +nameserver 114.114.114.114 +nameserver 8.8.8.8 EOF -fi # alias vi [ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF -net.ipv4.tcp_syncookies = 1 fs.file-max=65535 +net.ipv4.tcp_syncookies = 1 +net.ipv4.tcp_fin_timeout = 2 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 +net.ipv4.tcp_max_syn_backlog = 16384 +net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.route.gc_timeout = 100 +net.ipv4.tcp_syn_retries = 1 +net.ipv4.tcp_synack_retries = 1 +net.core.somaxconn = 16384 +net.core.netdev_max_backlog = 16384 +net.ipv4.tcp_max_orphans = 16384 EOF sysctl -p @@ -75,7 +82,7 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root service cron restart # iptables From 5bb857b3f0f3a3cdbcb8318aee8cb41fe0a38859 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 9 Dec 2013 18:39:47 +0800 Subject: [PATCH 256/617] php-fpm bug --- functions/php-5.3.sh | 2 ++ functions/php-5.4.sh | 2 ++ functions/php-5.5.sh | 2 ++ init/init_CentOS.sh | 8 +++++--- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index eddada76..b3ea6ccd 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -68,6 +68,8 @@ cd ../ tar xzf php-5.3.27.tar.gz useradd -M -s /sbin/nologin www +wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' +patch -d php-5.3.27 -p0 < fpm-race-condition.patch cd php-5.3.27 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index cef90b89..cd893950 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -70,6 +70,8 @@ cd ../ tar xzf php-5.4.22.tar.gz useradd -M -s /sbin/nologin www +wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' +patch -d php-5.4.22 -p0 < fpm-race-condition.patch cd php-5.4.22 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 3115d1ec..e11bc0ed 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -68,6 +68,8 @@ cd ../ tar xzf php-5.5.6.tar.gz useradd -M -s /sbin/nologin www +wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' +patch -d php-5.5.6 -p0 < fpm-race-condition.patch cd php-5.5.6 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index caca0437..eb73c899 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -41,9 +41,11 @@ if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then fi if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "X Window System" "Printing client" "Desktop*" + yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" + #yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "X Window System" "Printing client" "Desktop*" elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" + yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" + #yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" fi yum check-update @@ -52,7 +54,7 @@ yum check-update [ "$upgrade_yn" == 'y' ] && yum -y update # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch # use gcc-4.4 if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 32038bf9..fbf7e311 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -13,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget # PS1 [ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 3f4c2202..f5afa9ab 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -13,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget if [ ! -z "`cat /etc/issue | grep 13`" ];then apt-get -y install libcloog-ppl1 From e1789d936da03bea0fed71505423ae0e3221f256 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Dec 2013 16:27:11 +0800 Subject: [PATCH 257/617] ssh not connect --- init/init_CentOS.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index eb73c899..c7569e78 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -67,7 +67,7 @@ fi # closed Unnecessary services and remove obsolete rpm package for Service in `chkconfig --list | grep 3:on | awk '{print $1}'`;do chkconfig --level 3 $Service off;done -for Service in ssh network crond iptables irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done +for Service in sshd network crond iptables irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 @@ -78,7 +78,7 @@ sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab init q # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ \[\e[33;40m\]"' >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc # history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile From 394e47c717f2d5e4617f87579bfd8b0f43d032ac Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 12 Dec 2013 13:23:59 +0800 Subject: [PATCH 258/617] update redis 2.8.2 to 2.8.3 --- functions/ImageMagick.sh | 6 +++--- functions/redis.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 96db94a8..98262054 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-8.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-9.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-8.tar.gz -cd ImageMagick-6.8.7-8 +tar xzf ImageMagick-6.8.7-9.tar.gz +cd ImageMagick-6.8.7-9 ./configure make && make install cd ../ diff --git a/functions/redis.sh b/functions/redis.sh index e366d782..385a0f76 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.2.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.3.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -26,8 +26,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.2.tar.gz -cd redis-2.8.2 +tar xzf redis-2.8.3.tar.gz +cd redis-2.8.3 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings From 8b6268d100cc8400b6b2db0760eddfa3fec1b520 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Dec 2013 09:53:37 +0800 Subject: [PATCH 259/617] update php version --- functions/memcached.sh | 6 +++--- functions/php-5.3.sh | 10 +++++----- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/phpmyadmin.sh | 6 +++--- install.sh | 2 +- vhost.sh | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 3b449141..2774d9d8 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,15 +9,15 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/memcached-1.4.16.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.1.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.15.tar.gz -cd memcached-1.4.15 +tar xzf memcached-1.4.16.tar.gz +cd memcached-1.4.16 ./configure --prefix=$memcached_install_dir make && make install cd ../ diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index b3ea6ccd..50eba389 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.3.27.tar.gz" ] && echo "php-5.3.27.tar.gz found" || wget -c http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.3.27.tar.gz && Download_src +[ -s "php-5.3.28.tar.gz" ] && echo "php-5.3.28.tar.gz found" || wget -c http://www.php.net/get/php-5.3.28.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.3.28.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -66,11 +66,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.3.27.tar.gz +tar xzf php-5.3.28.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.3.27 -p0 < fpm-race-condition.patch -cd php-5.3.27 +patch -d php-5.3.28 -p0 < fpm-race-condition.patch +cd php-5.3.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index cd893950..7f682699 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.22.tar.gz" ] && echo "php-5.4.22.tar.gz found" || wget -c http://www.php.net/get/php-5.4.22.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.4.22.tar.gz && Download_src +[ -s "php-5.4.23.tar.gz" ] && echo "php-5.4.23.tar.gz found" || wget -c http://www.php.net/get/php-5.4.23.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.23.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.22.tar.gz +tar xzf php-5.4.23.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.22 -p0 < fpm-race-condition.patch -cd php-5.4.22 +patch -d php-5.4.23 -p0 < fpm-race-condition.patch +cd php-5.4.23 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index e11bc0ed..17512327 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.6.tar.gz" ] && echo "php-5.5.6.tar.gz found" || wget -c http://www.php.net/get/php-5.5.6.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.5.6.tar.gz && Download_src +[ -s "php-5.5.7.tar.gz" ] && echo "php-5.5.7.tar.gz found" || wget -c http://www.php.net/get/php-5.5.7.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.7.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -66,11 +66,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.6.tar.gz +tar xzf php-5.5.7.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.6 -p0 < fpm-race-condition.patch -cd php-5.5.6 +patch -d php-5.5.7 -p0 < fpm-race-condition.patch +cd php-5.5.7 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 711d7818..9a1ba1dc 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.0/phpMyAdmin-4.1.0-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.0.10-all-languages.tar.gz -/bin/mv phpMyAdmin-4.0.10-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.0-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.0-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } diff --git a/install.sh b/install.sh index 440f03c2..32bbf190 100755 --- a/install.sh +++ b/install.sh @@ -33,7 +33,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS while : do - echo -e "\033[32m \033[0m\n" + echo read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" diff --git a/vhost.sh b/vhost.sh index 1bde14c9..35ceaf74 100755 --- a/vhost.sh +++ b/vhost.sh @@ -18,7 +18,7 @@ Input_domain() { while : do - echo -e "\033[32m \033[0m" + echo read -p "Please input domain(example: www.linuxeye.com linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo -e "\033[31minput error! \033[0m" From c84cd6743524c1ba9f99d916d08ea18337bc87c8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Dec 2013 11:01:25 +0800 Subject: [PATCH 260/617] Python 2.4 does not support 'json' module --- functions/get_ip_area.py | 10 +++++++--- upgrade_php.sh | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/get_ip_area.py b/functions/get_ip_area.py index 5536f3f1..ae1ed330 100755 --- a/functions/get_ip_area.py +++ b/functions/get_ip_area.py @@ -1,11 +1,15 @@ #!/usr/bin/env python #coding:utf-8 try: - import sys,urllib2,json + import sys,urllib2 +# import sys,urllib2,json +# Python 2.4(CentOS/RHEL 5) does not support 'json' module apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] content = urllib2.urlopen(apiurl).read() - data = json.loads(content)['data'] - code = json.loads(content)['code'] +# data = json.loads(content)['data'] +# code = json.loads(content)['code'] + data = eval(content)['data'] + code = eval(content)['code'] if code == 0: print data['country_id'] else: diff --git a/upgrade_php.sh b/upgrade_php.sh index 79367481..32599a8c 100755 --- a/upgrade_php.sh +++ b/upgrade_php.sh @@ -57,6 +57,8 @@ if [ -e "php-$php_version.tar.gz" ];then echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf php-$php_version.tar.gz + wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' + patch -d php-$php_version -p0 < fpm-race-condition.patch cd php-$php_version make clean $php_install_dir/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash From caeb4ed7b08ddb3dfd55926f2a8f4a5cd63e98bd Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Dec 2013 11:47:06 +0800 Subject: [PATCH 261/617] MySQL Configuring incomplete, errors occurred --- functions/mariadb-5.5.sh | 1 - functions/mysql-5.5.sh | 1 - functions/mysql-5.6.sh | 1 - functions/percona-5.5.sh | 1 - functions/percona-5.6.sh | 1 - 5 files changed, 5 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 688dc67b..d7489dc2 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -44,7 +44,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ --DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 05ab6572..5e6a1be8 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -42,7 +42,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ --DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index c23540eb..4541d3b4 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -41,7 +41,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ --DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index c162695e..44f2d8d5 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -41,7 +41,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_SSL=system \ $EXE_LINKER make && make install diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 5a938c92..79de03b3 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -40,7 +40,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ --DWITH_SSL=system \ $EXE_LINKER make && make install From 6bdd3da413ac8a2832e07b487d0580ad43b9956a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 16 Dec 2013 22:31:35 +0800 Subject: [PATCH 262/617] update pecl_http 1.7 to 2.0 --- functions/mariadb-5.5.sh | 2 +- functions/pecl_http.sh | 22 +++++++++++++++++++--- init/init_CentOS.sh | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index d7489dc2..ffddaa83 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -36,7 +36,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ --DWITH_FEDERATED_STORAGE_ENGINE=1 \ +-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 0170a709..58b5ac4c 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -8,9 +8,25 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://pecl.php.net/get/pecl_http-2.0.1.tgz && Download_src -tar xzf pecl_http-2.0.1.tgz -cd pecl_http-2.0.1 +src_url=http://pecl.php.net/get/raphf-1.0.4.tgz && Download_src +src_url=http://pecl.php.net/get/propro-1.0.0.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-2.0.3.tgz && Download_src +tar xzf raphf-1.0.4.tgz +cd raphf-1.0.4 +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +cd .. + +tar xzf propro-1.0.0.tgz +cd propro-1.0.0 +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +cd .. + +tar xzf pecl_http-2.0.3.tgz +cd pecl_http-2.0.3 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c7569e78..ef9598b1 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -4,7 +4,7 @@ cd src . ../functions/download.sh -src_url=http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/yum-3.4.3.tar.gz && Download_src tar zxf yum-3.4.3.tar.gz cd yum-3.4.3 ./yummain.py install yum -y From b8ae5b84ebbe7c64ba39b99b5011fe10cd291c36 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 20 Dec 2013 14:38:21 +0800 Subject: [PATCH 263/617] change yum --- init/init_CentOS.sh | 24 ++++++++++++------------ upgrade_php.sh | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index ef9598b1..9cfbbf26 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -16,24 +16,24 @@ public_IP=`../functions/get_public_ip.py` if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d - #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d + #wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d + wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo - #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo + #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo fi fi if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d - #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d + #wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d + wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo - #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo + #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo + #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo fi fi diff --git a/upgrade_php.sh b/upgrade_php.sh index 32599a8c..b07f1474 100755 --- a/upgrade_php.sh +++ b/upgrade_php.sh @@ -36,7 +36,7 @@ do echo read -p "Please input upgrade PHP Version: " php_version if [ "${php_version%.*}" == "${Old_php_version%.*}" ]; then - if [ "${php_version##*.}" -gt "${Old_php_version##*.}" ]; then + if [ "${php_version##*.}" -ge "${Old_php_version##*.}" ]; then [ ! -e "php-$php_version.tar.gz" ] && wget -c http://www.php.net/distributions/php-$php_version.tar.gz > /dev/null 2>&1 if [ -e "php-$php_version.tar.gz" ];then echo -e "Download \033[32mphp-$php_version.tar.gz\033[0m successfully! " @@ -45,7 +45,7 @@ do fi break else - echo -e "Error: You must input PHP version greater than \033[32m$Old_php_version\033[0m!! " + echo -e "Error: You must input PHP version not less than \033[32m$Old_php_version\033[0m!! " fi else echo -e "\033[31minput error!\033[0m Please only input '\033[32m${Old_php_version%.*}.xx' \033[0m" From 8bdff58dfca20c4498901b24801e610928f11f78 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 21 Dec 2013 16:30:33 +0800 Subject: [PATCH 264/617] update source stable version --- functions/ImageMagick.sh | 6 +++--- functions/memcached.sh | 6 +++--- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 98262054..b9ad07ee 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-9.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-10.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-9.tar.gz -cd ImageMagick-6.8.7-9 +tar xzf ImageMagick-6.8.7-10.tar.gz +cd ImageMagick-6.8.7-10 ./configure make && make install cd ../ diff --git a/functions/memcached.sh b/functions/memcached.sh index 2774d9d8..9694121b 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,15 +9,15 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/memcached-1.4.16.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/memcached-1.4.17.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.1.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.16.tar.gz -cd memcached-1.4.16 +tar xzf memcached-1.4.17.tar.gz +cd memcached-1.4.17 ./configure --prefix=$memcached_install_dir make && make install cd ../ diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 44f2d8d5..5b18a3c5 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.34-rel32.0/source/Percona-Server-5.5.34-rel32.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf Percona-Server-5.5.34-rel32.0.tar.gz -cd Percona-Server-5.5.34-rel32.0 +tar zxf Percona-Server-5.5.35-rel33.0.tar.gz +cd Percona-Server-5.5.35-rel33.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 79de03b3..cde18edb 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/Percona-Server-5.6.14-rel62.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf Percona-Server-5.6.14-rel62.0.tar.gz -cd Percona-Server-5.6.14-rel62.0 +tar zxf Percona-Server-5.6.15-rel63.0.tar.gz +cd Percona-Server-5.6.15-rel63.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 31519ed2..a75c8dc5 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.34.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.35.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-2.8.12.1.tar.gz @@ -19,8 +19,8 @@ if [ ! -e "`which cmake`" ];then cd .. fi -tar zxf mysql-5.5.34.tar.gz -cd mysql-5.5.34 +tar zxf mysql-5.5.35.tar.gz +cd mysql-5.5.35 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 9a1ba1dc..9b03fcca 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.0/phpMyAdmin-4.1.0-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.1/phpMyAdmin-4.1.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.0-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.0-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.1-all-languages $home_dir/default/phpMyAdmin chown -R www.www $home_dir/default/phpMyAdmin cd .. } From 29e20c2a9e5c5210bc95b1ce33148ffe5216fbb2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 22 Dec 2013 18:31:02 +0800 Subject: [PATCH 265/617] pecl_http Unable to load --- functions/GraphicsMagick.sh | 13 +++++-------- functions/ImageMagick.sh | 3 ++- functions/memcached.sh | 2 ++ functions/pecl_http.sh | 3 ++- functions/phpmyadmin.sh | 4 ++++ functions/redis.sh | 1 + 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index bc33dc54..9ff743e8 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.5RC1.tgz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.6RC2.tgz && Download_src tar xzf GraphicsMagick-1.3.18.tar.gz cd GraphicsMagick-1.3.18 @@ -17,8 +17,8 @@ cd GraphicsMagick-1.3.18 make && make install cd ../ -tar xzf gmagick-1.1.5RC1.tgz -cd gmagick-1.1.5RC1 +tar xzf gmagick-1.1.6RC2.tgz +cd gmagick-1.1.6RC2 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize @@ -27,11 +27,8 @@ make && make install cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/gmagick.so" ];then - if [ -z "`cat $php_install_dir/etc/php.ini | grep ^extension_dir`" ];then - sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"gmagick.so\"@" $php_install_dir/etc/php.ini - else - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini - fi + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index b9ad07ee..a0aa8487 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -28,7 +28,8 @@ make && make install cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then - sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"\nextension = \"imagick.so\"@" $php_install_dir/etc/php.ini + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "imagick.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP imagick module install failed, Please contact the author! \033[0m" diff --git a/functions/memcached.sh b/functions/memcached.sh index 9694121b..1d9a42ba 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -45,6 +45,7 @@ $php_install_dir/bin/phpize make && make install cd .. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else @@ -66,6 +67,7 @@ $php_install_dir/bin/phpize make && make install cd ../ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 58b5ac4c..39de91a6 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -32,7 +32,8 @@ $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/http.so" ];then - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "http.so"@' $php_install_dir/etc/php.ini + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "raphf.so"\nextension = "propro.so"\nextension = "http.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP pecl_http module install failed, Please contact the author! \033[0m" diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 9b03fcca..45d97d93 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -12,6 +12,10 @@ src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.1/php tar xzf phpMyAdmin-4.1.1-all-languages.tar.gz /bin/mv phpMyAdmin-4.1.1-all-languages $home_dir/default/phpMyAdmin +/bin/cp $home_dir/default/phpMyAdmin{config.sample.inc.php,config.inc.php} +mkdir $home_dir/default/phpMyAdmin{upload,save} +sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php +sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" $home_dir/default/phpMyAdmin/config.inc.php chown -R www.www $home_dir/default/phpMyAdmin cd .. } diff --git a/functions/redis.sh b/functions/redis.sh index 385a0f76..02ab4971 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -20,6 +20,7 @@ $php_install_dir/bin/phpize make && make install cd .. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else From b179d82a9a48d29656e549742cc8d64267f13f4c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 23 Dec 2013 12:23:17 +0800 Subject: [PATCH 266/617] phpmyadmin error --- functions/phpmyadmin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 45d97d93..42167a91 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -12,8 +12,8 @@ src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.1/php tar xzf phpMyAdmin-4.1.1-all-languages.tar.gz /bin/mv phpMyAdmin-4.1.1-all-languages $home_dir/default/phpMyAdmin -/bin/cp $home_dir/default/phpMyAdmin{config.sample.inc.php,config.inc.php} -mkdir $home_dir/default/phpMyAdmin{upload,save} +/bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} +mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" $home_dir/default/phpMyAdmin/config.inc.php chown -R www.www $home_dir/default/phpMyAdmin From c06b52c5c58ddefbf96b43b7412cc32389191881 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 Jan 2014 11:24:24 +0800 Subject: [PATCH 267/617] update source stable version --- functions/ImageMagick.sh | 6 +++--- functions/ngx_pagespeed.sh | 16 ++++++++-------- functions/pecl_http.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index a0aa8487..8b0bb2ee 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.7-10.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-1.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.7-10.tar.gz -cd ImageMagick-6.8.7-10 +tar xzf ImageMagick-6.8.8-1.tar.gz +cd ImageMagick-6.8.8-1 ./configure make && make install cd ../ diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index aa9167a5..275f0e64 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.1.tar.gz && Download_src -[ -s "ngx_pagespeed-1.7.30.1-beta.zip" ] && echo "ngx_pagespeed-1.7.30.1-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.1-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.2.tar.gz && Download_src +[ -s "ngx_pagespeed-1.7.30.2-beta.zip" ] && echo "ngx_pagespeed-1.7.30.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.7.30.1-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.1-beta -tar xzf 1.7.30.1.tar.gz -C ngx_pagespeed-1.7.30.1-beta +unzip -q ngx_pagespeed-1.7.30.2-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.2-beta +tar xzf 1.7.30.2.tar.gz -C ngx_pagespeed-1.7.30.2-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.4.4 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.1-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.2-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 39de91a6..a4a28294 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src src_url=http://pecl.php.net/get/raphf-1.0.4.tgz && Download_src src_url=http://pecl.php.net/get/propro-1.0.0.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-2.0.3.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-2.0.4.tgz && Download_src tar xzf raphf-1.0.4.tgz cd raphf-1.0.4 $php_install_dir/bin/phpize @@ -25,8 +25,8 @@ $php_install_dir/bin/phpize make && make install cd .. -tar xzf pecl_http-2.0.3.tgz -cd pecl_http-2.0.3 +tar xzf pecl_http-2.0.4.tgz +cd pecl_http-2.0.4 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 42167a91..ca105093 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.1/phpMyAdmin-4.1.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.4/phpMyAdmin-4.1.4-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.4-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.4-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From f8df2e87bed776a0d743cce78e97be1977d8aba4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 12 Jan 2014 21:07:49 +0800 Subject: [PATCH 268/617] update php version --- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- upgrade_web.sh | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 7f682699..8c9c5efc 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.23.tar.gz" ] && echo "php-5.4.23.tar.gz found" || wget -c http://www.php.net/get/php-5.4.23.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.4.23.tar.gz && Download_src +[ -s "php-5.4.24.tar.gz" ] && echo "php-5.4.24.tar.gz found" || wget -c http://www.php.net/get/php-5.4.24.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.24.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.23.tar.gz +tar xzf php-5.4.24.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.23 -p0 < fpm-race-condition.patch -cd php-5.4.23 +patch -d php-5.4.24 -p0 < fpm-race-condition.patch +cd php-5.4.24 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 17512327..91d1ef92 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.7.tar.gz" ] && echo "php-5.5.7.tar.gz found" || wget -c http://www.php.net/get/php-5.5.7.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.5.7.tar.gz && Download_src +[ -s "php-5.5.8.tar.gz" ] && echo "php-5.5.8.tar.gz found" || wget -c http://www.php.net/get/php-5.5.8.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.8.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -66,11 +66,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.7.tar.gz +tar xzf php-5.5.8.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.7 -p0 < fpm-race-condition.patch -cd php-5.5.7 +patch -d php-5.5.8 -p0 < fpm-race-condition.patch +cd php-5.5.8 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/upgrade_web.sh b/upgrade_web.sh index faa7977f..c14238af 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -115,7 +115,11 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then make if [ -f "objs/nginx" ];then /bin/mv $web_install_dir/sbin/nginx $web_install_dir/sbin/nginx$(date +%m%d) + /bin/mv $web_install_dir/sbin/dso_tool $web_install_dir/sbin/dso_tool$(date +%m%d) + /bin/mv $web_install_dir/modules $web_install_dir/modules$(date +%m%d) /bin/cp objs/nginx $web_install_dir/sbin/nginx + /bin/cp objs/dso_tool $web_install_dir/sbin/dso_tool + /bin/cp -R objs/modules $web_install_dir/ kill -USR2 `cat /var/run/nginx.pid` kill -QUIT `cat /var/run/nginx.pid.oldbin` echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_tengine_version\033[0m to \033[32m$tengine_version\033[0m" From 4812c7e6c77a2b15855c1863ba17eb8f2f72ea20 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 17 Jan 2014 10:52:22 +0800 Subject: [PATCH 269/617] update redis 2.8.3 to 2.8.4 --- functions/ImageMagick.sh | 6 +++--- functions/ngx_pagespeed.sh | 16 ++++++++-------- functions/redis.sh | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 8b0bb2ee..714c8083 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-1.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-2.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-1.tar.gz -cd ImageMagick-6.8.8-1 +tar xzf ImageMagick-6.8.8-2.tar.gz +cd ImageMagick-6.8.8-2 ./configure make && make install cd ../ diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 275f0e64..b1492b7d 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.2.tar.gz && Download_src -[ -s "ngx_pagespeed-1.7.30.2-beta.zip" ] && echo "ngx_pagespeed-1.7.30.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.3.tar.gz && Download_src +[ -s "ngx_pagespeed-1.7.30.3-beta.zip" ] && echo "ngx_pagespeed-1.7.30.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.7.30.2-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.2-beta -tar xzf 1.7.30.2.tar.gz -C ngx_pagespeed-1.7.30.2-beta +unzip -q ngx_pagespeed-1.7.30.3-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.3-beta +tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.4.4 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.2-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.3-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/redis.sh b/functions/redis.sh index 02ab4971..2a693f75 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.3.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.4.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.3.tar.gz -cd redis-2.8.3 +tar xzf redis-2.8.4.tar.gz +cd redis-2.8.4 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings From b4edebccf6a427bcd497fa305a98a1f73123bbb6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 18 Jan 2014 16:30:50 +0800 Subject: [PATCH 270/617] add upgrade_redis.sh and upgrade_phpmyadmin.sh --- upgrade_phpmyadmin.sh | 70 +++++++++++++++++++++++++++++++++++++ upgrade_redis.sh | 81 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100755 upgrade_phpmyadmin.sh create mode 100755 upgrade_redis.sh diff --git a/upgrade_phpmyadmin.sh b/upgrade_phpmyadmin.sh new file mode 100755 index 00000000..8755498d --- /dev/null +++ b/upgrade_phpmyadmin.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade phpMyAdmin for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf + +[ ! -e "$home_dir/default/phpMyAdmin" ] && echo -e "\033[31mThe phpMyAdmin is not installed on your system!\033[0m " && exit 1 + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} +echo + +Upgrade_phpMyAdmin() +{ +Old_phpMyAdmin_version=`grep Version $home_dir/default/phpMyAdmin/README | awk '{print $2}'` +echo -e "Current phpMyAdmin Version: \033[32m$Old_phpMyAdmin_version\033[0m" +while : +do + echo + read -p "Please input upgrade phpMyAdmin Version(example: 4.1.5): " phpMyAdmin_version + if [ "$phpMyAdmin_version" != "$Old_phpMyAdmin_version" ];then + [ ! -e "phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz" ] && wget -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/$phpMyAdmin_version/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz > /dev/null 2>&1 + if [ -e "phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz" ];then + echo -e "Download \033[32mphpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mphpMyAdmin version does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade phpMyAdmin version is the same as the old version\033[0m" + fi +done + +if [ -e "phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz" ];then + echo -e "\033[32mphpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz + rm -rf $home_dir/default/phpMyAdmin + /bin/mv phpMyAdmin-${phpMyAdmin_version}-all-languages $home_dir/default/phpMyAdmin + /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} + mkdir $home_dir/default/phpMyAdmin/{upload,save} + sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php + sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" $home_dir/default/phpMyAdmin/config.inc.php + chown -R www.www $home_dir/default/phpMyAdmin + cd .. + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_phpMyAdmin_version\033[0m to \033[32m$phpMyAdmin_version\033[0m" +fi +} +Upgrade_phpMyAdmin diff --git a/upgrade_redis.sh b/upgrade_redis.sh new file mode 100755 index 00000000..e9a00ca1 --- /dev/null +++ b/upgrade_redis.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +echo "#######################################################################" +echo "# LNMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ #" +echo "# Upgrade Redis for LNMP #" +echo "# For more information Please visit http://blog.linuxeye.com/31.html #" +echo "#######################################################################" + +cd src +. ../options.conf + +[ ! -d "$redis_install_dir" ] && echo -e "\033[31mThe Redis is not installed on your system!\033[0m " && exit 1 + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} +echo + +Upgrade_Redis() +{ +Old_redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'` +echo -e "Current Redis Version: \033[32m$Old_redis_version\033[0m" +while : +do + echo + read -p "Please input upgrade Redis Version(example: 2.8.4): " redis_version + if [ "$redis_version" != "$Old_redis_version" ];then + [ ! -e "redis-$redis_version.tar.gz" ] && wget -c http://download.redis.io/releases/redis-$redis_version.tar.gz > /dev/null 2>&1 + if [ -e "redis-$redis_version.tar.gz" ];then + echo -e "Download \033[32mredis-$redis_version.tar.gz\033[0m successfully! " + break + else + echo -e "\033[31mRedis version does not exist!\033[0m" + fi + else + echo -e "\033[31minput error! The upgrade Redis version is the same as the old version\033[0m" + fi +done + +if [ -e "redis-$redis_version.tar.gz" ];then + echo -e "\033[32mredis-$redis_version.tar.gz\033[0m [found]" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf redis-$redis_version.tar.gz + cd redis-$redis_version + make clean + if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then + sed -i '1i\CFLAGS= -march=i686' src/Makefile + sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings + fi + + make + + if [ -f "src/redis-server" ];then + echo -e "\nRestarting Redis..." + service redis-server stop + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + service redis-server start + echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_redis_version\033[0m to \033[32m$redis_version\033[0m" + else + echo -e "\033[31mUpgrade Redis failed! \033[0m" + fi + cd .. +fi +} + +Upgrade_Redis From db5d744abe3d3c68706787933cc964beeae2d151 Mon Sep 17 00:00:00 2001 From: Jan Chren Date: Sun, 26 Jan 2014 01:07:01 +0100 Subject: [PATCH 271/617] Support for Raspbian and maybe some other Debian-based distros --- functions/check_os.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/check_os.sh b/functions/check_os.sh index d4d07edc..c478076d 100755 --- a/functions/check_os.sh +++ b/functions/check_os.sh @@ -4,7 +4,7 @@ if [ -f /etc/redhat-release ];then OS=CentOS -elif [ ! -z "`cat /etc/issue | grep Debian`" ];then +elif [ ! -z "`cat /etc/issue | grep bian`" ];then OS=Debian elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then OS=Ubuntu From d18348bbbf6817dfcd1296b5ef6a9c1032fbe741 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 27 Jan 2014 12:09:38 +0800 Subject: [PATCH 272/617] delete ldap --- README.md | 2 ++ functions/apache-2.4.sh | 6 +++--- functions/check_os.sh | 2 +- functions/jemalloc.sh | 6 +++--- functions/nginx.sh | 6 +++--- functions/php-5.3.sh | 22 ++++++++-------------- functions/php-5.4.sh | 24 ++++++++---------------- functions/php-5.5.sh | 22 ++++++++-------------- functions/phpmyadmin.sh | 6 +++--- functions/pureftpd.sh | 2 +- functions/tengine.sh | 6 +++--- init/init_CentOS.sh | 4 +--- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- 14 files changed, 46 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 15b82c45..c4fc8094 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ Memcached: ```bash ./upgrade_php.sh # upgrade PHP ./upgrade_web.sh # upgrade Nginx/Tengine + ./upgrade_redis.sh # upgrade Redis + ./upgrade_phpmyadmin.sh # upgrade phpMyAdmin ``` ## How to uninstall diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index f6091400..0f45a76a 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -9,13 +9,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.7.tar.gz && Download_src -tar xzf pcre-8.33.tar.gz -cd pcre-8.33 +tar xzf pcre-8.34.tar.gz +cd pcre-8.34 ./configure make && make install cd ../ diff --git a/functions/check_os.sh b/functions/check_os.sh index d4d07edc..c478076d 100755 --- a/functions/check_os.sh +++ b/functions/check_os.sh @@ -4,7 +4,7 @@ if [ -f /etc/redhat-release ];then OS=CentOS -elif [ ! -z "`cat /etc/issue | grep Debian`" ];then +elif [ ! -z "`cat /etc/issue | grep bian`" ];then OS=Debian elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then OS=Ubuntu diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh index af0e4182..ebfc626a 100755 --- a/functions/jemalloc.sh +++ b/functions/jemalloc.sh @@ -7,10 +7,10 @@ Install_jemalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.4.1.tar.bz2 && Download_src +src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.5.0.tar.bz2 && Download_src -tar xjf jemalloc-3.4.1.tar.bz2 -cd jemalloc-3.4.1 +tar xjf jemalloc-3.5.0.tar.bz2 +cd jemalloc-3.5.0 ./configure make && make install if [ -f "/usr/local/lib/libjemalloc.so" ];then diff --git a/functions/nginx.sh b/functions/nginx.sh index 372f5d79..d7e16aa1 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src src_url=http://nginx.org/download/nginx-1.4.4.tar.gz && Download_src -tar xzf pcre-8.33.tar.gz -cd pcre-8.33 +tar xzf pcre-8.34.tar.gz +cd pcre-8.34 ./configure make && make install cd ../ diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 50eba389..ed6dc8b5 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -48,15 +48,9 @@ ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n - ln -s /usr/lib64/libldap* /usr/lib \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n - ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n -else \n - ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n -fi' OS_command tar xzf mcrypt-2.6.8.tar.gz @@ -78,20 +72,20 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi make ZEND_EXTRA_LIBS='-liconv' make install diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 8c9c5efc..8e117904 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -48,17 +48,9 @@ ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n - ln -s /usr/lib64/libldap* /usr/lib \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n - ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n - ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/ \n -else \n - ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n - ln -s /usr/lib/i386-linux-gnu/liblber.so /usr/lib/ \n -fi' OS_command tar xzf mcrypt-2.6.8.tar.gz @@ -80,20 +72,20 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockes --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi make ZEND_EXTRA_LIBS='-liconv' make install diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 91d1ef92..d7b1a2a4 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -48,15 +48,9 @@ ldconfig OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n - ln -s /usr/lib64/libldap* /usr/lib \n else \n ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n fi' -OS_Debian_Ubuntu='if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n - ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/ \n -else \n - ln -s /usr/lib/i386-linux-gnu/libldap.so /usr/lib/ \n -fi' OS_command tar xzf mcrypt-2.6.8.tar.gz @@ -78,20 +72,20 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-fpm-user=www --with-fpm-group=www --enable-fpm --enable-opcache --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --with-kerberos --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc \ ---enable-ftp --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi make ZEND_EXTRA_LIBS='-liconv' make install diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index ca105093..ce7b818c 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.4/phpMyAdmin-4.1.4-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.6/phpMyAdmin-4.1.6-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.4-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.4-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.6-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.6-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index ae912d41..7adbb0c1 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -15,7 +15,7 @@ src_url=http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz && Download_s tar xzf pure-ftpd-1.0.36.tar.gz cd pure-ftpd-1.0.36 [ $OS == 'Ubuntu' ] && ln -s $db_install_dir/lib/libmysqlclient.so /usr/lib -./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-mysql=$db_install_dir --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english +./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-mysql=$db_install_dir --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 make && make install if [ -d "$pureftpd_install_dir" ];then echo -e "\033[32mPure-Ftp install successfully! \033[0m" diff --git a/functions/tengine.sh b/functions/tengine.sh index 02ad4543..1551adc4 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-1.5.2.tar.gz && Download_src -tar xzf pcre-8.33.tar.gz -cd pcre-8.33 +tar xzf pcre-8.34.tar.gz +cd pcre-8.34 ./configure make && make install cd ../ diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 9cfbbf26..cfea5265 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -42,10 +42,8 @@ fi if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" - #yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "X Window System" "Printing client" "Desktop*" elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" - #yum -y groupremove "FTP Server" "Text-based Internet" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "X Window System" "X Software Development" "Printing Support" "OpenFabrics Enterprise Distribution" fi yum check-update @@ -54,7 +52,7 @@ yum check-update [ "$upgrade_yn" == 'y' ] && yum -y update # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch # use gcc-4.4 if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then diff --git a/init/init_Debian.sh b/init/init_Debian.sh index fbf7e311..72e6a626 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -13,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget # PS1 [ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index f5afa9ab..c19e8987 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -13,7 +13,7 @@ apt-get -y upgrade [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev slapd ldap-utils libnss-ldap bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget if [ ! -z "`cat /etc/issue | grep 13`" ];then apt-get -y install libcloog-ppl1 From 53edccff2887b48e9e6c98a1b69c608645702ba3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 1 Feb 2014 18:05:41 +0800 Subject: [PATCH 273/617] update mysql and mariadb --- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index ffddaa83..b0a788e4 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.34/kvm-tarbake-jaunty-x86/mariadb-5.5.34.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.35/kvm-tarbake-jaunty-x86/mariadb-5.5.35.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-5.5.34.tar.gz -cd mariadb-5.5.34 +tar zxf mariadb-5.5.35.tar.gz +cd mariadb-5.5.35 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 5e6a1be8..88c3c8b7 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.35.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.5.35.tar.gz -cd mysql-5.5.35 +tar zxf mysql-5.5.36.tar.gz +cd mysql-5.5.36 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 4541d3b4..bab0e652 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.6.15.tar.gz -cd mysql-5.6.15 +tar zxf mysql-5.6.16.tar.gz +cd mysql-5.6.16 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index a75c8dc5..b7bf7124 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.35.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-2.8.12.1.tar.gz @@ -19,8 +19,8 @@ if [ ! -e "`which cmake`" ];then cd .. fi -tar zxf mysql-5.5.35.tar.gz -cd mysql-5.5.35 +tar zxf mysql-5.5.36.tar.gz +cd mysql-5.5.36 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} From d50f87854a569015c40ebf55757804d4009bd44f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 1 Feb 2014 19:24:15 +0800 Subject: [PATCH 274/617] add vhost error --- vhost.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vhost.sh b/vhost.sh index 35ceaf74..a4abd73f 100755 --- a/vhost.sh +++ b/vhost.sh @@ -326,24 +326,24 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ } $anti_hotlinking `echo -e $ngx_pagespeed` -location / { - try_files \$uri @apache; - } +#location / { +# try_files \$uri @apache; +# } location @apache { internal; proxy_pass http://127.0.0.1:8080; -} + } location ~ .*\.(php|php5)?$ { proxy_pass http://127.0.0.1:8080; } -location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { - expires 30d; +location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; } location ~ .*\.(js|css)?$ { - expires 1h; + expires 7d; } } EOF From 4327976f2130551d7fdc9d3b97eaaab96a37feec Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 1 Feb 2014 19:30:13 +0800 Subject: [PATCH 275/617] nginx error --- functions/apache-2.2.sh | 2 +- functions/apache-2.4.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index 1d276359..e5a23edc 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -40,7 +40,7 @@ if [ "$Nginx_version" == '3' ];then TMP_IP=$local_IP elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:8080/' $apache_install_dir/conf/httpd.conf - sed -i 's@^Listen@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf + sed -i 's@^Listen.*@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf TMP_PORT=8080 TMP_IP=127.0.0.1 fi diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 0f45a76a..5e9babec 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -53,7 +53,7 @@ if [ "$Nginx_version" == '3' ];then TMP_IP=$local_IP elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:8080/' $apache_install_dir/conf/httpd.conf - sed -i 's@^Listen@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf + sed -i 's@^Listen.*@Listen 127.0.0.1:8080@' $apache_install_dir/conf/httpd.conf TMP_PORT=8080 TMP_IP=127.0.0.1 fi From ba0f3f07ed0a19c5f90d9d28cc71690577af1aed Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 1 Feb 2014 22:02:11 +0800 Subject: [PATCH 276/617] vhost bug --- vhost.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vhost.sh b/vhost.sh index a4abd73f..40031021 100755 --- a/vhost.sh +++ b/vhost.sh @@ -326,9 +326,9 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ } $anti_hotlinking `echo -e $ngx_pagespeed` -#location / { -# try_files \$uri @apache; -# } +location ~ / { + try_files \$uri @apache; + } location @apache { internal; From d892a3ba06e7ab185c87e39d011384ffc0b5d3c8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 1 Feb 2014 23:17:10 +0800 Subject: [PATCH 277/617] vhost bug --- vhost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vhost.sh b/vhost.sh index 40031021..1ca1362e 100755 --- a/vhost.sh +++ b/vhost.sh @@ -326,7 +326,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ } $anti_hotlinking `echo -e $ngx_pagespeed` -location ~ / { +location / { try_files \$uri @apache; } From 67336c70c6916bef1588c96440abbc04a6978448 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 2 Feb 2014 21:17:16 +0800 Subject: [PATCH 278/617] delete lanmp vhost rewrite --- vhost.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vhost.sh b/vhost.sh index 1ca1362e..24535f84 100755 --- a/vhost.sh +++ b/vhost.sh @@ -318,7 +318,6 @@ listen 80; server_name $domain$moredomainame; $N_log index index.html index.htm index.jsp index.php; -include $rewrite.conf; root $vhostdir; #error_page 404 /404.html; if ( \$query_string ~* ".*[\;'\<\>].*" ){ @@ -418,7 +417,7 @@ elif [ -d "$web_install_dir" -a -d "$apache_install_dir" ];then Input_domain Ngx_pagespeed Nginx_anti_hotlinking - Nginx_rewrite + #Nginx_rewrite Nginx_log Apache_log Create_nginx_apache_conf From 1116b29edfa1fb938abfe63d4f21f333b3814fb0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 5 Feb 2014 16:17:23 +0800 Subject: [PATCH 279/617] set opcache.optimization_level=0 --- conf/nginx.conf | 2 +- conf/nginx_apache.conf | 2 +- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 3 ++- functions/redis.sh | 6 +++--- functions/zendopcache.sh | 1 + 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2bf9f453..b0915563 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -29,7 +29,7 @@ http { fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 256k; + fastcgi_temp_file_write_size 128k; gzip on; gzip_disable "msie6"; diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index da8f1787..5f4f9741 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -44,7 +44,7 @@ http { fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 256k; + fastcgi_temp_file_write_size 128k; gzip on; gzip_disable "msie6"; diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index ed6dc8b5..d57520a6 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -164,7 +164,7 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 512 +pm.max_requests = 20480 request_terminate_timeout = 0 request_slowlog_timeout = 0 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 8e117904..25a11e47 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -164,7 +164,7 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 512 +pm.max_requests = 20480 request_terminate_timeout = 0 request_slowlog_timeout = 0 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index d7b1a2a4..da4f9a4a 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -126,6 +126,7 @@ sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_ sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.optimization_level.*@opcache.optimization_level=0@' $php_install_dir/etc/php.ini if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then # php-fpm Init Script @@ -174,7 +175,7 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 512 +pm.max_requests = 20480 request_terminate_timeout = 0 request_slowlog_timeout = 0 diff --git a/functions/redis.sh b/functions/redis.sh index 2a693f75..802f4011 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.4.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.5.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.4.tar.gz -cd redis-2.8.4 +tar xzf redis-2.8.5.tar.gz +cd redis-2.8.5 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index d9ff8ae7..436596ae 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -27,6 +27,7 @@ opcache.revalidate_freq=60 opcache.save_comments=0 opcache.fast_shutdown=1 opcache.enable_cli=1 +opcache.optimization_level=0 EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else From f368073efd9163f6c3b6e3251cfcf09590d4bb0a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 12 Feb 2014 17:45:08 +0800 Subject: [PATCH 280/617] update source stable version --- functions/GraphicsMagick.sh | 12 ++++++------ functions/ImageMagick.sh | 6 +++--- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 11 +++++------ 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index 9ff743e8..81be13b3 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -8,17 +8,17 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.6RC2.tgz && Download_src +src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.6RC3.tgz && Download_src -tar xzf GraphicsMagick-1.3.18.tar.gz -cd GraphicsMagick-1.3.18 +tar xzf GraphicsMagick-1.3.19.tar.gz +cd GraphicsMagick-1.3.19 ./configure --enable-shared make && make install cd ../ -tar xzf gmagick-1.1.6RC2.tgz -cd gmagick-1.1.6RC2 +tar xzf gmagick-1.1.6RC3.tgz +cd gmagick-1.1.6RC3 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 714c8083..d929cdb4 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-2.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-5.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-2.tar.gz -cd ImageMagick-6.8.8-2 +tar xzf ImageMagick-6.8.8-5.tar.gz +cd ImageMagick-6.8.8-5 ./configure make && make install cd ../ diff --git a/functions/nginx.sh b/functions/nginx.sh index d7e16aa1..fa2c3b62 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.4.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.5.tar.gz && Download_src tar xzf pcre-8.34.tar.gz cd pcre-8.34 @@ -18,9 +18,9 @@ cd pcre-8.34 make && make install cd ../ -tar xzf nginx-1.4.4.tar.gz +tar xzf nginx-1.4.5.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.4 +cd nginx-1.4.5 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index b1492b7d..3014f227 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.7.30.3-beta.zip tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.4.4 + cd nginx-1.4.5 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 25a11e47..5d22760c 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.24.tar.gz" ] && echo "php-5.4.24.tar.gz found" || wget -c http://www.php.net/get/php-5.4.24.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.4.24.tar.gz && Download_src +[ -s "php-5.4.25.tar.gz" ] && echo "php-5.4.25.tar.gz found" || wget -c http://www.php.net/get/php-5.4.25.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.25.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.24.tar.gz +tar xzf php-5.4.25.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.24 -p0 < fpm-race-condition.patch -cd php-5.4.24 +patch -d php-5.4.25 -p0 < fpm-race-condition.patch +cd php-5.4.25 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index da4f9a4a..f4575257 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.8.tar.gz" ] && echo "php-5.5.8.tar.gz found" || wget -c http://www.php.net/get/php-5.5.8.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.5.8.tar.gz && Download_src +[ -s "php-5.5.9.tar.gz" ] && echo "php-5.5.9.tar.gz found" || wget -c http://www.php.net/get/php-5.5.9.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.9.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.8.tar.gz +tar xzf php-5.5.9.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.8 -p0 < fpm-race-condition.patch -cd php-5.5.8 +patch -d php-5.5.9 -p0 < fpm-race-condition.patch +cd php-5.5.9 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -126,7 +126,6 @@ sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_ sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini -sed -i 's@^;opcache.optimization_level.*@opcache.optimization_level=0@' $php_install_dir/etc/php.ini if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then # php-fpm Init Script From eac1a85640a14391d54751125cf93d16a7560867 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 16 Feb 2014 14:56:09 +0800 Subject: [PATCH 281/617] update redis 2.8.5 to 2.8.6 --- functions/redis.sh | 6 +++--- init/init_CentOS.sh | 22 +++++++++------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 802f4011..c950bd56 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.5.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.6.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.5.tar.gz -cd redis-2.8.5 +tar xzf redis-2.8.6.tar.gz +cd redis-2.8.6 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index cfea5265..fc203695 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,26 +14,22 @@ yum clean all public_IP=`../functions/get_public_ip.py` if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - #wget -c http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d - wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo + #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - #sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base-163.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base-163.repo - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS6-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS6-Base.repo + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi fi if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - #wget -c http://mirrors.163.com/.help/CentOS5-Base-163.repo -P /etc/yum.repos.d - wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo + #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - #sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base-163.repo - #sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base-163.repo - sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS5-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS5-Base.repo + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi fi From 343d9a2dfb1efe3682de4c308223bd9f5d2e773f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 20 Feb 2014 15:03:21 +0800 Subject: [PATCH 282/617] upgrade tengine bug --- functions/GraphicsMagick.sh | 6 +++--- functions/ImageMagick.sh | 6 +++--- functions/mariadb-5.5.sh | 6 +++--- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- functions/zendopcache.sh | 9 ++++----- upgrade_web.sh | 17 ++++++++++++++++- 11 files changed, 47 insertions(+), 33 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index 81be13b3..b8a03e46 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.6RC3.tgz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.7RC1.tgz && Download_src tar xzf GraphicsMagick-1.3.19.tar.gz cd GraphicsMagick-1.3.19 @@ -17,8 +17,8 @@ cd GraphicsMagick-1.3.19 make && make install cd ../ -tar xzf gmagick-1.1.6RC3.tgz -cd gmagick-1.1.6RC3 +tar xzf gmagick-1.1.7RC1.tgz +cd gmagick-1.1.7RC1 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index d929cdb4..d5db90ae 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-5.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-7.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-5.tar.gz -cd ImageMagick-6.8.8-5 +tar xzf ImageMagick-6.8.8-7.tar.gz +cd ImageMagick-6.8.8-7 ./configure make && make install cd ../ diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index b0a788e4..071c84f3 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,14 +9,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.35/kvm-tarbake-jaunty-x86/mariadb-5.5.35.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 88c3c8b7..1931041f 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index bab0e652..50e3d94e 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,14 +9,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 5b18a3c5..487e5c48 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index cde18edb..e4329a4c 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index b7bf7124..482ab207 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.1.tar.gz - cd cmake-2.8.12.1 + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index ce7b818c..85614ba7 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.6/phpMyAdmin-4.1.6-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.7/phpMyAdmin-4.1.7-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.6-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.6-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.7-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.7-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 436596ae..11b50069 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -5,13 +5,12 @@ Install_ZendOPcache() { cd $lnmp_dir/src -. ../functions/download.sh . ../options.conf -src_url=https://github.com/zendtech/ZendOptimizerPlus/tarball/master && Download_src -/bin/mv master zendtech-ZendOptimizerPlus.tar.gz -tar xzf zendtech-ZendOptimizerPlus.tar.gz -cd zendtech-ZendOptimizerPlus* +rm -rf ZendOptimizerPlus-master* +wget -c --no-check-certificate -O ZendOptimizerPlus-master.zip https://github.com/zendtech/ZendOptimizerPlus/archive/master.zip +unzip -q ZendOptimizerPlus-master.zip +cd ZendOptimizerPlus-master make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/upgrade_web.sh b/upgrade_web.sh index c14238af..ce952155 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -15,6 +15,7 @@ echo "#######################################################################" cd src . ../options.conf +. ../functions/download.sh [ ! -e "$web_install_dir/sbin/nginx" ] && echo -e "\033[31mThe Nginx/Tengine is not installed on your system!\033[0m " && exit 1 @@ -119,7 +120,21 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then /bin/mv $web_install_dir/modules $web_install_dir/modules$(date +%m%d) /bin/cp objs/nginx $web_install_dir/sbin/nginx /bin/cp objs/dso_tool $web_install_dir/sbin/dso_tool - /bin/cp -R objs/modules $web_install_dir/ + chmod +x $web_install_dir/sbin/* + make install + if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then + cd $lnmp_dir/src + rm -rf ngx_pagespeed* + src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.3.tar.gz && Download_src + [ -s "ngx_pagespeed-1.7.30.3-beta.zip" ] && echo "ngx_pagespeed-1.7.30.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + + unzip -q ngx_pagespeed-1.7.30.3-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.3-beta + tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta + cd tengine-$tengine_version + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.3-beta + fi + kill -USR2 `cat /var/run/nginx.pid` kill -QUIT `cat /var/run/nginx.pid.oldbin` echo -e "You have \033[32msuccessfully\033[0m upgrade from \033[32m$Old_tengine_version\033[0m to \033[32m$tengine_version\033[0m" From cb8d8f86308ce7494ebf29fde934948df403c366 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 25 Feb 2014 12:04:52 +0800 Subject: [PATCH 283/617] set opcache.optimization_level=0 --- conf/nginx_apache.conf | 2 +- functions/php-5.5.sh | 1 + vhost.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index 5f4f9741..9d1585de 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -67,7 +67,7 @@ http { } location / { - try_files $uri @apache; + error_page 404 = @apache; } location @apache { diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index f4575257..8aabf62c 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -126,6 +126,7 @@ sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_ sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.optimization_level.*@opcache.optimization_level=0@' $php_install_dir/etc/php.ini if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then # php-fpm Init Script diff --git a/vhost.sh b/vhost.sh index 24535f84..a0a4700c 100755 --- a/vhost.sh +++ b/vhost.sh @@ -326,7 +326,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ $anti_hotlinking `echo -e $ngx_pagespeed` location / { - try_files \$uri @apache; + error_page 404 = @apache; } location @apache { From 50df7a9b7f59f798fe9aa1cd615bce6611c530d6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 25 Feb 2014 12:56:00 +0800 Subject: [PATCH 284/617] enable rewrite.so --- functions/apache-2.2.sh | 1 + functions/apache-2.4.sh | 1 + functions/test.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index e5a23edc..1affcc0e 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -45,6 +45,7 @@ elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then TMP_IP=127.0.0.1 fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf +sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf sed -i "s@^DocumentRoot.*@DocumentRoot \"$home_dir/default\"@" $apache_install_dir/conf/httpd.conf diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 5e9babec..d96775d2 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -58,6 +58,7 @@ elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' ];then TMP_IP=127.0.0.1 fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf +sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf sed -i "s@^DocumentRoot.*@DocumentRoot \"$home_dir/default\"@" $apache_install_dir/conf/httpd.conf diff --git a/functions/test.sh b/functions/test.sh index f528e1bb..bfbef97e 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -20,5 +20,6 @@ unzip -q tz.zip -d $home_dir/default [ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LAMP@g' $home_dir/default/index.html chown -R www.www $home_dir/default [ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start +[ -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart cd .. } From 5888a1ddf641196e405722aad7e8cc6a05241df2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 26 Feb 2014 16:41:25 +0800 Subject: [PATCH 285/617] update mariadb 5.5.35 to 5.5.36 --- functions/apache-2.2.sh | 4 ++++ functions/apache-2.4.sh | 4 ++++ functions/mariadb-5.5.sh | 6 +++--- functions/nginx.sh | 4 ++++ functions/php-5.3.sh | 3 +++ functions/php-5.4.sh | 3 +++ functions/php-5.5.sh | 3 +++ functions/tengine.sh | 4 ++++ 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index 1affcc0e..ff193341 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -22,6 +22,10 @@ else echo -e "\033[31mApache install failed, Please contact the author! \033[0m" kill -9 $$ fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$apache_install_dir/bin@" /etc/profile +. /etc/profile + cd .. /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index d96775d2..38d1a055 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -35,6 +35,10 @@ else echo -e "\033[31mApache install failed, Please contact the author! \033[0m" kill -9 $$ fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$apache_install_dir/bin@" /etc/profile +. /etc/profile + cd .. /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 071c84f3..f238206f 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.35/kvm-tarbake-jaunty-x86/mariadb-5.5.35.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.36/kvm-tarbake-jaunty-x86/mariadb-5.5.36.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-5.5.35.tar.gz -cd mariadb-5.5.35 +tar zxf mariadb-5.5.36.tar.gz +cd mariadb-5.5.36 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/nginx.sh b/functions/nginx.sh index fa2c3b62..d66b0339 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -46,6 +46,10 @@ else echo -e "\033[31mNginx install failed, Please Contact the author! \033[0m" kill -9 $$ fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $nginx_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$nginx_install_dir/bin@" /etc/profile +. /etc/profile + cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index d57520a6..4ed3aba1 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -97,6 +97,9 @@ else kill -9 $$ fi +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +. /etc/profile + # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 5d22760c..07879bd9 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -97,6 +97,9 @@ else kill -9 $$ fi +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +. /etc/profile + # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 8aabf62c..fb1a29f5 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -97,6 +97,9 @@ else kill -9 $$ fi +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +. /etc/profile + # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar diff --git a/functions/tengine.sh b/functions/tengine.sh index 1551adc4..1b85fee7 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -44,6 +44,10 @@ else echo -e "\033[31mTengine install failed, Please Contact the author! \033[0m" kill -9 $$ fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $tengine_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$tengine_install_dir/bin@" /etc/profile +. /etc/profile + cd ../../ OS_CentOS='/bin/cp init/Nginx-init-CentOS /etc/init.d/nginx \n chkconfig --add nginx \n From 6a702aed0f91876ed8b915e5ad7536e62673950a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 27 Feb 2014 19:13:03 +0800 Subject: [PATCH 286/617] vhost bug --- conf/nginx_apache.conf | 2 +- vhost.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index 9d1585de..5f4f9741 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -67,7 +67,7 @@ http { } location / { - error_page 404 = @apache; + try_files $uri @apache; } location @apache { diff --git a/vhost.sh b/vhost.sh index a0a4700c..24535f84 100755 --- a/vhost.sh +++ b/vhost.sh @@ -326,7 +326,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ $anti_hotlinking `echo -e $ngx_pagespeed` location / { - error_page 404 = @apache; + try_files \$uri @apache; } location @apache { From cc7519506d7fc4893dc50dda6be20a3c698d4471 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 2 Mar 2014 21:00:45 +0800 Subject: [PATCH 287/617] add apcu --- README.md | 2 +- functions/apcu.sh | 32 +++++ functions/jemalloc.sh | 6 +- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 9 +- functions/phpmyadmin.sh | 6 +- functions/test.sh | 5 +- functions/xcache.sh | 2 +- install.sh | 254 +++++++++++++++++++++++----------------- 10 files changed, 195 insertions(+), 125 deletions(-) create mode 100755 functions/apcu.sh diff --git a/README.md b/README.md index c4fc8094..d0ede695 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache, eAccelerator, xcache and ZendGuardLoader (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc diff --git a/functions/apcu.sh b/functions/apcu.sh new file mode 100755 index 00000000..31e10295 --- /dev/null +++ b/functions/apcu.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_APCU() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +src_url=http://pecl.php.net/get/apcu-4.0.4.tgz && Download_src +tar xzf apcu-4.0.4.tgz +cd apcu-4.0.4 +make clean +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make && make install +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/apcu.so" ];then + cat >> $php_install_dir/etc/php.ini << EOF +extension = apcu.so +apc.enabled=1 +apc.shm_size=32M +apc.ttl=7200 +apc.enable_cli=1 +EOF + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + /bin/cp apc.php $home_dir/default +else + echo -e "\033[31meAPCU module install failed, Please contact the author! \033[0m" +fi +cd ../../ +} diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh index ebfc626a..c4016027 100755 --- a/functions/jemalloc.sh +++ b/functions/jemalloc.sh @@ -7,10 +7,10 @@ Install_jemalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.5.0.tar.bz2 && Download_src +src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.5.1.tar.bz2 && Download_src -tar xjf jemalloc-3.5.0.tar.bz2 -cd jemalloc-3.5.0 +tar xjf jemalloc-3.5.1.tar.bz2 +cd jemalloc-3.5.1 ./configure make && make install if [ -f "/usr/local/lib/libjemalloc.so" ];then diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 4ed3aba1..7b5aef85 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -169,7 +169,7 @@ pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 -request_terminate_timeout = 0 +request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 07879bd9..6a938098 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -169,7 +169,7 @@ pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 -request_terminate_timeout = 0 +request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index fb1a29f5..0729a0ef 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -66,9 +66,10 @@ wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id= patch -d php-5.5.9 -p0 < fpm-race-condition.patch cd php-5.5.9 make clean +[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs --enable-opcache --disable-fileinfo --with-mysql=$db_install_dir \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ @@ -78,7 +79,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --enable-opcache --disable-fileinfo --with-mysql=$db_install_dir \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp --disable-fileinfo --with-mysql=$db_install_dir \ --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ @@ -120,6 +121,7 @@ sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,c sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini +if [ "$PHP_cache" == '1' ];then sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' $php_install_dir/etc/php.ini @@ -130,6 +132,7 @@ sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/e sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.optimization_level.*@opcache.optimization_level=0@' $php_install_dir/etc/php.ini +fi if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then # php-fpm Init Script @@ -180,7 +183,7 @@ pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 -request_terminate_timeout = 0 +request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 85614ba7..999d2404 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.7/phpMyAdmin-4.1.7-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.8/phpMyAdmin-4.1.8-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.7-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.7-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.8-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.8-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/test.sh b/functions/test.sh index bfbef97e..7377fd8d 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -14,8 +14,9 @@ src_url=https://gist.github.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default unzip -q tz.zip -d $home_dir/default -[ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html -[ "$PHP_cache" == '2' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html +[ "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html +[ "$PHP_cache" == '3' ] && sed -i 's@xcache@APC@' $home_dir/default/index.html +[ "$PHP_cache" == '4' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html [ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LANMP@g' $home_dir/default/index.html [ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LAMP@g' $home_dir/default/index.html chown -R www.www $home_dir/default diff --git a/functions/xcache.sh b/functions/xcache.sh index 0fb5c80a..33f165c4 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -57,7 +57,7 @@ xcache.coveragedump_directory = "" EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" + echo -e "\033[31meXcache module install failed, Please contact the author! \033[0m" fi cd ../../ } diff --git a/install.sh b/install.sh index 32bbf190..61dcdb6f 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.6 22-Nov-2013 lj2007331 AT gmail.com +# Version: 0.6 2-Mar-2014 lj2007331 AT gmail.com # Notes: LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: @@ -147,119 +147,149 @@ done # check PHP while : do - echo - read -p "Do you want to install PHP? [y/n]: " PHP_yn - if [ "$PHP_yn" != 'y' -a "$PHP_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - if [ "$PHP_yn" == 'y' ];then - [ -d "$php_install_dir" ] && echo -e "\033[31mThe php already installed! \033[0m" && PHP_yn=n && break - while : - do - echo - echo 'Please select a version of the PHP:' - echo -e "\t\033[32m1\033[0m. Install php-5.5" - echo -e "\t\033[32m2\033[0m. Install php-5.4" - echo -e "\t\033[32m3\033[0m. Install php-5.3" - read -p "Please input a number:(Default 1 press Enter) " PHP_version - [ -z "$PHP_version" ] && PHP_version=1 - if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" - else - if [ $PHP_version == 2 ];then - while : - do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t\033[32m1\033[0m. Install Zend OPcache" - echo -e "\t\033[32m2\033[0m. Install eAccelerator-1.0-dev" - echo -e "\t\033[32m3\033[0m. Install XCache" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" - else - break - fi - done - fi - if [ $PHP_version == 3 ];then - while : - do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t\033[32m1\033[0m. Install Zend OPcache" - echo -e "\t\033[32m2\033[0m. Install eAccelerator-0.9" - echo -e "\t\033[32m3\033[0m. Install XCache" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2\033[0m" - else - break - fi - done - fi - if [ "$PHP_cache" == '3' ];then - while : - do - read -p "Please input xcache admin password: " xcache_admin_pass - (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" - done - fi - if [ "$PHP_version" == '2' -o "$PHP_version" == '3' ];then - while : - do - echo - read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn - if [ "$ZendGuardLoader_yn" != 'y' -a "$ZendGuardLoader_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done +echo +read -p "Do you want to install PHP? [y/n]: " PHP_yn +if [ "$PHP_yn" != 'y' -a "$PHP_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" +else + if [ "$PHP_yn" == 'y' ];then + [ -d "$php_install_dir" ] && echo -e "\033[31mThe php already installed! \033[0m" && PHP_yn=n && break + while : + do + echo + echo 'Please select a version of the PHP:' + echo -e "\t\033[32m1\033[0m. Install php-5.5" + echo -e "\t\033[32m2\033[0m. Install php-5.4" + echo -e "\t\033[32m3\033[0m. Install php-5.3" + read -p "Please input a number:(Default 1 press Enter) " PHP_version + [ -z "$PHP_version" ] && PHP_version=1 + if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" + else + while : + do + echo + read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn + if [ "$PHP_cache_yn" != 'y' -a "$PHP_cache_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + if [ "$PHP_cache_yn" == 'y' ];then + if [ $PHP_version == 1 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install XCache" + echo -e "\t\033[32m3\033[0m. Install APCU" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" + else + break + fi + done + fi + if [ $PHP_version == 2 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install XCache" + echo -e "\t\033[32m3\033[0m. Install APCU" + echo -e "\t\033[32m4\033[0m. Install eAccelerator-1.0-dev" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 -a $PHP_cache != 4 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4\033[0m" + else + break + fi + done + fi + if [ $PHP_version == 3 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install XCache" + echo -e "\t\033[32m3\033[0m. Install APCU" + echo -e "\t\033[32m4\033[0m. Install eAccelerator-0.9" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 -a $PHP_cache != 2 -a $PHP_cache != 3 -a $PHP_cache != 4 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4\033[0m" + else + break + fi + done + fi + fi + break fi - + done + if [ "$PHP_cache" == '2' ];then + while : + do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" + done + fi + if [ "$PHP_version" == '2' -o "$PHP_version" == '3' ];then while : do echo - read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn - if [ "$Magick_yn" != 'y' -a "$Magick_yn" != 'n' ];then + read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn + if [ "$ZendGuardLoader_yn" != 'y' -a "$ZendGuardLoader_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else break fi done - if [ "$Magick_yn" == 'y' ];then - while : - do - echo 'Please select ImageMagick or GraphicsMagick:' - echo -e "\t\033[32m1\033[0m. Install ImageMagick" - echo -e "\t\033[32m2\033[0m. Install GraphicsMagick" - read -p "Please input a number:(Default 1 press Enter) " Magick - [ -z "$Magick" ] && Magick=1 - if [ $Magick != 1 -a $Magick != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2 \033[0m" - else - break - fi - done - fi + fi + while : + do + echo + read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn + if [ "$Magick_yn" != 'y' -a "$Magick_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + if [ "$Magick_yn" == 'y' ];then while : do - echo - read -p "Do you want to install pecl_http PHP extension(Support HTTP request curls)? [y/n]: " pecl_http_yn - if [ "$pecl_http_yn" != 'y' -a "$pecl_http_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + echo 'Please select ImageMagick or GraphicsMagick:' + echo -e "\t\033[32m1\033[0m. Install ImageMagick" + echo -e "\t\033[32m2\033[0m. Install GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [ $Magick != 1 -a $Magick != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2 \033[0m" else break fi done - break fi - done - fi - break + + while : + do + echo + read -p "Do you want to install pecl_http PHP extension(Support HTTP request curls)? [y/n]: " pecl_http_yn + if [ "$pecl_http_yn" != 'y' -a "$pecl_http_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + break + fi + done fi + break +fi done if [ "$Web_yn" == 'y' -a "$DB_yn" == 'y' -a "$PHP_yn" == 'y' ];then @@ -475,19 +505,22 @@ if [ "$pecl_http_yn" == 'y' ];then Install_pecl_http 2>&1 | tee -a $lnmp_dir/install.log fi -# PHP opcode cache (php <= 5.4) -if [ "$PHP_cache" == '1' ];then +# PHP opcode cache +if [ "$PHP_cache" == '1' -a "$PHP_version" != '1' ];then . functions/zendopcache.sh Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$PHP_cache" == '2' -a "$PHP_version" == '2' ];then +elif [ "$PHP_cache" == '2' ];then + . functions/xcache.sh + Install_XCache 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_cache" == '3' ];then + . functions/apcu.sh + Install_APCU 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_cache" == '4' -a "$PHP_version" == '2' ];then . functions/eaccelerator-1.0-dev.sh Install_eAccelerator-1-0-dev 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$PHP_cache" == '2' -a "$PHP_version" == '3' ];then +elif [ "$PHP_cache" == '4' -a "$PHP_version" == '3' ];then . functions/eaccelerator-0.9.sh Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$PHP_cache" == '3' ];then - . functions/xcache.sh - Install_XCache 2>&1 | tee -a $lnmp_dir/install.log fi # ZendGuardLoader (php <= 5.4) @@ -553,13 +586,14 @@ echo "####################Congratulations########################" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database user:"`\033[32mroot\033[0m" [ "$DB_yn" == 'y' ] && echo -e "`printf "%-32s" "Database password:"`\033[32m${dbrootpwd}\033[0m" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`\033[32m$php_install_dir\033[0m" -[ "$PHP_version" == '1' -o "$PHP_cache" == '1' ] && echo -e "`printf "%-32s" "Opcache Control Panel url:"`\033[32mhttp://$local_IP/ocp.php\033[0m" -[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator Control Panel url:"`\033[32mhttp://$local_IP/control.php\033[0m" -[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator user:"`\033[32madmin\033[0m" -[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "eAccelerator password:"`\033[32meAccelerator\033[0m" -[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache Control Panel url:"`\033[32mhttp://$local_IP/xcache\033[0m" -[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" -[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" +[ "$PHP_cache" == '1' ] && echo -e "`printf "%-32s" "Opcache Control Panel url:"`\033[32mhttp://$local_IP/ocp.php\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "xcache Control Panel url:"`\033[32mhttp://$local_IP/xcache\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "xcache user:"`\033[32madmin\033[0m" +[ "$PHP_cache" == '2' ] && echo -e "`printf "%-32s" "xcache password:"`\033[32m$xcache_admin_pass\033[0m" +[ "$PHP_cache" == '3' ] && echo -e "`printf "%-32s" "APC Control Panel url:"`\033[32mhttp://$local_IP/apc.php\033[0m" +[ "$PHP_cache" == '4' ] && echo -e "`printf "%-32s" "eAccelerator Control Panel url:"`\033[32mhttp://$local_IP/control.php\033[0m" +[ "$PHP_cache" == '4' ] && echo -e "`printf "%-32s" "eAccelerator user:"`\033[32madmin\033[0m" +[ "$PHP_cache" == '4' ] && echo -e "`printf "%-32s" "eAccelerator password:"`\033[32meAccelerator\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`\033[32m$pureftpd_install_dir\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Pure-FTPd php manager dir:"`\033[32m$home_dir/default/ftp\033[0m" [ "$FTP_yn" == 'y' ] && echo -e "`printf "%-32s" "Ftp User Control Panel url:"`\033[32mhttp://$local_IP/ftp\033[0m" From bae4c21548b31d5d4f17b593623aefdcdff140f1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 6 Mar 2014 13:02:35 +0800 Subject: [PATCH 288/617] update nginx 1.4.5 to 1.4.6 --- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index d66b0339..551ad3c4 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.5.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.6.tar.gz && Download_src tar xzf pcre-8.34.tar.gz cd pcre-8.34 @@ -18,9 +18,9 @@ cd pcre-8.34 make && make install cd ../ -tar xzf nginx-1.4.5.tar.gz +tar xzf nginx-1.4.6.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.5 +cd nginx-1.4.6 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 3014f227..83d31427 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.7.30.3-beta.zip tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.4.5 + cd nginx-1.4.6 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` From 5fd73cb90a93ec60a5707dc409d88ce8193ce271 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 8 Mar 2014 20:02:23 +0800 Subject: [PATCH 289/617] update php version --- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 6a938098..799ce7d8 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.25.tar.gz" ] && echo "php-5.4.25.tar.gz found" || wget -c http://www.php.net/get/php-5.4.25.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.4.25.tar.gz && Download_src +[ -s "php-5.4.26.tar.gz" ] && echo "php-5.4.26.tar.gz found" || wget -c http://www.php.net/get/php-5.4.26.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.26.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.25.tar.gz +tar xzf php-5.4.26.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.25 -p0 < fpm-race-condition.patch -cd php-5.4.25 +patch -d php-5.4.26 -p0 < fpm-race-condition.patch +cd php-5.4.26 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 0729a0ef..30edc1c1 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.9.tar.gz" ] && echo "php-5.5.9.tar.gz found" || wget -c http://www.php.net/get/php-5.5.9.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.5.9.tar.gz && Download_src +[ -s "php-5.5.10.tar.gz" ] && echo "php-5.5.10.tar.gz found" || wget -c http://www.php.net/get/php-5.5.10.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.10.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.9.tar.gz +tar xzf php-5.5.10.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.9 -p0 < fpm-race-condition.patch -cd php-5.5.9 +patch -d php-5.5.10 -p0 < fpm-race-condition.patch +cd php-5.5.10 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then From 6b644a99ebf42609cf633f4e8f8607cc0eb2ad00 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 8 Mar 2014 20:04:06 +0800 Subject: [PATCH 290/617] update phpmyadmin version --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 999d2404..21331170 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.8/phpMyAdmin-4.1.8-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.9/phpMyAdmin-4.1.9-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.8-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.8-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.9-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.9-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 5dd2001cffdbb53830699e43d628e991349939a8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 10 Mar 2014 09:40:21 +0800 Subject: [PATCH 291/617] update redis 2.8.6 to 2.8.7 --- functions/redis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index c950bd56..ee6f22e2 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.6.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.7.tar.gz && Download_src tar xzf redis-2.2.4.tgz cd redis-2.2.4 @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.6.tar.gz -cd redis-2.8.6 +tar xzf redis-2.8.7.tar.gz +cd redis-2.8.7 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings From 9e9dd3ebd839f6bfc4edc933f5c6666c68031fd7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 11 Mar 2014 09:45:08 +0800 Subject: [PATCH 292/617] update percona version --- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 487e5c48..c1589d56 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.36-34.0/source/tarball/percona-server-5.5.36-34.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf Percona-Server-5.5.35-rel33.0.tar.gz -cd Percona-Server-5.5.35-rel33.0 +tar zxf percona-server-5.5.36-34.0.tar.gz +cd percona-server-5.5.36-34.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index e4329a4c..d3338bd7 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.16-rel64.0/source/tarball/percona-server-5.6.16-64.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf Percona-Server-5.6.15-rel63.0.tar.gz -cd Percona-Server-5.6.15-rel63.0 +tar zxf percona-Server-5.6.16-rel64.0.tar.gz +cd percona-Server-5.6.16-rel64.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From aba0f1cfb5eb6a6f9e8daa41e50a043f83107f82 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 11 Mar 2014 16:43:59 +0800 Subject: [PATCH 293/617] update percona version --- functions/percona-5.6.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index d3338bd7..11c861ee 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf percona-Server-5.6.16-rel64.0.tar.gz -cd percona-Server-5.6.16-rel64.0 +tar zxf percona-server-5.6.16-64.0.tar.gz +cd percona-server-5.6.16-64.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From c0bc7f1fb701bb77952da2e1301197c5e90edaff Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 12 Mar 2014 10:27:57 +0800 Subject: [PATCH 294/617] update percona version --- functions/percona-5.5.sh | 6 +++--- functions/percona-5.6.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index c1589d56..d8ca3898 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.36-34.0/source/tarball/percona-server-5.5.36-34.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf percona-server-5.5.36-34.0.tar.gz -cd percona-server-5.5.36-34.0 +tar zxf Percona-Server-5.5.35-rel33.0.tar.gz +cd Percona-Server-5.5.35-rel33.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 11c861ee..2dad86ad 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.16-rel64.0/source/tarball/percona-server-5.6.16-64.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf percona-server-5.6.16-64.0.tar.gz -cd percona-server-5.6.16-64.0 +tar zxf Percona-Server-5.6.15-rel63.0.tar.gz +cd Percona-Server-5.6.15-rel63.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From 75490c853cd8c35be81f8cb3de28927e0aff7bab Mon Sep 17 00:00:00 2001 From: root Date: Sun, 16 Mar 2014 22:53:06 +0800 Subject: [PATCH 295/617] update ngx_pagespeed --- functions/ngx_pagespeed.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 83d31427..4b3771c3 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.3.tar.gz && Download_src -[ -s "ngx_pagespeed-1.7.30.3-beta.zip" ] && echo "ngx_pagespeed-1.7.30.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz && Download_src +[ -s "ngx_pagespeed-1.7.30.4-beta.zip" ] && echo "ngx_pagespeed-1.7.30.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.7.30.3-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.3-beta -tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta +unzip -q ngx_pagespeed-1.7.30.4-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.4-beta +tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.4.6 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.3-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.4-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache From 01855cf84c0dd81fc36937e653e0b59ee079fd42 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 19 Mar 2014 16:17:36 +0800 Subject: [PATCH 296/617] update apache 2.4.7 to 2.4.9 --- functions/GraphicsMagick.sh | 6 +++--- functions/apache-2.4.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index b8a03e46..04650b29 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.7RC1.tgz && Download_src +src_url=http://pecl.php.net/get/gmagick-1.1.7RC2.tgz && Download_src tar xzf GraphicsMagick-1.3.19.tar.gz cd GraphicsMagick-1.3.19 @@ -17,8 +17,8 @@ cd GraphicsMagick-1.3.19 make && make install cd ../ -tar xzf gmagick-1.1.7RC1.tgz -cd gmagick-1.1.7RC1 +tar xzf gmagick-1.1.7RC2.tgz +cd gmagick-1.1.7RC2 make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 38d1a055..225541dd 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src -src_url=http://www.apache.org/dist/httpd/httpd-2.4.7.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.4.9.tar.gz && Download_src tar xzf pcre-8.34.tar.gz cd pcre-8.34 @@ -21,10 +21,10 @@ make && make install cd ../ useradd -M -s /sbin/nologin www -tar xzf httpd-2.4.7.tar.gz +tar xzf httpd-2.4.9.tar.gz tar xzf apr-1.4.8.tar.gz tar xzf apr-util-1.5.2.tar.gz -cd httpd-2.4.7 +cd httpd-2.4.9 /bin/cp -R ../apr-1.4.8 ./srclib/apr /bin/cp -R ../apr-util-1.5.2 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir From ebb6ac1a5b3e07b4aca72c4f6d3cb80b65ec4e71 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 19 Mar 2014 17:37:14 +0800 Subject: [PATCH 297/617] update nginx 1.4.6 to 1.4.7 --- functions/nginx.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index 551ad3c4..04e83fa5 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.6.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.4.7.tar.gz && Download_src tar xzf pcre-8.34.tar.gz cd pcre-8.34 @@ -18,9 +18,9 @@ cd pcre-8.34 make && make install cd ../ -tar xzf nginx-1.4.6.tar.gz +tar xzf nginx-1.4.7.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.6 +cd nginx-1.4.7 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h From c21ffd2f17ee4940552b5cb2ea97196963b6ad97 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 27 Mar 2014 15:37:30 +0800 Subject: [PATCH 298/617] update redis 2.8.7 to 2.8.8 --- functions/ImageMagick.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- functions/redis.sh | 28 ++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index d5db90ae..60af0413 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-7.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-9.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-7.tar.gz -cd ImageMagick-6.8.8-7 +tar xzf ImageMagick-6.8.8-9.tar.gz +cd ImageMagick-6.8.8-9 ./configure make && make install cd ../ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 21331170..890fc9cc 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.9/phpMyAdmin-4.1.9-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.11/phpMyAdmin-4.1.11-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.9-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.9-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.11-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.11-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/redis.sh b/functions/redis.sh index ee6f22e2..891b9590 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://pecl.php.net/get/redis-2.2.4.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.7.tar.gz && Download_src +src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.8.tar.gz && Download_src -tar xzf redis-2.2.4.tgz -cd redis-2.2.4 +tar xzf redis-2.2.5.tgz +cd redis-2.2.5 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.7.tar.gz -cd redis-2.8.7 +tar xzf redis-2.8.8.tar.gz +cd redis-2.8.8 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -45,6 +45,22 @@ if [ -f "src/redis-server" ];then sed -i "s@logfile.*@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf sed -i "s@^dir.*@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf + + Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` + if [ $Memtatol -le 512 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 64000000@' $redis_install_dir/etc/redis.conf + elif [ $Memtatol -gt 512 -a $Memtatol -le 1024 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 128000000@' $redis_install_dir/etc/redis.conf + elif [ $Memtatol -gt 1024 -a $Memtatol -le 1500 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 256000000@' $redis_install_dir/etc/redis.conf + elif [ $Memtatol -gt 1500 -a $Memtatol -le 2500 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 360000000@' $redis_install_dir/etc/redis.conf + elif [ $Memtatol -gt 2500 -a $Memtatol -le 3500 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 512000000@' $redis_install_dir/etc/redis.conf + elif [ $Memtatol -gt 3500 ];then + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 1024000000@' $redis_install_dir/etc/redis.conf + fi + cd ../../ OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n From 6518deed91842714d83ebb52749ec266ebfdfcd4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 27 Mar 2014 22:49:42 +0800 Subject: [PATCH 299/617] update mysql version --- functions/mysql-5.5.sh | 6 +++--- functions/mysql-5.6.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 1931041f..492e20f8 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.5.36.tar.gz -cd mysql-5.5.36 +tar zxf mysql-5.5.37.tar.gz +cd mysql-5.5.37 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 50e3d94e..e85a65c3 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.6.16.tar.gz -cd mysql-5.6.16 +tar zxf mysql-5.6.17.tar.gz +cd mysql-5.6.17 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From 0e42c32bb0b2121d3ee767e43a9d70dd82b2b239 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 3 Apr 2014 10:30:34 +0800 Subject: [PATCH 300/617] update php_memcached 2.1.0 to 2.2.0 --- functions/memcached.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 1d9a42ba..53752ef2 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -11,7 +11,7 @@ cd $lnmp_dir/src src_url=http://blog.linuxeye.com/lnmp/src/memcached-1.4.17.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src -src_url=http://pecl.php.net/get/memcached-2.1.0.tgz && Download_src +src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server @@ -59,8 +59,8 @@ cd libmemcached-1.0.16 make && make install cd .. -tar xzf memcached-2.1.0.tgz -cd memcached-2.1.0 +tar xzf memcached-2.2.0.tgz +cd memcached-2.2.0 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 4b3771c3..609d7821 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.7.30.4-beta.zip tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.4.6 + cd nginx-1.4.7 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` From 9148c900fe9460b647397c6c8eba5808cda68eae Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 3 Apr 2014 14:38:47 +0800 Subject: [PATCH 301/617] update jemalloc 3.5.1 to 3.6.0 --- functions/ImageMagick.sh | 6 +++--- functions/jemalloc.sh | 6 +++--- functions/memcached.sh | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 60af0413..e85a9ced 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-9.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-10.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-9.tar.gz -cd ImageMagick-6.8.8-9 +tar xzf ImageMagick-6.8.8-10.tar.gz +cd ImageMagick-6.8.8-10 ./configure make && make install cd ../ diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh index c4016027..54a804ce 100755 --- a/functions/jemalloc.sh +++ b/functions/jemalloc.sh @@ -7,10 +7,10 @@ Install_jemalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.5.1.tar.bz2 && Download_src +src_url=http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2 && Download_src -tar xjf jemalloc-3.5.1.tar.bz2 -cd jemalloc-3.5.1 +tar xjf jemalloc-3.6.0.tar.bz2 +cd jemalloc-3.6.0 ./configure make && make install if [ -f "/usr/local/lib/libjemalloc.so" ];then diff --git a/functions/memcached.sh b/functions/memcached.sh index 53752ef2..ce609749 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,8 +9,8 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/memcached-1.4.17.tar.gz && Download_src -src_url=https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.17.tar.gz && Download_src +src_url=https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src @@ -53,8 +53,8 @@ else fi # php memcached extension -tar xzf libmemcached-1.0.16.tar.gz -cd libmemcached-1.0.16 +tar xzf libmemcached-1.0.18.tar.gz +cd libmemcached-1.0.18 ./configure --with-memcached=$memcached_install_dir make && make install cd .. From d2f68e265206d924f966c8dfa359eb71e1396bac Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 3 Apr 2014 15:14:28 +0800 Subject: [PATCH 302/617] update php mysql client --- functions/php-mysql-client.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 482ab207..22d78b2f 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-2.8.12.2.tar.gz @@ -19,8 +19,8 @@ if [ ! -e "`which cmake`" ];then cd .. fi -tar zxf mysql-5.5.36.tar.gz -cd mysql-5.5.36 +tar zxf mysql-5.5.37.tar.gz +cd mysql-5.5.37 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} From f97e1251d138b63373134ddf469377262b156e77 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 3 Apr 2014 15:21:30 +0800 Subject: [PATCH 303/617] update apache 2.2.26 to 2.2.27 --- functions/apache-2.2.sh | 6 +++--- functions/apache-2.4.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index ff193341..d077fa8e 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.apache.org/dist/httpd/httpd-2.2.26.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.2.27.tar.gz && Download_src useradd -M -s /sbin/nologin www -tar xzf httpd-2.2.26.tar.gz -cd httpd-2.2.26 +tar xzf httpd-2.2.27.tar.gz +cd httpd-2.2.27 ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install if [ -d "$apache_install_dir" ];then diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 225541dd..53b6883f 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -10,8 +10,8 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-1.4.8.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.9.tar.gz && Download_src tar xzf pcre-8.34.tar.gz @@ -22,11 +22,11 @@ cd ../ useradd -M -s /sbin/nologin www tar xzf httpd-2.4.9.tar.gz -tar xzf apr-1.4.8.tar.gz -tar xzf apr-util-1.5.2.tar.gz +tar xzf apr-1.5.0.tar.gz +tar xzf apr-util-1.5.3.tar.gz cd httpd-2.4.9 -/bin/cp -R ../apr-1.4.8 ./srclib/apr -/bin/cp -R ../apr-util-1.5.2 ./srclib/apr-util +/bin/cp -R ../apr-1.5.0 ./srclib/apr +/bin/cp -R ../apr-util-1.5.3 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install if [ -d "$apache_install_dir" ];then From 201257a7ca6b6e645c1376b03fd7e5d57b80628e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 3 Apr 2014 22:54:56 +0800 Subject: [PATCH 304/617] update php 5.5.10 to 5.5.11 --- functions/php-5.5.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 30edc1c1..b5eda8c4 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.10.tar.gz" ] && echo "php-5.5.10.tar.gz found" || wget -c http://www.php.net/get/php-5.5.10.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.5.10.tar.gz && Download_src +[ -s "php-5.5.11.tar.gz" ] && echo "php-5.5.11.tar.gz found" || wget -c http://www.php.net/get/php-5.5.11.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.5.11.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.10.tar.gz +tar xzf php-5.5.11.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.10 -p0 < fpm-race-condition.patch -cd php-5.5.10 +patch -d php-5.5.11 -p0 < fpm-race-condition.patch +cd php-5.5.11 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then From 894760dcb70dcc237c784792e28974404b894d31 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 6 Apr 2014 09:09:04 +0800 Subject: [PATCH 305/617] update php 5.4.26 to 5.4.27 --- functions/php-5.4.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 799ce7d8..9c94baba 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,8 +13,8 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.26.tar.gz" ] && echo "php-5.4.26.tar.gz found" || wget -c http://www.php.net/get/php-5.4.26.tar.gz/from/this/mirror -src_url=http://www.php.net/distributions/php-5.4.26.tar.gz && Download_src +[ -s "php-5.4.27.tar.gz" ] && echo "php-5.4.27.tar.gz found" || wget -c http://www.php.net/get/php-5.4.27.tar.gz/from/this/mirror +src_url=http://www.php.net/distributions/php-5.4.27.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -60,11 +60,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.26.tar.gz +tar xzf php-5.4.27.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.26 -p0 < fpm-race-condition.patch -cd php-5.4.26 +patch -d php-5.4.27 -p0 < fpm-race-condition.patch +cd php-5.4.27 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ From ebf55d3bdb207691a47f8f73410e4c9f9b42d599 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 7 Apr 2014 14:02:48 +0800 Subject: [PATCH 306/617] add MariDB-10.0 --- README.md | 2 +- functions/apache-2.2.sh | 4 +- functions/apache-2.4.sh | 4 +- functions/mariadb-10.0.sh | 204 ++++++++++++++++++++++++++++++++++++++ functions/phpmyadmin.sh | 6 +- install.sh | 47 +++++---- 6 files changed, 239 insertions(+), 28 deletions(-) create mode 100755 functions/mariadb-10.0.sh diff --git a/README.md b/README.md index d0ede695..839497d6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - Constant updates - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues -- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-5.5, Percona-5.5, Percona-5.6) +- You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index d077fa8e..f20eb294 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -36,8 +36,8 @@ chkconfig httpd on' OS_Debian_Ubuntu='update-rc.d httpd defaults' OS_command -sed -i 's/^User daemon/User www/' $apache_install_dir/conf/httpd.conf -sed -i 's/^Group daemon/Group www/' $apache_install_dir/conf/httpd.conf +sed -i 's@^User daemon@User www@' $apache_install_dir/conf/httpd.conf +sed -i 's@^Group daemon@Group www@' $apache_install_dir/conf/httpd.conf if [ "$Nginx_version" == '3' ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 53b6883f..89c28830 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -49,8 +49,8 @@ chkconfig httpd on' OS_Debian_Ubuntu='update-rc.d httpd defaults' OS_command -sed -i 's/^User daemon/User www/' $apache_install_dir/conf/httpd.conf -sed -i 's/^Group daemon/Group www/' $apache_install_dir/conf/httpd.conf +sed -i 's@^User daemon@User www@' $apache_install_dir/conf/httpd.conf +sed -i 's@^Group daemon@Group www@' $apache_install_dir/conf/httpd.conf if [ "$Nginx_version" == '3' ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh new file mode 100755 index 00000000..e58a7c71 --- /dev/null +++ b/functions/mariadb-10.0.sh @@ -0,0 +1,204 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_MariaDB-10-0() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-10.0.10/kvm-tarbake-jaunty-x86/mariadb-10.0.10.tar.gz && Download_src + +useradd -M -s /sbin/nologin mysql +mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir +if [ ! -e "`which cmake`" ];then + tar xzf cmake-2.8.12.2.tar.gz + cd cmake-2.8.12.2 + CFLAGS= CXXFLAGS= ./configure + make && make install + cd .. +fi +tar zxf mariadb-10.0.10.tar.gz +cd mariadb-10.0.10 +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 +cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ +-DMYSQL_DATADIR=$mariadb_data_dir \ +-DWITH_ARIA_STORAGE_ENGINE=1 \ +-DWITH_XTRADB_STORAGE_ENGINE=1 \ +-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ +-DWITH_INNOBASE_STORAGE_ENGINE=1 \ +-DWITH_PARTITION_STORAGE_ENGINE=1 \ +-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \ +-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ +-DWITH_MYISAM_STORAGE_ENGINE=1 \ +-DWITH_READLINE=1 \ +-DENABLED_LOCAL_INFILE=1 \ +-DDEFAULT_CHARSET=utf8 \ +-DDEFAULT_COLLATION=utf8_general_ci \ +-DWITH_EMBEDDED_SERVER=1 \ +$EXE_LINKER +make && make install + +if [ -d "$mariadb_install_dir" ];then + echo -e "\033[32mMariaDB install successfully! \033[0m" +else + echo -e "\033[31mMariaDB install failed, Please contact the author! \033[0m" + kill -9 $$ +fi + +/bin/cp support-files/my-small.cnf /etc/my.cnf +/bin/cp support-files/mysql.server /etc/init.d/mysqld +chmod +x /etc/init.d/mysqld +OS_CentOS='chkconfig --add mysqld \n +chkconfig mysqld on' +OS_Debian_Ubuntu='update-rc.d mysqld defaults' +OS_command +cd ../../ + +# my.cf +cat > /etc/my.cnf << EOF +[client] +port = 3306 +socket = /tmp/mysql.sock + +[mysqld] +port = 3306 +socket = /tmp/mysql.sock + +basedir = $mariadb_install_dir +datadir = $mariadb_data_dir +pid-file = $mariadb_data_dir/mysql.pid +user = mysql +bind-address = 0.0.0.0 +server-id = 1 + +skip-name-resolve +#skip-networking +back_log = 600 + +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_size = 8M +query_cache_limit = 2M + +ft_min_word_len = 4 + +log_bin = mysql-bin +binlog_format = mixed +expire_logs_days = 30 + +log_error = $mariadb_data_dir/mysql-error.log +slow_query_log = 1 +long_query_time = 1 +slow_query_log_file = $mariadb_data_dir/mysql-slow.log + +performance_schema = 0 + +#lower_case_table_names = 1 + +skip-external-locking + +default_storage_engine = InnoDB +#default-storage-engine = MyISAM +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 + +Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` +if [ $Memtatol -gt 1500 -a $Memtatol -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 [ $Memtatol -gt 2500 -a $Memtatol -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 [ $Memtatol -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 + +$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir + +chown mysql.mysql -R $mariadb_data_dir +service mysqld start +export PATH=$PATH:$mariadb_install_dir/bin +echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile +. /etc/profile + +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" +$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" +$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 "reset master;" +sed -i "s@^db_install_dir.*@db_install_dir=$mariadb_install_dir@" options.conf +sed -i "s@^db_data_dir.*@db_data_dir=$mariadb_data_dir@" options.conf +service mysqld stop +} diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 890fc9cc..8d3f8ef6 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.11/phpMyAdmin-4.1.11-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.12/phpMyAdmin-4.1.12-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.11-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.11-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.12-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.12-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/install.sh b/install.sh index 61dcdb6f..1d7cbeef 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Author: yeho # Blog: http://blog.linuxeye.com # -# Version: 0.6 2-Mar-2014 lj2007331 AT gmail.com +# Version: 0.7 7-Apr-2014 lj2007331 AT gmail.com # Notes: LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # This script's project home is: @@ -87,18 +87,21 @@ do fi done fi - echo - echo 'Please select Apache server:' - echo -e "\t\033[32m1\033[0m. Install Apache-2.4" - echo -e "\t\033[32m2\033[0m. Install Apache-2.2" - echo -e "\t\033[32m3\033[0m. Do not install" - read -p "Please input a number:(Default 3 press Enter) " Apache_version - [ -z "$Apache_version" ] && Apache_version=3 - if [ $Apache_version != 1 -a $Apache_version != 2 -a $Apache_version != 3 ];then - echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" - else - break - fi + while : + do + echo + echo 'Please select Apache server:' + echo -e "\t\033[32m1\033[0m. Install Apache-2.4" + echo -e "\t\033[32m2\033[0m. Install Apache-2.2" + echo -e "\t\033[32m3\033[0m. Do not install" + read -p "Please input a number:(Default 3 press Enter) " Apache_version + [ -z "$Apache_version" ] && Apache_version=3 + if [ $Apache_version != 1 -a $Apache_version != 2 -a $Apache_version != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" + else + break + fi + done break fi done @@ -123,13 +126,14 @@ do echo 'Please select a version of the Database:' echo -e "\t\033[32m1\033[0m. Install MySQL-5.6" echo -e "\t\033[32m2\033[0m. Install MySQL-5.5" - echo -e "\t\033[32m3\033[0m. Install MariaDB-5.5" - echo -e "\t\033[32m4\033[0m. Install Percona-5.5" + echo -e "\t\033[32m3\033[0m. Install MariaDB-10.0" + echo -e "\t\033[32m4\033[0m. Install MariaDB-5.5" echo -e "\t\033[32m5\033[0m. Install Percona-5.6" + echo -e "\t\033[32m6\033[0m. Install Percona-5.5" read -p "Please input a number:(Default 1 press Enter) " DB_version [ -z "$DB_version" ] && DB_version=1 - if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 -a $DB_version != 4 -a $DB_version != 5 ];then - echo -e "\033[31minput error! Please only input number 1,2,3,4,5 \033[0m" + if [ $DB_version != 1 -a $DB_version != 2 -a $DB_version != 3 -a $DB_version != 4 -a $DB_version != 5 -a $DB_version != 6 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4,5,6 \033[0m" else while : do @@ -453,14 +457,17 @@ elif [ "$DB_version" == '2' ];then . functions/mysql-5.5.sh Install_MySQL-5-5 2>&1 | tee -a $lnmp_dir/install.log elif [ "$DB_version" == '3' ];then + . functions/mariadb-10.0.sh + Install_MariaDB-10-0 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '4' ];then . functions/mariadb-5.5.sh Install_MariaDB-5-5 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$DB_version" == '4' ];then - . functions/percona-5.5.sh - Install_Percona-5-5 2>&1 | tee -a $lnmp_dir/install.log elif [ "$DB_version" == '5' ];then . functions/percona-5.6.sh Install_Percona-5-6 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$DB_version" == '6' ];then + . functions/percona-5.5.sh + Install_Percona-5-5 2>&1 | tee -a $lnmp_dir/install.log fi # PHP MySQL Client From 7449f546ce53685719075c26fe14658557f970d2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 13 Apr 2014 15:38:06 +0800 Subject: [PATCH 307/617] sasl.h is not available --- functions/memcached.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/memcached.sh b/functions/memcached.sh index ce609749..f56bb2d2 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -53,6 +53,8 @@ else fi # php memcached extension +OS_CentOS='yum -y install cyrus-sasl-devel' +OS_command tar xzf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure --with-memcached=$memcached_install_dir From 9dfe21dc69d3c4753e354e0cb27da1946cecba7a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 13 Apr 2014 19:57:32 +0800 Subject: [PATCH 308/617] update pcre 8.34 to 8.35 --- functions/apache-2.4.sh | 6 +++--- functions/nginx.sh | 6 +++--- functions/tengine.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 89c28830..07225b43 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -9,13 +9,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.9.tar.gz && Download_src -tar xzf pcre-8.34.tar.gz -cd pcre-8.34 +tar xzf pcre-8.35.tar.gz +cd pcre-8.35 ./configure make && make install cd ../ diff --git a/functions/nginx.sh b/functions/nginx.sh index 04e83fa5..fd869f2d 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src src_url=http://nginx.org/download/nginx-1.4.7.tar.gz && Download_src -tar xzf pcre-8.34.tar.gz -cd pcre-8.34 +tar xzf pcre-8.35.tar.gz +cd pcre-8.35 ./configure make && make install cd ../ diff --git a/functions/tengine.sh b/functions/tengine.sh index 1b85fee7..858fde06 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-1.5.2.tar.gz && Download_src -tar xzf pcre-8.34.tar.gz -cd pcre-8.34 +tar xzf pcre-8.35.tar.gz +cd pcre-8.35 ./configure make && make install cd ../ From 72ca0a496e8244866f340598dc4dc807b2b52db7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 13 Apr 2014 22:16:25 +0800 Subject: [PATCH 309/617] undefined reference to `pthread_once' --- functions/memcached.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index f56bb2d2..da743ba7 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -53,10 +53,11 @@ else fi # php memcached extension -OS_CentOS='yum -y install cyrus-sasl-devel' -OS_command tar xzf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 +OS_CentOS='yum -y install cyrus-sasl-devel' +OS_Debian_Ubuntu='sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure' +OS_command ./configure --with-memcached=$memcached_install_dir make && make install cd .. From 595c7ba678bc1a5c36760134040ba127e128f1c0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 14 Apr 2014 22:12:53 +0800 Subject: [PATCH 310/617] update typecho rewrite --- conf/typecho.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/typecho.conf b/conf/typecho.conf index fa863369..96864da6 100644 --- a/conf/typecho.conf +++ b/conf/typecho.conf @@ -4,6 +4,6 @@ if (-f $request_filename/index.html){ if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } -if (!-f $request_filename){ +if (!-e $request_filename){ rewrite (.*) /index.php; } From d818217ebd5a865da1bd838eba3a8bfacf95a9ce Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 18 Apr 2014 22:57:24 +0800 Subject: [PATCH 311/617] update memcached 1.4.17 to 1.4.18 --- functions/ImageMagick.sh | 6 +++--- functions/memcached.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index e85a9ced..ea56b238 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.8-10.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-0.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.8-10.tar.gz -cd ImageMagick-6.8.8-10 +tar xzf ImageMagick-6.8.9-0.tar.gz +cd ImageMagick-6.8.9-0 ./configure make && make install cd ../ diff --git a/functions/memcached.sh b/functions/memcached.sh index da743ba7..164e2586 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,15 +9,15 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.memcached.org/files/memcached-1.4.17.tar.gz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.18.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.17.tar.gz -cd memcached-1.4.17 +tar xzf memcached-1.4.18.tar.gz +cd memcached-1.4.18 ./configure --prefix=$memcached_install_dir make && make install cd ../ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 8d3f8ef6..5a3ac50a 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.12/phpMyAdmin-4.1.12-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.13/phpMyAdmin-4.1.13-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.12-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.12-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.13-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.13-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 0be7d499a76a0c983bb5cf43c0a39d99ea49cb24 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 19 Apr 2014 22:23:55 +0800 Subject: [PATCH 312/617] update mariadb 5.5.36 to 5.5.37 --- functions/mariadb-10.0.sh | 2 +- functions/mariadb-5.5.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index e58a7c71..fce2431c 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-10.0.10/kvm-tarbake-jaunty-x86/mariadb-10.0.10.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.10/kvm-tarbake-jaunty-x86/mariadb-10.0.10.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index f238206f..ceb1be15 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.36/kvm-tarbake-jaunty-x86/mariadb-5.5.36.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.37/source/mariadb-5.5.37.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-5.5.36.tar.gz -cd mariadb-5.5.36 +tar zxf mariadb-5.5.37.tar.gz +cd mariadb-5.5.37 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From 2c44879cdb167fc896ad5383c9f8dafc7c848a2f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 22 Apr 2014 22:16:50 +0800 Subject: [PATCH 313/617] update redis 2.8.8 to 2.8.9 --- functions/redis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 891b9590..0b31d750 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.8.tar.gz && Download_src +src_url=http://download.redis.io/releases/redis-2.8.9.tar.gz && Download_src tar xzf redis-2.2.5.tgz cd redis-2.2.5 @@ -27,8 +27,8 @@ else echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" fi -tar xzf redis-2.8.8.tar.gz -cd redis-2.8.8 +tar xzf redis-2.8.9.tar.gz +cd redis-2.8.9 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings From 83583ac03bc09ca38bf65d73f7c934b595efa8a0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 25 Apr 2014 19:18:36 +0800 Subject: [PATCH 314/617] update nginx 1.4.7 to 1.6.0 --- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- functions/pecl_http.sh | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index fd869f2d..72564565 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.4.7.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.6.0.tar.gz && Download_src tar xzf pcre-8.35.tar.gz cd pcre-8.35 @@ -18,9 +18,9 @@ cd pcre-8.35 make && make install cd ../ -tar xzf nginx-1.4.7.tar.gz +tar xzf nginx-1.6.0.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.4.7 +cd nginx-1.6.0 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 609d7821..2103acfa 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.7.30.4-beta.zip tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.4.7 + cd nginx-1.6.0 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index a4a28294..53d8d72f 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src src_url=http://pecl.php.net/get/raphf-1.0.4.tgz && Download_src src_url=http://pecl.php.net/get/propro-1.0.0.tgz && Download_src -src_url=http://pecl.php.net/get/pecl_http-2.0.4.tgz && Download_src +src_url=http://pecl.php.net/get/pecl_http-2.0.6.tgz && Download_src tar xzf raphf-1.0.4.tgz cd raphf-1.0.4 $php_install_dir/bin/phpize @@ -25,8 +25,8 @@ $php_install_dir/bin/phpize make && make install cd .. -tar xzf pecl_http-2.0.4.tgz -cd pecl_http-2.0.4 +tar xzf pecl_http-2.0.6.tgz +cd pecl_http-2.0.6 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config From c496dccdac64ba3f7ac3136d6bc9d4eb0520b138 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 26 Apr 2014 12:26:49 +0800 Subject: [PATCH 315/617] upgrade_web.sh bug --- upgrade_web.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/upgrade_web.sh b/upgrade_web.sh index ce952155..0e89567c 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -125,14 +125,14 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then cd $lnmp_dir/src rm -rf ngx_pagespeed* - src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.3.tar.gz && Download_src - [ -s "ngx_pagespeed-1.7.30.3-beta.zip" ] && echo "ngx_pagespeed-1.7.30.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz && Download_src + [ -s "ngx_pagespeed-1.7.30.4-beta.zip" ] && echo "ngx_pagespeed-1.7.30.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip - unzip -q ngx_pagespeed-1.7.30.3-beta.zip - /bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.3-beta - tar xzf 1.7.30.3.tar.gz -C ngx_pagespeed-1.7.30.3-beta + unzip -q ngx_pagespeed-1.7.30.4-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.4-beta + tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta cd tengine-$tengine_version - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.3-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.4-beta fi kill -USR2 `cat /var/run/nginx.pid` From b8eecfca1e7def0115cef8d3f4410163d5faab75 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 26 Apr 2014 18:47:54 +0800 Subject: [PATCH 316/617] update init_CentOS.sh --- init/init_CentOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index fc203695..a96de92f 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -45,7 +45,7 @@ fi yum check-update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && yum -y update +[ "$upgrade_yn" == 'y' ] && yum -y upgrade # Install needed packages yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch From 1dcc9495055cb514a8c19308ba2e601a780f3dd9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 26 Apr 2014 23:38:07 +0800 Subject: [PATCH 317/617] add mysqlnd --- functions/php-5.3.sh | 30 ++++++++++++++++++++++-------- functions/php-5.4.sh | 30 ++++++++++++++++++++++-------- functions/php-5.5.sh | 32 +++++++++++++++++++++++--------- functions/zendopcache.sh | 14 +++++++++++++- install.sh | 17 ++++++++++++++++- 5 files changed, 96 insertions(+), 27 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 7b5aef85..c8ffe595 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,7 +13,6 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.3.28.tar.gz" ] && echo "php-5.3.28.tar.gz found" || wget -c http://www.php.net/get/php-5.3.28.tar.gz/from/this/mirror src_url=http://www.php.net/distributions/php-5.3.28.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz @@ -40,8 +39,13 @@ make && make install cd ../ # linked library -[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir -ln -s $db_install_dir/include /usr/include/mysql +if [ "$PHP_MySQL_driver" == '1' ];then + PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" +elif [ "$PHP_MySQL_driver" == '2' ];then + [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir + ln -s $db_install_dir/include /usr/include/mysql + PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" +fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -68,8 +72,7 @@ cd php-5.3.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -78,8 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -106,6 +108,19 @@ fi /bin/cp php.ini-production $php_install_dir/etc/php.ini # Modify php.ini +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini @@ -183,7 +198,6 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -Mem=`free -m | awk '/Mem:/{print $2}'` sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 9c94baba..2f356a51 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,6 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.4.27.tar.gz" ] && echo "php-5.4.27.tar.gz found" || wget -c http://www.php.net/get/php-5.4.27.tar.gz/from/this/mirror src_url=http://www.php.net/distributions/php-5.4.27.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz @@ -40,8 +39,13 @@ make && make install cd ../ # linked library -[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir -ln -s $db_install_dir/include /usr/include/mysql +if [ "$PHP_MySQL_driver" == '1' ];then + PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" +elif [ "$PHP_MySQL_driver" == '2' ];then + [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir + ln -s $db_install_dir/include /usr/include/mysql + PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" +fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -68,8 +72,7 @@ cd php-5.4.27 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -78,8 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -106,6 +108,19 @@ fi /bin/cp php.ini-production $php_install_dir/etc/php.ini # Modify php.ini +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini @@ -183,7 +198,6 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -Mem=`free -m | awk '/Mem:/{print $2}'` sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index b5eda8c4..1d72680d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,6 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -[ -s "php-5.5.11.tar.gz" ] && echo "php-5.5.11.tar.gz found" || wget -c http://www.php.net/get/php-5.5.11.tar.gz/from/this/mirror src_url=http://www.php.net/distributions/php-5.5.11.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz @@ -40,8 +39,13 @@ make && make install cd ../ # linked library -[ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir -ln -s $db_install_dir/include /usr/include/mysql +if [ "$PHP_MySQL_driver" == '1' ];then + PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" +elif [ "$PHP_MySQL_driver" == '2' ];then + [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir + ln -s $db_install_dir/include /usr/include/mysql + PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" +fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -69,8 +73,7 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -79,8 +82,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp --disable-fileinfo --with-mysql=$db_install_dir \ ---with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -107,6 +109,19 @@ fi /bin/cp php.ini-production $php_install_dir/etc/php.ini # Modify php.ini +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini @@ -124,7 +139,7 @@ sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_ if [ "$PHP_cache" == '1' ];then sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini -sed -i 's@^;opcache.memory_consumption.*@opcache.memory_consumption=128@' $php_install_dir/etc/php.ini +sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini @@ -197,7 +212,6 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -Mem=`free -m | awk '/Mem:/{print $2}'` sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 11b50069..5f09647f 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -15,11 +15,23 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" ];then cat >> $php_install_dir/etc/php.ini << EOF [opcache] zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" -opcache.memory_consumption=128 +opcache.memory_consumption=$Memory_limit opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 diff --git a/install.sh b/install.sh index 1d7cbeef..aced6926 100755 --- a/install.sh +++ b/install.sh @@ -170,6 +170,21 @@ else if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 ];then echo -e "\033[31minput error! Please only input number 1,2,3 \033[0m" else + while : + do + echo + echo 'You can either use the mysqlnd or libmysql library to connect from PHP to MySQL:' + echo -e "\t\033[32m1\033[0m. MySQL native driver (mysqlnd)" + echo -e "\t\033[32m2\033[0m. MySQL Client Library (libmysql)" + read -p "Please input a number:(Default 1 press Enter) " PHP_MySQL_driver + [ -z "$PHP_MySQL_driver" ] && PHP_MySQL_driver=1 + if [ $PHP_MySQL_driver != 1 -a $PHP_MySQL_driver != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + break + fi + done + while : do echo @@ -471,7 +486,7 @@ elif [ "$DB_version" == '6' ];then fi # PHP MySQL Client -if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' ];then +if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' -a "$PHP_MySQL_driver" == '2' ];then . functions/php-mysql-client.sh Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log fi From 9278fb58144ca5766097c6e6b2fac026777693df Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 27 Apr 2014 14:32:35 +0800 Subject: [PATCH 318/617] init_Ubuntu.sh bug --- functions/tcmalloc.sh | 5 +++-- init/init_Debian.sh | 2 -- init/init_Ubuntu.sh | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index c9ebfb1e..5d645f5f 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -13,8 +13,9 @@ src_url=http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz && Download if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then tar xzf libunwind-1.1.tar.gz cd libunwind-1.1 - CFLAGS="$CFLAGS -fPIC" ./configure - make && make install + CFLAGS=-fPIC ./configure + make CFLAGS=-fPIC + make CFLAGS=-fPIC install cd .. tar xzf gperftools-2.1.tar.gz cd gperftools-2.1 diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 72e6a626..3d363c6a 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -6,8 +6,6 @@ apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-b dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y update -# update packages -apt-get -y upgrade # check upgrade OS [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index c19e8987..30a245f1 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -6,8 +6,6 @@ apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-b dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd apt-get -y update -# update packages -apt-get -y upgrade # check upgrade OS [ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade From 8c7025c42793e69e18123840fab9fea2d7e2ef8d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 27 Apr 2014 17:01:30 +0800 Subject: [PATCH 319/617] update phpMyadmin 4.1.13 to 4.1.14 --- functions/mysql-5.6.sh | 2 +- functions/phpmyadmin.sh | 6 +++--- install.sh | 24 +++++++++++++----------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index e85a65c3..5aa80dba 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -26,7 +26,7 @@ cd mysql-5.6.17 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'" + EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 5a3ac50a..392f226a 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.13/phpMyAdmin-4.1.13-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.14/phpMyAdmin-4.1.14-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.13-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.13-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.1.14-all-languages.tar.gz +/bin/mv phpMyAdmin-4.1.14-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/install.sh b/install.sh index aced6926..9601c7f7 100755 --- a/install.sh +++ b/install.sh @@ -28,6 +28,7 @@ local_IP=`./functions/get_local_ip.py` # Definition Directory . ./options.conf +. functions/check_os.sh mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} # choice upgrade OS @@ -40,16 +41,18 @@ do else [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && echo -e "\033[31mYour system is already upgraded! \033[0m" && upgrade_yn=n && break # check sendmail - while : - do - echo - read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn - if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done + if [ "$OS" != 'Debian' ];then + while : + do + echo + read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + fi break fi done @@ -431,7 +434,6 @@ fi chmod +x functions/*.sh init/* *.sh # init -. functions/check_os.sh if [ "$OS" == 'CentOS' ];then . init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/install.log /bin/mv init/init_CentOS.sh init/init_CentOS.ed From 9abd3c01270ee25adaadcb8d133ea8cf731ce4f6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 2 May 2014 23:01:53 +0800 Subject: [PATCH 320/617] update php version --- functions/memcached.sh | 6 +++--- functions/php-5.4.sh | 8 ++++---- functions/php-5.5.sh | 8 ++++---- functions/tcmalloc.sh | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index 164e2586..5ffabd02 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,15 +9,15 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.memcached.org/files/memcached-1.4.18.tar.gz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.19.tar.gz && Download_src src_url=https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && Download_src src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.18.tar.gz -cd memcached-1.4.18 +tar xzf memcached-1.4.19.tar.gz +cd memcached-1.4.19 ./configure --prefix=$memcached_install_dir make && make install cd ../ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 2f356a51..756cebfc 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.27.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.28.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -64,11 +64,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.27.tar.gz +tar xzf php-5.4.28.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.27 -p0 < fpm-race-condition.patch -cd php-5.4.27 +patch -d php-5.4.28 -p0 < fpm-race-condition.patch +cd php-5.4.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 1d72680d..9c2da42d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.11.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.12.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -64,11 +64,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.11.tar.gz +tar xzf php-5.5.12.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.11 -p0 < fpm-race-condition.patch -cd php-5.5.11 +patch -d php-5.5.12 -p0 < fpm-race-condition.patch +cd php-5.5.12 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 5d645f5f..9a6e7a33 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -7,10 +7,10 @@ Install_tcmalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz && Download_src src_url=http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz && Download_src if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then + src_url=http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz && Download_src tar xzf libunwind-1.1.tar.gz cd libunwind-1.1 CFLAGS=-fPIC ./configure From bb6d1a6e5b8f888773399e21c6953954d23b048d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 13 May 2014 10:48:34 +0800 Subject: [PATCH 321/617] update ImageMagick 6.8.9-0 to 6.8.9-1 --- functions/ImageMagick.sh | 6 +++--- functions/test.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index ea56b238..7f214acc 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,11 +8,11 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-0.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-1.tar.gz && Download_src src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src -tar xzf ImageMagick-6.8.9-0.tar.gz -cd ImageMagick-6.8.9-0 +tar xzf ImageMagick-6.8.9-1.tar.gz +cd ImageMagick-6.8.9-1 ./configure make && make install cd ../ diff --git a/functions/test.sh b/functions/test.sh index 7377fd8d..00a66609 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.yahei.net/tz/tz.zip && Download_src -src_url=https://gist.github.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src +src_url=https://gist.githubusercontent.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default From c1edfde450635caefd98150baf933a8a48be87a8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 13 May 2014 19:17:50 +0800 Subject: [PATCH 322/617] delete --disable-fileinfo --- functions/php-5.3.sh | 4 ++-- functions/php-5.4.sh | 4 ++-- functions/php-5.5.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index c8ffe595..137cdf17 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -72,7 +72,7 @@ cd php-5.3.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -81,7 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 756cebfc..0f314210 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -72,7 +72,7 @@ cd php-5.4.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -81,7 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 9c2da42d..e342a7ab 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -73,7 +73,7 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -82,7 +82,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ From daa4c711666ae587c58003f7f47c6489bd96def6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 May 2014 19:12:40 +0800 Subject: [PATCH 323/617] update ngx_pagespeed 1.7.30.4-beta to 1.8.31.2-beta --- functions/ngx_pagespeed.sh | 16 ++++++++-------- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- upgrade_web.sh | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 2103acfa..330b97f7 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz && Download_src -[ -s "ngx_pagespeed-1.7.30.4-beta.zip" ] && echo "ngx_pagespeed-1.7.30.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.2.tar.gz && Download_src +[ -s "ngx_pagespeed-1.8.31.2-beta.zip" ] && echo "ngx_pagespeed-1.8.31.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.7.30.4-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.4-beta -tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta +unzip -q ngx_pagespeed-1.8.31.2-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.2-beta +tar xzf 1.8.31.2.tar.gz -C ngx_pagespeed-1.8.31.2-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.6.0 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.7.30.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.4-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.2-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 3d363c6a..23961c01 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -8,7 +8,7 @@ dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common l apt-get -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade +[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 30a245f1..d0e2f8b8 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -8,7 +8,7 @@ dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common l apt-get -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y dist-upgrade +[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget diff --git a/upgrade_web.sh b/upgrade_web.sh index 0e89567c..c8be449c 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -125,14 +125,14 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then cd $lnmp_dir/src rm -rf ngx_pagespeed* - src_url=https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz && Download_src - [ -s "ngx_pagespeed-1.7.30.4-beta.zip" ] && echo "ngx_pagespeed-1.7.30.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.7.30.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.2.tar.gz && Download_src + [ -s "ngx_pagespeed-1.8.31.2-beta.zip" ] && echo "ngx_pagespeed-1.8.31.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip - unzip -q ngx_pagespeed-1.7.30.4-beta.zip - /bin/mv ngx_pagespeed-master ngx_pagespeed-1.7.30.4-beta - tar xzf 1.7.30.4.tar.gz -C ngx_pagespeed-1.7.30.4-beta + unzip -q ngx_pagespeed-1.8.31.2-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.2-beta + tar xzf 1.8.31.2.tar.gz -C ngx_pagespeed-1.8.31.2-beta cd tengine-$tengine_version - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.7.30.4-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.2-beta fi kill -USR2 `cat /var/run/nginx.pid` From 04636dc822fe5f54e5a165a964efd009ab896351 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 15 May 2014 13:22:39 +0800 Subject: [PATCH 324/617] add --disable-fileinfo --- functions/php-5.3.sh | 4 ++-- functions/php-5.4.sh | 4 ++-- functions/php-5.5.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 137cdf17..c8ffe595 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -72,7 +72,7 @@ cd php-5.3.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -81,7 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 0f314210..756cebfc 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -72,7 +72,7 @@ cd php-5.4.28 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -81,7 +81,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index e342a7ab..9c2da42d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -73,7 +73,7 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -82,7 +82,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ From 9bb4b10d672c07fbd2006d3cbb9159e2ad0d56de Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 15 May 2014 17:43:26 +0800 Subject: [PATCH 325/617] update memcached 1.4.19 to 1.4.20 --- README.md | 2 +- functions/GraphicsMagick.sh | 33 +++++++------- functions/ImageMagick.sh | 33 +++++++------- functions/memcached.sh | 89 +++++++++++++++++++------------------ functions/phpmyadmin.sh | 6 +-- functions/redis.sh | 33 +++++++------- functions/test.sh | 4 +- install.sh | 2 - 8 files changed, 102 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 839497d6..c561fb3d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ tar xzf lnmp.tar.gz cd lnmp chmod +x install.sh - # Prevent interrupt the installation process. If the network is down, you can execute commands `srceen -r lnmp` network reconnect the installation window. + # Prevent interrupt the installation process. If the network is down, you can execute commands `screen -r lnmp` network reconnect the installation window. screen -S lnmp ./install.sh ``` diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index 04650b29..0c92c1f6 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -9,7 +9,6 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz && Download_src -src_url=http://pecl.php.net/get/gmagick-1.1.7RC2.tgz && Download_src tar xzf GraphicsMagick-1.3.19.tar.gz cd GraphicsMagick-1.3.19 @@ -17,22 +16,24 @@ cd GraphicsMagick-1.3.19 make && make install cd ../ -tar xzf gmagick-1.1.7RC2.tgz -cd gmagick-1.1.7RC2 -make clean -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ +if [ -e "$php_install_dir/bin/phpize" ];then + src_url=http://pecl.php.net/get/gmagick-1.1.7RC2.tgz && Download_src + tar xzf gmagick-1.1.7RC2.tgz + cd gmagick-1.1.7RC2 + make clean + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make && make install + cd ../ -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/gmagick.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/gmagick.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo -e "\033[31mPHP Gmagick module install failed, Please contact the author! \033[0m" + fi fi - cd ../ } diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 7f214acc..5f6bfed8 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -9,7 +9,6 @@ cd $lnmp_dir/src . ../options.conf src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-1.tar.gz && Download_src -src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src tar xzf ImageMagick-6.8.9-1.tar.gz cd ImageMagick-6.8.9-1 @@ -18,22 +17,24 @@ make && make install cd ../ ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick -tar xzf imagick-3.1.2.tgz -cd imagick-3.1.2 -make clean -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ +if [ -e "$php_install_dir/bin/phpize" ];then + src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src + tar xzf imagick-3.1.2.tgz + cd imagick-3.1.2 + make clean + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make && make install + cd ../ -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "imagick.so"@' $php_install_dir/etc/php.ini - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo -e "\033[31mPHP imagick module install failed, Please contact the author! \033[0m" + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "imagick.so"@' $php_install_dir/etc/php.ini + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo -e "\033[31mPHP imagick module install failed, Please contact the author! \033[0m" + fi fi - cd ../ } diff --git a/functions/memcached.sh b/functions/memcached.sh index 5ffabd02..e634d4eb 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,15 +9,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.memcached.org/files/memcached-1.4.19.tar.gz && Download_src -src_url=https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && Download_src -src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src -src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.20.tar.gz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.19.tar.gz -cd memcached-1.4.19 +tar xzf memcached-1.4.20.tar.gz +cd memcached-1.4.20 ./configure --prefix=$memcached_install_dir make && make install cd ../ @@ -36,46 +33,50 @@ else echo -e "\033[31mmemcached install failed, Please contact the author! \033[0m" fi -# php memcache extension -tar xzf memcache-2.2.7.tgz -cd memcache-2.2.7 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd .. -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo -e "\033[31mPHP memcache module install failed, Please contact the author! \033[0m" -fi +if [ -e "$php_install_dir/bin/phpize" ];then + src_url=https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && Download_src + src_url=http://pecl.php.net/get/memcached-2.2.0.tgz && Download_src + src_url=http://pecl.php.net/get/memcache-2.2.7.tgz && Download_src + # php memcache extension + tar xzf memcache-2.2.7.tgz + cd memcache-2.2.7 + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make && make install + cd .. + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo -e "\033[31mPHP memcache module install failed, Please contact the author! \033[0m" + fi -# php memcached extension -tar xzf libmemcached-1.0.18.tar.gz -cd libmemcached-1.0.18 -OS_CentOS='yum -y install cyrus-sasl-devel' -OS_Debian_Ubuntu='sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure' -OS_command -./configure --with-memcached=$memcached_install_dir -make && make install -cd .. + # php memcached extension + tar xzf libmemcached-1.0.18.tar.gz + cd libmemcached-1.0.18 + OS_CentOS='yum -y install cyrus-sasl-devel' + OS_Debian_Ubuntu='sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure' + OS_command + ./configure --with-memcached=$memcached_install_dir + make && make install + cd .. -tar xzf memcached-2.2.0.tgz -cd memcached-2.2.0 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd ../ -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" + tar xzf memcached-2.2.0.tgz + cd memcached-2.2.0 + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make && make install + cd ../ + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" + fi fi - cd ../ } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 392f226a..0f1505f3 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.14/phpMyAdmin-4.1.14-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.1/phpMyAdmin-4.2.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.1.14-all-languages.tar.gz -/bin/mv phpMyAdmin-4.1.14-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/redis.sh b/functions/redis.sh index 0b31d750..070c04c1 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -9,24 +9,25 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src -src_url=http://download.redis.io/releases/redis-2.8.9.tar.gz && Download_src - -tar xzf redis-2.2.5.tgz -cd redis-2.2.5 -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make && make install -cd .. -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" +if [ -e "$php_install_dir/bin/phpize" ];then + src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src + tar xzf redis-2.2.5.tgz + cd redis-2.2.5 + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make && make install + cd .. + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo -e "\033[31mPHP Redis module install failed, Please contact the author! \033[0m" + fi fi +src_url=http://download.redis.io/releases/redis-2.8.9.tar.gz && Download_src tar xzf redis-2.8.9.tar.gz cd redis-2.8.9 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then diff --git a/functions/test.sh b/functions/test.sh index 00a66609..d0e36546 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -20,7 +20,7 @@ unzip -q tz.zip -d $home_dir/default [ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LANMP@g' $home_dir/default/index.html [ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LAMP@g' $home_dir/default/index.html chown -R www.www $home_dir/default -[ -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start -[ -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart +[ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start +[ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart cd .. } diff --git a/install.sh b/install.sh index 9601c7f7..04b1af4b 100755 --- a/install.sh +++ b/install.sh @@ -357,7 +357,6 @@ do done fi -if [ "$PHP_yn" == 'y' ];then # check redis while : do @@ -387,7 +386,6 @@ do break fi done -fi # gcc sane CFLAGS and CXXFLAGS #while : From 1740a82eba2d918936dbd04c98a0e4e2e60c5e43 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 May 2014 15:59:30 +0800 Subject: [PATCH 326/617] update mariadb 10.0.10 to 10.0.11 --- functions/mariadb-10.0.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index fce2431c..08c04ed8 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-10.0.10/kvm-tarbake-jaunty-x86/mariadb-10.0.10.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.11/source/mariadb-10.0.11.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-10.0.10.tar.gz -cd mariadb-10.0.10 +tar zxf mariadb-10.0.11.tar.gz +cd mariadb-10.0.11 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From 164209d5d22117a600a4b2cec1185fb198535271 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 16 May 2014 16:08:50 +0800 Subject: [PATCH 327/617] add request_terminate_timeout --- functions/php-5.3.sh | 2 ++ functions/php-5.4.sh | 2 ++ functions/php-5.5.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index c8ffe595..f93b3682 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -183,6 +183,8 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 +pm.process_idle_timeout = 10s +request_terminate_timeout = 120 request_terminate_timeout = 600 request_slowlog_timeout = 0 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 756cebfc..4b6f6cf4 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -183,6 +183,8 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 +pm.process_idle_timeout = 10s +request_terminate_timeout = 120 request_terminate_timeout = 600 request_slowlog_timeout = 0 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 9c2da42d..feb3d773 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -197,6 +197,8 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 20480 +pm.process_idle_timeout = 10s +request_terminate_timeout = 120 request_terminate_timeout = 600 request_slowlog_timeout = 0 From 3b45995b2947b4399a4e019e1317ecbf3b86bdd1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 May 2014 11:29:53 +0800 Subject: [PATCH 328/617] install php bug --- functions/php-5.3.sh | 6 ++---- functions/php-5.4.sh | 8 +++----- functions/php-5.5.sh | 6 ++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index f93b3682..1c433ad8 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -182,11 +182,9 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 20480 -pm.process_idle_timeout = 10s +pm.max_requests = 2048 +pm.process_idle_timeout = 10 request_terminate_timeout = 120 - -request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 4b6f6cf4..36d60006 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -77,7 +77,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockes --with-xmlrpc --enable-ftp \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -182,11 +182,9 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 20480 -pm.process_idle_timeout = 10s +pm.max_requests = 2048 +pm.process_idle_timeout = 10 request_terminate_timeout = 120 - -request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index feb3d773..a6dc89a8 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -196,11 +196,9 @@ pm.max_children = 12 pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 -pm.max_requests = 20480 -pm.process_idle_timeout = 10s +pm.max_requests = 2048 +pm.process_idle_timeout = 10 request_terminate_timeout = 120 - -request_terminate_timeout = 600 request_slowlog_timeout = 0 slowlog = log/slow.log From b90816b7e2de6c7c3aff3feb7bff4e8b42737af2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 23 May 2014 13:50:10 +0800 Subject: [PATCH 329/617] make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1 --- functions/mariadb-10.0.sh | 2 +- functions/mariadb-5.5.sh | 2 +- functions/mysql-5.5.sh | 2 +- functions/mysql-5.6.sh | 2 +- functions/percona-5.5.sh | 2 +- functions/percona-5.6.sh | 2 +- functions/php-5.3.sh | 32 ++++++++++++++++++++++++++++---- functions/php-5.4.sh | 32 ++++++++++++++++++++++++++++---- functions/php-5.5.sh | 32 ++++++++++++++++++++++++++++---- functions/phpmyadmin.sh | 6 +++--- functions/tengine.sh | 4 ++++ upgrade_web.sh | 3 +++ 12 files changed, 100 insertions(+), 21 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 08c04ed8..4065a429 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -82,7 +82,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index ceb1be15..95e608fb 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -82,7 +82,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 492e20f8..83c95a94 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -79,7 +79,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 5aa80dba..50987197 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -78,7 +78,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index d8ca3898..afd7691b 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -78,7 +78,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 2dad86ad..0ff4eb56 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -77,7 +77,7 @@ server-id = 1 skip-name-resolve #skip-networking -back_log = 600 +back_log = 300 max_connections = 1000 max_connect_errors = 6000 diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 1c433ad8..7d794542 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -198,10 +198,34 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + +if [ $Mem -le 3000 ];then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 90@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 90@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 100@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 100@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 120@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 120@" $php_install_dir/etc/php-fpm.conf +fi + [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 36d60006..6d097c86 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -198,10 +198,34 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + +if [ $Mem -le 3000 ];then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 90@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 90@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 100@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 100@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 120@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 120@" $php_install_dir/etc/php-fpm.conf +fi + [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index a6dc89a8..835e4e70 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -212,10 +212,34 @@ env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp EOF -sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf -sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + +if [ $Mem -le 3000 ];then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 90@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 90@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 100@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 100@" $php_install_dir/etc/php-fpm.conf +elif [ $Mem -gt 8500 ];then + sed -i "s@^pm.max_children.*@pm.max_children = 120@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 120@" $php_install_dir/etc/php-fpm.conf +fi + [ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $local_IP:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 0f1505f3..e5aff073 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.1/phpMyAdmin-4.2.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.2-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.2-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/tengine.sh b/functions/tengine.sh index 858fde06..da5365fc 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -28,6 +28,10 @@ cd tengine-1.5.2 # close debug sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc +# make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1 +sed -i 's@\(.*\)this option allow a potential SSL 2.0 rollback (CAN-2005-2969)\(.*\)@#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING\n\1this option allow a potential SSL 2.0 rollback (CAN-2005-2969)\2@' src/event/ngx_event_openssl.c +sed -i 's@\(.*\)SSL_CTX_set_options(ssl->ctx, SSL_OP_MSIE_SSLV2_RSA_PADDING)\(.*\)@\1SSL_CTX_set_options(ssl->ctx, SSL_OP_MSIE_SSLV2_RSA_PADDING)\2\n#endif@' src/event/ngx_event_openssl.c + if [ "$je_tc_malloc" == '1' ];then malloc_module='--with-jemalloc' elif [ "$je_tc_malloc" == '2' ];then diff --git a/upgrade_web.sh b/upgrade_web.sh index c8be449c..24a62977 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -109,6 +109,9 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then tar xzf tengine-$tengine_version.tar.gz cd tengine-$tengine_version make clean + # make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1 + sed -i 's@\(.*\)this option allow a potential SSL 2.0 rollback (CAN-2005-2969)\(.*\)@#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING\n\1this option allow a potential SSL 2.0 rollback (CAN-2005-2969)\2@' src/event/ngx_event_openssl.c + sed -i 's@\(.*\)SSL_CTX_set_options(ssl->ctx, SSL_OP_MSIE_SSLV2_RSA_PADDING)\(.*\)@\1SSL_CTX_set_options(ssl->ctx, SSL_OP_MSIE_SSLV2_RSA_PADDING)\2\n#endif@' src/event/ngx_event_openssl.c $web_install_dir/sbin/nginx -V &> $$ tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` rm -rf $$ From c2d497d2c83fbc4e9914b3f1faf2741f74a387c7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 25 May 2014 22:49:20 +0800 Subject: [PATCH 330/617] /dev/shm not exist --- functions/php-5.3.sh | 2 ++ functions/php-5.4.sh | 2 ++ functions/php-5.5.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 7d794542..3a24d4c3 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -199,6 +199,8 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $lnmp_dir/vhost.sh $lnmp_dir/conf/nginx.conf + if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 6d097c86..f9fdd02e 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -199,6 +199,8 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $lnmp_dir/vhost.sh $lnmp_dir/conf/nginx.conf + if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 835e4e70..72572c9e 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -213,6 +213,8 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF +[ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $lnmp_dir/vhost.sh $lnmp_dir/conf/nginx.conf + if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf From 18af6d213ece978d5d21a08583595f938da4cc7b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 May 2014 09:47:43 +0800 Subject: [PATCH 331/617] update php 5.5.12 to 5.5.13 --- functions/php-5.5.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 72572c9e..e6e1279b 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.12.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.13.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -64,11 +64,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.5.12.tar.gz +tar xzf php-5.5.13.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.12 -p0 < fpm-race-condition.patch -cd php-5.5.12 +patch -d php-5.5.13 -p0 < fpm-race-condition.patch +cd php-5.5.13 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then From 067dfd9fcc184e91e6056099dd97e595a3455277 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 May 2014 23:33:44 +0800 Subject: [PATCH 332/617] add ionCube --- README.md | 2 +- functions/ioncube.sh | 39 ++++++++++++++++++++ init/init_CentOS.sh | 8 ++--- init/init_Debian.sh | 8 ++--- init/init_Ubuntu.sh | 8 ++--- install.sh | 85 ++++++++++++++++++++++++++------------------ 6 files changed, 103 insertions(+), 47 deletions(-) create mode 100755 functions/ioncube.sh diff --git a/README.md b/README.md index c561fb3d..c53bb07a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator and ZendGuardLoader (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc diff --git a/functions/ioncube.sh b/functions/ioncube.sh new file mode 100755 index 00000000..a23362d2 --- /dev/null +++ b/functions/ioncube.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_ionCube() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +php_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` +PHP_version=${php_version%.*} + +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src + tar xzf ioncube_loaders_lin_x86-64.tar.gz +else + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src + tar xzf ioncube_loaders_lin_x86.tar.gz +fi + +if [ "$PHP_version" == '5.5' ];then + /bin/cp ioncube/ioncube_loader_lin_5.5.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.5.so" +elif [ "$PHP_version" == '5.4' ];then + /bin/cp ioncube/ioncube_loader_lin_5.4.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.4.so" +elif [ "$PHP_version" == '5.3' ];then + /bin/cp ioncube/ioncube_loader_lin_5.3.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.3.so" +fi + +cat >> $php_install_dir/etc/php.ini << EOF +[ionCube Loader] +zend_extension="$zend_extension" +EOF +[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart +cd ../ +} diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index a96de92f..123be084 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -95,10 +95,10 @@ rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Set DNS -cat > /etc/resolv.conf << EOF -nameserver 114.114.114.114 -nameserver 8.8.8.8 -EOF +#cat > /etc/resolv.conf << EOF +#nameserver 114.114.114.114 +#nameserver 8.8.8.8 +#EOF # Wrong password five times locked 180s [ -z "`cat /etc/pam.d/system-auth | grep 'pam_tally2.so'`" ] && sed -i '4a auth required pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 23961c01..ad44d205 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -37,10 +37,10 @@ rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Set DNS -cat > /etc/resolv.conf << EOF -nameserver 114.114.114.114 -nameserver 8.8.8.8 -EOF +#cat > /etc/resolv.conf << EOF +#nameserver 114.114.114.114 +#nameserver 8.8.8.8 +#EOF # alias vi [ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index d0e2f8b8..77a3f946 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -46,10 +46,10 @@ rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Set DNS -cat > /etc/resolv.conf << EOF -nameserver 114.114.114.114 -nameserver 8.8.8.8 -EOF +#cat > /etc/resolv.conf << EOF +#nameserver 114.114.114.114 +#nameserver 8.8.8.8 +#EOF # alias vi [ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc diff --git a/install.sh b/install.sh index 04b1af4b..ad29f534 100755 --- a/install.sh +++ b/install.sh @@ -39,20 +39,20 @@ do if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else - [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && echo -e "\033[31mYour system is already upgraded! \033[0m" && upgrade_yn=n && break + [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && { echo -e "\033[31mYour system is already upgraded! \033[0m" ; upgrade_yn=n ; } # check sendmail - if [ "$OS" != 'Debian' ];then - while : - do - echo - read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn - if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done - fi + #if [ "$OS" != 'Debian' ];then + # while : + # do + # echo + # read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + # if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then + # echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + # else + # break + # fi + # done + #fi break fi done @@ -66,7 +66,7 @@ do echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$Web_yn" == 'y' ];then - [ -d "$web_install_dir" ] && echo -e "\033[31mThe web service already installed! \033[0m" && Web_yn=n && break + [ -d "$web_install_dir" ] && { echo -e "\033[31mThe web service already installed! \033[0m" ; Web_yn=n ; break ; } while : do echo @@ -122,7 +122,7 @@ do echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$DB_yn" == 'y' ];then - [ -d "$db_install_dir" ] && echo -e "\033[31mThe database already installed! \033[0m" && DB_yn=n && break + [ -d "$db_install_dir" ] && { echo -e "\033[31mThe database already installed! \033[0m" ; DB_yn=n ; break ; } while : do echo @@ -160,7 +160,7 @@ if [ "$PHP_yn" != 'y' -a "$PHP_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$PHP_yn" == 'y' ];then - [ -d "$php_install_dir" ] && echo -e "\033[31mThe php already installed! \033[0m" && PHP_yn=n && break + [ -d "$php_install_dir" ] && { echo -e "\033[31mThe php already installed! \033[0m" ; PHP_yn=n ; break ; } while : do echo @@ -254,7 +254,7 @@ else while : do read -p "Please input xcache admin password: " xcache_admin_pass - (( ${#xcache_admin_pass} >= 5 )) && xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` && break || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" + (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" done fi if [ "$PHP_version" == '2' -o "$PHP_version" == '3' ];then @@ -270,6 +270,17 @@ else done fi + while : + do + echo + read -p "Do you want to install ionCube? [y/n]: " ionCube_yn + if [ "$ionCube_yn" != 'y' -a "$ionCube_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + while : do echo @@ -296,16 +307,16 @@ else done fi - while : - do - echo - read -p "Do you want to install pecl_http PHP extension(Support HTTP request curls)? [y/n]: " pecl_http_yn - if [ "$pecl_http_yn" != 'y' -a "$pecl_http_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done + #while : + #do + # echo + # read -p "Do you want to install pecl_http PHP extension(Support HTTP request curls)? [y/n]: " pecl_http_yn + # if [ "$pecl_http_yn" != 'y' -a "$pecl_http_yn" != 'n' ];then + # echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + # else + # break + # fi + #done break fi done @@ -325,7 +336,7 @@ do else if [ "$FTP_yn" == 'y' ];then - [ -d "$pureftpd_install_dir" ] && echo -e "\033[31mThe FTP service already installed! \033[0m" && FTP_yn=n && break + [ -d "$pureftpd_install_dir" ] && { echo -e "\033[31mThe FTP service already installed! \033[0m" ; FTP_yn=n ; break ; } while : do read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd @@ -340,6 +351,7 @@ do break fi done +fi # check phpMyAdmin while : @@ -355,7 +367,6 @@ do break fi done -fi # check redis while : @@ -366,7 +377,7 @@ do echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$redis_yn" == 'y' ];then - [ -d "$redis_install_dir" ] && echo -e "\033[31mThe redis already installed! \033[0m" && redis_yn=n && break + [ -d "$redis_install_dir" ] && { echo -e "\033[31mThe redis already installed! \033[0m" ; redis_yn=n ; break ; } fi break fi @@ -381,7 +392,7 @@ do echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else if [ "$memcached_yn" == 'y' ];then - [ -d "$memcached_install_dir" ] && echo -e "\033[31mThe memcached already installed! \033[0m" && memcached_yn=n && break + [ -d "$memcached_install_dir" ] && { echo -e "\033[31mThe memcached already installed! \033[0m" ; memcached_yn=n ; break ; } fi break fi @@ -433,14 +444,14 @@ chmod +x functions/*.sh init/* *.sh # init if [ "$OS" == 'CentOS' ];then - . init/init_CentOS.sh 2>&1 | tee -a $lnmp_dir/install.log + . init/init_CentOS.sh 2>&1 | tee $lnmp_dir/install.log /bin/mv init/init_CentOS.sh init/init_CentOS.ed [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ] && export CC="gcc44" CXX="g++44" elif [ "$OS" == 'Debian' ];then - . init/init_Debian.sh 2>&1 | tee -a $lnmp_dir/install.log + . init/init_Debian.sh 2>&1 | tee $lnmp_dir/install.log /bin/mv init/init_Debian.sh init/init_Debian.ed elif [ "$OS" == 'Ubuntu' ];then - . init/init_Ubuntu.sh 2>&1 | tee -a $lnmp_dir/install.log + . init/init_Ubuntu.sh 2>&1 | tee $lnmp_dir/install.log /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed fi @@ -551,6 +562,12 @@ if [ "$ZendGuardLoader_yn" == 'y' ];then Install_ZendGuardLoader 2>&1 | tee -a $lnmp_dir/install.log fi +# ionCube +if [ "$ionCube_yn" == 'y' ];then + . functions/ioncube.sh + Install_ionCube 2>&1 | tee -a $lnmp_dir/install.log +fi + # Web server if [ "$Nginx_version" == '1' ];then . functions/nginx.sh From c5876e3d6a8383ac5ad195b5342ba59709d7ccac Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 May 2014 23:38:36 +0800 Subject: [PATCH 333/617] ionCude ZendGuardLoader bug --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index ad29f534..7af4d0b1 100755 --- a/install.sh +++ b/install.sh @@ -556,18 +556,18 @@ elif [ "$PHP_cache" == '4' -a "$PHP_version" == '3' ];then Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log fi -# ZendGuardLoader (php <= 5.4) -if [ "$ZendGuardLoader_yn" == 'y' ];then - . functions/ZendGuardLoader.sh - Install_ZendGuardLoader 2>&1 | tee -a $lnmp_dir/install.log -fi - # ionCube if [ "$ionCube_yn" == 'y' ];then . functions/ioncube.sh Install_ionCube 2>&1 | tee -a $lnmp_dir/install.log fi +# ZendGuardLoader (php <= 5.4) +if [ "$ZendGuardLoader_yn" == 'y' ];then + . functions/ZendGuardLoader.sh + Install_ZendGuardLoader 2>&1 | tee -a $lnmp_dir/install.log +fi + # Web server if [ "$Nginx_version" == '1' ];then . functions/nginx.sh From 84a3fc72568b8e0efa9d2aa4c839d51a9f0587be Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 31 May 2014 12:23:31 +0800 Subject: [PATCH 334/617] update MySQL 5.6.17 to 5.6.19 --- functions/mysql-5.6.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 50987197..4886fa25 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.6.17.tar.gz -cd mysql-5.6.17 +tar zxf mysql-5.6.19.tar.gz +cd mysql-5.6.19 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From c823824686a24c340043179d5d53ec835a191965 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 31 May 2014 17:02:58 +0800 Subject: [PATCH 335/617] update php 5.4.28 to 5.4.29 --- functions/php-5.4.sh | 8 ++++---- install.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index f9fdd02e..cdfb3f01 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.28.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.29.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -64,11 +64,11 @@ ldconfig make && make install cd ../ -tar xzf php-5.4.28.tar.gz +tar xzf php-5.4.29.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.28 -p0 < fpm-race-condition.patch -cd php-5.4.28 +patch -d php-5.4.29 -p0 < fpm-race-condition.patch +cd php-5.4.29 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ diff --git a/install.sh b/install.sh index 7af4d0b1..f20eda27 100755 --- a/install.sh +++ b/install.sh @@ -445,14 +445,14 @@ chmod +x functions/*.sh init/* *.sh # init if [ "$OS" == 'CentOS' ];then . init/init_CentOS.sh 2>&1 | tee $lnmp_dir/install.log - /bin/mv init/init_CentOS.sh init/init_CentOS.ed + #/bin/mv init/init_CentOS.sh init/init_CentOS.ed [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ] && export CC="gcc44" CXX="g++44" elif [ "$OS" == 'Debian' ];then . init/init_Debian.sh 2>&1 | tee $lnmp_dir/install.log - /bin/mv init/init_Debian.sh init/init_Debian.ed + #/bin/mv init/init_Debian.sh init/init_Debian.ed elif [ "$OS" == 'Ubuntu' ];then . init/init_Ubuntu.sh 2>&1 | tee $lnmp_dir/install.log - /bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed + #/bin/mv init/init_Ubuntu.sh init/init_Ubuntu.ed fi # Optimization compiled code using safe, sane CFLAGS and CXXFLAGS From 2d58f418b49c99eb2f3a21dbd67c8f9ea76a0ec9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 1 Jun 2014 09:44:40 +0800 Subject: [PATCH 336/617] update MySQL 5.5.37 to 5.5.38 --- functions/mysql-5.5.sh | 6 +++--- functions/php-mysql-client.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 83c95a94..b7d03b96 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mysql-5.5.37.tar.gz -cd mysql-5.5.37 +tar zxf mysql-5.5.38.tar.gz +cd mysql-5.5.38 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 22d78b2f..38bbf55e 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-2.8.12.2.tar.gz @@ -19,8 +19,8 @@ if [ ! -e "`which cmake`" ];then cd .. fi -tar zxf mysql-5.5.37.tar.gz -cd mysql-5.5.37 +tar zxf mysql-5.5.38.tar.gz +cd mysql-5.5.38 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} From 05ea55fc49c9e92b7d8dad9a3187aa3b51006bb2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 1 Jun 2014 14:10:21 +0800 Subject: [PATCH 337/617] update ngx_pagespeed 1.8.31.2-beta to 1.8.31.3-beta --- functions/ngx_pagespeed.sh | 16 ++++++++-------- upgrade_web.sh | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 330b97f7..0bc833d7 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.2.tar.gz && Download_src -[ -s "ngx_pagespeed-1.8.31.2-beta.zip" ] && echo "ngx_pagespeed-1.8.31.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz && Download_src +[ -s "ngx_pagespeed-1.8.31.3-beta.zip" ] && echo "ngx_pagespeed-1.8.31.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.8.31.2-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.2-beta -tar xzf 1.8.31.2.tar.gz -C ngx_pagespeed-1.8.31.2-beta +unzip -q ngx_pagespeed-1.8.31.3-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.3-beta +tar xzf 1.8.31.3.tar.gz -C ngx_pagespeed-1.8.31.3-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.6.0 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.2-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.3-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/upgrade_web.sh b/upgrade_web.sh index 24a62977..eb126d02 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -128,14 +128,14 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then cd $lnmp_dir/src rm -rf ngx_pagespeed* - src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.2.tar.gz && Download_src - [ -s "ngx_pagespeed-1.8.31.2-beta.zip" ] && echo "ngx_pagespeed-1.8.31.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz && Download_src + [ -s "ngx_pagespeed-1.8.31.3-beta.zip" ] && echo "ngx_pagespeed-1.8.31.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip - unzip -q ngx_pagespeed-1.8.31.2-beta.zip - /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.2-beta - tar xzf 1.8.31.2.tar.gz -C ngx_pagespeed-1.8.31.2-beta + unzip -q ngx_pagespeed-1.8.31.3-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.3-beta + tar xzf 1.8.31.3.tar.gz -C ngx_pagespeed-1.8.31.3-beta cd tengine-$tengine_version - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.2-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.3-beta fi kill -USR2 `cat /var/run/nginx.pid` From e30321df4a3fc9b51fae5de4b16e3b8bfeaf7ea8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 1 Jun 2014 16:44:41 +0800 Subject: [PATCH 338/617] add --enable-inline-optimization --- functions/php-5.4.sh | 4 ++-- functions/php-5.5.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index cdfb3f01..62f7cdde 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -75,7 +75,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -84,7 +84,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index e6e1279b..2e97a2a7 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -76,7 +76,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -85,7 +85,7 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug From 1c44507e74b324502df08ac2fb16d0dc53bcfe81 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 2 Jun 2014 23:01:22 +0800 Subject: [PATCH 339/617] set mysqlnd.collect_memory_statistics = On --- functions/php-5.3.sh | 1 + functions/php-5.4.sh | 1 + functions/php-5.5.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 3a24d4c3..584efd5b 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -133,6 +133,7 @@ sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.in sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 62f7cdde..701d106a 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -133,6 +133,7 @@ sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.in sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 2e97a2a7..ef4b978d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -134,6 +134,7 @@ sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.in sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini if [ "$PHP_cache" == '1' ];then From 51873d50bbf98310aed06bcb4da5f63e7f277ed7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 4 Jun 2014 13:08:06 +0800 Subject: [PATCH 340/617] ioncube bug --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index f20eda27..8eefda9f 100755 --- a/install.sh +++ b/install.sh @@ -538,6 +538,12 @@ if [ "$pecl_http_yn" == 'y' ];then Install_pecl_http 2>&1 | tee -a $lnmp_dir/install.log fi +# ionCube +if [ "$ionCube_yn" == 'y' ];then + . functions/ioncube.sh + Install_ionCube 2>&1 | tee -a $lnmp_dir/install.log +fi + # PHP opcode cache if [ "$PHP_cache" == '1' -a "$PHP_version" != '1' ];then . functions/zendopcache.sh @@ -556,12 +562,6 @@ elif [ "$PHP_cache" == '4' -a "$PHP_version" == '3' ];then Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log fi -# ionCube -if [ "$ionCube_yn" == 'y' ];then - . functions/ioncube.sh - Install_ionCube 2>&1 | tee -a $lnmp_dir/install.log -fi - # ZendGuardLoader (php <= 5.4) if [ "$ZendGuardLoader_yn" == 'y' ];then . functions/ZendGuardLoader.sh From 1a9c6b1db0c23f6908df79ace6eb689d4bae35f7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 4 Jun 2014 14:18:22 +0800 Subject: [PATCH 341/617] ionCube bug --- functions/ioncube.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/ioncube.sh b/functions/ioncube.sh index a23362d2..c2ff67c9 100755 --- a/functions/ioncube.sh +++ b/functions/ioncube.sh @@ -30,10 +30,14 @@ elif [ "$PHP_version" == '5.3' ];then zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.3.so" fi -cat >> $php_install_dir/etc/php.ini << EOF +if [ -n "`grep '^\[opcache\]' $php_install_dir/etc/php.ini`" -a -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then + sed -i "s@^\[opcache\]@[ionCube Loader]\nzend_extension=\"$zend_extension\"\n[opcache]@" $php_install_dir/etc/php.ini +elif [ -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then + cat >> $php_install_dir/etc/php.ini << EOF [ionCube Loader] zend_extension="$zend_extension" EOF +fi [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart cd ../ } From 8bcd134c664196bcefb222b48dc06d791112a768 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 5 Jun 2014 12:58:46 +0800 Subject: [PATCH 342/617] pureftpd bug --- functions/pureftpd.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index 7adbb0c1..e248ac1e 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -20,6 +20,7 @@ make && make install if [ -d "$pureftpd_install_dir" ];then echo -e "\033[32mPure-Ftp install successfully! \033[0m" cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin + sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@" $pureftpd_install_dir/sbin/pure-config.pl chmod +x $pureftpd_install_dir/sbin/pure-config.pl cp contrib/redhat.init /etc/init.d/pureftpd cd ../../ @@ -34,6 +35,7 @@ update-rc.d pureftpd defaults" OS_command /bin/cp conf/pure-ftpd.conf $pureftpd_install_dir/ + sed -i "s@^MySQLConfigFile.*@MySQLConfigFile $pureftpd_install_dir/pureftpd-mysql.conf@" $pureftpd_install_dir/pure-ftpd.conf /bin/cp conf/pureftpd-mysql.conf $pureftpd_install_dir/ conn_ftpusers_dbpwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` sed -i "s@^conn_ftpusers_dbpwd.*@conn_ftpusers_dbpwd=$conn_ftpusers_dbpwd@" options.conf From 55d1102630f9dd62e12830c23ba2a8a3d5fbdab2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 6 Jun 2014 10:11:08 +0800 Subject: [PATCH 343/617] update redis 2.8.9 to 2.8.10 --- functions/ImageMagick.sh | 6 +++--- functions/redis.sh | 6 +++--- init/init_CentOS.sh | 2 +- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 5f6bfed8..d0461827 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-1.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-2.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-1.tar.gz -cd ImageMagick-6.8.9-1 +tar xzf ImageMagick-6.8.9-2.tar.gz +cd ImageMagick-6.8.9-2 ./configure make && make install cd ../ diff --git a/functions/redis.sh b/functions/redis.sh index 070c04c1..716493fa 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -27,9 +27,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.9.tar.gz && Download_src -tar xzf redis-2.8.9.tar.gz -cd redis-2.8.9 +src_url=http://download.redis.io/releases/redis-2.8.10.tar.gz && Download_src +tar xzf redis-2.8.10.tar.gz +cd redis-2.8.10 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 123be084..c6e74d64 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -110,7 +110,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -net.ipv4.tcp_fin_timeout = 2 +net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 diff --git a/init/init_Debian.sh b/init/init_Debian.sh index ad44d205..03d56cf3 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -52,7 +52,7 @@ sed -i 's@^# alias@alias@g' ~/.bashrc [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 net.ipv4.tcp_syncookies = 1 -net.ipv4.tcp_fin_timeout = 2 +net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 77a3f946..50a78799 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -58,7 +58,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 net.ipv4.tcp_syncookies = 1 -net.ipv4.tcp_fin_timeout = 2 +net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 From 1e52270a46ffe642c54f375ba4ffcc746cab5b61 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 6 Jun 2014 19:49:01 +0800 Subject: [PATCH 344/617] php extensions bug --- functions/ZendGuardLoader.sh | 13 +++++++------ functions/ioncube.sh | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh index d50b1978..df5c9ede 100755 --- a/functions/ZendGuardLoader.sh +++ b/functions/ZendGuardLoader.sh @@ -11,36 +11,37 @@ cd $lnmp_dir/src php_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` PHP_version=${php_version%.*} +[ ! -e "$php_install_dir/lib/php/extensions/" ] && mkdir $php_install_dir/lib/php/extensions/ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then if [ "$PHP_version" == '5.4' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ fi if [ "$PHP_version" == '5.3' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ fi else if [ "$PHP_version" == '5.4' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ fi if [ "$PHP_version" == '5.3' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ fi fi -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ZendGuardLoader.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/ZendGuardLoader.so" ];then cat >> $php_install_dir/etc/php.ini << EOF [Zend Guard Loader] -zend_extension="/usr/local/php/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ZendGuardLoader.so" +zend_extension="/usr/local/php/lib/php/extensions/ZendGuardLoader.so" zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 diff --git a/functions/ioncube.sh b/functions/ioncube.sh index c2ff67c9..7ea29216 100755 --- a/functions/ioncube.sh +++ b/functions/ioncube.sh @@ -19,15 +19,16 @@ else tar xzf ioncube_loaders_lin_x86.tar.gz fi +[ ! -e "$php_install_dir/lib/php/extensions/" ] && mkdir $php_install_dir/lib/php/extensions/ if [ "$PHP_version" == '5.5' ];then - /bin/cp ioncube/ioncube_loader_lin_5.5.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ - zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.5.so" + /bin/cp ioncube/ioncube_loader_lin_5.5.so $php_install_dir/lib/php/extensions/ + zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.5.so" elif [ "$PHP_version" == '5.4' ];then - /bin/cp ioncube/ioncube_loader_lin_5.4.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ - zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.4.so" + /bin/cp ioncube/ioncube_loader_lin_5.4.so $php_install_dir/lib/php/extensions/ + zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.4.so" elif [ "$PHP_version" == '5.3' ];then - /bin/cp ioncube/ioncube_loader_lin_5.3.so $php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ - zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/ioncube_loader_lin_5.3.so" + /bin/cp ioncube/ioncube_loader_lin_5.3.so $php_install_dir/lib/php/extensions/ + zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.3.so" fi if [ -n "`grep '^\[opcache\]' $php_install_dir/etc/php.ini`" -a -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then From 26a98ff65c82a2bb72ae5d4d93e085f257cbc409 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 9 Jun 2014 13:28:06 +0800 Subject: [PATCH 345/617] add sendmail --- functions/redis.sh | 4 ++-- init/init_CentOS.sh | 4 ++-- init/init_Debian.sh | 4 ++-- init/init_Ubuntu.sh | 4 ++-- install.sh | 24 ++++++++++++------------ uninstall.sh | 2 ++ 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 716493fa..80e06179 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -72,8 +72,8 @@ chown -R redis:redis $redis_install_dir/var/ \n update-rc.d redis-server defaults" OS_command sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server - echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf - sysctl -p + #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf + #sysctl -p service redis-server start else cd ../../ diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c6e74d64..dd2253f4 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -48,7 +48,7 @@ yum check-update [ "$upgrade_yn" == 'y' ] && yum -y upgrade # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch +yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync # use gcc-4.4 if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then @@ -140,7 +140,7 @@ init q # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/root;chmod 600 /var/spool/cron/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root service crond restart # iptables diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 03d56cf3..b0bed46e 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -11,7 +11,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync # PS1 [ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc @@ -78,7 +78,7 @@ init q # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root service cron restart # iptables diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 50a78799..bd41f83d 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -11,7 +11,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget +apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget bc expect rsync if [ ! -z "`cat /etc/issue | grep 13`" ];then apt-get -y install libcloog-ppl1 @@ -80,7 +80,7 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" > /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root service cron restart # iptables diff --git a/install.sh b/install.sh index 8eefda9f..0391d842 100755 --- a/install.sh +++ b/install.sh @@ -41,18 +41,18 @@ do else [ -e init/init_*.ed -a "$upgrade_yn" == 'y' ] && { echo -e "\033[31mYour system is already upgraded! \033[0m" ; upgrade_yn=n ; } # check sendmail - #if [ "$OS" != 'Debian' ];then - # while : - # do - # echo - # read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn - # if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then - # echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - # else - # break - # fi - # done - #fi + if [ "$OS" != 'Debian' ];then + while : + do + echo + read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + fi break fi done diff --git a/uninstall.sh b/uninstall.sh index 90fd3290..f2cdc7db 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -24,6 +24,8 @@ Uninstall() [ -e "$redis_install_dir" ] && service redis-server stop && rm -rf /etc/init.d/redis-server [ -e "$memcached_install_dir" ] && service memcached stop && rm -rf /etc/init.d/memcached +/bin/mv ${home_dir}{,_$(date +%F)} +/bin/mv ${db_data_dir}{,_$(date +%F)} for D in `cat ./options.conf | grep dir= | grep -v lnmp | awk -F'=' '{print $2}' | sort | uniq` do [ -e "$D" ] && rm -rf $D From 42f1a88f14f460e9a5797d99d5d52f82ebf59c26 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 9 Jun 2014 17:31:29 +0800 Subject: [PATCH 346/617] add backup scripts --- backup.sh | 55 ++++++++++++++ backup_setup.sh | 123 +++++++++++++++++++++++++++++++ options.conf | 15 ++++ tools/ckssh.py | 13 ++++ tools/db_bk.sh | 33 +++++++++ tools/mabs.sh | 172 ++++++++++++++++++++++++++++++++++++++++++++ tools/mscp.exp | 158 ++++++++++++++++++++++++++++++++++++++++ tools/mssh.exp | 129 +++++++++++++++++++++++++++++++++ tools/thread.sh | 46 ++++++++++++ tools/website_bk.sh | 13 ++++ 10 files changed, 757 insertions(+) create mode 100755 backup.sh create mode 100755 backup_setup.sh create mode 100755 tools/ckssh.py create mode 100755 tools/db_bk.sh create mode 100755 tools/mabs.sh create mode 100755 tools/mscp.exp create mode 100755 tools/mssh.exp create mode 100755 tools/thread.sh create mode 100755 tools/website_bk.sh diff --git a/backup.sh b/backup.sh new file mode 100755 index 00000000..8ccdd71b --- /dev/null +++ b/backup.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +. ./options.conf +DB_Local_BK() { + for D in `echo $db_name | tr ',' ' '` + do + cd $lnmp_dir/tools + ./db_bk.sh $D + done +} + +DB_Remote_BK() { + for D in `echo $db_name | tr ',' ' '` + do + cd $lnmp_dir/tools + ./db_bk.sh $D + echo "file:::$backup_dir/DB_${D}_$(date +%Y%m%d).tgz $backup_dir push" >> $lnmp_dir/tools/config.txt + echo "com:::[ -e "$backup_dir/DB_${D}_$(date +%Y%m%d).tgz" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago").tgz" >> $lnmp_dir/tools/config.txt + done +} + +WEB_Local_BK() { + for W in `echo $website_name | tr ',' ' '` + do + cd $lnmp_dir/tools + ./website_bk.sh $W + done +} + +WEB_Remote_BK() { + for W in `echo $website_name | tr ',' ' '` + do + cd $lnmp_dir/tools + echo "file:::$home_dir/$W $backup_dir push" >> $lnmp_dir/tools/config.txt + done +} + +if [ "$local_bankup_yn" == 'y' -a "$remote_bankup_yn" == 'n' ];then + WEB_Local_BK + DB_Local_BK +elif [ "$local_bankup_yn" == 'n' -a "$remote_bankup_yn" == 'y' ];then + echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > $lnmp_dir/tools/config.txt + DB_Remote_BK + WEB_Remote_BK + ./mabs.sh | tee mabs.log +elif [ "$local_bankup_yn" == 'y' -a "$remote_bankup_yn" == 'y' ];then + echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > $lnmp_dir/tools/config.txt + WEB_Local_BK + WEB_Remote_BK + DB_Local_BK + DB_Remote_BK + ./mabs.sh | tee mabs.log +fi diff --git a/backup_setup.sh b/backup_setup.sh new file mode 100755 index 00000000..031bc02b --- /dev/null +++ b/backup_setup.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +while : +do + echo + echo 'Please select your backup destination:' + echo -e "\t\033[32m1\033[0m. Only Localhost" + echo -e "\t\033[32m2\033[0m. Only Remote host" + echo -e "\t\033[32m3\033[0m. Localhost and remote host" + read -p "Please input a number:(Default 1 press Enter) " DESC_BK + [ -z "$DESC_BK" ] && DESC_BK=1 + if [ $DESC_BK != 1 -a $DESC_BK != 2 -a $DESC_BK != 3 ];then + echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" + else + break + fi +done + +[ "$DESC_BK" == '1' ] && { sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf; sed -i 's@remote_bankup_yn=.*@remote_bankup_yn=n@' ./options.conf; } +[ "$DESC_BK" == '2' ] && { sed -i 's@^local_bankup_yn=.*@local_bankup_yn=n@' ./options.conf; sed -i 's@remote_bankup_yn=.*@remote_bankup_yn=y@' ./options.conf; } +[ "$DESC_BK" == '3' ] && { sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf; sed -i 's@remote_bankup_yn=.*@remote_bankup_yn=y@' ./options.conf; } + +. ./options.conf + +while : +do + echo + echo "Please enter the directory for save the backup file: " + read -p "(Default directory: /home/backup): " backup_dir + [ -z "$backup_dir" ] && backup_dir="/home/backup" + if [ -z "`echo $backup_dir | grep '^/'`" ]; then + echo -e "\033[31minput error! \033[0m" + else + break + fi +done +sed -i "s@^backup_dir=.*@backup_dir=$backup_dir@" ./options.conf + +while : +do + echo + echo "Pleas enter a valid backup number of days: " + read -p "(Default days: 5): " expired_days + [ -z "$expired_days" ] && expired_days=5 + [ -n "`echo $expired_days | sed -n "/^[0-9]\+$/p"`" ] && break || echo -e "\033[31minput error! Please only enter numbers! \033[0m" +done +sed -i "s@^expired_days=.*@expired_days=$expired_days@" ./options.conf + +databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|ftpusers)"` +while : +do + echo + echo "Please enter one or more name for database, separate multiple database names with commas: " + read -p "(Default database: `echo $databases | tr ' ' ','`) " db_name + db_name=`echo $db_name | tr -d ' '` + [ -z "$db_name" ] && db_name="`echo $databases | tr ' ' ','`" + D_tmp=0 + echo $db_name + for D in `echo $db_name | tr ',' ' '` + do + [ -z "`echo $databases | grep -w $D`" ] && { echo -e "\033[31m$D not exist! \033[0m" ; D_tmp=1; } + done + [ "$D_tmp" != '1' ] && break +done +sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf + +websites=`ls $home_dir | grep -vw default` +while : +do + echo + echo "Please enter one or more name for website, separate multiple website names with commas: " + read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name + website_name=`echo $website_name | tr -d ' '` + [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`" + W_tmp=0 + echo $db_name + for W in `echo $website_name | tr ',' ' '` + do + [ ! -e "$home_dir/$W" ] && { echo -e "\033[31m$home_dir/$W not exist! \033[0m" ; W_tmp=1; } + done + [ "$W_tmp" != '1' ] && break +done +echo $website_name +sed -i "s@^website_name=.*@website_name=$website_name@" ./options.conf + +if [ "$remote_bankup_yn" == 'y' ];then + > tools/iplist.txt + while : + do + echo + read -p "Please enter the remote host ip: " remote_ip + [ -z "$remote_ip" ] && continue + echo + read -p "Please enter the remote host port(Default: 22) : " remote_port + [ -z "$remote_port" ] && remote_port=22 + echo + read -p "Please enter the remote host user(Default: root) : " remote_user + [ -z "$remote_user" ] && remote_user=root + echo + read -p "Please enter the remote host password: " remote_password + IPcode=$(echo "ibase=16;$(echo "$remote_ip" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Portcode=$(echo "ibase=16;$(echo "$remote_port" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + PWcode=$(echo "ibase=16;$(echo "$remote_password" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + [ -e "~/.ssh/known_hosts" ] && grep $remote_ip ~/.ssh/known_hosts | sed -i "/$remote_ip/d" ~/.ssh/known_hosts + ./tools/mssh.exp ${IPcode}P $remote_user ${PWcode}P ${Portcode}P true 10 + if [ $? -eq 0 ];then + [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo -e "\033[31m$remote_ip has been added! \033[0m" + while : + do + echo + read -p "Do you want to add more host ? [y/n]: " more_host_yn + if [ "$more_host_yn" != 'y' -a "$more_host_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + [ "$more_host_yn" == 'n' ] && break + fi + done +fi diff --git a/options.conf b/options.conf index f0c0cb80..bec87696 100644 --- a/options.conf +++ b/options.conf @@ -44,3 +44,18 @@ dbrootpwd= ftpmanagerpwd= conn_ftpusers_dbpwd= + +######################################################################### +# Backup Dest directory, change this if you have someother location +backup_dir=/home/backup + +# How many days before the backup directory will be removed +expired_days=5 + +db_name= + +website_name= + +local_bankup_yn=y + +remote_bankup_yn=n diff --git a/tools/ckssh.py b/tools/ckssh.py new file mode 100755 index 00000000..24d4988c --- /dev/null +++ b/tools/ckssh.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +# Author: yeho +# Blog: http://blog.linuxeye.com + +import socket,sys +sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +sk.settimeout(1) +try: + sk.connect((sys.argv[1],int(sys.argv[2]))) + print 'ok' +except Exception: + print 'no' +sk.close() diff --git a/tools/db_bk.sh b/tools/db_bk.sh new file mode 100755 index 00000000..3c87f6eb --- /dev/null +++ b/tools/db_bk.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +. ../options.conf + +DBname=$1 +LogFile=$backup_dir/db.log +DumpFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d).sql +NewFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d).tgz +OldFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago").tgz + +[ ! -e "$backup_dir" ] && mkdir -p $backup_dir + +DB_tmp=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep $DBname` +[ -z "$DB_tmp" ] && { echo "[$DBname] not exist" >> $LogFile ; exit 1 ; } + +if [ -f $OldFile ];then + rm -f $OldFile + echo "[$OldFile] Delete Old File Success" >> $LogFile +else + echo "[$OldFile] Delete Old Backup File" >> $LogFile +fi + +if [ -f $NewFile ];then + echo "[$NewFile] The Backup File is exists,Can't Backup" >> $LogFile +else + $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --opt --databases $DBname > $DumpFile + cd $backup_dir + tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1 + echo "[$NewFile] Backup success ">> $LogFile + /bin/rm -f $DumpFile +fi diff --git a/tools/mabs.sh b/tools/mabs.sh new file mode 100755 index 00000000..2f1b8182 --- /dev/null +++ b/tools/mabs.sh @@ -0,0 +1,172 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +###################### proc defination ######################## +# ignore rule +ignore_init() +{ + # ignore password + array_ignore_pwd_length=0 + if [ -f ./ignore_pwd ]; then + while read IGNORE_PWD + do + array_ignore_pwd[$array_ignore_pwd_length]=$IGNORE_PWD + let array_ignore_pwd_length=$array_ignore_pwd_length+1 + done < ./ignore_pwd + fi + + # ignore ip address + array_ignore_ip_length=0 + if [ -f ./ignore_ip ]; then + while read IGNORE_IP + do + array_ignore_ip[$array_ignore_ip_length]=$IGNORE_IP + let array_ignore_ip_length=$array_ignore_ip_length+1 + done < ./ignore_ip + fi +} + +show_version() +{ + echo "version: 1.0" + echo "updated date: 2014-06-08" +} + +show_usage() +{ + echo -e "`printf %-16s "Usage: $0"` [-h|--help]" + echo -e "`printf %-16s ` [-v|-V|--version]" + echo -e "`printf %-16s ` [-l|--iplist ... ]" + echo -e "`printf %-16s ` [-c|--config ... ]" + echo -e "`printf %-16s ` [-t|--sshtimeout ... ]" + echo -e "`printf %-16s ` [-T|--fttimeout ... ]" + echo -e "`printf %-16s ` [-L|--bwlimit ... ]" + echo -e "`printf %-16s ` [-n|--ignore]" +} + +IPLIST="iplist.txt" +CONFIG_FILE="config.txt" +IGNRFLAG="noignr" +SSHTIMEOUT=100 +SCPTIMEOUT=2000 +BWLIMIT=1024000 +[ ! -e 'logs' ] && mkdir logs + +TEMP=`getopt -o hvVl:c:t:T:L:n --long help,version,iplist:,config:,sshtimeout:,fttimeout:,bwlimit:,log:,ignore -- "$@" 2>/dev/null` + +[ $? != 0 ] && echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 + +eval set -- "$TEMP" + +while : +do + [ -z "$1" ] && break; + case "$1" in + -h|--help) + show_usage; exit 0 + ;; + -v|-V|--version) + show_version; exit 0 + ;; + -l|--iplist) + IPLIST=$2; shift 2 + ;; + -c|--config) + CONFIG_FILE=$2; shift 2 + ;; + -t|--sshtimeout) + SSHTIMEOUT=$2; shift 2 + ;; + -T|--fttimeout) + SCPTIMEOUT=$2; shift 2 + ;; + -L|--bwlimit) + BWLIMIT=$2; shift 2 + ;; + --log) + LOG_FILE=$2; shift 2 + ;; + -n|--ignore) + IGNRFLAG="ignr"; shift + ;; + --) + shift + ;; + *) + echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 + ;; + esac +done + +################ main ####################### +BEGINDATETIME=`date "+%F %T"` +[ ! -f $IPLIST ] && echo -e "\033[31mERROR: iplist \"$IPLIST\" not exists, please check! \033[0m\n" && exit 1 + +[ ! -f $CONFIG_FILE ] && echo -e "\033[31mERROR: config \"$CONFIG_FILE\" not exists, please check! \033[0m\n" && exit 1 + +IP_count=$(egrep -v '^#|^$' $IPLIST|wc -l) +IP_init=1 +while [[ $IP_init -le $IP_count ]] +do + egrep -v '^#|^$' $IPLIST | sed -n "$IP_init,$(expr $IP_init + 50)p" > $IPLIST.tmp + + IPSEQ=0 + + while read IP PORT USER PASSWD PASSWD_2ND PASSWD_3RD PASSWD_4TH OTHERS + # while read Line + do + [ -z "`echo $IP | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|CNS'`" ] && continue + if [ "`python ./ckssh.py $IP $PORT`" == 'no' ];then + [ ! -e ipnologin.txt ] && > ipnologin.txt + [ -z "`grep $IP ipnologin.txt | grep $(date +%F)`" ] && echo "`date +%F_%H%M` $IP" >> ipnologin.txt + continue + fi + + #[ -e "~/.ssh/known_hosts" ] && grep $IP ~/.ssh/known_hosts | sed -i "/$IP/d" ~/.ssh/known_hosts + + let IPSEQ=$IPSEQ+1 + + if [ $IGNRFLAG == "ignr" ]; then + ignore_init + ignored_flag=0 + + i=0 + while [ $i -lt $array_ignore_pwd_length ] + do + [ ${PASSWD}x == ${array_ignore_pwd[$i]}x ] && ignored_flag=1 && break + let i=$i+1 + done + + [ $ignored_flag -eq 1 ] && continue + + j=0 + while [ $j -lt $array_ignore_ip_length ] + do + [ ${IP}x == ${array_ignore_ip[$j]}x ] && ignored_flag=1 && break + let j=$j+1 + done + + [ $ignored_flag -eq 1 ] && continue + fi + + PASSWD_USE=$PASSWD + + IPcode=$(echo "ibase=16;$(echo "$IP" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Portcode=$(echo "ibase=16;$(echo "$PORT" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + #USER=$USER + PWcode=$(echo "ibase=16;$(echo "$PASSWD_USE" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Othercode=$(echo "ibase=16;$(echo "$OTHERS" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + #echo $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode + ./thread.sh $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode | tee logs/$IP.log & + done < $IPLIST.tmp + sleep 3 + IP_init=$(expr $IP_init + 50) +done + +ENDDATETIME=`date "+%F %T"` + +echo "$BEGINDATETIME -- $ENDDATETIME" +echo "$0 $* --excutes over!" + +exit 0 diff --git a/tools/mscp.exp b/tools/mscp.exp new file mode 100755 index 00000000..f9281a09 --- /dev/null +++ b/tools/mscp.exp @@ -0,0 +1,158 @@ +#!/usr/bin/expect -- + +proc Usage_Exit {self} { + puts "" + puts "Usage: $self ip user passwd port sourcefile destdir direction bwlimit timeout" + puts "" + puts " sourcefile: a file or directory to be transferred" + puts " 需要拷贝目录时目录名后不要带 /, 否则会拷贝该目录下的所有文件" + puts " destdir: the location that the sourcefile to be put into" + puts " direction: pull or push" + puts " pull: remote -> local" + puts " push: local -> remote" + puts " bwlimit: bandwidth limit, kbit/s, 0 means no limit" + puts " timeout: timeout of expect, s, -1 means no timeout" + puts "" + exit 1 +} + +if { [llength $argv] < 9 } { + Usage_Exit $argv0 +} + +set ipcode [lindex $argv 0] +set ip [exec dc -e $ipcode] +set user [lindex $argv 1] +set passwduncode [lindex $argv 2] +set passwd [exec dc -e $passwduncode] +set portcode [lindex $argv 3] +set port [exec dc -e $portcode] +set sourcefile [lindex $argv 4] +set destdir [lindex $argv 5] +set direction [lindex $argv 6] +set bwlimit [lindex $argv 7] +set timeoutflag [lindex $argv 8] + +set yesnoflag 0 +set timeout $timeoutflag + +for {} {1} {} { +# for is only used to retry when "Interrupted system call" occured + +if { $direction == "pull" } { + + if { $bwlimit > 0 } { + spawn rsync -crazP --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + } elseif { $bwlimit == 0 } { + spawn rsync -crazP -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + } else { + Usage_Exit $argv0 + } + +} elseif { $direction == "push" } { + + if { $bwlimit > 0 } { + spawn rsync -crazP --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + } elseif { $bwlimit == 0 } { + spawn rsync -crazP -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + } else { + Usage_Exit $argv0 + } + +} else { + Usage_Exit $argv0 +} + +expect { + + "assword:" { + send "$passwd\r" + break; + } + + "yes/no)?" { + set yesnoflag 1 + send "yes\r" + break; + } + + "FATAL" { + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 + } + + timeout { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "No route to host" { + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 + } + + "Connection Refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Connection refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Host key verification failed" { + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 + } + + "Illegal host key" { + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 + } + + "Connection Timed Out" { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "Interrupted system call" { + puts "\n$ip Interrupted system call!!!\n" + } +} + +} + +if { $yesnoflag == 1 } { + expect { + "assword:" { + send "$passwd\r" + } + + "yes/no)?" { + set yesnoflag 2 + send "yes\r" + } + } +} + +if { $yesnoflag == 2 } { + expect { + "assword:" { + send "$passwd\r" + } + } +} + +expect { + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } + + eof { + puts "OK_SCP: $ip\n" + exit 0; + } +} diff --git a/tools/mssh.exp b/tools/mssh.exp new file mode 100755 index 00000000..9bd5f215 --- /dev/null +++ b/tools/mssh.exp @@ -0,0 +1,129 @@ +#!/usr/bin/expect -- + +if { [llength $argv] < 4 } { + puts "Usage: $argv0 ip user passwd port commands timeout" + exit 1 +} + +match_max 600000 + +set ipcode [lindex $argv 0] +set ip [exec dc -e $ipcode] +set user [lindex $argv 1] +set passwdcode [lindex $argv 2] +set passwd [exec dc -e $passwdcode] +set portcode [lindex $argv 3] +set port [exec dc -e $portcode] +set commands [lindex $argv 4] +set timeoutflag [lindex $argv 5] + +set yesnoflag 0 +set timeout $timeoutflag + + +for {} {1} {} { +# for is only used to retry when "Interrupted system call" occured + +spawn /usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port $ip + +expect { + + "assword:" { + send "$passwd\r" + break; + } + + "yes/no)?" { + set yesnoflag 1 + send "yes\r" + break; + } + + "FATAL" { + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 + } + + timeout { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "No route to host" { + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 + } + + "Connection Refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Connection refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Host key verification failed" { + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 + } + + "Illegal host key" { + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 + } + + "Connection Timed Out" { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "Interrupted system call" { + puts "\n$ip Interrupted system call!!!\n" + } +} +} + +if { $yesnoflag == 1 } { + expect { + "assword:" { + send "$passwd\r" + } + + "yes/no)?" { + set yesnoflag 2 + send "yes\r" + } + } +} + +if { $yesnoflag == 2 } { + expect { + "assword:" { + send "$passwd\r" + } + } +} + +expect { + "]" {send "$commands \r"} + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } +} + +expect { + "]" {send "sleep 1 \r"} +} + +expect { + "]" {send "exit\r"} +} + +expect eof { + puts "OK_SSH: $ip\n" + exit 0; +} diff --git a/tools/thread.sh b/tools/thread.sh new file mode 100755 index 00000000..02aeb8b4 --- /dev/null +++ b/tools/thread.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +# Default Parameters +myIFS=":::" + +IP=$1P +PORT=$2P +USER=$3 +PASSWD=$4P +CONFIG_FILE=$5 +SSHTIMEOUT=$6 +SCPTIMEOUT=$7 +BWLIMIT=$8 + +while read eachline +do + [ -z "`echo $eachline | grep -E '^com|^file'`" ] && continue + + myKEYWORD=`echo $eachline | awk -F"$myIFS" '{ print $1 }'` + myCONFIGLINE=`echo $eachline | awk -F"$myIFS" '{ print $2 }'` + + if [ "$myKEYWORD"x == "file"x ]; then + SOURCEFILE=`echo $myCONFIGLINE | awk '{ print $1 }'` + DESTDIR=`echo $myCONFIGLINE | awk '{ print $2 }'` + DIRECTION=`echo $myCONFIGLINE | awk '{ print $3 }'` + ./mscp.exp $IP $USER $PASSWD $PORT $SOURCEFILE $DESTDIR $DIRECTION $BWLIMIT $SCPTIMEOUT + + [ $? -ne 0 ] && echo -e "\033[31mSCP Try Out All Password Failed\033[0m\n" + + elif [ "$myKEYWORD"x == "com"x ]; then + ./mssh.exp $IP $USER $PASSWD $PORT "${myCONFIGLINE}" $SSHTIMEOUT + [ $? -ne 0 ] && echo -e "\033[31mSSH Try Out All Password Failed\033[0m\n" + + else + echo "ERROR: configuration wrong! [$eachline] " + echo " where KEYWORD should not be [$myKEYWORD], but 'com' or 'file'" + echo " if you dont want to run it, you can comment it with '#'" + echo "" + exit + fi + +done < $CONFIG_FILE + +exit 0 diff --git a/tools/website_bk.sh b/tools/website_bk.sh new file mode 100755 index 00000000..ed76bd36 --- /dev/null +++ b/tools/website_bk.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +. ../options.conf + +WebSite=$1 +LogFile=$backup_dir/website.log +[ ! -e "$home_dir/$WebSite" ] && { echo "[$home_dir/$WebSite] not exist" >> $LogFile ; exit 1 ; } + +[ ! -e "$backup_dir" ] && mkdir -p $backup_dir + +rsync -crazP --delete $home_dir/$WebSite $backup_dir From 7db878391f5305b39d2e3abad1929d87535e2296 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Jun 2014 16:52:00 +0800 Subject: [PATCH 347/617] update mariadb 5.5.37 to 5.5.38 --- README.md | 23 +++++++++++++++++------ functions/ImageMagick.sh | 6 +++--- functions/apache-2.2.sh | 5 +++-- functions/apache-2.4.sh | 3 ++- functions/mariadb-10.0.sh | 4 ++-- functions/mariadb-5.5.sh | 10 +++++----- functions/mysql-5.5.sh | 4 ++-- functions/mysql-5.6.sh | 4 ++-- functions/nginx.sh | 6 +++--- functions/percona-5.5.sh | 4 ++-- functions/percona-5.6.sh | 4 ++-- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/tengine.sh | 6 +++--- 15 files changed, 49 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index c53bb07a..5f276e5b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ - According to their needs can to install memcached, redis - According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc - Add a virtual host script provided +- Nginx/Tengine, PHP, Redis, phpMyAdmin upgrade script provided +- Add backup script provided ## How to use @@ -30,6 +32,21 @@ ./install.sh ``` +## How to add a virtual host + +```bash + ./vhost.sh +``` + +## Hown to backup + +```bash + ./backup_setup.sh # Set backup options + ./backup.sh # Start backup, You can add cron jobs + # crontab -l # Examples + 0 1 * * * cd ~/lnmp;./backup.sh > /dev/null 2>&1 & +``` + ## How to manage service Nginx/Tengine: ```bash @@ -60,12 +77,6 @@ Memcached: service memcached {start|stop|status|restart|reload|force-reload} ``` -## How to add a virtual host - -```bash - ./vhost.sh -``` - ## How to upgrade ```bash ./upgrade_php.sh # upgrade PHP diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index d0461827..7d4f8d8d 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-2.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-3.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-2.tar.gz -cd ImageMagick-6.8.9-2 +tar xzf ImageMagick-6.8.9-3.tar.gz +cd ImageMagick-6.8.9-3 ./configure make && make install cd ../ diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index f20eb294..46ac3271 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -23,7 +23,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$apache_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile . /etc/profile cd .. @@ -98,12 +98,13 @@ ServerSignature Off AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript DeflateCompressionLevel 6 SetOutputFilter DEFLATE +Include conf/vhost/default.conf Include conf/vhost/*.conf EOF if [ "$Nginx_version" != '3' ];then mkdir mod_remoteip;cd mod_remoteip - src_url=https://raw.github.com/ttkzw/mod_remoteip-httpd22/master/mod_remoteip.c && Download_src + src_url=https://raw.githubusercontent.com/ttkzw/mod_remoteip-httpd22/master/mod_remoteip.c && Download_src $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 07225b43..1605c7a6 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -36,7 +36,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$apache_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $apache_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile . /etc/profile cd .. @@ -111,6 +111,7 @@ ServerSignature Off AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript DeflateCompressionLevel 6 SetOutputFilter DEFLATE +Include conf/vhost/default.conf Include conf/vhost/*.conf EOF diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 4065a429..9f819304 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -187,8 +187,8 @@ $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_in chown mysql.mysql -R $mariadb_data_dir service mysqld start -export PATH=$PATH:$mariadb_install_dir/bin -echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile +export PATH=$mariadb_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $mariadb_install_dir`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile . /etc/profile $mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 95e608fb..812edc9b 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-5.5.37/source/mariadb-5.5.37.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.38/source/mariadb-5.5.38.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-5.5.37.tar.gz -cd mariadb-5.5.37 +tar zxf mariadb-5.5.38.tar.gz +cd mariadb-5.5.38 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -187,8 +187,8 @@ $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_in chown mysql.mysql -R $mariadb_data_dir service mysqld start -export PATH=$PATH:$mariadb_install_dir/bin -echo "export PATH=\$PATH:$mariadb_install_dir/bin" >> /etc/profile +export PATH=$mariadb_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $mariadb_install_dir`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile . /etc/profile $mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index b7d03b96..3d7bf18f 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -184,8 +184,8 @@ $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_instal chown mysql.mysql -R $mysql_data_dir service mysqld start -export PATH=$PATH:$mysql_install_dir/bin -echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile +export PATH=$mysql_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $mysql_install_dir`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile . /etc/profile $mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 4886fa25..a621bc0c 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -184,8 +184,8 @@ $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_instal chown mysql.mysql -R $mysql_data_dir service mysqld start -export PATH=$PATH:$mysql_install_dir/bin -echo "export PATH=\$PATH:$mysql_install_dir/bin" >> /etc/profile +export PATH=$mysql_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $mysql_install_dir`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile . /etc/profile $mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" diff --git a/functions/nginx.sh b/functions/nginx.sh index 72564565..25aa682c 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -47,7 +47,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $nginx_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$nginx_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $nginx_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/bin:\1@" /etc/profile . /etc/profile cd ../../ @@ -59,13 +59,13 @@ update-rc.d nginx defaults' OS_command sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx -mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk -sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf +mv $nginx_install_dir/conf/nginx.conf{,_bk} if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then /bin/cp conf/nginx_apache.conf $nginx_install_dir/conf/nginx.conf else /bin/cp conf/nginx.conf $nginx_install_dir/conf/nginx.conf fi +sed -i "s@/home/wwwroot/default@$home_dir/default@" $nginx_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index afd7691b..99a01d1d 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -183,8 +183,8 @@ $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_in chown mysql.mysql -R $percona_data_dir service mysqld start -export PATH=$PATH:$percona_install_dir/bin -echo "export PATH=\$PATH:$percona_install_dir/bin" >> /etc/profile +export PATH=$percona_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $percona_install_dir`" ] && echo "export PATH=$percona_install_dir/bin:\$PATH" >> /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;" diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 0ff4eb56..78972d9d 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -183,8 +183,8 @@ $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_in chown mysql.mysql -R $percona_data_dir service mysqld start -export PATH=$PATH:$percona_install_dir/bin -echo "export PATH=\$PATH:$percona_install_dir/bin" >> /etc/profile +export PATH=$percona_install_dir/bin:$PATH +[ -z "`cat /etc/profile | grep $percona_install_dir`" ] && echo "export PATH=$percona_install_dir/bin:\$PATH" >> /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;" diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 584efd5b..89e037a7 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -99,7 +99,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile # wget -c http://pear.php.net/go-pear.phar diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 701d106a..23377ae4 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -99,7 +99,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile # wget -c http://pear.php.net/go-pear.phar diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index ef4b978d..3e610df9 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -100,7 +100,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$php_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile # wget -c http://pear.php.net/go-pear.phar diff --git a/functions/tengine.sh b/functions/tengine.sh index da5365fc..a519273c 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -49,7 +49,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $tengine_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\1:$tengine_install_dir/bin@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $tengine_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/bin:\1@" /etc/profile . /etc/profile cd ../../ @@ -61,13 +61,13 @@ update-rc.d nginx defaults' OS_command sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx -mv $tengine_install_dir/conf/nginx.conf $tengine_install_dir/conf/nginx.conf_bk -sed -i "s@/home/wwwroot/default@$home_dir/default@" conf/nginx.conf +mv $tengine_install_dir/conf/nginx.conf{,_bk} if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then /bin/cp conf/nginx_apache.conf $tengine_install_dir/conf/nginx.conf else /bin/cp conf/nginx.conf $tengine_install_dir/conf/nginx.conf fi +sed -i "s@/home/wwwroot/default@$home_dir/default@" $tengine_install_dir/conf/nginx.conf sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf From 64a59f64c632040998d99a4fff223c3178582644 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Jun 2014 17:02:43 +0800 Subject: [PATCH 348/617] update phpMyAdmin 4.2.2 to 4.2.3 --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index e5aff073..e8c7c659 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.3/phpMyAdmin-4.2.3-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.2-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.2-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.3-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.3-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From df9ec0241b5a40c8d53a2ab85b77e22cc77df313 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Jun 2014 17:55:38 +0800 Subject: [PATCH 349/617] apache nginx bug --- functions/apache-2.2.sh | 3 +-- functions/apache-2.4.sh | 3 +-- vhost.sh | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index 46ac3271..e0922852 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -73,7 +73,7 @@ endscript EOF mkdir $apache_install_dir/conf/vhost -cat > $apache_install_dir/conf/vhost/default.conf << EOF +cat >> $apache_install_dir/conf/httpd.conf << EOF NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com @@ -98,7 +98,6 @@ ServerSignature Off AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript DeflateCompressionLevel 6 SetOutputFilter DEFLATE -Include conf/vhost/default.conf Include conf/vhost/*.conf EOF diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 1605c7a6..38eb82e0 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -86,7 +86,7 @@ endscript EOF mkdir $apache_install_dir/conf/vhost -cat > $apache_install_dir/conf/vhost/default.conf << EOF +cat >> $apache_install_dir/conf/httpd.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$home_dir/default" @@ -111,7 +111,6 @@ ServerSignature Off AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript DeflateCompressionLevel 6 SetOutputFilter DEFLATE -Include conf/vhost/default.conf Include conf/vhost/*.conf EOF diff --git a/vhost.sh b/vhost.sh index 24535f84..de3afd8a 100755 --- a/vhost.sh +++ b/vhost.sh @@ -224,7 +224,7 @@ if [ $? == 0 ];then echo "Restart Nginx......" $web_install_dir/sbin/nginx -s reload else - rm -rf $web_install_dir/conf/vhost/$domain.conf $vhostdir + rm -rf $web_install_dir/conf/vhost/$domain.conf echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" exit 1 fi @@ -292,7 +292,7 @@ if [ $? == 0 ];then echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf $apache_install_dir/conf/vhost/$domain.conf $vhostdir + rm -rf $apache_install_dir/conf/vhost/$domain.conf echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" exit 1 fi @@ -353,7 +353,7 @@ if [ $? == 0 ];then echo "Restart Nginx......" $web_install_dir/sbin/nginx -s reload else - rm -rf $web_install_dir/conf/vhost/$domain.conf $vhostdir + rm -rf $web_install_dir/conf/vhost/$domain.conf echo -e "Create virtualhost ... \033[31m[FAILED]\033[0m" fi @@ -386,7 +386,7 @@ if [ $? == 0 ];then echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf $apache_install_dir/conf/vhost/$domain.conf $vhostdir + rm -rf $apache_install_dir/conf/vhost/$domain.conf exit 1 fi printf " From b560659b3939fd4727793d7289e61e00f1cb6e48 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Jun 2014 10:43:48 +0800 Subject: [PATCH 350/617] update redis 2.8.10 to 2.8.11 --- conf/nginx.conf | 2 +- conf/nginx_apache.conf | 2 +- functions/mariadb-10.0.sh | 1 + functions/mariadb-5.5.sh | 1 + functions/mysql-5.5.sh | 1 + functions/mysql-5.6.sh | 1 + functions/percona-5.5.sh | 1 + functions/percona-5.6.sh | 1 + functions/redis.sh | 6 +++--- init/init_CentOS.sh | 5 ++++- init/init_Debian.sh | 5 ++++- init/init_Ubuntu.sh | 5 ++++- 12 files changed, 23 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b0915563..6bb243b8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ http { server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; - client_max_body_size 8m; + client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 120; diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index 5f4f9741..f83f95b7 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -16,7 +16,7 @@ http { server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; - client_max_body_size 8m; + client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 120; diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 9f819304..9084c639 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -101,6 +101,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 812edc9b..7e66d23f 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -101,6 +101,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 3d7bf18f..fe265b15 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -98,6 +98,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index a621bc0c..39ea3ca5 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -97,6 +97,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 99a01d1d..47fb46a0 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -97,6 +97,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 78972d9d..6ec81fa0 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -96,6 +96,7 @@ key_buffer_size = 4M thread_cache_size = 8 +query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M diff --git a/functions/redis.sh b/functions/redis.sh index 80e06179..fac0050f 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -27,9 +27,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.10.tar.gz && Download_src -tar xzf redis-2.8.10.tar.gz -cd redis-2.8.10 +src_url=http://download.redis.io/releases/redis-2.8.11.tar.gz && Download_src +tar xzf redis-2.8.11.tar.gz +cd redis-2.8.11 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index dd2253f4..fcdc5f4d 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -48,7 +48,10 @@ yum check-update [ "$upgrade_yn" == 'y' ] && yum -y upgrade # Install needed packages -yum -y install gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync +for Package in gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync +do + yum -y install $Package +done # use gcc-4.4 if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then diff --git a/init/init_Debian.sh b/init/init_Debian.sh index b0bed46e..478ed2c0 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -11,7 +11,10 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync +for Package in gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync +do + apt-get -y install $Package +done # PS1 [ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index bd41f83d..a7755d2f 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -11,7 +11,10 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -apt-get -y install gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget bc expect rsync +for Package in gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget bc expect rsync +do + apt-get -y install $Package +done if [ ! -z "`cat /etc/issue | grep 13`" ];then apt-get -y install libcloog-ppl1 From dd6ec14d4c52c126acb7de4d0e9053ab7d1ec4ab Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 17 Jun 2014 10:39:20 +0800 Subject: [PATCH 351/617] update mariadb 10.0.11 to 10.0.12 --- functions/mariadb-10.0.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 9084c639..9a13830e 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-10.0.11/source/mariadb-10.0.11.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.12/source/mariadb-10.0.12.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then make && make install cd .. fi -tar zxf mariadb-10.0.11.tar.gz -cd mariadb-10.0.11 +tar zxf mariadb-10.0.12.tar.gz +cd mariadb-10.0.12 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then From dc27941892e571944f4d9345dd44f4e7983d25e4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 18 Jun 2014 11:05:09 +0800 Subject: [PATCH 352/617] messagebus enable --- init/init_CentOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index fcdc5f4d..322dda1f 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -64,7 +64,7 @@ fi # closed Unnecessary services and remove obsolete rpm package for Service in `chkconfig --list | grep 3:on | awk '{print $1}'`;do chkconfig --level 3 $Service off;done -for Service in sshd network crond iptables irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done +for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 From 2806ea009891f70316bbc488cdfcbdb08b482658 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 19 Jun 2014 19:58:27 +0800 Subject: [PATCH 353/617] add php module bug --- functions/GraphicsMagick.sh | 6 ++++-- functions/ImageMagick.sh | 6 ++++-- functions/ZendGuardLoader.sh | 4 ++++ functions/apache-2.2.sh | 3 ++- functions/apache-2.4.sh | 3 ++- functions/apcu.sh | 2 +- functions/eaccelerator-0.9.sh | 8 +++++--- functions/eaccelerator-1.0-dev.sh | 8 +++++--- functions/ioncube.sh | 1 + functions/jemalloc.sh | 4 +++- functions/mariadb-10.0.sh | 5 ++++- functions/mariadb-5.5.sh | 5 ++++- functions/memcached.sh | 12 ++++++++---- functions/mysql-5.5.sh | 5 ++++- functions/mysql-5.6.sh | 5 ++++- functions/pecl_http.sh | 4 ++-- functions/percona-5.5.sh | 5 ++++- functions/percona-5.6.sh | 5 ++++- functions/php-5.3.sh | 8 +++++++- functions/php-5.4.sh | 8 +++++++- functions/php-5.5.sh | 8 +++++++- functions/php-mysql-client.sh | 5 ++++- functions/redis.sh | 9 ++++++--- functions/tcmalloc.sh | 3 +++ functions/xcache.sh | 6 ++++-- functions/zendopcache.sh | 8 +++++--- 26 files changed, 108 insertions(+), 38 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index 0c92c1f6..a9a35b88 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -15,6 +15,7 @@ cd GraphicsMagick-1.3.19 ./configure --enable-shared make && make install cd ../ +/bin/rm -rf GraphicsMagick-1.3.19 if [ -e "$php_install_dir/bin/phpize" ];then src_url=http://pecl.php.net/get/gmagick-1.1.7RC2.tgz && Download_src @@ -26,9 +27,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd ../ + /bin/rm -rf gmagick-1.1.7RC2 - if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/gmagick.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/gmagick.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 7d4f8d8d..5bc1b262 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -15,6 +15,7 @@ cd ImageMagick-6.8.9-3 ./configure make && make install cd ../ +/bin/rm -rf ImageMagick-6.8.9-3 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then @@ -27,9 +28,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd ../ + /bin/rm -rf imagick-3.1.2 - if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/imagick.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/imagick.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "imagick.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh index df5c9ede..db83c087 100755 --- a/functions/ZendGuardLoader.sh +++ b/functions/ZendGuardLoader.sh @@ -17,24 +17,28 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ + /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 fi if [ "$PHP_version" == '5.3' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ + /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 fi else if [ "$PHP_version" == '5.4' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ + /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi if [ "$PHP_version" == '5.3' ];then src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ + /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 fi fi diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index e0922852..a9d4f86f 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -27,6 +27,7 @@ fi . /etc/profile cd .. +/bin/rm -rf httpd-2.2.27 /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd @@ -73,7 +74,7 @@ endscript EOF mkdir $apache_install_dir/conf/vhost -cat >> $apache_install_dir/conf/httpd.conf << EOF +cat >> $apache_install_dir/conf/vhost/0.conf << EOF NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 38eb82e0..9d4afbe0 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -40,6 +40,7 @@ fi . /etc/profile cd .. +/bin/rm -rf httpd-2.4.9 /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd @@ -86,7 +87,7 @@ endscript EOF mkdir $apache_install_dir/conf/vhost -cat >> $apache_install_dir/conf/httpd.conf << EOF +cat >> $apache_install_dir/conf/vhost/0.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$home_dir/default" diff --git a/functions/apcu.sh b/functions/apcu.sh index 31e10295..278d5d79 100755 --- a/functions/apcu.sh +++ b/functions/apcu.sh @@ -15,7 +15,7 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/apcu.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/apcu.so" ];then cat >> $php_install_dir/etc/php.ini << EOF extension = apcu.so apc.enabled=1 diff --git a/functions/eaccelerator-0.9.sh b/functions/eaccelerator-0.9.sh index 4759b589..d26a4284 100755 --- a/functions/eaccelerator-0.9.sh +++ b/functions/eaccelerator-0.9.sh @@ -16,11 +16,11 @@ $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache cat >> $php_install_dir/etc/php.ini << EOF [eaccelerator] -zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/eaccelerator.so" eaccelerator.shm_size="64" eaccelerator.cache_dir="/var/eaccelerator_cache" eaccelerator.enable="1" @@ -44,5 +44,7 @@ EOF else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" fi -cd ../../ +cd .. +/bin/rm -rf eaccelerator-0.9.6.1 +cd .. } diff --git a/functions/eaccelerator-1.0-dev.sh b/functions/eaccelerator-1.0-dev.sh index b41474a9..52050c22 100755 --- a/functions/eaccelerator-1.0-dev.sh +++ b/functions/eaccelerator-1.0-dev.sh @@ -16,11 +16,11 @@ make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R www.www /var/eaccelerator_cache cat >> $php_install_dir/etc/php.ini << EOF [eaccelerator] -zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/eaccelerator.so" +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/eaccelerator.so" eaccelerator.shm_size="64" eaccelerator.cache_dir="/var/eaccelerator_cache" eaccelerator.enable="1" @@ -44,5 +44,7 @@ EOF else echo -e "\033[31meAccelerator module install failed, Please contact the author! \033[0m" fi -cd ../../ +cd .. +/bin/rm -rf eaccelerator-eaccelerator-42067ac +cd .. } diff --git a/functions/ioncube.sh b/functions/ioncube.sh index 7ea29216..6029e012 100755 --- a/functions/ioncube.sh +++ b/functions/ioncube.sh @@ -31,6 +31,7 @@ elif [ "$PHP_version" == '5.3' ];then zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.3.so" fi +/bin/rm -rf ioncube if [ -n "`grep '^\[opcache\]' $php_install_dir/etc/php.ini`" -a -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then sed -i "s@^\[opcache\]@[ionCube Loader]\nzend_extension=\"$zend_extension\"\n[opcache]@" $php_install_dir/etc/php.ini elif [ -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then diff --git a/functions/jemalloc.sh b/functions/jemalloc.sh index 54a804ce..85576192 100755 --- a/functions/jemalloc.sh +++ b/functions/jemalloc.sh @@ -20,5 +20,7 @@ else echo -e "\033[31mjemalloc install failed, Please contact the author! \033[0m" kill -9 $$ fi -cd ../../ +cd .. +/bin/rm -rf jemalloc-3.6.0 +cd .. } diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 9a13830e..ba9ce4d3 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -20,6 +20,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf mariadb-10.0.12.tar.gz cd mariadb-10.0.12 @@ -61,7 +62,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf mariadb-10.0.12 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 7e66d23f..8455cd28 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -20,6 +20,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf mariadb-5.5.38.tar.gz cd mariadb-5.5.38 @@ -61,7 +62,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf mariadb-5.5.38 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/memcached.sh b/functions/memcached.sh index e634d4eb..ffdd9ae0 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -18,6 +18,7 @@ cd memcached-1.4.20 ./configure --prefix=$memcached_install_dir make && make install cd ../ +/bin/rm -rf memcached-1.4.20 if [ -d "$memcached_install_dir" ];then echo -e "\033[32mmemcached install successfully! \033[0m" ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached @@ -45,8 +46,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd .. - if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcache.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + /bin/rm -rf memcache-2.2.7 + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/memcache.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else @@ -62,6 +64,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-memcached=$memcached_install_dir make && make install cd .. + /bin/rm -rf libmemcached-1.0.18 tar xzf memcached-2.2.0.tgz cd memcached-2.2.0 @@ -70,8 +73,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd ../ - if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/memcached.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + /bin/rm -rf memcached-2.2.0 + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/memcached.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/ | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index fe265b15..cb5a4d80 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -19,6 +19,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf mysql-5.5.38.tar.gz cd mysql-5.5.38 @@ -58,7 +59,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf mysql-5.5.38 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 39ea3ca5..c01a910f 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -20,6 +20,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf mysql-5.6.19.tar.gz cd mysql-5.6.19 @@ -57,7 +58,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf mysql-5.6.19 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/pecl_http.sh b/functions/pecl_http.sh index 53d8d72f..a9e3a177 100755 --- a/functions/pecl_http.sh +++ b/functions/pecl_http.sh @@ -31,8 +31,8 @@ make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/http.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/http.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "raphf.so"\nextension = "propro.so"\nextension = "http.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 47fb46a0..da5fd7f3 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -19,6 +19,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf Percona-Server-5.5.35-rel33.0.tar.gz cd Percona-Server-5.5.35-rel33.0 @@ -57,7 +58,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf Percona-Server-5.5.35-rel33.0 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 6ec81fa0..e5fcface 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -19,6 +19,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf Percona-Server-5.6.15-rel63.0.tar.gz cd Percona-Server-5.6.15-rel63.0 @@ -56,7 +57,9 @@ OS_CentOS='chkconfig --add mysqld \n chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command -cd ../../ +cd .. +/bin/rm -rf Percona-Server-5.6.15-rel63.0 +cd .. # my.cf cat > /etc/my.cnf << EOF diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 89e037a7..85835956 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -21,6 +21,7 @@ cd libiconv-1.14 [ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ +/bin/rm -rf libiconv-1.14 tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 @@ -31,12 +32,14 @@ cd libltdl/ ./configure --enable-ltdl-install make && make install cd ../../ +/bin/rm -rf libmcrypt-2.5.8 tar xzf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure make && make install cd ../ +/bin/rm -rf mhash-0.9.9.9 # linked library if [ "$PHP_MySQL_driver" == '1' ];then @@ -63,6 +66,7 @@ ldconfig ./configure make && make install cd ../ +/bin/rm -rf mcrypt-2.6.8 tar xzf php-5.3.28.tar.gz useradd -M -s /sbin/nologin www @@ -234,5 +238,7 @@ service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi -cd ../../ +cd .. +/bin/rm -rf php-5.3.28 +cd .. } diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 23377ae4..372093b0 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -21,6 +21,7 @@ cd libiconv-1.14 [ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ +/bin/rm -rf libiconv-1.14 tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 @@ -31,12 +32,14 @@ cd libltdl/ ./configure --enable-ltdl-install make && make install cd ../../ +/bin/rm -rf libmcrypt-2.5.8 tar xzf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure make && make install cd ../ +/bin/rm -rf mhash-0.9.9.9 # linked library if [ "$PHP_MySQL_driver" == '1' ];then @@ -63,6 +66,7 @@ ldconfig ./configure make && make install cd ../ +/bin/rm -rf mcrypt-2.6.8 tar xzf php-5.4.29.tar.gz useradd -M -s /sbin/nologin www @@ -234,5 +238,7 @@ service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi -cd ../../ +cd .. +/bin/rm -rf php-5.4.29 +cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 3e610df9..16c36278 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -21,6 +21,7 @@ cd libiconv-1.14 [ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h make && make install cd ../ +/bin/rm -rf libiconv-1.14 tar xzf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 @@ -31,12 +32,14 @@ cd libltdl/ ./configure --enable-ltdl-install make && make install cd ../../ +/bin/rm -rf libmcrypt-2.5.8 tar xzf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure make && make install cd ../ +/bin/rm -rf mhash-0.9.9.9 # linked library if [ "$PHP_MySQL_driver" == '1' ];then @@ -63,6 +66,7 @@ ldconfig ./configure make && make install cd ../ +/bin/rm -rf mcrypt-2.6.8 tar xzf php-5.5.13.tar.gz useradd -M -s /sbin/nologin www @@ -248,5 +252,7 @@ service php-fpm start elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi -cd ../../ +cd .. +/bin/rm -rf php-5.5.13 +cd .. } diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 38bbf55e..cda7aeb2 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -17,6 +17,7 @@ if [ ! -e "`which cmake`" ];then CFLAGS= CXXFLAGS= ./configure make && make install cd .. + /bin/rm -rf cmake-2.8.12.2 fi tar zxf mysql-5.5.38.tar.gz @@ -27,5 +28,7 @@ mkdir -p $mysql_install_dir/{lib,bin} /bin/cp libmysql/libmysqlclient* $mysql_install_dir/lib /bin/cp scripts/mysql_config $mysql_install_dir/bin /bin/cp -R include $mysql_install_dir -cd ../../ +cd .. +/bin/rm -rf mysql-5.5.38 +cd .. } diff --git a/functions/redis.sh b/functions/redis.sh index fac0050f..a297c1ac 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -18,8 +18,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd .. - if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/redis.so" ];then - [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/`\"@" $php_install_dir/etc/php.ini + /bin/rm -rf redis-2.2.5 + if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/redis.so" ];then + [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else @@ -62,7 +63,9 @@ if [ -f "src/redis-server" ];then [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i 's@maxmemory @maxmemory \nmaxmemory 1024000000@' $redis_install_dir/etc/redis.conf fi - cd ../../ + cd .. + /bin/rm -rf redis-2.8.11 + cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n chkconfig redis-server on' diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index 9a6e7a33..cbc0121c 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -17,17 +17,20 @@ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then make CFLAGS=-fPIC make CFLAGS=-fPIC install cd .. + /bin/rm -rf libunwind-1.1 tar xzf gperftools-2.1.tar.gz cd gperftools-2.1 ./configure make && make install cd .. + /bin/rm -rf gperftools-2.1 else tar xzf gperftools-2.1.tar.gz cd gperftools-2.1 ./configure --enable-frame-pointers make && make install cd .. + /bin/rm -rf gperftools-2.1 fi if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf diff --git a/functions/xcache.sh b/functions/xcache.sh index 33f165c4..d58b1878 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -15,7 +15,7 @@ make clean $php_install_dir/bin/phpize ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config make && make install -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/xcache.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/xcache.so" ];then /bin/cp -R htdocs $home_dir/default/xcache chown -R www.www $home_dir/default/xcache touch /tmp/xcache;chown www.www /tmp/xcache @@ -59,5 +59,7 @@ EOF else echo -e "\033[31meXcache module install failed, Please contact the author! \033[0m" fi -cd ../../ +cd .. +/bin/rm -rf xcache-3.1.0 +cd .. } diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 5f09647f..7f869ea2 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -27,10 +27,10 @@ elif [ $Mem -gt 4500 ];then else Memory_limit=128 fi -if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" ];then +if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/opcache.so" ];then cat >> $php_install_dir/etc/php.ini << EOF [opcache] -zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions`/opcache.so" +zend_extension="$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/opcache.so" opcache.memory_consumption=$Memory_limit opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 @@ -44,5 +44,7 @@ EOF else echo -e "\033[31meZend OPcache module install failed, Please contact the author! \033[0m" fi -cd ../../ +cd .. +/bin/rm -rf ZendOptimizerPlus-master +cd .. } From 491fdecd18ec705c059123fa78c557b6bb66b0f7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 21 Jun 2014 15:09:56 +0800 Subject: [PATCH 354/617] update phpMyAdmin 4.2.3 to 4.2.4 --- functions/phpmyadmin.sh | 6 +++--- functions/xcache.sh | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index e8c7c659..68316280 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.3/phpMyAdmin-4.2.3-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.4/phpMyAdmin-4.2.4-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.3-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.3-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.4-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.4-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/xcache.sh b/functions/xcache.sh index d58b1878..e88beb51 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -28,20 +28,20 @@ xcache.admin.user = "admin" xcache.admin.pass = "$xcache_admin_md5_pass" [xcache] -xcache.cacher = On -xcache.size = 20M -xcache.count = `cat /proc/cpuinfo | grep -c processor` +xcache.size = 40M +xcache.count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.slots = 8K xcache.ttl = 3600 xcache.gc_interval = 300 -xcache.var_size = 4M -xcache.var_count = 1 +xcache.var_size = 40M +xcache.var_count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.test = Off -xcache.readonly_protection = On +xcache.readonly_protection = Off +xcache.shm_scheme = "mmap" xcache.mmap_path = "/tmp/xcache" xcache.coredump_directory = "" xcache.cacher = On @@ -52,7 +52,8 @@ xcache.optimizer = Off ; enabling this feature will impact performance ; enable only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value" ; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions -xcache.coverager = On +xcache.coverager = Off +xcache.coverager_autostart = On xcache.coveragedump_directory = "" EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart From b5f857c32f2588056d9b2d5f2b3b3ee5a35d55c7 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 21 Jun 2014 17:07:51 +0800 Subject: [PATCH 355/617] update ngx_pagespeed 1.8.31.3-beta to 1.8.31.4-beta --- functions/ngx_pagespeed.sh | 16 ++++++++-------- functions/xcache.sh | 20 ++++++++++++++++++-- upgrade_web.sh | 12 ++++++------ 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 0bc833d7..5dc44fb1 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz && Download_src -[ -s "ngx_pagespeed-1.8.31.3-beta.zip" ] && echo "ngx_pagespeed-1.8.31.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz && Download_src +[ -s "ngx_pagespeed-1.8.31.4-beta.zip" ] && echo "ngx_pagespeed-1.8.31.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.8.31.3-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.3-beta -tar xzf 1.8.31.3.tar.gz -C ngx_pagespeed-1.8.31.3-beta +unzip -q ngx_pagespeed-1.8.31.4-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.4-beta +tar xzf 1.8.31.4.tar.gz -C ngx_pagespeed-1.8.31.4-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.6.0 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.3-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.4-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/xcache.sh b/functions/xcache.sh index e88beb51..b72eb35a 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -19,6 +19,22 @@ if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extens /bin/cp -R htdocs $home_dir/default/xcache chown -R www.www $home_dir/default/xcache touch /tmp/xcache;chown www.www /tmp/xcache + + Memtatol=`free -m | grep 'Mem:' | awk '{print $2}'` + if [ $Memtatol -le 512 ];then + xcache_size=40M + elif [ $Memtatol -gt 512 -a $Memtatol -le 1024 ];then + xcache_size=80M + elif [ $Memtatol -gt 1024 -a $Memtatol -le 1500 ];then + xcache_size=100M + elif [ $Memtatol -gt 1500 -a $Memtatol -le 2500 ];then + xcache_size=160M + elif [ $Memtatol -gt 2500 -a $Memtatol -le 3500 ];then + xcache_size=180M + elif [ $Memtatol -gt 3500 ];then + xcache_size=200M + fi + cat >> $php_install_dir/etc/php.ini << EOF [xcache-common] extension = "xcache.so" @@ -28,12 +44,12 @@ xcache.admin.user = "admin" xcache.admin.pass = "$xcache_admin_md5_pass" [xcache] -xcache.size = 40M +xcache.size = $xcache_size xcache.count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.slots = 8K xcache.ttl = 3600 xcache.gc_interval = 300 -xcache.var_size = 40M +xcache.var_size = $xcache_size xcache.var_count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.var_slots = 8K xcache.var_ttl = 0 diff --git a/upgrade_web.sh b/upgrade_web.sh index eb126d02..e6da270b 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -128,14 +128,14 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then cd $lnmp_dir/src rm -rf ngx_pagespeed* - src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz && Download_src - [ -s "ngx_pagespeed-1.8.31.3-beta.zip" ] && echo "ngx_pagespeed-1.8.31.3-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.3-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz && Download_src + [ -s "ngx_pagespeed-1.8.31.4-beta.zip" ] && echo "ngx_pagespeed-1.8.31.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip - unzip -q ngx_pagespeed-1.8.31.3-beta.zip - /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.3-beta - tar xzf 1.8.31.3.tar.gz -C ngx_pagespeed-1.8.31.3-beta + unzip -q ngx_pagespeed-1.8.31.4-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.4-beta + tar xzf 1.8.31.4.tar.gz -C ngx_pagespeed-1.8.31.4-beta cd tengine-$tengine_version - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.3-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.4-beta fi kill -USR2 `cat /var/run/nginx.pid` From 95b5295513447eac9036fbe6b902a83496f384a2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 22 Jun 2014 11:32:08 +0800 Subject: [PATCH 356/617] update apcu 4.0.4 to 4.0.6 --- functions/apcu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/apcu.sh b/functions/apcu.sh index 278d5d79..aed1e0c8 100755 --- a/functions/apcu.sh +++ b/functions/apcu.sh @@ -8,9 +8,9 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://pecl.php.net/get/apcu-4.0.4.tgz && Download_src -tar xzf apcu-4.0.4.tgz -cd apcu-4.0.4 +src_url=http://pecl.php.net/get/apcu-4.0.6.tgz && Download_src +tar xzf apcu-4.0.6.tgz +cd apcu-4.0.6 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config From 0d0284b4ce95824591aef81c8085987ec9a13d29 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Jun 2014 17:54:11 +0800 Subject: [PATCH 357/617] update redis 2.8.11 to 2.8.12 --- functions/redis.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index a297c1ac..5fba4016 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.11.tar.gz && Download_src -tar xzf redis-2.8.11.tar.gz -cd redis-2.8.11 +src_url=http://download.redis.io/releases/redis-2.8.12.tar.gz && Download_src +tar xzf redis-2.8.12.tar.gz +cd redis-2.8.12 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.11 + /bin/rm -rf redis-2.8.12 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n From d940ba5764cce0446839130622ca86b9a4f2b82c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 27 Jun 2014 16:13:47 +0800 Subject: [PATCH 358/617] update php 5.4.29 to 5.4.30 --- functions/php-5.4.sh | 10 +++++----- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 372093b0..25da5746 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.29.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.30.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.29.tar.gz +tar xzf php-5.4.30.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.29 -p0 < fpm-race-condition.patch -cd php-5.4.29 +patch -d php-5.4.30 -p0 < fpm-race-condition.patch +cd php-5.4.30 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.29 +/bin/rm -rf php-5.4.30 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 68316280..fb3d93b6 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.4/phpMyAdmin-4.2.4-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.5/phpMyAdmin-4.2.5-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.4-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.4-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.5-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.5-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From df4c027888e6f08d3e66ae94ecedcf065780c42f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 28 Jun 2014 17:15:42 +0800 Subject: [PATCH 359/617] update php 5.5.13 to 5.5.14 --- functions/php-5.5.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 16c36278..e42bd048 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.13.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.14.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.13.tar.gz +tar xzf php-5.5.14.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.13 -p0 < fpm-race-condition.patch -cd php-5.5.13 +patch -d php-5.5.14 -p0 < fpm-race-condition.patch +cd php-5.5.14 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.13 +/bin/rm -rf php-5.5.14 cd .. } From 2547e3f01c9923767851ba7c056ef9bab7bb9ed3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 28 Jun 2014 18:26:35 +0800 Subject: [PATCH 360/617] update htop 1.0.2 to 1.0.3 --- init/init_CentOS.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 322dda1f..a70f88d4 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,29 +12,28 @@ cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -public_IP=`../functions/get_public_ip.py` -if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} +#public_IP=`../functions/get_public_ip.py` +#if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi - fi - - if [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo + elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS-Base.repo sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi fi yum makecache -fi +#fi if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" @@ -194,9 +193,9 @@ fi # install htop if [ ! -e "`which htop`" ];then - src_url=http://downloads.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz && Download_src - tar xzf htop-1.0.2.tar.gz - cd htop-1.0.2 + 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 ./configure make && make install cd .. From 0eeaa5c1d0f4d7aa4a5f7160d1257e000e358f26 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 28 Jun 2014 19:01:29 +0800 Subject: [PATCH 361/617] update yum bug --- init/init_CentOS.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index a70f88d4..a7daf0b2 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,6 +12,8 @@ cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all +rename repo repo_bk /etc/yum.repos.d/*.repo +/bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then From 41e848c0216353cef16e80e35164f21fe273236e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 28 Jun 2014 20:31:12 +0800 Subject: [PATCH 362/617] update yum bug --- init/init_CentOS.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index a7daf0b2..2782b5c8 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,8 +12,10 @@ cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -rename repo repo_bk /etc/yum.repos.d/*.repo +cd /etc/yum.repos.d/ +rename repo repo_bk *.repo /bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} +cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then From 25b7584f41035d7bd58a6aff4aa2d08ed612211a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 30 Jun 2014 17:39:24 +0800 Subject: [PATCH 363/617] update libevent download address --- functions/pureftpd.sh | 1 + init/init_CentOS.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/pureftpd.sh b/functions/pureftpd.sh index e248ac1e..c3d24b08 100755 --- a/functions/pureftpd.sh +++ b/functions/pureftpd.sh @@ -36,6 +36,7 @@ update-rc.d pureftpd defaults" /bin/cp conf/pure-ftpd.conf $pureftpd_install_dir/ sed -i "s@^MySQLConfigFile.*@MySQLConfigFile $pureftpd_install_dir/pureftpd-mysql.conf@" $pureftpd_install_dir/pure-ftpd.conf + sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" $pureftpd_install_dir/pure-ftpd.conf /bin/cp conf/pureftpd-mysql.conf $pureftpd_install_dir/ conn_ftpusers_dbpwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` sed -i "s@^conn_ftpusers_dbpwd.*@conn_ftpusers_dbpwd=$conn_ftpusers_dbpwd@" options.conf diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 2782b5c8..1b3c43b5 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -174,7 +174,7 @@ service iptables restart # install tmux if [ ! -e "`which tmux`" ];then - src_url=http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.21-stable.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz && Download_src tar xzf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable From c2c4aebecaf89556499857c4e8969cc394148cf3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 30 Jun 2014 18:04:25 +0800 Subject: [PATCH 364/617] delete opcache.optimization_level=0 --- functions/php-5.5.sh | 2 +- functions/zendopcache.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index e42bd048..1958fc14 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -151,7 +151,7 @@ sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_ sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini -sed -i 's@^;opcache.optimization_level.*@opcache.optimization_level=0@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini fi if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 7f869ea2..3a77960c 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -38,7 +38,7 @@ opcache.revalidate_freq=60 opcache.save_comments=0 opcache.fast_shutdown=1 opcache.enable_cli=1 -opcache.optimization_level=0 +;opcache.optimization_level=0 EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else From a646f748a55b05dc0739e56df47168582b76bad8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 2 Jul 2014 17:55:10 +0800 Subject: [PATCH 365/617] update yum bug --- init/init_CentOS.sh | 12 +++++++----- init/init_Debian.sh | 11 ++++++----- init/init_Ubuntu.sh | 11 ++++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 1b3c43b5..1e9131ef 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -15,6 +15,7 @@ yum clean all cd /etc/yum.repos.d/ rename repo repo_bk *.repo /bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} +/bin/mv /etc/yum.repos.d/centos.repo{_bk,} cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then @@ -120,14 +121,15 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 16384 -net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 16384 -net.core.netdev_max_backlog = 16384 -net.ipv4.tcp_max_orphans = 16384 +net.core.somaxconn = 65535 +net.core.netdev_max_backlog = 262144 +net.ipv4.tcp_timestamps = 0 +net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 478ed2c0..c03c084b 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -59,14 +59,15 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 16384 -net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 16384 -net.core.netdev_max_backlog = 16384 -net.ipv4.tcp_max_orphans = 16384 +net.core.somaxconn = 65535 +net.core.netdev_max_backlog = 262144 +net.ipv4.tcp_timestamps = 0 +net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index a7755d2f..66c9e3b8 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -65,14 +65,15 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 16384 -net.ipv4.tcp_max_tw_buckets = 36000 +net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 16384 -net.core.netdev_max_backlog = 16384 -net.ipv4.tcp_max_orphans = 16384 +net.core.somaxconn = 65535 +net.core.netdev_max_backlog = 262144 +net.ipv4.tcp_timestamps = 0 +net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p From 5ae7023eeacb3dc44f75f59f0120c7c5d05e3ec1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 2 Jul 2014 23:11:45 +0800 Subject: [PATCH 366/617] update cmake 2.8.12.2 to 3.0.0 --- functions/ImageMagick.sh | 8 ++++---- functions/mariadb-10.0.sh | 8 ++++---- functions/mariadb-5.5.sh | 8 ++++---- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/php-mysql-client.sh | 8 ++++---- functions/tcmalloc.sh | 32 ++++++++------------------------ init/init_CentOS.sh | 3 +-- 10 files changed, 41 insertions(+), 58 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 5bc1b262..cb9779d2 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-3.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-5.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-3.tar.gz -cd ImageMagick-6.8.9-3 +tar xzf ImageMagick-6.8.9-5.tar.gz +cd ImageMagick-6.8.9-5 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-3 +/bin/rm -rf ImageMagick-6.8.9-5 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index ba9ce4d3..30a7a206 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-10.0.12/source/mariadb-10.0.12.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf mariadb-10.0.12.tar.gz cd mariadb-10.0.12 diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 8455cd28..c9805c88 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-5.5.38/source/mariadb-5.5.38.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf mariadb-5.5.38.tar.gz cd mariadb-5.5.38 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index cb5a4d80..99760618 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf mysql-5.5.38.tar.gz cd mysql-5.5.38 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index c01a910f..6ab4972a 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf mysql-5.6.19.tar.gz cd mysql-5.6.19 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index da5fd7f3..5f184028 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf Percona-Server-5.5.35-rel33.0.tar.gz cd Percona-Server-5.5.35-rel33.0 diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index e5fcface..80011db9 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf Percona-Server-5.6.15-rel63.0.tar.gz cd Percona-Server-5.6.15-rel63.0 diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index cda7aeb2..1a9c63ea 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,16 +8,16 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src if [ ! -e "`which cmake`" ];then - tar xzf cmake-2.8.12.2.tar.gz - cd cmake-2.8.12.2 + tar xzf cmake-3.0.0.tar.gz + cd cmake-3.0.0 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-2.8.12.2 + /bin/rm -rf cmake-3.0.0 fi tar zxf mysql-5.5.38.tar.gz diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index cbc0121c..c3ec209e 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -7,31 +7,15 @@ Install_tcmalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz && Download_src +src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.2.1.tar.gz && Download_src + +tar xzf gperftools-2.2.1.tar.gz +cd gperftools-2.2.1 +./configure --enable-frame-pointers +make && make install +cd .. +/bin/rm -rf gperftools-2.2.1 -if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then - src_url=http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz && Download_src - tar xzf libunwind-1.1.tar.gz - cd libunwind-1.1 - CFLAGS=-fPIC ./configure - make CFLAGS=-fPIC - make CFLAGS=-fPIC install - cd .. - /bin/rm -rf libunwind-1.1 - tar xzf gperftools-2.1.tar.gz - cd gperftools-2.1 - ./configure - make && make install - cd .. - /bin/rm -rf gperftools-2.1 -else - tar xzf gperftools-2.1.tar.gz - cd gperftools-2.1 - ./configure --enable-frame-pointers - make && make install - cd .. - /bin/rm -rf gperftools-2.1 -fi if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 1e9131ef..2aabf572 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,8 +14,7 @@ yum clean all cd /etc/yum.repos.d/ rename repo repo_bk *.repo -/bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} -/bin/mv /etc/yum.repos.d/centos.repo{_bk,} +rename repo_bk repo *ent* cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then From b9448b1a1da667d7c510ffe7bcfa3ade0fffa54c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 11 Jul 2014 20:32:35 +0800 Subject: [PATCH 367/617] update percona --- functions/percona-5.5.sh | 12 ++++++++---- functions/percona-5.6.sh | 12 ++++++++---- init/init_CentOS.sh | 1 + init/init_Debian.sh | 1 + init/init_Ubuntu.sh | 1 + 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 5f184028..9ace7417 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/source/Percona-Server-5.5.35-rel33.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.38-35.2.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.0 fi -tar zxf Percona-Server-5.5.35-rel33.0.tar.gz -cd Percona-Server-5.5.35-rel33.0 +tar zxf percona-server-5.5.38-35.2.tar.gz +cd percona-server-5.5.38-35.2 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -45,6 +45,10 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ $EXE_LINKER make && make install +cd $percona_install_dir/lib/ +ln -s libperconaserverclient.so libmysqlclient.so +cd - + if [ -d "$percona_install_dir" ];then echo -e "\033[32mPercona install successfully! \033[0m" else @@ -59,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf Percona-Server-5.5.35-rel33.0 +/bin/rm -rf percona-server-5.5.38-35.2 cd .. # my.cf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 80011db9..6044195f 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.15-rel63.0/source/Percona-Server-5.6.15-rel63.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.19-67.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.0 fi -tar zxf Percona-Server-5.6.15-rel63.0.tar.gz -cd Percona-Server-5.6.15-rel63.0 +tar zxf percona-server-5.6.19-67.0.tar.gz +cd percona-server-5.6.19-67.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -44,6 +44,10 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ $EXE_LINKER make && make install +cd $percona_install_dir/lib/ +ln -s libperconaserverclient.so libmysqlclient.so +cd - + if [ -d "$percona_install_dir" ];then echo -e "\033[32mPercona install successfully! \033[0m" else @@ -58,7 +62,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf Percona-Server-5.6.15-rel63.0 +/bin/rm -rf percona-server-5.6.19-67.0 cd .. # my.cf diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 2aabf572..87fe21d4 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -163,6 +163,7 @@ cat > /etc/sysconfig/iptables << EOF -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood diff --git a/init/init_Debian.sh b/init/init_Debian.sh index c03c084b..f88fa4c1 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -98,6 +98,7 @@ cat > /etc/iptables.up.rules << EOF -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 66c9e3b8..9e7913bb 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -100,6 +100,7 @@ cat > /etc/iptables.up.rules << EOF -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood From 5980a45009c4b5e6e943cbff0caaad534d2df485 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 12 Jul 2014 16:58:42 +0800 Subject: [PATCH 368/617] support CentOS 7 --- init/init_CentOS.sh | 14 +++++++------- install.sh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 87fe21d4..3a78aafe 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -18,7 +18,7 @@ rename repo_bk repo *ent* cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then + if [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} @@ -26,7 +26,7 @@ cd - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi - elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then + elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} @@ -39,9 +39,9 @@ cd - yum makecache #fi -if [ ! -z "$(cat /etc/redhat-release | grep '6\.')" ];then +if [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" -elif [ ! -z "$(cat /etc/redhat-release | grep '5\.')" ];then +elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" fi @@ -57,7 +57,7 @@ do done # use gcc-4.4 -if [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ];then +if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then yum -y install gcc44 gcc44-c++ libstdc++44-devel export CC="gcc44" CXX="g++44" fi @@ -132,14 +132,14 @@ net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p -if [ -z "$(cat /etc/redhat-release | grep '6\.')" ];then +if [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then sed -i 's/3:2345:respawn/#3:2345:respawn/g' /etc/inittab sed -i 's/4:2345:respawn/#4:2345:respawn/g' /etc/inittab sed -i 's/5:2345:respawn/#5:2345:respawn/g' /etc/inittab sed -i 's/6:2345:respawn/#6:2345:respawn/g' /etc/inittab sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/g' /etc/inittab sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n -else +elif [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf fi diff --git a/install.sh b/install.sh index 0391d842..c1d4edc6 100755 --- a/install.sh +++ b/install.sh @@ -446,7 +446,7 @@ chmod +x functions/*.sh init/* *.sh if [ "$OS" == 'CentOS' ];then . init/init_CentOS.sh 2>&1 | tee $lnmp_dir/install.log #/bin/mv init/init_CentOS.sh init/init_CentOS.ed - [ ! -z "`gcc --version | head -n1 | grep 4\.1`" ] && export CC="gcc44" CXX="g++44" + [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ] && export CC="gcc44" CXX="g++44" elif [ "$OS" == 'Debian' ];then . init/init_Debian.sh 2>&1 | tee $lnmp_dir/install.log #/bin/mv init/init_Debian.sh init/init_Debian.ed From c2d7511c7720b0152d9779f9288a934190583936 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 14 Jul 2014 22:42:45 +0800 Subject: [PATCH 369/617] ubuntu bug --- init/init_Debian.sh | 7 +++++-- init/init_Ubuntu.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/init/init_Debian.sh b/init/init_Debian.sh index f88fa4c1..0da0d486 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -2,8 +2,11 @@ # Author: yeho # Blog: http://blog.linuxeye.com -apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* +do + apt-get -y remove $Package +done +dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 9e7913bb..e53eb549 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -2,8 +2,11 @@ # Author: yeho # Blog: http://blog.linuxeye.com -apt-get -y remove apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common libmysqlclient15off libmysqlclient15-dev mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd +for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* +do + apt-get -y remove $Package +done +dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update From ec63ea3c85ac9fe0430333138d849fb2b5d7aef1 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 15 Jul 2014 10:25:09 +0800 Subject: [PATCH 370/617] update redis 2.8.12 to 2.8.13 --- functions/redis.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index 5fba4016..923e0a77 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.12.tar.gz && Download_src -tar xzf redis-2.8.12.tar.gz -cd redis-2.8.12 +src_url=http://download.redis.io/releases/redis-2.8.13.tar.gz && Download_src +tar xzf redis-2.8.13.tar.gz +cd redis-2.8.13 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.12 + /bin/rm -rf redis-2.8.13 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n From d5ee8082c9a37ee8f31cf819eaf477dd370e4017 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 20 Jul 2014 09:22:05 +0800 Subject: [PATCH 371/617] update httpd 2.4.9 to 2.4.10 --- functions/apache-2.4.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 9d4afbe0..980b33f7 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -10,9 +10,9 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz && Download_src -src_url=http://www.apache.org/dist/httpd/httpd-2.4.9.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.4.10.tar.gz && Download_src tar xzf pcre-8.35.tar.gz cd pcre-8.35 @@ -21,11 +21,11 @@ make && make install cd ../ useradd -M -s /sbin/nologin www -tar xzf httpd-2.4.9.tar.gz -tar xzf apr-1.5.0.tar.gz +tar xzf httpd-2.4.10.tar.gz +tar xzf apr-1.5.1.tar.gz tar xzf apr-util-1.5.3.tar.gz -cd httpd-2.4.9 -/bin/cp -R ../apr-1.5.0 ./srclib/apr +cd httpd-2.4.10 +/bin/cp -R ../apr-1.5.1 ./srclib/apr /bin/cp -R ../apr-util-1.5.3 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install @@ -40,7 +40,7 @@ fi . /etc/profile cd .. -/bin/rm -rf httpd-2.4.9 +/bin/rm -rf httpd-2.4.10 /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd From 8bd64030950438627c57c78157f5a856982eea25 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 25 Jul 2014 10:13:06 +0800 Subject: [PATCH 372/617] update php 5.5.14 to 5.5.15 --- functions/php-5.5.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 1958fc14..ddb47911 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.14.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.15.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.14.tar.gz +tar xzf php-5.5.15.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.14 -p0 < fpm-race-condition.patch -cd php-5.5.14 +patch -d php-5.5.15 -p0 < fpm-race-condition.patch +cd php-5.5.15 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.14 +/bin/rm -rf php-5.5.15 cd .. } From 926ec2e6e38a2549bf5ee3f2f201d6cdc05ef6aa Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 30 Jul 2014 17:04:49 +0800 Subject: [PATCH 373/617] update php 5.4.30 to 5.4.31 --- functions/ImageMagick.sh | 8 ++++---- functions/php-5.4.sh | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index cb9779d2..a051f779 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-5.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-6.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-5.tar.gz -cd ImageMagick-6.8.9-5 +tar xzf ImageMagick-6.8.9-6.tar.gz +cd ImageMagick-6.8.9-6 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-5 +/bin/rm -rf ImageMagick-6.8.9-6 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 25da5746..ba09463c 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.30.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.31.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.30.tar.gz +tar xzf php-5.4.31.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.30 -p0 < fpm-race-condition.patch -cd php-5.4.30 +patch -d php-5.4.31 -p0 < fpm-race-condition.patch +cd php-5.4.31 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.30 +/bin/rm -rf php-5.4.31 cd .. } From 05c71a2148bd6389672c7991441a66f4c4fbeada Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 1 Aug 2014 22:25:05 +0800 Subject: [PATCH 374/617] update MySQL 5.6.19 to 5.6.20 --- functions/mysql-5.6.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 6ab4972a..c0d56446 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.0 fi -tar zxf mysql-5.6.19.tar.gz -cd mysql-5.6.19 +tar zxf mysql-5.6.20.tar.gz +cd mysql-5.6.20 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -59,7 +59,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.6.19 +/bin/rm -rf mysql-5.6.20 cd .. # my.cf diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index fb3d93b6..ffe9f30e 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.5/phpMyAdmin-4.2.5-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.7/phpMyAdmin-4.2.7-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.5-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.5-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.7-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.7-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From baa2a2fa58b06779f272c33740ed2b16e8cd4272 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 3 Aug 2014 16:44:59 +0800 Subject: [PATCH 375/617] update MySQL 5.5.38 to 5.5.39 --- functions/.mysql-5.5.sh.swp | Bin 0 -> 16384 bytes functions/mysql-5.5.sh | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 functions/.mysql-5.5.sh.swp diff --git a/functions/.mysql-5.5.sh.swp b/functions/.mysql-5.5.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..b34e9b6a6a27eb5c4cceb256b344ed0bb84fb316 GIT binary patch literal 16384 zcmeI3e~cVu8OLAo2Npq%&=@r_Z?~5&6lZ_-uGhk1_ip#vwYzuc?X|X{bvirq?(Xzv zXNH;CyW0YiKqCIAAVEPB5n>9)5H(Tw!^DKd)I{YkEB>PaBMAZtMofT6qTu&^XXb8q z?zXoOOfZ>kKDpiZdEe)K-{*baAJ03}M&@XxM)#(21fP!*^5n};*K@zUl015p5XZ7S zp1jq^(D!D?rHRR{@_mUbOt*9|?J(PN(}vlx)6K4_db(x0=}ynR$&kiV<0-ejm8w`C zTOhW;TeiRzB%jM>c(I*{9rVhN9eK+d;sUV+Vhh9;h%FFXAhtkkf!G4E1!4>Q|60Ja zFCn*~`IiJ;xG(top2*)fgU{X|{r-qN_!<9+Ef8BEwm@uw*aEQyVhh9;h%FFXAhtkk zf!G4E1>S`gP&7h5fp&d^UjX3we;EJ2@)5iX0Dc6%4ekZEgC;l(_JK+8(uWDTAKV8# zFafrM*RLStMesZD82B;x7Ptp=0RvOuQt<5Mg!~Yk1K$M4&Hb#A%6x>fOFu>pa~9w8E_4_9J~ZSx&VF; z9tRJB2f@97``B49^m9{JSC`0*;zbax+p$l=#)|IAp59?r*P{iRo1DyKh;Dk!QSjQx zGTR^{ou2M09T~5fD7qtiZHFnEi=x?3(ot4r*K$0$sT)jo^)rl1GY3PtkTtr^CUZjR zWQ{bs#*(a?EXIC3ayG{sEX2HKO?SMWY%4A1%C^e;v~NvrSS`^g z7Zu4Z$LiV;=fl#WG;CBpSL+uIHfmkgG`emZEo;dNEa|Mus@3V}!kA%kyX&-I$v#sB z4fc~z!c@DC!%Ve@2CX%hTUOSszJhx~jVq4su_3acp|)iiVOJ*htaZh*ndut=RgH_m z7Pb?EWn)M@rD2E>BRe(LRJw*Ixt`^~pb|4%y2)j=UZq~Fkw7j7a(PW&!FZIW2yvHm zTVkv5CQ~saK6<*@!h|%e71X3EF08_N31^ly#Z&mu2QNACyeSL`F)Xtc6yi>f0@;Wnk;F%jIgaHF)hMJwC1ITk)A@ZaL?D}2Yi_T&y6aK&;o*X-#djH zo6N(A2?zFn!(}Chxt6ia;OWd+W{#w5TnX=zCMlW*G1r<&iGQSvT=*$mf!MkxUCfD7 z$UwMX!>v&$;^=6j%LXJ^J3ZKo&jK_DQ%x8wjj`}2MT(~p8w)eE<@1?|a3jDjFj{ui z(3$C-B&y=k8)%w&Dm155vq`VNo|flk$WC-Er8WssHJVD1G|Z58I#hC+f&2595A*v1 z@myUjm5Qkmd@Zqtu9)(XM%VPZg=E)8*I{2ZrTJww8mu;MlBn$^3|mugg(AyLavjrX z-dw$qT$f9H6vA95OqA?c8ohSaZ@q5nUP|-LqxsEMZR&PyZY41|!CR9le|R@5MVdOH z!DmS~3@YuTV`FPcOl@0KVl;6glh5Cn&vt6P`sb@O7%bXUu#9P+q4NgAcvAGr!@f(s zHls?{Yg^6^Dhg&g3BnAQ4bz*8=ykiQ3g2sX4WrkmLT}O=sie_F;7xr#lb|QBL$z3* zI?58GyLM6WH^@Q8%E!ubwK99Syg;PV7b=T~1Ia=pB8w7gKr(i0Gs$}`0y z)kS%Fu39ZFR_104U9UMQx0s0|g(0i@V6H>Og?f2Wh3P|;qh-0iIJZzdSeDDP2O~LZ$N7GBkqlGS;`HG|bJdF}nJJgb z3&lm=;h`1H7Z(;Qyw?}WQ<D-pPrkYDODBa*-uZHhA(hjjKoLXt?YTM6rYHbd7miW>x+0j-1I;-VJd}0SlTef(0 z9j!8(e#-jm>^LZ4m$qE~HoM5YF4BSyKt%awGsfS97so^1%$rFi*eZkWN#j>vgS~4C z7TQl~V3G!Yr3~HduCgBEWnaP+ga}=2 zq+zktX~I45MO-q3v1DrZfxchiE*eS?B@%N>v6(Fuz@3gM{yBuUzZ?nONZuIHsxL9;RW@W>%DDF%wQg)O~>j4 z`<3ljt2)1xar9-n(q;~$hb-6IQApw-p%`s^Prh@tX^o(cBRIPklJB5q5ykoKpI2O$ zhw-E6#|X6?#q=l+Hk8`{8zL^LsAbaKsom7GC?CuNea4`=hJZ$I>Tu6SkDf@Z5BP}$ zUD3TZ^)>pAxTWnzZ9z7-R|Kp$V7=uQU@I1ZAqJc8_ypm`8Jal7L&pAedJCG)*3LJ5 zQ-L3X_;El4P6^z#@PKu`xOixjX~QSQ{u5(dnxHoXA!$%E<@YpOl@&!dE(wa`AyORS zq_x>3b5%#Ty&!PpH=2G_-k_4iJ*N;%VkrpVH|Z8~@+pWTU?>b19o!wQN1MTllf_L7r+5~wCR!fN|ZA_lI~3 z^bL{t?Hgf?B2EL1k(5!JIK)?=aEJto@pNHp6GmMI8ly?0s@mW&(6u2=D2p^}Q!mPK zFOn46=Ucdre@A=^6F1U=x8++S*>{Ks!8Ai8FwkhLU&NE3F_OYH{jXN2krYQAX>;Ei zN!12F8sb~o=*WtTkUk&6`jp+&vxL6|7nI?0Ryfsk7^6}rJWM1Z*`LHOWo3ybZ^ju5 zr>(Kvt;th_@at*+p_#uS!TflZ(D(epPl#>=NW~M1jYEe-JVxaYLUGrO3v~V@fnQh+ KJgk82$bSK5?kg_< literal 0 HcmV?d00001 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 99760618..c457125a 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.0 fi -tar zxf mysql-5.5.38.tar.gz -cd mysql-5.5.38 +tar zxf mysql-5.5.39.tar.gz +cd mysql-5.5.39 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -60,7 +60,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.5.38 +/bin/rm -rf mysql-5.5.39 cd .. # my.cf From 00541b055ef8d53f5a26bc4eedf1533f2e5f10f4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 5 Aug 2014 23:21:42 +0800 Subject: [PATCH 376/617] Delete .mysql-5.5.sh.swp --- functions/.mysql-5.5.sh.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 functions/.mysql-5.5.sh.swp diff --git a/functions/.mysql-5.5.sh.swp b/functions/.mysql-5.5.sh.swp deleted file mode 100644 index b34e9b6a6a27eb5c4cceb256b344ed0bb84fb316..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI3e~cVu8OLAo2Npq%&=@r_Z?~5&6lZ_-uGhk1_ip#vwYzuc?X|X{bvirq?(Xzv zXNH;CyW0YiKqCIAAVEPB5n>9)5H(Tw!^DKd)I{YkEB>PaBMAZtMofT6qTu&^XXb8q z?zXoOOfZ>kKDpiZdEe)K-{*baAJ03}M&@XxM)#(21fP!*^5n};*K@zUl015p5XZ7S zp1jq^(D!D?rHRR{@_mUbOt*9|?J(PN(}vlx)6K4_db(x0=}ynR$&kiV<0-ejm8w`C zTOhW;TeiRzB%jM>c(I*{9rVhN9eK+d;sUV+Vhh9;h%FFXAhtkkf!G4E1!4>Q|60Ja zFCn*~`IiJ;xG(top2*)fgU{X|{r-qN_!<9+Ef8BEwm@uw*aEQyVhh9;h%FFXAhtkk zf!G4E1>S`gP&7h5fp&d^UjX3we;EJ2@)5iX0Dc6%4ekZEgC;l(_JK+8(uWDTAKV8# zFafrM*RLStMesZD82B;x7Ptp=0RvOuQt<5Mg!~Yk1K$M4&Hb#A%6x>fOFu>pa~9w8E_4_9J~ZSx&VF; z9tRJB2f@97``B49^m9{JSC`0*;zbax+p$l=#)|IAp59?r*P{iRo1DyKh;Dk!QSjQx zGTR^{ou2M09T~5fD7qtiZHFnEi=x?3(ot4r*K$0$sT)jo^)rl1GY3PtkTtr^CUZjR zWQ{bs#*(a?EXIC3ayG{sEX2HKO?SMWY%4A1%C^e;v~NvrSS`^g z7Zu4Z$LiV;=fl#WG;CBpSL+uIHfmkgG`emZEo;dNEa|Mus@3V}!kA%kyX&-I$v#sB z4fc~z!c@DC!%Ve@2CX%hTUOSszJhx~jVq4su_3acp|)iiVOJ*htaZh*ndut=RgH_m z7Pb?EWn)M@rD2E>BRe(LRJw*Ixt`^~pb|4%y2)j=UZq~Fkw7j7a(PW&!FZIW2yvHm zTVkv5CQ~saK6<*@!h|%e71X3EF08_N31^ly#Z&mu2QNACyeSL`F)Xtc6yi>f0@;Wnk;F%jIgaHF)hMJwC1ITk)A@ZaL?D}2Yi_T&y6aK&;o*X-#djH zo6N(A2?zFn!(}Chxt6ia;OWd+W{#w5TnX=zCMlW*G1r<&iGQSvT=*$mf!MkxUCfD7 z$UwMX!>v&$;^=6j%LXJ^J3ZKo&jK_DQ%x8wjj`}2MT(~p8w)eE<@1?|a3jDjFj{ui z(3$C-B&y=k8)%w&Dm155vq`VNo|flk$WC-Er8WssHJVD1G|Z58I#hC+f&2595A*v1 z@myUjm5Qkmd@Zqtu9)(XM%VPZg=E)8*I{2ZrTJww8mu;MlBn$^3|mugg(AyLavjrX z-dw$qT$f9H6vA95OqA?c8ohSaZ@q5nUP|-LqxsEMZR&PyZY41|!CR9le|R@5MVdOH z!DmS~3@YuTV`FPcOl@0KVl;6glh5Cn&vt6P`sb@O7%bXUu#9P+q4NgAcvAGr!@f(s zHls?{Yg^6^Dhg&g3BnAQ4bz*8=ykiQ3g2sX4WrkmLT}O=sie_F;7xr#lb|QBL$z3* zI?58GyLM6WH^@Q8%E!ubwK99Syg;PV7b=T~1Ia=pB8w7gKr(i0Gs$}`0y z)kS%Fu39ZFR_104U9UMQx0s0|g(0i@V6H>Og?f2Wh3P|;qh-0iIJZzdSeDDP2O~LZ$N7GBkqlGS;`HG|bJdF}nJJgb z3&lm=;h`1H7Z(;Qyw?}WQ<D-pPrkYDODBa*-uZHhA(hjjKoLXt?YTM6rYHbd7miW>x+0j-1I;-VJd}0SlTef(0 z9j!8(e#-jm>^LZ4m$qE~HoM5YF4BSyKt%awGsfS97so^1%$rFi*eZkWN#j>vgS~4C z7TQl~V3G!Yr3~HduCgBEWnaP+ga}=2 zq+zktX~I45MO-q3v1DrZfxchiE*eS?B@%N>v6(Fuz@3gM{yBuUzZ?nONZuIHsxL9;RW@W>%DDF%wQg)O~>j4 z`<3ljt2)1xar9-n(q;~$hb-6IQApw-p%`s^Prh@tX^o(cBRIPklJB5q5ykoKpI2O$ zhw-E6#|X6?#q=l+Hk8`{8zL^LsAbaKsom7GC?CuNea4`=hJZ$I>Tu6SkDf@Z5BP}$ zUD3TZ^)>pAxTWnzZ9z7-R|Kp$V7=uQU@I1ZAqJc8_ypm`8Jal7L&pAedJCG)*3LJ5 zQ-L3X_;El4P6^z#@PKu`xOixjX~QSQ{u5(dnxHoXA!$%E<@YpOl@&!dE(wa`AyORS zq_x>3b5%#Ty&!PpH=2G_-k_4iJ*N;%VkrpVH|Z8~@+pWTU?>b19o!wQN1MTllf_L7r+5~wCR!fN|ZA_lI~3 z^bL{t?Hgf?B2EL1k(5!JIK)?=aEJto@pNHp6GmMI8ly?0s@mW&(6u2=D2p^}Q!mPK zFOn46=Ucdre@A=^6F1U=x8++S*>{Ks!8Ai8FwkhLU&NE3F_OYH{jXN2krYQAX>;Ei zN!12F8sb~o=*WtTkUk&6`jp+&vxL6|7nI?0Ryfsk7^6}rJWM1Z*`LHOWo3ybZ^ju5 zr>(Kvt;th_@at*+p_#uS!TflZ(D(epPl#>=NW~M1jYEe-JVxaYLUGrO3v~V@fnQh+ KJgk82$bSK5?kg_< From d00793b34fd6494ac6db889df4e595f55ba3c47d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 6 Aug 2014 09:42:31 +0800 Subject: [PATCH 377/617] update nginx 1.6.0 to 1.6.1 --- functions/mariadb-5.5.sh | 8 ++++---- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index c9805c88..a79ff75a 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-5.5.38/source/mariadb-5.5.38.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.39/source/mariadb-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.0 fi -tar zxf mariadb-5.5.38.tar.gz -cd mariadb-5.5.38 +tar zxf mariadb-5.5.39.tar.gz +cd mariadb-5.5.39 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-5.5.38 +/bin/rm -rf mariadb-5.5.39 cd .. # my.cf diff --git a/functions/nginx.sh b/functions/nginx.sh index 25aa682c..fb58c7ff 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.6.0.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.6.1.tar.gz && Download_src tar xzf pcre-8.35.tar.gz cd pcre-8.35 @@ -18,9 +18,9 @@ cd pcre-8.35 make && make install cd ../ -tar xzf nginx-1.6.0.tar.gz +tar xzf nginx-1.6.1.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.6.0 +cd nginx-1.6.1 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 5dc44fb1..be0ff86e 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.8.31.4-beta.zip tar xzf 1.8.31.4.tar.gz -C ngx_pagespeed-1.8.31.4-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.6.0 + cd nginx-1.6.1 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` From 93e3946dd091f9c4b0926b91c158d15ee5d41ce6 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 7 Aug 2014 15:52:56 +0800 Subject: [PATCH 378/617] memcached-init CentOS 7.0 bug --- init/Memcached-init-CentOS | 129 +++++++++++++++---------------------- 1 file changed, 52 insertions(+), 77 deletions(-) diff --git a/init/Memcached-init-CentOS b/init/Memcached-init-CentOS index 523371f2..7ed1068f 100755 --- a/init/Memcached-init-CentOS +++ b/init/Memcached-init-CentOS @@ -1,106 +1,81 @@ -#!/bin/sh +#! /bin/sh # # chkconfig: - 55 45 # description: The memcached daemon is a network memory cache service. # processname: memcached # config: /etc/sysconfig/memcached -# pidfile: /var/run/memcached/memcached.*.pid - + # Source function library. -. /etc/init.d/functions - +. /etc/rc.d/init.d/functions + PORT=11211 USER=memcached MAXCONN=1024 +CACHESIZE=64 OPTIONS="" - + if [ -f /etc/sysconfig/memcached ];then . /etc/sysconfig/memcached fi - + # Check that networking is up. -. /etc/sysconfig/network - if [ "$NETWORKING" = "no" ] then exit 0 fi - + RETVAL=0 -prog="/usr/local/memcached/bin/memcached" - -start_instance() { - echo -n $"Starting $prog ($1): " - daemon --pidfile /var/run/memcached/memcached.$1.pid memcached -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached.$1 - PORT=`expr $PORT + 1` -} - -stop_instance() { - echo -n $"Stopping $prog ($1): " - killproc -p /var/run/memcached/memcached.$1.pid /usr/bin/memcached - RETVAL=$? - echo - if [ $RETVAL -eq 0 ] ; then - rm -f /var/lock/subsys/memcached.$1 - rm -f /var/run/memcached.$1.pid - fi -} - -start () { - # insure that /var/run/memcached has proper permissions - mkdir -p /var/run/memcached - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then - chown $USER /var/run/memcached - fi +prog="memcached" - start_instance default 64; - #start_instance block 16; - #start_instance content 128; - #start_instance filter 128; - #start_instance form 32; - #start_instance menu 16; - #start_instance page 8; - #start_instance update 8; - #start_instance views 8; +start () { + echo -n $"Starting $prog: " + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + daemon memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached } stop () { - stop_instance default; - #stop_instance block; - #stop_instance content; - #stop_instance filter; - #stop_instance form; - #stop_instance menu; - #stop_instance page; - #stop_instance update; - #stop_instance views; + echo -n $"Stopping $prog: " + killproc memcached + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/subsys/memcached + rm -f /var/run/memcached/memcached.pid + fi } - + restart () { - stop - start + stop + start } - - + + # See how we were called. case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status memcached - ;; - restart|reload|force-reload) - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" - exit 1 + start) + start + ;; + stop) + stop + ;; + status) + status memcached + ;; + restart|reload) + restart + ;; + condrestart) + [ -f /var/lock/subsys/memcached ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" + exit 1 esac - + exit $? From 0810c5c09d3150c268733233f5a0c27dc58e501b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 9 Aug 2014 10:39:25 +0800 Subject: [PATCH 379/617] update cmake 3.0.0 to 3.0.1 --- functions/mariadb-10.0.sh | 8 ++++---- functions/mariadb-5.5.sh | 8 ++++---- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/php-mysql-client.sh | 8 ++++---- init/Memcached-init-CentOS | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 30a7a206..d822ead3 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-10.0.12/source/mariadb-10.0.12.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf mariadb-10.0.12.tar.gz cd mariadb-10.0.12 diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index a79ff75a..41bcc848 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-5.5.39/source/mariadb-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf mariadb-5.5.39.tar.gz cd mariadb-5.5.39 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index c457125a..3e695104 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf mysql-5.5.39.tar.gz cd mysql-5.5.39 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index c0d56446..9402f7a0 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf mysql-5.6.20.tar.gz cd mysql-5.6.20 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 9ace7417..b960b52d 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.38-35.2.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf percona-server-5.5.38-35.2.tar.gz cd percona-server-5.5.38-35.2 diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 6044195f..004c70f5 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.19-67.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf percona-server-5.6.19-67.0.tar.gz cd percona-server-5.6.19-67.0 diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 1a9c63ea..63261e4a 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,16 +8,16 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.0.tar.gz - cd cmake-3.0.0 + tar xzf cmake-3.0.1.tar.gz + cd cmake-3.0.1 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.0 + /bin/rm -rf cmake-3.0.1 fi tar zxf mysql-5.5.38.tar.gz diff --git a/init/Memcached-init-CentOS b/init/Memcached-init-CentOS index 7ed1068f..74f7e45b 100755 --- a/init/Memcached-init-CentOS +++ b/init/Memcached-init-CentOS @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # # chkconfig: - 55 45 # description: The memcached daemon is a network memory cache service. From a7e4da2ca504fb403d4e0decaea6e1d34cebd598 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 12 Aug 2014 09:47:59 +0800 Subject: [PATCH 380/617] update mariadb 10.0.12 to 10.0.13 --- functions/mariadb-10.0.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index d822ead3..dd4be149 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-10.0.12/source/mariadb-10.0.12.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.13/source/mariadb-10.0.13.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.1 fi -tar zxf mariadb-10.0.12.tar.gz -cd mariadb-10.0.12 +tar zxf mariadb-10.0.13.tar.gz +cd mariadb-10.0.13 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-10.0.12 +/bin/rm -rf mariadb-10.0.13 cd .. # my.cf From fc5286dcc5b84fde67a976895a7e5f3141514d00 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 15 Aug 2014 10:21:18 +0800 Subject: [PATCH 381/617] update php 5.3.28 to 5.3.29 --- functions/php-5.3.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 85835956..ee7ddfb9 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.3.28.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.3.29.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.3.28.tar.gz +tar xzf php-5.3.29.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.3.28 -p0 < fpm-race-condition.patch -cd php-5.3.28 +patch -d php-5.3.29 -p0 < fpm-race-condition.patch +cd php-5.3.29 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.3.28 +/bin/rm -rf php-5.3.29 cd .. } From b5ffdd0b543b145ff2132ca374001115c4ed6649 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 27 Aug 2014 10:19:54 +0800 Subject: [PATCH 382/617] update php version --- functions/ImageMagick.sh | 8 ++++---- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/phpmyadmin.sh | 6 +++--- init/init_CentOS.sh | 7 ++----- init/init_Debian.sh | 7 ++----- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index a051f779..62cd01ec 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-6.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-7.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-6.tar.gz -cd ImageMagick-6.8.9-6 +tar xzf ImageMagick-6.8.9-7.tar.gz +cd ImageMagick-6.8.9-7 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-6 +/bin/rm -rf ImageMagick-6.8.9-7 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index ba09463c..fd9f913e 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.31.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.32.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.31.tar.gz +tar xzf php-5.4.32.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.31 -p0 < fpm-race-condition.patch -cd php-5.4.31 +patch -d php-5.4.32 -p0 < fpm-race-condition.patch +cd php-5.4.32 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.31 +/bin/rm -rf php-5.4.32 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index ddb47911..4c55b4e0 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.15.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.16.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.15.tar.gz +tar xzf php-5.5.16.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.15 -p0 < fpm-race-condition.patch -cd php-5.5.15 +patch -d php-5.5.16 -p0 < fpm-race-condition.patch +cd php-5.5.16 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.15 +/bin/rm -rf php-5.5.16 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index ffe9f30e..cb051822 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.7/phpMyAdmin-4.2.7-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.7.1/phpMyAdmin-4.2.7.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.7-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.7-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.7.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.7.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 3a78aafe..df8a2053 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -133,11 +133,8 @@ EOF sysctl -p if [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then - sed -i 's/3:2345:respawn/#3:2345:respawn/g' /etc/inittab - sed -i 's/4:2345:respawn/#4:2345:respawn/g' /etc/inittab - sed -i 's/5:2345:respawn/#5:2345:respawn/g' /etc/inittab - sed -i 's/6:2345:respawn/#6:2345:respawn/g' /etc/inittab - sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/g' /etc/inittab + sed -i 's@^[3-6]:2345:respawn@#&@g' /etc/inittab + sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n elif [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 0da0d486..cba9b2e7 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -75,11 +75,8 @@ EOF sysctl -p sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup -sed -i 's@^3:23:respawn@#3:23:respawn@' /etc/inittab -sed -i 's@^4:23:respawn@#4:23:respawn@' /etc/inittab -sed -i 's@^5:23:respawn@#5:23:respawn@' /etc/inittab -sed -i 's@^6:23:respawn@#6:23:respawn@' /etc/inittab -sed -i "s@^ctrlaltdel@#ctrlaltdel@" /etc/inittab +sed -i 's@^[3-6]:23:respawn@#&@g' /etc/inittab +sed -i "s@^ctrlaltdel@#&@" /etc/inittab sed -i 's@^# en_US.UTF-8@en_US.UTF-8@' /etc/locale.gen init q From 0a0d3dc5340565b3328916610861389e50cdf715 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 30 Aug 2014 22:09:06 +0800 Subject: [PATCH 383/617] update percona-server version --- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index b960b52d..a6fe1f15 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.38-35.2.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.39-36.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.1 fi -tar zxf percona-server-5.5.38-35.2.tar.gz -cd percona-server-5.5.38-35.2 +tar zxf percona-server-5.5.39-36.0.tar.gz +cd percona-server-5.5.39-36.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.5.38-35.2 +/bin/rm -rf percona-server-5.5.39-36.0 cd .. # my.cf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 004c70f5..ddc43406 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.19-67.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.20-68.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.1 fi -tar zxf percona-server-5.6.19-67.0.tar.gz -cd percona-server-5.6.19-67.0 +tar zxf percona-server-5.6.20-68.0.tar.gz +cd percona-server-5.6.20-68.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -62,7 +62,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.19-67.0 +/bin/rm -rf percona-server-5.6.20-68.0 cd .. # my.cf diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index ee7ddfb9..7e9abf88 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -161,7 +161,7 @@ cat > $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < $php_install_dir/etc/php-fpm.conf < Date: Mon, 1 Sep 2014 14:50:24 +0800 Subject: [PATCH 384/617] bug --- init/init_CentOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index df8a2053..0022b280 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,7 +14,7 @@ yum clean all cd /etc/yum.repos.d/ rename repo repo_bk *.repo -rename repo_bk repo *ent* +[ -e "/etc/yum.repos.d/CentOS-Base.repo_bk" ] && /bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} || rename repo_bk repo *ent* cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then From 02a9ddc11d43936b4a4a17ca7fad04607ca260de Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 2 Sep 2014 11:28:52 +0800 Subject: [PATCH 385/617] update redis 2.8.13 to 2.8.14 --- functions/php-5.6.sh | 258 +++++++++++++++++++++++++++++++++++++++++++ functions/redis.sh | 8 +- 2 files changed, 262 insertions(+), 4 deletions(-) create mode 100755 functions/php-5.6.sh diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh new file mode 100755 index 00000000..e8e08460 --- /dev/null +++ b/functions/php-5.6.sh @@ -0,0 +1,258 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_PHP-5-6() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.0.tar.gz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +make && make install +cd ../ +/bin/rm -rf libiconv-1.14 + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ +/bin/rm -rf libmcrypt-2.5.8 + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ +/bin/rm -rf mhash-0.9.9.9 + +# linked library +if [ "$PHP_MySQL_driver" == '1' ];then + PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" +elif [ "$PHP_MySQL_driver" == '2' ];then + [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir + ln -s $db_install_dir/include /usr/include/mysql + PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" +fi +echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf +echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf +ldconfig +OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n +else \n + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n +fi' +OS_command + +tar xzf mcrypt-2.6.8.tar.gz +cd mcrypt-2.6.8 +ldconfig +./configure +make && make install +cd ../ +/bin/rm -rf mcrypt-2.6.8 + +tar xzf php-5.6.0.tar.gz +useradd -M -s /sbin/nologin www +wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' +patch -d php-5.6.0 -p0 < fpm-race-condition.patch +cd php-5.6.0 +make clean +[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' +if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +else +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +fi +make ZEND_EXTRA_LIBS='-liconv' +make install + +if [ -d "$php_install_dir" ];then + echo -e "\033[32mPHP install successfully! \033[0m" +else + echo -e "\033[31mPHP install failed, Please Contact the author! \033[0m" + kill -9 $$ +fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile +. /etc/profile + +# wget -c http://pear.php.net/go-pear.phar +# $php_install_dir/bin/php go-pear.phar + +/bin/cp php.ini-production $php_install_dir/etc/php.ini + +# Modify php.ini +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini +sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini +sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini +sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini +sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini +[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + +if [ "$PHP_cache" == '1' ];then +sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini +sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini +sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini +fi + +if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then +# php-fpm Init Script +/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +OS_CentOS='chkconfig --add php-fpm \n +chkconfig php-fpm on' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' +OS_command + +cat > $php_install_dir/etc/php-fpm.conf <&1 | tee -a $lnmp_dir/install.log + . functions/php-5.3.sh + Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/install.log elif [ "$PHP_version" == '2' ];then . functions/php-5.4.sh Install_PHP-5-4 2>&1 | tee -a $lnmp_dir/install.log elif [ "$PHP_version" == '3' ];then - . functions/php-5.3.sh - Install_PHP-5-3 2>&1 | tee -a $lnmp_dir/install.log + . functions/php-5.5.sh + Install_PHP-5-5 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_version" == '4' ];then + . functions/php-5.6.sh + Install_PHP-5-6 2>&1 | tee -a $lnmp_dir/install.log fi # ImageMagick or GraphicsMagick From 738a8ebd329e159864228f469cf4f53a6c93697f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 4 Sep 2014 09:30:00 +0800 Subject: [PATCH 387/617] update phpMyAdmin 4.2.7.1 to 4.2.8 --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index cb051822..3a5814db 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.7.1/phpMyAdmin-4.2.7.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.8/phpMyAdmin-4.2.8-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.7.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.7.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.8-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.8-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 352ffccbd9e583fe2ce8e387dbc98b0e2a8afc11 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 4 Sep 2014 13:08:46 +0800 Subject: [PATCH 388/617] bug php-5.6 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 9c3b4bc8..ee35bf72 100755 --- a/install.sh +++ b/install.sh @@ -168,7 +168,7 @@ else echo -e "\t\033[32m1\033[0m. Install php-5.3" echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.5" - echo -e "\t\033[32m4\033[0m. Install php-5.5" + echo -e "\t\033[32m4\033[0m. Install php-5.6" read -p "Please input a number:(Default 1 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 ];then From d0db01b637bbe03ebd0cbea31c9e1ad71b053ece Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 5 Sep 2014 21:47:16 +0800 Subject: [PATCH 389/617] bug --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ee35bf72..78140551 100755 --- a/install.sh +++ b/install.sh @@ -563,7 +563,7 @@ if [ "$ionCube_yn" == 'y' ];then fi # PHP opcode cache -if [ "$PHP_cache" == '1' -a "$PHP_version" != '1' ];then +if [ "$PHP_cache" == '1' -a "$PHP_version" != '3' -o "$PHP_version" != '4' ];then . functions/zendopcache.sh Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/install.log elif [ "$PHP_cache" == '2' ];then @@ -575,7 +575,7 @@ elif [ "$PHP_cache" == '3' ];then elif [ "$PHP_cache" == '4' -a "$PHP_version" == '2' ];then . functions/eaccelerator-1.0-dev.sh Install_eAccelerator-1-0-dev 2>&1 | tee -a $lnmp_dir/install.log -elif [ "$PHP_cache" == '4' -a "$PHP_version" == '3' ];then +elif [ "$PHP_cache" == '4' -a "$PHP_version" == '1' ];then . functions/eaccelerator-0.9.sh Install_eAccelerator-0-9 2>&1 | tee -a $lnmp_dir/install.log fi From 69d76823c1118969df7c6344bd3378074b83e7a9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 10 Sep 2014 14:32:53 +0800 Subject: [PATCH 390/617] bug --- install.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 78140551..b42b8e12 100755 --- a/install.sh +++ b/install.sh @@ -272,7 +272,7 @@ else (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo -e "\033[31mxcache admin password least 5 characters! \033[0m" done fi - if [ "$PHP_version" == '2' -o "$PHP_version" == '3' ];then + if [ "$PHP_version" == '1' -o "$PHP_version" == '2' ];then while : do echo @@ -285,16 +285,18 @@ else done fi - while : - do - echo - read -p "Do you want to install ionCube? [y/n]: " ionCube_yn - if [ "$ionCube_yn" != 'y' -a "$ionCube_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done + if [ "$PHP_version" != '4' ];then + while : + do + echo + read -p "Do you want to install ionCube? [y/n]: " ionCube_yn + if [ "$ionCube_yn" != 'y' -a "$ionCube_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + fi while : do @@ -563,7 +565,7 @@ if [ "$ionCube_yn" == 'y' ];then fi # PHP opcode cache -if [ "$PHP_cache" == '1' -a "$PHP_version" != '3' -o "$PHP_version" != '4' ];then +if [ "$PHP_cache" == '1' ] && [ "$PHP_version" != '3' -a "$PHP_version" != '4' ];then . functions/zendopcache.sh Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/install.log elif [ "$PHP_cache" == '2' ];then From 439ad286bf91843ca1f8a3f4db3d6a17ec0bd9f0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 12 Sep 2014 18:45:36 +0800 Subject: [PATCH 391/617] update cmake 3.0.1 to 3.0.2 --- functions/mariadb-10.0.sh | 8 ++++---- functions/mariadb-5.5.sh | 8 ++++---- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/php-mysql-client.sh | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index dd4be149..6423a55e 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-10.0.13/source/mariadb-10.0.13.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf mariadb-10.0.13.tar.gz cd mariadb-10.0.13 diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 41bcc848..13105c82 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-5.5.39/source/mariadb-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf mariadb-5.5.39.tar.gz cd mariadb-5.5.39 diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 3e695104..ba3e5b93 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.39.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf mysql-5.5.39.tar.gz cd mysql-5.5.39 diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 9402f7a0..85ecd253 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,18 +9,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf mysql-5.6.20.tar.gz cd mysql-5.6.20 diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index a6fe1f15..5c3192a8 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.39-36.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf percona-server-5.5.39-36.0.tar.gz cd percona-server-5.5.39-36.0 diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index ddc43406..396e262c 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,18 +8,18 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.20-68.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf percona-server-5.6.20-68.0.tar.gz cd percona-server-5.6.20-68.0 diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 63261e4a..3eb2dd99 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -8,16 +8,16 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gz && Download_src +src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.1.tar.gz - cd cmake-3.0.1 + tar xzf cmake-3.0.2.tar.gz + cd cmake-3.0.2 CFLAGS= CXXFLAGS= ./configure make && make install cd .. - /bin/rm -rf cmake-3.0.1 + /bin/rm -rf cmake-3.0.2 fi tar zxf mysql-5.5.38.tar.gz From 345129ddcf9fe0acdb08d5fe76b3bbdd8c6921d2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 13 Sep 2014 10:29:42 +0800 Subject: [PATCH 392/617] update redis 2.8.14 to 2.8.15 --- functions/redis.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index de3aa6c4..c13646a2 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.14.tar.gz && Download_src -tar xzf redis-2.8.14.tar.gz -cd redis-2.8.14 +src_url=http://download.redis.io/releases/redis-2.8.15.tar.gz && Download_src +tar xzf redis-2.8.15.tar.gz +cd redis-2.8.15 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.14 + /bin/rm -rf redis-2.8.15 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n From cc704e8db28a31cb90e2d829c8459d6a1a2f20a3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 13 Sep 2014 12:52:29 +0800 Subject: [PATCH 393/617] yum bug --- init/init_CentOS.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 0022b280..58a3562e 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -12,15 +12,11 @@ cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -cd /etc/yum.repos.d/ -rename repo repo_bk *.repo -[ -e "/etc/yum.repos.d/CentOS-Base.repo_bk" ] && /bin/mv /etc/yum.repos.d/CentOS-Base.repo{_bk,} || rename repo_bk repo *ent* -cd - #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then if [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d - if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo @@ -28,7 +24,7 @@ cd - fi elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d - if [ ! -z "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS-Base.repo @@ -50,6 +46,16 @@ yum check-update # check upgrade OS [ "$upgrade_yn" == 'y' ] && yum -y upgrade +cd /etc/yum.repos.d/ +if [ -e "CentOS-Base.repo" -a ! -e "centos.repo" ];then + rename repo repo_bk *.repo + /bin/mv CentOS-Base.repo{_bk,} +elif [ -e "CentOS-Base.repo" -a -e "centos.repo" ];then + rename repo repo_bk *.repo + /bin/mv centos.repo{_bk,} +fi +cd - + # Install needed packages for Package in gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync do From 2974d4216089def6d25ea06568f5bc076a726887 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Sep 2014 10:37:56 +0800 Subject: [PATCH 394/617] update ngx_pagespeed 1.8.31.4-beta to 1.9.32.1-beta --- functions/ngx_pagespeed.sh | 16 ++++++++-------- functions/phpmyadmin.sh | 6 +++--- vhost.sh | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index be0ff86e..2f899829 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz && Download_src -[ -s "ngx_pagespeed-1.8.31.4-beta.zip" ] && echo "ngx_pagespeed-1.8.31.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.1.tar.gz && Download_src +[ -s "ngx_pagespeed-1.9.32.1-beta.zip" ] && echo "ngx_pagespeed-1.9.32.1-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.1-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.8.31.4-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.4-beta -tar xzf 1.8.31.4.tar.gz -C ngx_pagespeed-1.8.31.4-beta +unzip -q ngx_pagespeed-1.9.32.1-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.9.32.1-beta +tar xzf 1.9.32.1.tar.gz -C ngx_pagespeed-1.9.32.1-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.6.1 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.8.31.4-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.4-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.1-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 3a5814db..3b8dee3b 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.8/phpMyAdmin-4.2.8-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.8.1/phpMyAdmin-4.2.8.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.8-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.8-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.8.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.8.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/vhost.sh b/vhost.sh index de3afd8a..757c2698 100755 --- a/vhost.sh +++ b/vhost.sh @@ -19,7 +19,7 @@ Input_domain() while : do echo - read -p "Please input domain(example: www.linuxeye.com linuxeye.com): " domain + read -p "Please input domain(example: www.linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo -e "\033[31minput error! \033[0m" else From d8f91632276335fdfeb0b7c1d04f8625cd536f31 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 20 Sep 2014 22:25:41 +0800 Subject: [PATCH 395/617] update php version --- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/phpmyadmin.sh | 6 +++--- init/Memcached-init-CentOS | 0 init/Memcached-init-Ubuntu | 0 init/Nginx-init-CentOS | 0 init/Nginx-init-Ubuntu | 0 init/Redis-server-init-CentOS | 0 init/Redis-server-init-Ubuntu | 0 upgrade_web.sh | 12 ++++++------ 10 files changed, 19 insertions(+), 19 deletions(-) mode change 100755 => 100644 init/Memcached-init-CentOS mode change 100755 => 100644 init/Memcached-init-Ubuntu mode change 100755 => 100644 init/Nginx-init-CentOS mode change 100755 => 100644 init/Nginx-init-Ubuntu mode change 100755 => 100644 init/Redis-server-init-CentOS mode change 100755 => 100644 init/Redis-server-init-Ubuntu diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 095495a8..1d32e68d 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.32.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.33.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.32.tar.gz +tar xzf php-5.4.33.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.32 -p0 < fpm-race-condition.patch -cd php-5.4.32 +patch -d php-5.4.33 -p0 < fpm-race-condition.patch +cd php-5.4.33 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.32 +/bin/rm -rf php-5.4.33 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index d0116d0a..1259f15c 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.16.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.17.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.16.tar.gz +tar xzf php-5.5.17.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.16 -p0 < fpm-race-condition.patch -cd php-5.5.16 +patch -d php-5.5.17 -p0 < fpm-race-condition.patch +cd php-5.5.17 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.16 +/bin/rm -rf php-5.5.17 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 3b8dee3b..1f973c77 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.8.1/phpMyAdmin-4.2.8.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.9/phpMyAdmin-4.2.9-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.8.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.8.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.9-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.9-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/init/Memcached-init-CentOS b/init/Memcached-init-CentOS old mode 100755 new mode 100644 diff --git a/init/Memcached-init-Ubuntu b/init/Memcached-init-Ubuntu old mode 100755 new mode 100644 diff --git a/init/Nginx-init-CentOS b/init/Nginx-init-CentOS old mode 100755 new mode 100644 diff --git a/init/Nginx-init-Ubuntu b/init/Nginx-init-Ubuntu old mode 100755 new mode 100644 diff --git a/init/Redis-server-init-CentOS b/init/Redis-server-init-CentOS old mode 100755 new mode 100644 diff --git a/init/Redis-server-init-Ubuntu b/init/Redis-server-init-Ubuntu old mode 100755 new mode 100644 diff --git a/upgrade_web.sh b/upgrade_web.sh index e6da270b..a5b58a53 100755 --- a/upgrade_web.sh +++ b/upgrade_web.sh @@ -128,14 +128,14 @@ if [ -e "tengine-$tengine_version.tar.gz" ];then if [ -e "$web_install_dir/modules$(date +%m%d)/ngx_pagespeed.so" ];then cd $lnmp_dir/src rm -rf ngx_pagespeed* - src_url=https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz && Download_src - [ -s "ngx_pagespeed-1.8.31.4-beta.zip" ] && echo "ngx_pagespeed-1.8.31.4-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.8.31.4-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip + src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.1.tar.gz && Download_src + [ -s "ngx_pagespeed-1.9.32.1-beta.zip" ] && echo "ngx_pagespeed-1.9.32.1-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.1-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip - unzip -q ngx_pagespeed-1.8.31.4-beta.zip - /bin/mv ngx_pagespeed-master ngx_pagespeed-1.8.31.4-beta - tar xzf 1.8.31.4.tar.gz -C ngx_pagespeed-1.8.31.4-beta + unzip -q ngx_pagespeed-1.9.32.1-beta.zip + /bin/mv ngx_pagespeed-master ngx_pagespeed-1.9.32.1-beta + tar xzf 1.9.32.1.tar.gz -C ngx_pagespeed-1.9.32.1-beta cd tengine-$tengine_version - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.8.31.4-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.1-beta fi kill -USR2 `cat /var/run/nginx.pid` From 3c4487e28d5450a0d3ddd59a510a2b4316fc6d16 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 20 Sep 2014 22:26:22 +0800 Subject: [PATCH 396/617] update php version --- init/Memcached-init-CentOS | 0 init/Memcached-init-Ubuntu | 0 init/Nginx-init-CentOS | 0 init/Nginx-init-Ubuntu | 0 init/Redis-server-init-CentOS | 0 init/Redis-server-init-Ubuntu | 0 6 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 init/Memcached-init-CentOS mode change 100644 => 100755 init/Memcached-init-Ubuntu mode change 100644 => 100755 init/Nginx-init-CentOS mode change 100644 => 100755 init/Nginx-init-Ubuntu mode change 100644 => 100755 init/Redis-server-init-CentOS mode change 100644 => 100755 init/Redis-server-init-Ubuntu diff --git a/init/Memcached-init-CentOS b/init/Memcached-init-CentOS old mode 100644 new mode 100755 diff --git a/init/Memcached-init-Ubuntu b/init/Memcached-init-Ubuntu old mode 100644 new mode 100755 diff --git a/init/Nginx-init-CentOS b/init/Nginx-init-CentOS old mode 100644 new mode 100755 diff --git a/init/Nginx-init-Ubuntu b/init/Nginx-init-Ubuntu old mode 100644 new mode 100755 diff --git a/init/Redis-server-init-CentOS b/init/Redis-server-init-CentOS old mode 100644 new mode 100755 diff --git a/init/Redis-server-init-Ubuntu b/init/Redis-server-init-Ubuntu old mode 100644 new mode 100755 From 1fe2bc79e55c399d10a61b02b13582d6abc06014 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 22 Sep 2014 17:28:02 +0800 Subject: [PATCH 397/617] update nginx 1.6.1 to 1.6.2 --- functions/nginx.sh | 6 +++--- functions/ngx_pagespeed.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/nginx.sh b/functions/nginx.sh index fb58c7ff..49f798da 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-1.6.1.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-1.6.2.tar.gz && Download_src tar xzf pcre-8.35.tar.gz cd pcre-8.35 @@ -18,9 +18,9 @@ cd pcre-8.35 make && make install cd ../ -tar xzf nginx-1.6.1.tar.gz +tar xzf nginx-1.6.2.tar.gz useradd -M -s /sbin/nologin www -cd nginx-1.6.1 +cd nginx-1.6.2 # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 2f899829..9efb120f 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -17,7 +17,7 @@ unzip -q ngx_pagespeed-1.9.32.1-beta.zip tar xzf 1.9.32.1.tar.gz -C ngx_pagespeed-1.9.32.1-beta if [ "$Nginx_version" == '1' ];then - cd nginx-1.6.1 + cd nginx-1.6.2 make clean $web_install_dir/sbin/nginx -V &> $$ nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` From 5249684d0bf8966c2dc9e9a3b17c4fb0c6a6d89e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 24 Sep 2014 21:45:43 +0800 Subject: [PATCH 398/617] update MySQL version --- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index ba3e5b93..5e119f2c 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.39.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.5.39.tar.gz -cd mysql-5.5.39 +tar zxf mysql-5.5.40.tar.gz +cd mysql-5.5.40 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -60,7 +60,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.5.39 +/bin/rm -rf mysql-5.5.40 cd .. # my.cf diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 85ecd253..d0f9d558 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.21.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.6.20.tar.gz -cd mysql-5.6.20 +tar zxf mysql-5.6.21.tar.gz +cd mysql-5.6.21 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -59,7 +59,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.6.20 +/bin/rm -rf mysql-5.6.21 cd .. # my.cf From 8b2e27fddd8176b6bf29e483e1d1c4598129f354 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 25 Sep 2014 10:19:34 +0800 Subject: [PATCH 399/617] update apache 2.2.27 to 2.2.29 --- functions/apache-2.2.sh | 8 ++++---- functions/apache-2.4.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/apache-2.2.sh b/functions/apache-2.2.sh index a9d4f86f..4a4680b5 100755 --- a/functions/apache-2.2.sh +++ b/functions/apache-2.2.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.apache.org/dist/httpd/httpd-2.2.27.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.2.29.tar.gz && Download_src useradd -M -s /sbin/nologin www -tar xzf httpd-2.2.27.tar.gz -cd httpd-2.2.27 +tar xzf httpd-2.2.29.tar.gz +cd httpd-2.2.29 ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install if [ -d "$apache_install_dir" ];then @@ -27,7 +27,7 @@ fi . /etc/profile cd .. -/bin/rm -rf httpd-2.2.27 +/bin/rm -rf httpd-2.2.29 /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 980b33f7..4d1a0987 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -11,7 +11,7 @@ cd $lnmp_dir/src src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.10.tar.gz && Download_src tar xzf pcre-8.35.tar.gz @@ -23,10 +23,10 @@ cd ../ useradd -M -s /sbin/nologin www tar xzf httpd-2.4.10.tar.gz tar xzf apr-1.5.1.tar.gz -tar xzf apr-util-1.5.3.tar.gz +tar xzf apr-util-1.5.4.tar.gz cd httpd-2.4.10 /bin/cp -R ../apr-1.5.1 ./srclib/apr -/bin/cp -R ../apr-util-1.5.3 ./srclib/apr-util +/bin/cp -R ../apr-util-1.5.4 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir make && make install if [ -d "$apache_install_dir" ];then From bb591af30f6ee11cf7d23ab42e476f5879112719 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 25 Sep 2014 16:53:48 +0800 Subject: [PATCH 400/617] update version --- functions/GraphicsMagick.sh | 8 ++++---- functions/ImageMagick.sh | 8 ++++---- functions/redis.sh | 8 ++++---- functions/xcache.sh | 8 ++++---- init/init_CentOS.sh | 8 +++++--- install.sh | 5 +++-- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index a9a35b88..c93af767 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.20/GraphicsMagick-1.3.20.tar.gz && Download_src -tar xzf GraphicsMagick-1.3.19.tar.gz -cd GraphicsMagick-1.3.19 +tar xzf GraphicsMagick-1.3.20.tar.gz +cd GraphicsMagick-1.3.20 ./configure --enable-shared make && make install cd ../ -/bin/rm -rf GraphicsMagick-1.3.19 +/bin/rm -rf GraphicsMagick-1.3.20 if [ -e "$php_install_dir/bin/phpize" ];then src_url=http://pecl.php.net/get/gmagick-1.1.7RC2.tgz && Download_src diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 62cd01ec..68dbdba3 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-7.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-8.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-7.tar.gz -cd ImageMagick-6.8.9-7 +tar xzf ImageMagick-6.8.9-8.tar.gz +cd ImageMagick-6.8.9-8 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-7 +/bin/rm -rf ImageMagick-6.8.9-8 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/redis.sh b/functions/redis.sh index c13646a2..67aa7d7e 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.15.tar.gz && Download_src -tar xzf redis-2.8.15.tar.gz -cd redis-2.8.15 +src_url=http://download.redis.io/releases/redis-2.8.17.tar.gz && Download_src +tar xzf redis-2.8.17.tar.gz +cd redis-2.8.17 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.15 + /bin/rm -rf redis-2.8.17 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n diff --git a/functions/xcache.sh b/functions/xcache.sh index b72eb35a..09680979 100755 --- a/functions/xcache.sh +++ b/functions/xcache.sh @@ -8,9 +8,9 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://xcache.lighttpd.net/pub/Releases/3.1.0/xcache-3.1.0.tar.gz && Download_src -tar xzf xcache-3.1.0.tar.gz -cd xcache-3.1.0 +src_url=http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz && Download_src +tar xzf xcache-3.2.0.tar.gz +cd xcache-3.2.0 make clean $php_install_dir/bin/phpize ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config @@ -77,6 +77,6 @@ else echo -e "\033[31meXcache module install failed, Please contact the author! \033[0m" fi cd .. -/bin/rm -rf xcache-3.1.0 +/bin/rm -rf xcache-3.2.0 cd .. } diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 58a3562e..c6f5ab28 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -62,6 +62,8 @@ do yum -y install $Package done +yum -y update bash openssl + # use gcc-4.4 if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then yum -y install gcc44 gcc44-c++ libstdc++44-devel @@ -180,15 +182,15 @@ service iptables restart # install tmux if [ ! -e "`which tmux`" ];then src_url=http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.21-stable.tar.gz && Download_src - src_url=http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.9/tmux-1.9a.tar.gz && Download_src tar xzf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable ./configure make && make install cd .. - tar xzf tmux-1.8.tar.gz - cd tmux-1.8 + tar xzf tmux-1.9a.tar.gz + cd tmux-1.9a CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure make && make install cd .. diff --git a/install.sh b/install.sh index b42b8e12..4247c153 100755 --- a/install.sh +++ b/install.sh @@ -252,10 +252,11 @@ else do echo 'Please select a opcode cache of the PHP:' echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + echo -e "\t\033[32m2\033[0m. Install XCache" read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 ];then - echo -e "\033[31minput error! Please only input number 1\033[0m" + if [ $PHP_cache != 1 -a $PHP_cache != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" else break fi From f8dd1ccdcbaa2f7b6cd7a65f5881dbe9c4f9d71e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 25 Sep 2014 23:07:24 +0800 Subject: [PATCH 401/617] enable nginx gzip js --- conf/nginx.conf | 2 +- conf/nginx_apache.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6bb243b8..a2e81c56 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -38,7 +38,7 @@ http { gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; - gzip_types text/plain application/x-javascript text/css application/xml; + gzip_types text/plain application/x-javascript text/css application/xml application/javascript; ###################pureftpd AND phpmyadmin############################ server { diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index f83f95b7..4e255ea1 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -53,7 +53,7 @@ http { gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; - gzip_types text/plain application/x-javascript text/css application/xml; + gzip_types text/plain application/x-javascript text/css application/xml application/javascript; ###################pureftpd AND phpmyadmin############################ server { From 6e67ab3b5343481f1c318832cfa2ac1d35a8bfe3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 27 Sep 2014 12:12:12 +0800 Subject: [PATCH 402/617] update mariadb 10.0.13 to 10.0.14 --- backup_setup.sh | 2 +- functions/mariadb-10.0.sh | 8 ++++---- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/php-5.6.sh | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backup_setup.sh b/backup_setup.sh index 031bc02b..ec2ff294 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -91,7 +91,7 @@ if [ "$remote_bankup_yn" == 'y' ];then do echo read -p "Please enter the remote host ip: " remote_ip - [ -z "$remote_ip" ] && continue + [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue echo read -p "Please enter the remote host port(Default: 22) : " remote_port [ -z "$remote_port" ] && remote_port=22 diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 6423a55e..0b2eacc5 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-10.0.13/source/mariadb-10.0.13.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.14/source/mariadb-10.0.14.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mariadb-10.0.13.tar.gz -cd mariadb-10.0.13 +tar zxf mariadb-10.0.14.tar.gz +cd mariadb-10.0.14 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-10.0.13 +/bin/rm -rf mariadb-10.0.14 cd .. # my.cf diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 7e9abf88..f59fe852 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -188,7 +188,7 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 -pm.process_idle_timeout = 10 +pm.process_idle_timeout = 10s request_terminate_timeout = 120 request_slowlog_timeout = 0 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 1d32e68d..71999e55 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -188,7 +188,7 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 -pm.process_idle_timeout = 10 +pm.process_idle_timeout = 10s request_terminate_timeout = 120 request_slowlog_timeout = 0 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 1259f15c..eab4731d 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -202,7 +202,7 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 -pm.process_idle_timeout = 10 +pm.process_idle_timeout = 10s request_terminate_timeout = 120 request_slowlog_timeout = 0 diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index e8e08460..ef0b80b2 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -202,7 +202,7 @@ pm.start_servers = 8 pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 -pm.process_idle_timeout = 10 +pm.process_idle_timeout = 10s request_terminate_timeout = 120 request_slowlog_timeout = 0 From 5059148569306405940f5aeec3ccbab2b4075886 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 Oct 2014 10:28:16 +0800 Subject: [PATCH 403/617] update version --- functions/memcached.sh | 2 +- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/php-5.6.sh | 10 +++++----- functions/php-mysql-client.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/functions/memcached.sh b/functions/memcached.sh index ffdd9ae0..77c5d790 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -76,7 +76,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then /bin/rm -rf memcached-2.2.0 if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/memcached.so" ];then [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions/ | grep zts`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"@' $php_install_dir/etc/php.ini + sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"\nmemcached.use_sasl = 1@' $php_install_dir/etc/php.ini [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo -e "\033[31mPHP memcached module install failed, Please contact the author! \033[0m" diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 5c3192a8..8300fd34 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.39-36.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.40-36.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf percona-server-5.5.39-36.0.tar.gz -cd percona-server-5.5.39-36.0 +tar zxf percona-server-5.5.40-36.1.tar.gz +cd percona-server-5.5.40-36.1 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.5.39-36.0 +/bin/rm -rf percona-server-5.5.40-36.1 cd .. # my.cf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 396e262c..fa9fb256 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.20-68.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-69.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf percona-server-5.6.20-68.0.tar.gz -cd percona-server-5.6.20-68.0 +tar zxf percona-server-5.6.21-69.0.tar.gz +cd percona-server-5.6.21-69.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -62,7 +62,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.20-68.0 +/bin/rm -rf percona-server-5.6.21-69.0 cd .. # my.cf diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index ef0b80b2..66d9cad2 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.0.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.1.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.0.tar.gz +tar xzf php-5.6.1.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.0 -p0 < fpm-race-condition.patch -cd php-5.6.0 +patch -d php-5.6.1 -p0 < fpm-race-condition.patch +cd php-5.6.1 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.0 +/bin/rm -rf php-5.6.1 cd .. } diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 3eb2dd99..74e5acc8 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-3.0.2.tar.gz @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.5.38.tar.gz -cd mysql-5.5.38 +tar zxf mysql-5.5.40.tar.gz +cd mysql-5.5.40 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} @@ -29,6 +29,6 @@ mkdir -p $mysql_install_dir/{lib,bin} /bin/cp scripts/mysql_config $mysql_install_dir/bin /bin/cp -R include $mysql_install_dir cd .. -/bin/rm -rf mysql-5.5.38 +/bin/rm -rf mysql-5.5.40 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 1f973c77..b98c0209 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.9/phpMyAdmin-4.2.9-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.9.1/phpMyAdmin-4.2.9.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.9-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.9-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.9.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.9.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 73bc5173a58598418c1f5e8e37aec560c386123b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 8 Oct 2014 20:21:28 +0800 Subject: [PATCH 404/617] input passwod bug --- install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 4247c153..c9daf165 100755 --- a/install.sh +++ b/install.sh @@ -141,7 +141,8 @@ do while : do read -p "Please input the root password of database: " dbrootpwd - (( ${#dbrootpwd} >= 5 )) && sed -i "s@^dbrootpwd.*@dbrootpwd=$dbrootpwd@" ./options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" + [ -n "`echo $dbrootpwd | grep +`" ] && { echo -e "\033[31minput error,not contain a plus sign (+).\033[0m"; continue; } + (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" done break fi @@ -358,8 +359,9 @@ do while : do read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd + [ -n "`echo $ftpmanagerpwd | grep +`" ] && { echo -e "\033[31minput error,not contain a plus sign (+).\033[0m"; continue; } if (( ${#ftpmanagerpwd} >= 5 ));then - sed -i "s@^ftpmanagerpwd.*@ftpmanagerpwd=$ftpmanagerpwd@" options.conf + sed -i "s+^ftpmanagerpwd.*+ftpmanagerpwd='$ftpmanagerpwd'+" options.conf break else echo -e "\033[31mFtp manager password least 5 characters! \033[0m" From 3db82902a74647a3511535f972534e710d3c5ba9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 10 Oct 2014 15:33:26 +0800 Subject: [PATCH 405/617] update mariadb 5.5.39 to 5.5.40 --- functions/mariadb-5.5.sh | 8 ++++---- functions/test.sh | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 13105c82..f6355a38 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=https://downloads.mariadb.org/f/mariadb-5.5.39/source/mariadb-5.5.39.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.40/source/mariadb-5.5.40.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mariadb-5.5.39.tar.gz -cd mariadb-5.5.39 +tar zxf mariadb-5.5.40.tar.gz +cd mariadb-5.5.40 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -63,7 +63,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-5.5.39 +/bin/rm -rf mariadb-5.5.40 cd .. # my.cf diff --git a/functions/test.sh b/functions/test.sh index d0e36546..cef87880 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -8,12 +8,22 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://www.yahei.net/tz/tz.zip && Download_src +public_IP=`../functions/get_public_ip.py` +if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then + FLAG_IP=CN +fi + +if [ "$FLAG_IP"x == "CN"x ];then + src_url=http://www.yahei.net/tz/tz.zip && Download_src + unzip -q tz.zip -d $home_dir/default +else + src_url=http://www.yahei.net/tz/tz_e.zip && Download_src + unzip -q tz_e.zip -d $home_dir/default;/bin/mv $home_dir/default/{tz_e.php,tz.php} +fi src_url=https://gist.githubusercontent.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src echo '' > $home_dir/default/phpinfo.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default -unzip -q tz.zip -d $home_dir/default [ "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html [ "$PHP_cache" == '3' ] && sed -i 's@xcache@APC@' $home_dir/default/index.html [ "$PHP_cache" == '4' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html @@ -23,4 +33,4 @@ chown -R www.www $home_dir/default [ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start [ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart cd .. -} + From 057d01a326e6fcc01ad550acf66877c7b0496927 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 11 Oct 2014 20:33:05 +0800 Subject: [PATCH 406/617] index.html bug --- README.md | 12 ++++++------ backup.sh | 4 ++-- functions/test.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5f276e5b..39ef3bd1 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,16 @@ - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) - You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) -- You can freely choose to install Nginx or Tengine -- You can freely choose to install Apache version (Apache-2.4, Apache-2.2) +- You can freely choose to install Nginx or Tengine +- You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ngx_pagespeed -- According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) +- According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis -- According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc -- Add a virtual host script provided +- According to their needs can to optimize MySQL and Nginx with jemalloc or tcmalloc +- Add a virtual host script provided - Nginx/Tengine, PHP, Redis, phpMyAdmin upgrade script provided -- Add backup script provided +- Add backup script provided ## How to use diff --git a/backup.sh b/backup.sh index 8ccdd71b..ab5d52c3 100755 --- a/backup.sh +++ b/backup.sh @@ -44,12 +44,12 @@ elif [ "$local_bankup_yn" == 'n' -a "$remote_bankup_yn" == 'y' ];then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > $lnmp_dir/tools/config.txt DB_Remote_BK WEB_Remote_BK - ./mabs.sh | tee mabs.log + ./mabs.sh -T -1 | tee mabs.log elif [ "$local_bankup_yn" == 'y' -a "$remote_bankup_yn" == 'y' ];then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > $lnmp_dir/tools/config.txt WEB_Local_BK WEB_Remote_BK DB_Local_BK DB_Remote_BK - ./mabs.sh | tee mabs.log + ./mabs.sh -T -1 | tee mabs.log fi diff --git a/functions/test.sh b/functions/test.sh index cef87880..ffa90b0a 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -33,4 +33,4 @@ chown -R www.www $home_dir/default [ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start [ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart cd .. - +} From d07419083adb8d6a0d1ee115eaa83cc28bfd5ff5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 13 Oct 2014 14:38:22 +0800 Subject: [PATCH 407/617] update phpMyAdmin 4.2.9.1 to 4.2.10 --- conf/index.html | 24 +++++++++++++----------- conf/index_cn.html | 39 +++++++++++++++++++++++++++++++++++++++ functions/phpmyadmin.sh | 6 +++--- functions/test.sh | 5 +++-- install.sh | 4 ++-- 5 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 conf/index_cn.html diff --git a/conf/index.html b/conf/index.html index cf16dfa7..d9f3f29a 100644 --- a/conf/index.html +++ b/conf/index.html @@ -1,15 +1,15 @@ -LNMP最新源码一键安装脚本 +LNMP and LAMP setup script - - + + + + +
+
+

Congratulations, LNMP安装成功!

+

LNMP最新源码一键安装脚本 Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc,添加虚拟主机请执行vhost.sh脚本。脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题(安装之前会执行初始化安全脚本init.sh

+

更多LNMP最新源码一键安装脚本信息请访问: http://blog.linuxeye.com/31.html

+

查看本地环境:探针 phpinfo FTP Manager xcache phpMyAdmin(为了更安全,建议将ftp和phpMyAdmin目录重命名!)

+

Github项目地址:https://github.com/lj2007331/lnmp

+

问题反馈论坛:http://bbs.linuxeye.com

+

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

+

赞助我们:

+

          支付宝:  lj2007331@163.com

+

          PayPal:  lj2007331@gmail.com

+ +
+ + diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index b98c0209..81cb841b 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.9.1/phpMyAdmin-4.2.9.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.10/phpMyAdmin-4.2.10-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.9.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.9.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.10-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.10-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/test.sh b/functions/test.sh index ffa90b0a..9840e529 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -16,14 +16,15 @@ fi if [ "$FLAG_IP"x == "CN"x ];then src_url=http://www.yahei.net/tz/tz.zip && Download_src unzip -q tz.zip -d $home_dir/default + /bin/cp $lnmp_dir/conf/index_cn.html $home_dir/default/index.html else src_url=http://www.yahei.net/tz/tz_e.zip && Download_src - unzip -q tz_e.zip -d $home_dir/default;/bin/mv $home_dir/default/{tz_e.php,tz.php} + unzip -q tz_e.zip -d $home_dir/default;/bin/mv $home_dir/default/{tz_e.php,proberv.php} + /bin/cp $lnmp_dir/conf/index.html $home_dir/default fi src_url=https://gist.githubusercontent.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src echo '' > $home_dir/default/phpinfo.php -/bin/cp $lnmp_dir/conf/index.html $home_dir/default [ "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@xcache@Opcache@' $home_dir/default/index.html [ "$PHP_cache" == '3' ] && sed -i 's@xcache@APC@' $home_dir/default/index.html [ "$PHP_cache" == '4' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@xcache@eAccelerator@' $home_dir/default/index.html diff --git a/install.sh b/install.sh index c9daf165..027a07f0 100755 --- a/install.sh +++ b/install.sh @@ -141,7 +141,7 @@ do while : do read -p "Please input the root password of database: " dbrootpwd - [ -n "`echo $dbrootpwd | grep +`" ] && { echo -e "\033[31minput error,not contain a plus sign (+).\033[0m"; continue; } + [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo -e "\033[31minput error,not contain a plus sign (+) and & \033[0m"; continue; } (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo -e "\033[31mdatabase root password least 5 characters! \033[0m" done break @@ -359,7 +359,7 @@ do while : do read -p "Please input the manager password of Pure-FTPd: " ftpmanagerpwd - [ -n "`echo $ftpmanagerpwd | grep +`" ] && { echo -e "\033[31minput error,not contain a plus sign (+).\033[0m"; continue; } + [ -n "`echo $ftpmanagerpwd | grep '[+|&]'`" ] && { echo -e "\033[31minput error,not contain a plus sign (+) and &\033[0m"; continue; } if (( ${#ftpmanagerpwd} >= 5 ));then sed -i "s+^ftpmanagerpwd.*+ftpmanagerpwd='$ftpmanagerpwd'+" options.conf break From e257b1caf9a13d989ac2f8de9450798c91ecbdad Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 16 Oct 2014 11:22:00 +0800 Subject: [PATCH 408/617] disable ngx_pagespeed --- README.md | 3 +-- conf/nginx.conf | 2 +- conf/nginx_apache.conf | 2 +- functions/memcached.sh | 8 ++++---- functions/nginx.sh | 4 +--- init/init_CentOS.sh | 2 +- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- install.sh | 22 +++++++++++----------- tools/mscp.exp | 8 ++++---- 10 files changed, 26 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 39ef3bd1..f1afaac6 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,9 @@ - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) -- You can freely choose to install PHP version (php-5.5, php-5.4, php-5.3) +- You can freely choose to install PHP version (php-5.3, php-5.4, php-5.5, php-5.6) - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) -- According to their needs can to install ngx_pagespeed - According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) - According to their needs can to install Pureftpd, phpMyAdmin - According to their needs can to install memcached, redis diff --git a/conf/nginx.conf b/conf/nginx.conf index a2e81c56..d2dce137 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ user www www; -worker_processes 4; +worker_processes auto; error_log /home/wwwlogs/error_nginx.log crit; pid /var/run/nginx.pid; diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index 4e255ea1..bbc17cc2 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -1,5 +1,5 @@ user www www; -worker_processes 4; +worker_processes auto; error_log /home/wwwlogs/error_nginx.log crit; pid /var/run/nginx.pid; diff --git a/functions/memcached.sh b/functions/memcached.sh index 77c5d790..b17882fc 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,16 +9,16 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.memcached.org/files/memcached-1.4.20.tar.gz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.21.tar.gz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.20.tar.gz -cd memcached-1.4.20 +tar xzf memcached-1.4.21.tar.gz +cd memcached-1.4.21 ./configure --prefix=$memcached_install_dir make && make install cd ../ -/bin/rm -rf memcached-1.4.20 +/bin/rm -rf memcached-1.4.21 if [ -d "$memcached_install_dir" ];then echo -e "\033[32mmemcached install successfully! \033[0m" ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached diff --git a/functions/nginx.sh b/functions/nginx.sh index 49f798da..f95f064e 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -71,9 +71,7 @@ sed -i "s@/home/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf # worker_cpu_affinity CPU_num=`cat /proc/cpuinfo | grep processor | wc -l` -if [ $CPU_num == 1 ];then - sed -i 's@^worker_processes.*@worker_processes 1;@' $nginx_install_dir/conf/nginx.conf -elif [ $CPU_num == 2 ];then +if [ $CPU_num == 2 ];then sed -i 's@^worker_processes.*@worker_processes 2;\nworker_cpu_affinity 10 01;@' $nginx_install_dir/conf/nginx.conf elif [ $CPU_num == 3 ];then sed -i 's@^worker_processes.*@worker_processes 3;\nworker_cpu_affinity 100 010 001;@' $nginx_install_dir/conf/nginx.conf diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index c6f5ab28..711fc761 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -128,7 +128,7 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 diff --git a/init/init_Debian.sh b/init/init_Debian.sh index cba9b2e7..4fec2ea9 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -62,7 +62,7 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index e53eb549..64d5d903 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -68,7 +68,7 @@ net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 262144 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 diff --git a/install.sh b/install.sh index 027a07f0..1aec247d 100755 --- a/install.sh +++ b/install.sh @@ -79,17 +79,17 @@ do if [ $Nginx_version != 1 -a $Nginx_version != 2 -a $Nginx_version != 3 ];then echo -e "\033[31minput error! Please only input number 1,2,3\033[0m" else - if [ $Nginx_version = 1 -o $Nginx_version = 2 ];then - while : - do - read -p "Do you want to install ngx_pagespeed module? [y/n]: " ngx_pagespeed_yn - if [ "$ngx_pagespeed_yn" != 'y' -a "$ngx_pagespeed_yn" != 'n' ];then - echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" - else - break - fi - done - fi + #if [ $Nginx_version = 1 -o $Nginx_version = 2 ];then + # while : + # do + # read -p "Do you want to install ngx_pagespeed module? [y/n]: " ngx_pagespeed_yn + # if [ "$ngx_pagespeed_yn" != 'y' -a "$ngx_pagespeed_yn" != 'n' ];then + # echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + # else + # break + # fi + # done + #fi while : do echo diff --git a/tools/mscp.exp b/tools/mscp.exp index f9281a09..3616f392 100755 --- a/tools/mscp.exp +++ b/tools/mscp.exp @@ -42,9 +42,9 @@ for {} {1} {} { if { $direction == "pull" } { if { $bwlimit > 0 } { - spawn rsync -crazP --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir } elseif { $bwlimit == 0 } { - spawn rsync -crazP -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir } else { Usage_Exit $argv0 } @@ -52,9 +52,9 @@ if { $direction == "pull" } { } elseif { $direction == "push" } { if { $bwlimit > 0 } { - spawn rsync -crazP --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir } elseif { $bwlimit == 0 } { - spawn rsync -crazP -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir } else { Usage_Exit $argv0 } From 35d6da88571b8af8fd8c6a7c6453d8caf29c7de9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 21 Oct 2014 11:00:06 +0800 Subject: [PATCH 409/617] update php version --- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 71999e55..7e37e503 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.33.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.34.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.33.tar.gz +tar xzf php-5.4.34.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.33 -p0 < fpm-race-condition.patch -cd php-5.4.33 +patch -d php-5.4.34 -p0 < fpm-race-condition.patch +cd php-5.4.34 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -239,6 +239,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.33 +/bin/rm -rf php-5.4.34 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index eab4731d..a0b6f839 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.17.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.18.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.17.tar.gz +tar xzf php-5.5.18.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.17 -p0 < fpm-race-condition.patch -cd php-5.5.17 +patch -d php-5.5.18 -p0 < fpm-race-condition.patch +cd php-5.5.18 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.17 +/bin/rm -rf php-5.5.18 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 66d9cad2..e3fccfb2 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.1.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.2.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -68,11 +68,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.1.tar.gz +tar xzf php-5.6.2.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.1 -p0 < fpm-race-condition.patch -cd php-5.6.1 +patch -d php-5.6.2 -p0 < fpm-race-condition.patch +cd php-5.6.2 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -253,6 +253,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.1 +/bin/rm -rf php-5.6.2 cd .. } From abfaaed23953d3d18cf25714dff45863734a6cde Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 21 Oct 2014 16:01:52 +0800 Subject: [PATCH 410/617] ubuntu 14 bug --- functions/ioncube.sh | 7 ++++++- functions/php-5.3.sh | 3 ++- functions/php-5.4.sh | 3 ++- functions/php-5.5.sh | 4 +++- functions/php-5.6.sh | 3 ++- install.sh | 1 + 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/functions/ioncube.sh b/functions/ioncube.sh index 6029e012..4e0b796f 100755 --- a/functions/ioncube.sh +++ b/functions/ioncube.sh @@ -20,7 +20,10 @@ else fi [ ! -e "$php_install_dir/lib/php/extensions/" ] && mkdir $php_install_dir/lib/php/extensions/ -if [ "$PHP_version" == '5.5' ];then +if [ "$PHP_version" == '5.6' ];then + /bin/cp ioncube/ioncube_loader_lin_5.6.so $php_install_dir/lib/php/extensions/ + zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.6.so" +elif [ "$PHP_version" == '5.5' ];then /bin/cp ioncube/ioncube_loader_lin_5.5.so $php_install_dir/lib/php/extensions/ zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.5.so" elif [ "$PHP_version" == '5.4' ];then @@ -29,6 +32,8 @@ elif [ "$PHP_version" == '5.4' ];then elif [ "$PHP_version" == '5.3' ];then /bin/cp ioncube/ioncube_loader_lin_5.3.so $php_install_dir/lib/php/extensions/ zend_extension="$php_install_dir/lib/php/extensions/ioncube_loader_lin_5.3.so" +else + exit 1 fi /bin/rm -rf ioncube diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index f59fe852..71ea37b1 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -18,7 +18,8 @@ src_url=http://www.php.net/distributions/php-5.3.29.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local -[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 14'`" ] && sed -i 's@gets is a security@@' srclib/stdio.h make && make install cd ../ /bin/rm -rf libiconv-1.14 diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 7e37e503..80cd6fbc 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -18,7 +18,8 @@ src_url=http://www.php.net/distributions/php-5.4.34.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local -[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 14'`" ] && sed -i 's@gets is a security@@' srclib/stdio.h make && make install cd ../ /bin/rm -rf libiconv-1.14 diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index a0b6f839..b40fce1f 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -18,7 +18,9 @@ src_url=http://www.php.net/distributions/php-5.5.18.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local -[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 14'`" ] && sed -i 's@gets is a security@@' srclib/stdio.h + make && make install cd ../ /bin/rm -rf libiconv-1.14 diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index e3fccfb2..578a94d2 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -18,7 +18,8 @@ src_url=http://www.php.net/distributions/php-5.6.2.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local -[ ! -z "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 14'`" ] && sed -i 's@gets is a security@@' srclib/stdio.h make && make install cd ../ /bin/rm -rf libiconv-1.14 diff --git a/install.sh b/install.sh index 1aec247d..09dabc01 100755 --- a/install.sh +++ b/install.sh @@ -323,6 +323,7 @@ else else break fi + [ -n "`cat /etc/issue | grep 'Ubuntu 14'`" -a "$Magick" == '1' ] && Magick=9 done fi From cccd2eaf6f874aa3dfaf39ae0163ece6c777877f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 29 Oct 2014 20:17:18 +0800 Subject: [PATCH 411/617] update phpMyAdmin 4.2.10 to 4.2.10.1 --- functions/get_public_ip.py | 2 +- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/get_public_ip.py b/functions/get_public_ip.py index 1439d319..d67a5da0 100755 --- a/functions/get_public_ip.py +++ b/functions/get_public_ip.py @@ -6,7 +6,7 @@ def getip(self): myip = self.visit("http://www.whereismyip.com/") except: try: - myip = self.visit("http://www.ip138.com/ip2city.asp") + myip = self.visit("http://20140507.ip138.com/ic.asp") except: myip = "So sorry!!!" return myip diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 81cb841b..a35ac584 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.10/phpMyAdmin-4.2.10-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.10.1/phpMyAdmin-4.2.10.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.10-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.10-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.10.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.10.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From a3289597fbd0c38fdab3e1588eec2b6a5ee35185 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 29 Oct 2014 20:49:51 +0800 Subject: [PATCH 412/617] change jquery download address --- functions/ImageMagick.sh | 8 ++++---- functions/ngx_pagespeed.sh | 16 ++++++++-------- functions/test.sh | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 68dbdba3..db8b7c29 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-8.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-9.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-8.tar.gz -cd ImageMagick-6.8.9-8 +tar xzf ImageMagick-6.8.9-9.tar.gz +cd ImageMagick-6.8.9-9 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-8 +/bin/rm -rf ImageMagick-6.8.9-9 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 9efb120f..1b7f4c95 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../options.conf rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.1.tar.gz && Download_src -[ -s "ngx_pagespeed-1.9.32.1-beta.zip" ] && echo "ngx_pagespeed-1.9.32.1-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.1-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.2.tar.gz && Download_src +[ -s "ngx_pagespeed-1.9.32.2-beta.zip" ] && echo "ngx_pagespeed-1.9.32.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip -unzip -q ngx_pagespeed-1.9.32.1-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.9.32.1-beta -tar xzf 1.9.32.1.tar.gz -C ngx_pagespeed-1.9.32.1-beta +unzip -q ngx_pagespeed-1.9.32.2-beta.zip +/bin/mv ngx_pagespeed-master ngx_pagespeed-1.9.32.2-beta +tar xzf 1.9.32.2.tar.gz -C ngx_pagespeed-1.9.32.2-beta if [ "$Nginx_version" == '1' ];then cd nginx-1.6.2 @@ -24,9 +24,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.1-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +43,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.1-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.2-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/test.sh b/functions/test.sh index 9840e529..02b89378 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -20,6 +20,7 @@ if [ "$FLAG_IP"x == "CN"x ];then else src_url=http://www.yahei.net/tz/tz_e.zip && Download_src unzip -q tz_e.zip -d $home_dir/default;/bin/mv $home_dir/default/{tz_e.php,proberv.php} + sed -i 's@https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js@http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js@' $home_dir/default/proberv.php /bin/cp $lnmp_dir/conf/index.html $home_dir/default fi src_url=https://gist.githubusercontent.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src From 4f0f6a084039f12624e081e9534049f9aa15bb65 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 31 Oct 2014 21:55:20 +0800 Subject: [PATCH 413/617] change alipay address --- conf/index.html | 2 +- conf/index_cn.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/index.html b/conf/index.html index d9f3f29a..b9389350 100644 --- a/conf/index.html +++ b/conf/index.html @@ -30,7 +30,7 @@

LNM

Author email:  

Donate:

          PayPal:  lj2007331@gmail.com

-

          alipay:  lj2007331@163.com

+

          alipay:  lj2007331@gmail.com

diff --git a/conf/index_cn.html b/conf/index_cn.html index 71407020..eae9b969 100644 --- a/conf/index_cn.html +++ b/conf/index_cn.html @@ -31,7 +31,7 @@

LNM

问题反馈论坛:http://bbs.linuxeye.com

LNMP最新源码一键安装脚本问题反馈请加QQ群: 235258658

赞助我们:

-

          支付宝:  lj2007331@163.com

+

          支付宝:  lj2007331@gmail.com

          PayPal:  lj2007331@gmail.com

From 302006d5192229acb29e53e603e49b8d1d6d8bb4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 4 Nov 2014 09:09:36 +0800 Subject: [PATCH 414/617] update percona 5.6.21-69.0 to 5.6.21-70.0 --- functions/percona-5.6.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index fa9fb256..9f0bdf61 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-69.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-70.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf percona-server-5.6.21-69.0.tar.gz -cd percona-server-5.6.21-69.0 +tar zxf percona-server-5.6.21-70.0.tar.gz +cd percona-server-5.6.21-70.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -62,7 +62,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.21-69.0 +/bin/rm -rf percona-server-5.6.21-70.0 cd .. # my.cf diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index a35ac584..81485b23 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.10.1/phpMyAdmin-4.2.10.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.11/phpMyAdmin-4.2.11-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.10.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.10.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.11-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.11-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 1e5d4bcf228e7101031be7bda2016c3be6a0cd99 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 10 Nov 2014 16:43:04 +0800 Subject: [PATCH 415/617] update gperftools 2.2.1 to 2.2.90 --- functions/ImageMagick.sh | 8 ++++---- functions/tcmalloc.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index db8b7c29..a9992d48 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-9.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-10.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-9.tar.gz -cd ImageMagick-6.8.9-9 +tar xzf ImageMagick-6.8.9-10.tar.gz +cd ImageMagick-6.8.9-10 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-9 +/bin/rm -rf ImageMagick-6.8.9-10 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index c3ec209e..c18b27ed 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -7,14 +7,14 @@ Install_tcmalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.2.1.tar.gz && Download_src +src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.2.90.tar.gz && Download_src -tar xzf gperftools-2.2.1.tar.gz -cd gperftools-2.2.1 +tar xzf gperftools-2.2.90.tar.gz +cd gperftools-2.2.90 ./configure --enable-frame-pointers make && make install cd .. -/bin/rm -rf gperftools-2.2.1 +/bin/rm -rf gperftools-2.2.90 if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf From 033710cacc85b9237177cb3d69bdb2f23a6b970f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 14 Nov 2014 09:55:55 +0800 Subject: [PATCH 416/617] update php version --- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index b40fce1f..0a586bae 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.18.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.19.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -70,11 +70,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.18.tar.gz +tar xzf php-5.5.19.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.18 -p0 < fpm-race-condition.patch -cd php-5.5.18 +patch -d php-5.5.19 -p0 < fpm-race-condition.patch +cd php-5.5.19 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -255,6 +255,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.18 +/bin/rm -rf php-5.5.19 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 578a94d2..d946441d 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.2.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.3.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.2.tar.gz +tar xzf php-5.6.3.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.2 -p0 < fpm-race-condition.patch -cd php-5.6.2 +patch -d php-5.6.3 -p0 < fpm-race-condition.patch +cd php-5.6.3 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -254,6 +254,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.2 +/bin/rm -rf php-5.6.3 cd .. } From 594e5d29631f856b277f78bf300f39fdd875c29b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 17 Nov 2014 18:00:25 +0800 Subject: [PATCH 417/617] added vpn_centos.sh --- backup.sh | 5 +- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/php-5.6.sh | 2 +- tools/db_bk.sh | 6 +- vpn_centos.sh | 227 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 237 insertions(+), 9 deletions(-) create mode 100755 vpn_centos.sh diff --git a/backup.sh b/backup.sh index ab5d52c3..eafcfc12 100755 --- a/backup.sh +++ b/backup.sh @@ -16,8 +16,9 @@ DB_Remote_BK() { do cd $lnmp_dir/tools ./db_bk.sh $D - echo "file:::$backup_dir/DB_${D}_$(date +%Y%m%d).tgz $backup_dir push" >> $lnmp_dir/tools/config.txt - echo "com:::[ -e "$backup_dir/DB_${D}_$(date +%Y%m%d).tgz" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago").tgz" >> $lnmp_dir/tools/config.txt + DB_FILE=`ls -lrt $backup_dir | grep DB_$D | tail -1 | awk '{print $NF}'` + echo "file:::$backup_dir/$DB_FILE $backup_dir push" >> $lnmp_dir/tools/config.txt + echo "com:::[ -e "$backup_dir/$DB_FILE" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> $lnmp_dir/tools/config.txt done } diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 71ea37b1..abcaa6c9 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -136,7 +136,7 @@ sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 80cd6fbc..378555d7 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -136,7 +136,7 @@ sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 0a586bae..a9d8a349 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -138,7 +138,7 @@ sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index d946441d..909ff5c5 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -137,7 +137,7 @@ sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini diff --git a/tools/db_bk.sh b/tools/db_bk.sh index 3c87f6eb..73f30324 100755 --- a/tools/db_bk.sh +++ b/tools/db_bk.sh @@ -6,9 +6,9 @@ DBname=$1 LogFile=$backup_dir/db.log -DumpFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d).sql -NewFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d).tgz -OldFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago").tgz +DumpFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d_%H).sql +NewFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d_%H).tgz +OldFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago")*.tgz [ ! -e "$backup_dir" ] && mkdir -p $backup_dir diff --git a/vpn_centos.sh b/vpn_centos.sh new file mode 100755 index 00000000..78f18094 --- /dev/null +++ b/vpn_centos.sh @@ -0,0 +1,227 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com +# +# This script's project home is: +# http://blog.linuxeye.com/31.html +# https://github.com/lj2007331/lnmp + +# Check if user is root +[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +printf " +####################################################################### +# LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# For more information please visit http://blog.linuxeye.com/31.html # +####################################################################### +" +[ ! -e "src" ] && mkdir src +cd src +. ../functions/download.sh + +while : +do + echo + read -p "Please input IP-Range(Default Range: 10.0.2): " iprange + [ -z "$iprange" ] && iprange="10.0.2" + if [ -z "`echo $iprange | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$'`" ];then + echo -e "\033[31minput error! Input format: xxx.xxx.xxx\033[0m" + else + break + fi +done + +echo +read -p "Please input PSK(Default PSK: psk): " MYPSK +[ -z "$MYPSK" ] && MYPSK="psk" + +while : +do + echo + read -p "Please input username: " Username + [ -n "$Username" ] && break +done + +while : +do + echo + read -p "Please input password: " Password + [ -n "$Password" ] && break +done +clear + +public_IP=`../functions/get_public_ip.py` + +get_char() +{ +SAVEDSTTY=`stty -g` +stty -echo +stty cbreak +dd if=/dev/tty bs=1 count=1 2> /dev/null +stty -raw +stty echo +stty $SAVEDSTTY +} + +echo "" +echo "ServerIP:$public_IP" +echo "" +echo "Server Local IP:$iprange.1" +echo "" +echo "Client Remote IP Range:$iprange.2-$iprange.254" +echo "" +echo "PSK:$MYPSK" +echo "" +echo "Press any key to start..." +char=`get_char` +clear + +if [ -n "`grep 'CentOS Linux release 7' /etc/redhat-release`" ];then + CentOS_REL=7 + for Package in wget ppp iptables iptables-services make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof vim-enhanced + do + yum -y install $Package + done + echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf +elif [ -n "`grep 'CentOS release 6' /etc/redhat-release`" ];then + CentOS_REL=6 + for Package in wget ppp iptables make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof vim-enhanced + do + yum -y install $Package + done + sed -i 's@net.ipv4.ip_forward.*@net.ipv4.ip_forward = 1@g' /etc/sysctl.conf +else + echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" + exit 1 +fi + +sysctl -p +mknod /dev/random c 1 9 +src_url=https://download.openswan.org/openswan/old/openswan-2.6/openswan-2.6.38.tar.gz && Download_src +tar xzf openswan-2.6.38.tar.gz +cd openswan-2.6.38 +make programs install +cd .. + +cat >/etc/ipsec.conf</etc/ipsec.secrets< /usr/bin/zl2tpset << EOF +#!/bin/bash +for each in /proc/sys/net/ipv4/conf/* +do + echo 0 > \$each/accept_redirects + echo 0 > \$each/send_redirects +done +EOF + +chmod +x /usr/bin/zl2tpset +/usr/bin/zl2tpset +[ -z "`grep zl2tpset /etc/rc.local`" ] && echo '/usr/bin/zl2tpset' >> /etc/rc.local +service ipsec restart +src_url=http://pkgs.fedoraproject.org/repo/pkgs/xl2tpd/xl2tpd-1.3.6.tar.gz/2f526cc0c36cf6d8a74f1fb2e08c18ec/xl2tpd-1.3.6.tar.gz && Download_src +tar xzf xl2tpd-1.3.6.tar.gz +cd xl2tpd-1.3.6 +make install + +[ ! -e "/var/run/xl2tpd" ] && mkdir /var/run/xl2tpd +[ ! -e "/etc/xl2tpd" ] && mkdir /etc/xl2tpd +cd .. + +cat >/etc/xl2tpd/xl2tpd.conf</etc/ppp/options.xl2tpd<>/etc/ppp/chap-secrets< Date: Mon, 24 Nov 2014 10:11:42 +0800 Subject: [PATCH 418/617] update php 5.4.34 to 5.4.35 --- functions/php-5.4.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 378555d7..7df5b7ef 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.34.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.35.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.34.tar.gz +tar xzf php-5.4.35.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.34 -p0 < fpm-race-condition.patch -cd php-5.4.34 +patch -d php-5.4.35 -p0 < fpm-race-condition.patch +cd php-5.4.35 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -240,6 +240,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.34 +/bin/rm -rf php-5.4.35 cd .. } From c52ecad9d87a182c3279dbfb9b7e6acb61e35c68 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 25 Nov 2014 18:01:32 +0800 Subject: [PATCH 419/617] You can change SSH port --- functions/percona-5.6.sh | 8 ++++---- init/init_CentOS.sh | 6 +++++- init/init_Debian.sh | 3 +++ init/init_Ubuntu.sh | 3 +++ install.sh | 20 ++++++++++++++++++++ vpn_centos.sh | 6 +++--- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 9f0bdf61..e34f6ffb 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-70.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-70.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf percona-server-5.6.21-70.0.tar.gz -cd percona-server-5.6.21-70.0 +tar zxf percona-server-5.6.21-70.1.tar.gz +cd percona-server-5.6.21-70.1 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -62,7 +62,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.21-70.0 +/bin/rm -rf percona-server-5.6.21-70.1 cd .. # my.cf diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 711fc761..145a224c 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -75,7 +75,7 @@ fi # closed Unnecessary services and remove obsolete rpm package for Service in `chkconfig --list | grep 3:on | awk '{print $1}'`;do chkconfig --level 3 $Service off;done -for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done +for Service in sshd network crond iptables iptables-services messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 @@ -177,7 +177,11 @@ cat > /etc/sysconfig/iptables << EOF -A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF + +FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/sysconfig/iptables` +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/sysconfig/iptables service iptables restart +service sshd restart # install tmux if [ ! -e "`which tmux`" ];then diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 4fec2ea9..89a89407 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -107,7 +107,10 @@ cat > /etc/iptables.up.rules << EOF -A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF +FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces +service ssh restart . ~/.bashrc diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 64d5d903..6bc598b0 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -112,7 +112,10 @@ cat > /etc/iptables.up.rules << EOF -A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF +FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces +service ssh restart . ~/.bashrc diff --git a/install.sh b/install.sh index 09dabc01..9dee0910 100755 --- a/install.sh +++ b/install.sh @@ -57,6 +57,26 @@ do fi done +# Use default SSH port 22. If you use another SSH port on your server +[ -z "`grep ^Port /etc/ssh/sshd_config`" ] && ssh_port=22 || ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'` +while : +do + echo + read -p "Please input SSH port(Default: $ssh_port): " SSH_PORT + [ -z "$SSH_PORT" ] && SSH_PORT=$ssh_port + if [ $SSH_PORT -eq 22 >/dev/null 2>&1 -o $SSH_PORT -gt 1024 >/dev/null 2>&1 -a $SSH_PORT -lt 65535 >/dev/null 2>&1 ];then + break + else + echo -e "\033[31minput error! Input range: 22,1024~65535\033[0m" + fi +done + +if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$SSH_PORT" != '22' ];then + sed -i "s@^#Port.*@&\nPort $SSH_PORT@" /etc/ssh/sshd_config +elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ];then + sed -i "s@^Port.*@Port $SSH_PORT@" /etc/ssh/sshd_config +fi + # check Web server while : do diff --git a/vpn_centos.sh b/vpn_centos.sh index 78f18094..34be0d66 100755 --- a/vpn_centos.sh +++ b/vpn_centos.sh @@ -24,9 +24,9 @@ cd src while : do echo - read -p "Please input IP-Range(Default Range: 10.0.2): " iprange + read -p "Please input private IP-Range(Default Range: 10.0.2): " iprange [ -z "$iprange" ] && iprange="10.0.2" - if [ -z "`echo $iprange | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$'`" ];then + if [ -z "`echo $iprange | grep -E "^10\.|^192\.168\.|^172\." | grep -o '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$'`" ];then echo -e "\033[31minput error! Input format: xxx.xxx.xxx\033[0m" else break @@ -202,7 +202,7 @@ logfd 2 logfile /var/log/l2tpd.log EOF -cat >>/etc/ppp/chap-secrets< /etc/ppp/chap-secrets< Date: Wed, 3 Dec 2014 15:11:43 +0800 Subject: [PATCH 420/617] update version --- functions/ImageMagick.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index a9992d48..c6a5d8a7 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.8.9-10.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-0.tar.gz && Download_src -tar xzf ImageMagick-6.8.9-10.tar.gz -cd ImageMagick-6.8.9-10 +tar xzf ImageMagick-6.9.0-0.tar.gz +cd ImageMagick-6.9.0-0 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.8.9-10 +/bin/rm -rf ImageMagick-6.9.0-0 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 81485b23..564697b1 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.11/phpMyAdmin-4.2.11-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.12/phpMyAdmin-4.2.12-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.11-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.11-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.12-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.12-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 0e2d40a86a8630c36785dbc6a39965ce835e7b97 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 3 Dec 2014 15:13:28 +0800 Subject: [PATCH 421/617] update phpMyAdmin 4.2.12 to 4.2.13 --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 564697b1..8d4da37c 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.12/phpMyAdmin-4.2.12-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.13/phpMyAdmin-4.2.13-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.12-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.12-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.2.13-all-languages.tar.gz +/bin/mv phpMyAdmin-4.2.13-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 5bd50a9fe31e41816f02900d4463fa9e158f4423 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 5 Dec 2014 13:40:10 +0800 Subject: [PATCH 422/617] update redis 2.8.17 to 2.8.18 --- functions/php-5.3.sh | 2 +- functions/php-5.4.sh | 2 +- functions/php-5.5.sh | 2 +- functions/php-5.6.sh | 2 +- functions/redis.sh | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index abcaa6c9..93af477b 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -135,7 +135,7 @@ sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 7df5b7ef..0b063cbc 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -135,7 +135,7 @@ sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index a9d8a349..b95a9afc 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -137,7 +137,7 @@ sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 909ff5c5..bb2639d7 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -136,7 +136,7 @@ sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 300@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini diff --git a/functions/redis.sh b/functions/redis.sh index 67aa7d7e..67041887 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.17.tar.gz && Download_src -tar xzf redis-2.8.17.tar.gz -cd redis-2.8.17 +src_url=http://download.redis.io/releases/redis-2.8.18.tar.gz && Download_src +tar xzf redis-2.8.18.tar.gz +cd redis-2.8.18 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.17 + /bin/rm -rf redis-2.8.18 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n From 0ad7055a00a6a69bdeb003dd71d39882d03831a4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 11 Dec 2014 18:05:27 +0800 Subject: [PATCH 423/617] update MySQL versionn --- functions/apache-2.4.sh | 6 +++--- functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- functions/nginx.sh | 6 +++--- functions/php-mysql-client.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- functions/tengine.sh | 6 +++--- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 4d1a0987..41ad3f57 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -9,13 +9,13 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz && Download_src src_url=http://www.apache.org/dist/httpd/httpd-2.4.10.tar.gz && Download_src -tar xzf pcre-8.35.tar.gz -cd pcre-8.35 +tar xzf pcre-8.36.tar.gz +cd pcre-8.36 ./configure make && make install cd ../ diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 5e119f2c..e5b15c7a 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.41.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -21,8 +21,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.5.40.tar.gz -cd mysql-5.5.40 +tar zxf mysql-5.5.41.tar.gz +cd mysql-5.5.41 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -60,7 +60,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.5.40 +/bin/rm -rf mysql-5.5.41 cd .. # my.cf diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index d0f9d558..469f9da9 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.21.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir @@ -22,8 +22,8 @@ if [ ! -e "`which cmake`" ];then cd .. /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.6.21.tar.gz -cd mysql-5.6.21 +tar zxf mysql-5.6.22.tar.gz +cd mysql-5.6.22 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -59,7 +59,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.6.21 +/bin/rm -rf mysql-5.6.22 cd .. # my.cf diff --git a/functions/nginx.sh b/functions/nginx.sh index f95f064e..c72b8924 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz && Download_src src_url=http://nginx.org/download/nginx-1.6.2.tar.gz && Download_src -tar xzf pcre-8.35.tar.gz -cd pcre-8.35 +tar xzf pcre-8.36.tar.gz +cd pcre-8.36 ./configure make && make install cd ../ diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh index 74e5acc8..a1d7db4f 100755 --- a/functions/php-mysql-client.sh +++ b/functions/php-mysql-client.sh @@ -9,7 +9,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.41.tar.gz && Download_src if [ ! -e "`which cmake`" ];then tar xzf cmake-3.0.2.tar.gz @@ -20,8 +20,8 @@ if [ ! -e "`which cmake`" ];then /bin/rm -rf cmake-3.0.2 fi -tar zxf mysql-5.5.40.tar.gz -cd mysql-5.5.40 +tar zxf mysql-5.5.41.tar.gz +cd mysql-5.5.41 cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir make mysqlclient libmysql mkdir -p $mysql_install_dir/{lib,bin} @@ -29,6 +29,6 @@ mkdir -p $mysql_install_dir/{lib,bin} /bin/cp scripts/mysql_config $mysql_install_dir/bin /bin/cp -R include $mysql_install_dir cd .. -/bin/rm -rf mysql-5.5.40 +/bin/rm -rf mysql-5.5.41 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 8d4da37c..68b90b22 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.13/phpMyAdmin-4.2.13-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.1/phpMyAdmin-4.3.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.2.13-all-languages.tar.gz -/bin/mv phpMyAdmin-4.2.13-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/tengine.sh b/functions/tengine.sh index a519273c..223600b4 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -9,11 +9,11 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-1.5.2.tar.gz && Download_src -tar xzf pcre-8.35.tar.gz -cd pcre-8.35 +tar xzf pcre-8.36.tar.gz +cd pcre-8.36 ./configure make && make install cd ../ From 911a6a21ea6213c22e99f12ceb256e75ae727fa9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 17 Dec 2014 17:12:51 +0800 Subject: [PATCH 424/617] update redis 2.8.18 to 2.8.19 --- functions/phpmyadmin.sh | 6 +++--- functions/redis.sh | 8 ++++---- init/init_Ubuntu.sh | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 68b90b22..72762fca 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.1/phpMyAdmin-4.3.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.2/phpMyAdmin-4.3.2-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.2-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.2-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/redis.sh b/functions/redis.sh index 67041887..4f21b833 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -28,9 +28,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then fi fi -src_url=http://download.redis.io/releases/redis-2.8.18.tar.gz && Download_src -tar xzf redis-2.8.18.tar.gz -cd redis-2.8.18 +src_url=http://download.redis.io/releases/redis-2.8.19.tar.gz && Download_src +tar xzf redis-2.8.19.tar.gz +cd redis-2.8.19 if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 32 ];then sed -i '1i\CFLAGS= -march=i686' src/Makefile sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings @@ -64,7 +64,7 @@ if [ -f "src/redis-server" ];then fi cd .. - /bin/rm -rf redis-2.8.18 + /bin/rm -rf redis-2.8.19 cd .. OS_CentOS='/bin/cp init/Redis-server-init-CentOS /etc/init.d/redis-server \n chkconfig --add redis-server \n diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 6bc598b0..71904453 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -19,9 +19,9 @@ do apt-get -y install $Package done -if [ ! -z "`cat /etc/issue | grep 13`" ];then +if [ -n "`cat /etc/issue | grep -E 1'[3|4]'`" ];then apt-get -y install libcloog-ppl1 -elif [ ! -z "`cat /etc/issue | grep 12`" ];then +elif [ -n "`cat /etc/issue | grep 12`" ];then apt-get -y install libcloog-ppl0 fi From 165b7ef54c871d01ae5c8f6badd8752c2e104862 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 18 Dec 2014 14:46:34 +0800 Subject: [PATCH 425/617] CentOS7 iptables bug --- init/init_CentOS.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 145a224c..fea9ec11 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -14,8 +14,14 @@ yum clean all #public_IP=`../functions/get_public_ip.py` #if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - if [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then - #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS6-Base.repo -P /etc/yum.repos.d + if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then + if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo + sed -i 's@\$releasever@7@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo + fi + elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo @@ -23,7 +29,6 @@ yum clean all sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then - #wget -c http://blog.linuxeye.com/wp-content/uploads/2013/12/CentOS5-Base.repo -P /etc/yum.repos.d if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo @@ -35,7 +40,11 @@ yum clean all yum makecache #fi -if [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then +if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then + yum -y install iptables-service + systemctl mask firewalld.service + systemctl enable iptables.service +elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" @@ -75,7 +84,7 @@ fi # closed Unnecessary services and remove obsolete rpm package for Service in `chkconfig --list | grep 3:on | awk '{print $1}'`;do chkconfig --level 3 $Service off;done -for Service in sshd network crond iptables iptables-services messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done +for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 From cf31a5445e5a9a3e0abc5ca86c34ea1dc01f201e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 19 Dec 2014 11:56:04 +0800 Subject: [PATCH 426/617] update php version and disable libmysql --- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- install.sh | 29 +++++++++++++++-------------- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 0b063cbc..cb5ee9e2 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.35.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.36.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.35.tar.gz +tar xzf php-5.4.36.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.35 -p0 < fpm-race-condition.patch -cd php-5.4.35 +patch -d php-5.4.36 -p0 < fpm-race-condition.patch +cd php-5.4.36 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -240,6 +240,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.35 +/bin/rm -rf php-5.4.36 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index b95a9afc..bd35504b 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.19.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.20.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -70,11 +70,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.19.tar.gz +tar xzf php-5.5.20.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.19 -p0 < fpm-race-condition.patch -cd php-5.5.19 +patch -d php-5.5.20 -p0 < fpm-race-condition.patch +cd php-5.5.20 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -255,6 +255,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.19 +/bin/rm -rf php-5.5.20 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index bb2639d7..07f05602 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.3.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.4.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.3.tar.gz +tar xzf php-5.6.4.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.3 -p0 < fpm-race-condition.patch -cd php-5.6.3 +patch -d php-5.6.4 -p0 < fpm-race-condition.patch +cd php-5.6.4 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -254,6 +254,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.3 +/bin/rm -rf php-5.6.4 cd .. } diff --git a/install.sh b/install.sh index 9dee0910..7a1f5b8f 100755 --- a/install.sh +++ b/install.sh @@ -195,20 +195,21 @@ else if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 ];then echo -e "\033[31minput error! Please only input number 1,2,3,4 \033[0m" else - while : - do - echo - echo 'You can either use the mysqlnd or libmysql library to connect from PHP to MySQL:' - echo -e "\t\033[32m1\033[0m. MySQL native driver (mysqlnd)" - echo -e "\t\033[32m2\033[0m. MySQL Client Library (libmysql)" - read -p "Please input a number:(Default 1 press Enter) " PHP_MySQL_driver - [ -z "$PHP_MySQL_driver" ] && PHP_MySQL_driver=1 - if [ $PHP_MySQL_driver != 1 -a $PHP_MySQL_driver != 2 ];then - echo -e "\033[31minput error! Please only input number 1,2\033[0m" - else - break - fi - done + PHP_MySQL_driver=1 + #while : + # do + # echo + # echo 'You can either use the mysqlnd or libmysql library to connect from PHP to MySQL:' + # echo -e "\t\033[32m1\033[0m. MySQL native driver (mysqlnd)" + # echo -e "\t\033[32m2\033[0m. MySQL Client Library (libmysql)" + # read -p "Please input a number:(Default 1 press Enter) " PHP_MySQL_driver + # [ -z "$PHP_MySQL_driver" ] && PHP_MySQL_driver=1 + # if [ $PHP_MySQL_driver != 1 -a $PHP_MySQL_driver != 2 ];then + # echo -e "\033[31minput error! Please only input number 1,2\033[0m" + # else + # break + # fi + #done while : do From 987f96e765c1ed2e936a8137dd666d52be95a6f4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 19 Dec 2014 16:12:32 +0800 Subject: [PATCH 427/617] joomla rewrite nginx --- conf/joomla.conf | 3 +++ vhost.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 conf/joomla.conf diff --git a/conf/joomla.conf b/conf/joomla.conf new file mode 100644 index 00000000..fba2dcc2 --- /dev/null +++ b/conf/joomla.conf @@ -0,0 +1,3 @@ +location / { + try_files $uri $uri/ /index.php?$args; +} diff --git a/vhost.sh b/vhost.sh index 757c2698..3f359bab 100755 --- a/vhost.sh +++ b/vhost.sh @@ -150,7 +150,7 @@ if [ "$rewrite_yn" == 'n' ];then else echo '' echo "Please input the rewrite of programme :" - echo -e "\033[32mwordpress\033[0m,\033[32mdiscuz\033[0m,\033[32mphpwind\033[0m,\033[32mtypecho\033[0m,\033[32mecshop\033[0m,\033[32mdrupal\033[0m rewrite was exist." + echo -e "\033[32mwordpress\033[0m,\033[32mdiscuz\033[0m,\033[32mphpwind\033[0m,\033[32mtypecho\033[0m,\033[32mecshop\033[0m,\033[32mdrupal\033[0m,\033[32mjoomla\033[0m rewrite was exist." read -p "(Default rewrite: other):" rewrite if [ "$rewrite" == "" ]; then rewrite="other" From 22341536db7c3bdbe590abc00333ff1294db0515 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 22 Dec 2014 15:46:49 +0800 Subject: [PATCH 428/617] added phpng/php-7 --- README.md | 2 +- functions/mariadb-10.0.sh | 10 +- functions/mariadb-5.5.sh | 10 +- functions/mysql-5.5.sh | 10 +- functions/mysql-5.6.sh | 10 +- functions/percona-5.5.sh | 10 +- functions/percona-5.6.sh | 10 +- functions/php-7.sh | 259 ++++++++++++++++++++++++++++++++++ functions/php-mysql-client.sh | 11 -- functions/test.sh | 4 +- init/init_CentOS.sh | 2 +- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 23 ++- install.sh | 30 +++- 14 files changed, 314 insertions(+), 79 deletions(-) create mode 100755 functions/php-7.sh diff --git a/README.md b/README.md index f1afaac6..e7c9f739 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - Source compiler installation, most source code is the latest stable version, and downloaded from the official website - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) -- You can freely choose to install PHP version (php-5.3, php-5.4, php-5.5, php-5.6) +- You can freely choose to install PHP version (php-5.3, php-5.4, php-5.5, php-5.6, php-7/phpng(alpha)) - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 0b2eacc5..499af8f2 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -9,19 +9,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-10.0.14/source/mariadb-10.0.14.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf mariadb-10.0.14.tar.gz cd mariadb-10.0.14 if [ "$je_tc_malloc" == '1' ];then @@ -42,6 +33,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index f6355a38..847bb753 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,19 +9,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=https://downloads.mariadb.org/f/mariadb-5.5.40/source/mariadb-5.5.40.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf mariadb-5.5.40.tar.gz cd mariadb-5.5.40 if [ "$je_tc_malloc" == '1' ];then @@ -42,6 +33,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index e5b15c7a..6890d684 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,19 +8,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.41.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf mysql-5.5.41.tar.gz cd mysql-5.5.41 if [ "$je_tc_malloc" == '1' ];then @@ -40,6 +31,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 469f9da9..09a61dbe 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,19 +9,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf mysql-5.6.22.tar.gz cd mysql-5.6.22 if [ "$je_tc_malloc" == '1' ];then @@ -39,6 +30,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 8300fd34..d43daf8a 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,19 +8,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.40-36.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf percona-server-5.5.40-36.1.tar.gz cd percona-server-5.5.40-36.1 if [ "$je_tc_malloc" == '1' ];then @@ -39,6 +30,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ +-DENABLE_DTRACE=0 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index e34f6ffb..1382312e 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,19 +8,10 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz && Download_src src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-70.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -if [ ! -e "`which cmake`" ];then - tar xzf cmake-3.0.2.tar.gz - cd cmake-3.0.2 - CFLAGS= CXXFLAGS= ./configure - make && make install - cd .. - /bin/rm -rf cmake-3.0.2 -fi tar zxf percona-server-5.6.21-70.1.tar.gz cd percona-server-5.6.21-70.1 if [ "$je_tc_malloc" == '1' ];then @@ -39,6 +30,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ $EXE_LINKER diff --git a/functions/php-7.sh b/functions/php-7.sh new file mode 100755 index 00000000..2ae6fef2 --- /dev/null +++ b/functions/php-7.sh @@ -0,0 +1,259 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_PHP-7() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../functions/check_os.sh +. ../options.conf + +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src + +tar xzf libiconv-1.14.tar.gz +cd libiconv-1.14 +./configure --prefix=/usr/local +[ -n "`cat /etc/issue | grep 'Ubuntu 13'`" ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ -n "`cat /etc/issue | grep 'Ubuntu 14'`" ] && sed -i 's@gets is a security@@' srclib/stdio.h +make && make install +cd ../ +/bin/rm -rf libiconv-1.14 + +tar xzf libmcrypt-2.5.8.tar.gz +cd libmcrypt-2.5.8 +./configure +make && make install +ldconfig +cd libltdl/ +./configure --enable-ltdl-install +make && make install +cd ../../ +/bin/rm -rf libmcrypt-2.5.8 + +tar xzf mhash-0.9.9.9.tar.gz +cd mhash-0.9.9.9 +./configure +make && make install +cd ../ +/bin/rm -rf mhash-0.9.9.9 + +# linked library +if [ "$PHP_MySQL_driver" == '1' ];then + PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" +elif [ "$PHP_MySQL_driver" == '2' ];then + [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir + ln -s $db_install_dir/include /usr/include/mysql + PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" +fi +echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf +echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf +ldconfig +OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n +else \n + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n +fi' +OS_command + +tar xzf mcrypt-2.6.8.tar.gz +cd mcrypt-2.6.8 +ldconfig +./configure +make && make install +cd ../ +/bin/rm -rf mcrypt-2.6.8 + +useradd -M -s /sbin/nologin www +git clone https://git.php.net/repository/php-src.git +cd php-src +git branch phpng origin/phpng +git checkout phpng +./buildconf + +make clean + +[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' +if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +else +CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +fi +make ZEND_EXTRA_LIBS='-liconv' +make install + +if [ -d "$php_install_dir" ];then + echo -e "\033[32mPHP install successfully! \033[0m" +else + echo -e "\033[31mPHP install failed, Please Contact the author! \033[0m" + kill -9 $$ +fi + +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $php_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile +. /etc/profile + +# wget -c http://pear.php.net/go-pear.phar +# $php_install_dir/bin/php go-pear.phar + +/bin/cp php.ini-production $php_install_dir/etc/php.ini + +# Modify php.ini +Mem=`free -m | awk '/Mem:/{print $2}'` +if [ $Mem -gt 1024 -a $Mem -le 1500 ];then + Memory_limit=192 +elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then + Memory_limit=320 +elif [ $Mem -gt 4500 ];then + Memory_limit=448 +else + Memory_limit=128 +fi +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini +sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini +sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini +sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini +sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini +[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + +if [ "$PHP_cache" == '1' ];then +sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini +sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini +sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini +fi + +if [ "$Apache_version" != '1' -a "$Apache_version" != '2' ];then +# php-fpm Init Script +/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm +OS_CentOS='chkconfig --add php-fpm \n +chkconfig php-fpm on' +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' +OS_command + +cat > $php_install_dir/etc/php-fpm.conf <' > $home_dir/default/phpinfo.php [ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LANMP@g' $home_dir/default/index.html [ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && sed -i 's@LNMP@LAMP@g' $home_dir/default/index.html chown -R www.www $home_dir/default -[ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && service mysqld start -[ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && service httpd restart +[ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && /etc/init.d/mysqld restart +[ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && /etc/init.d/httpd restart cd .. } diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index fea9ec11..1f29f2aa 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -66,7 +66,7 @@ fi cd - # Install needed packages -for Package in gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync +for Package in gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git do yum -y install $Package done diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 89a89407..8b9d9c3e 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -14,7 +14,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git do apt-get -y install $Package done diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 71904453..194f86eb 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -2,6 +2,9 @@ # Author: yeho # Blog: http://blog.linuxeye.com +cd src +. ../functions/download.sh + for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do apt-get -y remove $Package @@ -14,15 +17,25 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libtool libevent-dev bison libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget bc expect rsync +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev patch vim zip unzip tmux htop wget bc expect rsync git do apt-get -y install $Package done -if [ -n "`cat /etc/issue | grep -E 1'[3|4]'`" ];then - apt-get -y install libcloog-ppl1 -elif [ -n "`cat /etc/issue | grep 12`" ];then - apt-get -y install libcloog-ppl0 +if [ -n "`cat /etc/issue | grep -E 14`" ];then + apt-get -y install libcloog-ppl1 + apt-get -y remove bison + src_url=http://ftp.gnu.org/gnu/bison/bison-2.7.1.tar.gz && Download_src + tar xzf bison-2.7.1.tar.gz + cd bison-2.7.1 + ./configure + make && make install + cd .. + rm -rf bison-2.7.1 +elif [ -n "`cat /etc/issue | grep -E 13`" ];then + apt-get -y install bison libcloog-ppl1 +elif [ -n "`cat /etc/issue | grep -E 12`" ];then + apt-get -y install bison libcloog-ppl0 fi # check sendmail diff --git a/install.sh b/install.sh index 7a1f5b8f..210c0851 100755 --- a/install.sh +++ b/install.sh @@ -190,10 +190,11 @@ else echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.5" echo -e "\t\033[32m4\033[0m. Install php-5.6" + echo -e "\t\033[32m5\033[0m. Install php-7/phpng(alpha)" read -p "Please input a number:(Default 1 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=1 - if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 ];then - echo -e "\033[31minput error! Please only input number 1,2,3,4 \033[0m" + if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 -a $PHP_version != 5 ];then + echo -e "\033[31minput error! Please only input number 1,2,3,4,5 \033[0m" else PHP_MySQL_driver=1 #while : @@ -284,6 +285,20 @@ else fi done fi + if [ $PHP_version == 5 ];then + while : + do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t\033[32m1\033[0m. Install Zend OPcache" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [ $PHP_cache != 1 ];then + echo -e "\033[31minput error! Please only input number 1\033[0m" + else + break + fi + done + fi fi break fi @@ -308,7 +323,7 @@ else done fi - if [ "$PHP_version" != '4' ];then + if [ "$PHP_version" != '5' ];then while : do echo @@ -321,6 +336,7 @@ else done fi + if [ "$PHP_version" != '5' ];then while : do echo @@ -331,6 +347,7 @@ else break fi done + fi if [ "$Magick_yn" == 'y' ];then while : do @@ -411,6 +428,7 @@ do done # check redis +if [ "$PHP_version" != '5' ];then while : do echo @@ -439,6 +457,7 @@ do break fi done +fi # gcc sane CFLAGS and CXXFLAGS #while : @@ -566,6 +585,9 @@ elif [ "$PHP_version" == '3' ];then elif [ "$PHP_version" == '4' ];then . functions/php-5.6.sh Install_PHP-5-6 2>&1 | tee -a $lnmp_dir/install.log +elif [ "$PHP_version" == '5' ];then + . functions/php-7.sh + Install_PHP-7 2>&1 | tee -a $lnmp_dir/install.log fi # ImageMagick or GraphicsMagick @@ -590,7 +612,7 @@ if [ "$ionCube_yn" == 'y' ];then fi # PHP opcode cache -if [ "$PHP_cache" == '1' ] && [ "$PHP_version" != '3' -a "$PHP_version" != '4' ];then +if [ "$PHP_cache" == '1' ] && [ "$PHP_version" == '1' -o "$PHP_version" == '2' ];then . functions/zendopcache.sh Install_ZendOPcache 2>&1 | tee -a $lnmp_dir/install.log elif [ "$PHP_cache" == '2' ];then From 8f5912dc85ba0bdf1e48489c9f117d02a31d8741 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 22 Dec 2014 17:54:11 +0800 Subject: [PATCH 429/617] disable phpng/php-7 --- functions/php-7.sh | 8 +++++++- init/init_Debian.sh | 4 ++-- init/init_Ubuntu.sh | 4 ++-- install.sh | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/functions/php-7.sh b/functions/php-7.sh index 2ae6fef2..2fb5ff94 100755 --- a/functions/php-7.sh +++ b/functions/php-7.sh @@ -138,7 +138,8 @@ sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini +sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini @@ -153,7 +154,12 @@ sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.validate_timestamps.*@opcache.validate_timestamps=1@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.use_cwd.*@opcache.use_cwd=1@' $php_install_dir/etc/php.ini +sed -i 's@^opcache.max_accelerated_files.*@opcache.max_accelerated_files=100000@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.max_wasted_percentage.*@opcache.max_wasted_percentage=5@' $php_install_dir/etc/php.ini +sed -i 's@^;opcache.consistency_checks.*@opcache.consistency_checks=0@' $php_install_dir/etc/php.ini sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini fi diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 8b9d9c3e..91fcece9 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -2,9 +2,9 @@ # Author: yeho # Blog: http://blog.linuxeye.com -for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* +for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do - apt-get -y remove $Package + apt-get -y remove --purge $Package done dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index 194f86eb..eb70cb44 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -5,9 +5,9 @@ cd src . ../functions/download.sh -for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* +for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do - apt-get -y remove $Package + apt-get -y remove --purge $Package done dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P diff --git a/install.sh b/install.sh index 210c0851..cf2aca8f 100755 --- a/install.sh +++ b/install.sh @@ -190,7 +190,7 @@ else echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.5" echo -e "\t\033[32m4\033[0m. Install php-5.6" - echo -e "\t\033[32m5\033[0m. Install php-7/phpng(alpha)" + #echo -e "\t\033[32m5\033[0m. Install php-7/phpng(alpha)" read -p "Please input a number:(Default 1 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 -a $PHP_version != 5 ];then From f60a147f6e4c822863c075f2a2fc78ef990ab145 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 23 Dec 2014 15:27:19 +0800 Subject: [PATCH 430/617] update tengine 1.5.2 to 2.1.0 --- functions/mariadb-5.5.sh | 8 ++++---- functions/nginx.sh | 2 +- functions/php-7.sh | 8 ++++---- functions/tengine.sh | 6 +++--- install.sh | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 847bb753..d26c5dde 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=https://downloads.mariadb.org/f/mariadb-5.5.40/source/mariadb-5.5.40.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.41/source/mariadb-5.5.41.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-5.5.40.tar.gz -cd mariadb-5.5.40 +tar zxf mariadb-5.5.41.tar.gz +cd mariadb-5.5.41 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -55,7 +55,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-5.5.40 +/bin/rm -rf mariadb-5.5.41 cd .. # my.cf diff --git a/functions/nginx.sh b/functions/nginx.sh index c72b8924..978e49fd 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -38,7 +38,7 @@ elif [ "$je_tc_malloc" == '2' ];then chown -R www.www /tmp/tcmalloc fi -./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module $malloc_module +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module $malloc_module make && make install if [ -d "$nginx_install_dir" ];then echo -e "\033[32mNginx install successfully! \033[0m" diff --git a/functions/php-7.sh b/functions/php-7.sh index 2fb5ff94..e9f75ab8 100755 --- a/functions/php-7.sh +++ b/functions/php-7.sh @@ -69,10 +69,10 @@ cd ../ /bin/rm -rf mcrypt-2.6.8 useradd -M -s /sbin/nologin www -git clone https://git.php.net/repository/php-src.git -cd php-src -git branch phpng origin/phpng -git checkout phpng +rm -rf php-src* +wget -c --no-check-certificate -O php-src-master.zip https://github.com/php/php-src/archive/master.zip +unzip -q php-src-master.zip +cd php-src* ./buildconf make clean diff --git a/functions/tengine.sh b/functions/tengine.sh index 223600b4..0f6d3df0 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -10,7 +10,7 @@ cd $lnmp_dir/src . ../options.conf src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz && Download_src -src_url=http://tengine.taobao.org/download/tengine-1.5.2.tar.gz && Download_src +src_url=http://tengine.taobao.org/download/tengine-2.1.0.tar.gz && Download_src tar xzf pcre-8.36.tar.gz cd pcre-8.36 @@ -18,9 +18,9 @@ cd pcre-8.36 make && make install cd ../ -tar xzf tengine-1.5.2.tar.gz +tar xzf tengine-2.1.0.tar.gz useradd -M -s /sbin/nologin www -cd tengine-1.5.2 +cd tengine-2.1.0 # Modify Tengine version #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h diff --git a/install.sh b/install.sh index cf2aca8f..210c0851 100755 --- a/install.sh +++ b/install.sh @@ -190,7 +190,7 @@ else echo -e "\t\033[32m2\033[0m. Install php-5.4" echo -e "\t\033[32m3\033[0m. Install php-5.5" echo -e "\t\033[32m4\033[0m. Install php-5.6" - #echo -e "\t\033[32m5\033[0m. Install php-7/phpng(alpha)" + echo -e "\t\033[32m5\033[0m. Install php-7/phpng(alpha)" read -p "Please input a number:(Default 1 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=1 if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 -a $PHP_version != 5 ];then From c3cd907c7b738112af63d1528c79b1d45ba0b5a3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 30 Dec 2014 11:32:09 +0800 Subject: [PATCH 431/617] update version --- functions/ImageMagick.sh | 8 ++++---- functions/apcu.sh | 6 +++--- functions/phpmyadmin.sh | 6 +++--- functions/tcmalloc.sh | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index c6a5d8a7..6e31faae 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-0.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-2.tar.gz && Download_src -tar xzf ImageMagick-6.9.0-0.tar.gz -cd ImageMagick-6.9.0-0 +tar xzf ImageMagick-6.9.0-2.tar.gz +cd ImageMagick-6.9.0-2 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.9.0-0 +/bin/rm -rf ImageMagick-6.9.0-2 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/apcu.sh b/functions/apcu.sh index aed1e0c8..c0d859c7 100755 --- a/functions/apcu.sh +++ b/functions/apcu.sh @@ -8,9 +8,9 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://pecl.php.net/get/apcu-4.0.6.tgz && Download_src -tar xzf apcu-4.0.6.tgz -cd apcu-4.0.6 +src_url=http://pecl.php.net/get/apcu-4.0.7.tgz && Download_src +tar xzf apcu-4.0.7.tgz +cd apcu-4.0.7 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 72762fca..7cba8ca6 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.2/phpMyAdmin-4.3.2-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.4/phpMyAdmin-4.3.4-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.2-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.2-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.4-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.4-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index c18b27ed..cad2357e 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -7,14 +7,14 @@ Install_tcmalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.2.90.tar.gz && Download_src +src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.3.tar.gz && Download_src -tar xzf gperftools-2.2.90.tar.gz -cd gperftools-2.2.90 +tar xzf gperftools-2.3.tar.gz +cd gperftools-2.3 ./configure --enable-frame-pointers make && make install cd .. -/bin/rm -rf gperftools-2.2.90 +/bin/rm -rf gperftools-2.3 if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf From bb35bf73b41ca744083da81ecc3b1f9bedb55fba Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 30 Dec 2014 20:56:04 +0800 Subject: [PATCH 432/617] update iptables-services --- init/init_CentOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 1f29f2aa..d873db01 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -41,7 +41,7 @@ yum clean all #fi if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then - yum -y install iptables-service + yum -y install iptables-services systemctl mask firewalld.service systemctl enable iptables.service elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then From 004d821025ab34977aa03986f6f36afca3283e38 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 30 Dec 2014 21:37:10 +0800 Subject: [PATCH 433/617] added Wiki pages --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e7c9f739..b1ad089d 100644 --- a/README.md +++ b/README.md @@ -90,5 +90,8 @@ Memcached: ./uninstall.sh ``` +## Installation + Follow the instructions in [Wiki Installation page](https://github.com/lj2007331/lnmp/wiki/Installation)

+ For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
From cbcf1cadc940a8868d5077977aa23a28599e0548 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 5 Jan 2015 22:37:31 +0800 Subject: [PATCH 434/617] update memcached 1.4.21 to 1.4.22 --- README.md | 2 +- functions/ImageMagick.sh | 8 ++++---- functions/memcached.sh | 8 ++++---- functions/redis.sh | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b1ad089d..a702e7e0 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Memcached: ``` ## Installation - Follow the instructions in [Wiki Installation page](https://github.com/lj2007331/lnmp/wiki/Installation)

+ Follow the instructions in [Wiki Installation page](https://github.com/lj2007331/lnmp/wiki/Installation)
For feedback, questions, and to follow the progress of the project (Chinese):
[lnmp最新源码一键安装脚本](http://blog.linuxeye.com/31.html)
diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 6e31faae..99f8ee91 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-2.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-3.tar.gz && Download_src -tar xzf ImageMagick-6.9.0-2.tar.gz -cd ImageMagick-6.9.0-2 +tar xzf ImageMagick-6.9.0-3.tar.gz +cd ImageMagick-6.9.0-3 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.9.0-2 +/bin/rm -rf ImageMagick-6.9.0-3 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/memcached.sh b/functions/memcached.sh index b17882fc..07f56896 100755 --- a/functions/memcached.sh +++ b/functions/memcached.sh @@ -9,16 +9,16 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.memcached.org/files/memcached-1.4.21.tar.gz && Download_src +src_url=http://www.memcached.org/files/memcached-1.4.22.tar.gz && Download_src # memcached server useradd -M -s /sbin/nologin memcached -tar xzf memcached-1.4.21.tar.gz -cd memcached-1.4.21 +tar xzf memcached-1.4.22.tar.gz +cd memcached-1.4.22 ./configure --prefix=$memcached_install_dir make && make install cd ../ -/bin/rm -rf memcached-1.4.21 +/bin/rm -rf memcached-1.4.22 if [ -d "$memcached_install_dir" ];then echo -e "\033[32mmemcached install successfully! \033[0m" ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached diff --git a/functions/redis.sh b/functions/redis.sh index 4f21b833..afc764ee 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,15 +10,15 @@ cd $lnmp_dir/src . ../options.conf if [ -e "$php_install_dir/bin/phpize" ];then - src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src - tar xzf redis-2.2.5.tgz - cd redis-2.2.5 + src_url=http://pecl.php.net/get/redis-2.2.6.tgz && Download_src + tar xzf redis-2.2.6.tgz + cd redis-2.2.6 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd .. - /bin/rm -rf redis-2.2.5 + /bin/rm -rf redis-2.2.6 if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/redis.so" ];then [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini From 1d3a6d644962126b2f9ac40488ed3359557830b0 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 5 Jan 2015 22:39:07 +0800 Subject: [PATCH 435/617] update redis not found --- functions/redis.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/redis.sh b/functions/redis.sh index afc764ee..4f21b833 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,15 +10,15 @@ cd $lnmp_dir/src . ../options.conf if [ -e "$php_install_dir/bin/phpize" ];then - src_url=http://pecl.php.net/get/redis-2.2.6.tgz && Download_src - tar xzf redis-2.2.6.tgz - cd redis-2.2.6 + src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src + tar xzf redis-2.2.5.tgz + cd redis-2.2.5 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd .. - /bin/rm -rf redis-2.2.6 + /bin/rm -rf redis-2.2.5 if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/redis.so" ];then [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini From bc4da1ba6e711fe8964dc91a1a1ad97550212989 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 7 Jan 2015 17:38:35 +0800 Subject: [PATCH 436/617] added hhvm on CentOS 6.5,CentOS 7 --- README.md | 1 + backup.sh | 3 +- conf/nginx.conf | 2 +- functions/hhvm_CentOS.sh | 168 +++++++++++++++++++++++++++++++++++++++ functions/nginx.sh | 2 +- functions/phpmyadmin.sh | 6 +- functions/tengine.sh | 2 +- init/hhvm-init-CentOS6 | 96 ++++++++++++++++++++++ install.sh | 26 +++++- tools/db_bk.sh | 4 +- vhost.sh | 33 ++++++-- 11 files changed, 327 insertions(+), 16 deletions(-) create mode 100755 functions/hhvm_CentOS.sh create mode 100755 init/hhvm-init-CentOS6 diff --git a/README.md b/README.md index a702e7e0..9d59b418 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) - You can freely choose to install PHP version (php-5.3, php-5.4, php-5.5, php-5.6, php-7/phpng(alpha)) +- You can freely choose to install PHP version (CentOS6.5 64bit, CentOS7 64bit) - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) diff --git a/backup.sh b/backup.sh index eafcfc12..1cd15aaa 100755 --- a/backup.sh +++ b/backup.sh @@ -16,7 +16,8 @@ DB_Remote_BK() { do cd $lnmp_dir/tools ./db_bk.sh $D - DB_FILE=`ls -lrt $backup_dir | grep DB_$D | tail -1 | awk '{print $NF}'` + DB_GREP="DB_${D}_`date +%Y`" + DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'` echo "file:::$backup_dir/$DB_FILE $backup_dir push" >> $lnmp_dir/tools/config.txt echo "com:::[ -e "$backup_dir/$DB_FILE" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> $lnmp_dir/tools/config.txt done diff --git a/conf/nginx.conf b/conf/nginx.conf index d2dce137..ac263497 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -51,7 +51,7 @@ http { return 404; } - location ~ .*\.(php|php5)?$ { + location ~ .*\.(php|php5)?$ { #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh new file mode 100755 index 00000000..6bb82fce --- /dev/null +++ b/functions/hhvm_CentOS.sh @@ -0,0 +1,168 @@ +#!/bin/bash +# Author: yeho +# Blog: http://blog.linuxeye.com + +Install_hhvm_CentOS() +{ +cd $lnmp_dir/src +. ../functions/download.sh +. ../options.conf + +useradd -M -s /sbin/nologin www + +if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then + CentOS_RHL=7 +elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then + CentOS_RHL=6 +fi + +if [ "$CentOS_RHL" == '7' ];then +if [ -e /etc/yum.repos.d/epel.repo_bk ];then + /bin/mv /etc/yum.repos.d/epel.repo{_bk,} +elif [ ! -e /etc/yum.repos.d/epel.repo ];then +cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 7 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF +fi +src_url=http://blog.linuxeye.com/lnmp/src/hhvm-3.4.2-2.el7.centos.x86_64.rpm && Download_src +yum -y localinstall hhvm-3.4.2-2.el7.centos.x86_64.rpm +fi + +if [ "$CentOS_RHL" == '6' ];then +if [ -e /etc/yum.repos.d/epel.repo_bk ];then + /bin/mv /etc/yum.repos.d/epel.repo{_bk,} +elif [ ! -e /etc/yum.repos.d/epel.repo ];then +cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 6 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF +fi +yum -y install libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel mysql-devel \ +libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel \ +bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel \ +libevent-devel libcurl-devel libmemcached-devel + +cat > /etc/yum.repos.d/remi.repo << EOF +[remi] +name=Les RPM de remi pour Enterprise Linux 6 - \$basearch +#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/\$basearch/ +mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror +enabled=0 +gpgcheck=0 +EOF + +yum --enablerepo=remi -y install libwebp mysql mysql-devel mysql-libs + +cat > /etc/yum.repos.d/gleez.repo << EOF +[gleez] +name=Gleez repo +baseurl=http://yum.gleez.com/6/\$basearch/ +enabled=0 +gpgcheck=0 +EOF +yum --enablerepo=gleez -y install hhvm-stable +fi + +userdel -r nginx +rm -rf /var/run/hhvm/ /var/log/hhvm/ +mkdir /var/run/hhvm/ /var/log/hhvm/ +chown -R www.www /var/run/hhvm /var/log/hhvm +cat > /etc/hhvm/config.hdf << EOF +ResourceLimit { + CoreFileSize = 0 # in bytes + MaxSocket = 10000 # must be not 0, otherwise HHVM will not start + SocketDefaultTimeout = 5 # in seconds + MaxRSS = 0 + MaxRSSPollingCycle = 0 # in seconds, how often to check max memory + DropCacheCycle = 0 # in seconds, how often to drop disk cache +} + +Log { + Level = Info + AlwaysLogUnhandledExceptions = true + RuntimeErrorReportingLevel = 8191 + UseLogFile = true + UseSyslog = false + File = /var/log/hhvm/error.log + Access { + * { + File = /var/log/hhvm/access.log + Format = %h %l %u % t \"%r\" %>s %b + } + } +} + +MySQL { + ReadOnly = false + ConnectTimeout = 1000 # in ms + ReadTimeout = 1000 # in ms + SlowQueryThreshold = 1000 # in ms, log slow queries as errors + KillOnTimeout = false +} + +Mail { + SendmailPath = /usr/sbin/sendmail -t -i + ForceExtraParameters = +} +EOF + +cat > /etc/hhvm/server.ini << EOF +; php options +pid = /var/run/hhvm/pid + +; hhvm specific +;hhvm.server.port = 9001 +hhvm.server.file_socket = /var/run/hhvm/sock +hhvm.server.type = fastcgi +hhvm.server.default_document = index.php +hhvm.log.use_log_file = true +hhvm.log.file = /var/log/hhvm/error.log +hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc +EOF + +cat > /etc/hhvm/php.ini << EOF +hhvm.mysql.socket = /tmp/mysql.sock +expose_php = 0 +memory_limit = 400000000 +post_max_size = 50000000 +EOF + +if [ "$CentOS_RHL" == '7' ];then +cat > /etc/systemd/system/hhvm.service << EOF +[Unit] +Description=HHVM HipHop Virtual Machine (FCGI) + +[Service] +ExecStart=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable hhvm +systemctl start hhvm +elif [ "$CentOS_RHL" == '6' ];then +/bin/cp ../init/hhvm-init-CentOS6 /etc/init.d/hhvm +chmod +x /etc/init.d/hhvm +chkconfig hhvm on +service hhvm start +fi +if [ -e "/usr/bin/hhvm" -o -e "/usr/local/bin/hhvm" ];then + sed -i 's@/dev/shm/php-cgi.sock@/var/run/hhvm/sock@' $web_install_dir/conf/nginx.conf + [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf + sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf + service nginx reload +fi +cd .. +} diff --git a/functions/nginx.sh b/functions/nginx.sh index 978e49fd..2ec4de7b 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -38,7 +38,7 @@ elif [ "$je_tc_malloc" == '2' ];then chown -R www.www /tmp/tcmalloc fi -./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module $malloc_module +./configure --prefix=$nginx_install_dir --user=www --group=www --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_flv_module $malloc_module make && make install if [ -d "$nginx_install_dir" ];then echo -e "\033[32mNginx install successfully! \033[0m" diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 7cba8ca6..c1103b9a 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.4/phpMyAdmin-4.3.4-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.5/phpMyAdmin-4.3.5-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.4-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.4-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.5-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.5-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/functions/tengine.sh b/functions/tengine.sh index 0f6d3df0..88b8a411 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -40,7 +40,7 @@ elif [ "$je_tc_malloc" == '2' ];then chown -R www.www /tmp/tcmalloc fi -./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module +./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module make && make install if [ -d "$tengine_install_dir" ];then echo -e "\033[32mTengine install successfully! \033[0m" diff --git a/init/hhvm-init-CentOS6 b/init/hhvm-init-CentOS6 new file mode 100755 index 00000000..260d7633 --- /dev/null +++ b/init/hhvm-init-CentOS6 @@ -0,0 +1,96 @@ +#!/bin/sh +# +# hhvm Starts The HHVM FastCGI Daemon +# +# chkconfig: - 85 15 +# description: Starts The HHVM FastCGI Daemon +# processname: hhvm +# config: /etc/hhvm/server.ini +# config: /etc/sysconfig/hhvm +# pidfile: /var/run/hhvm/hhvm.pid +# +### BEGIN INIT INFO +# Provides: hhvm +# Short-Description: start and stop the HHVM FastCGI Daemon +# Description: Starts The HHVM FastCGI Daemon +### END INIT INFO + +# Standard LSB functions +#. /lib/lsb/init-functions + +# Source function library. +. /etc/init.d/functions + +# Check that networking is up. +. /etc/sysconfig/network + +if [ "$NETWORKING" = "no" ] +then + exit 0 +fi + +RETVAL=0 +HHVM=/usr/bin/hhvm +prog="hhvm" +pidfile=${PIDFILE-/var/run/hhvm/pid} +lockfile=${LOCKFILE-/var/run/hhvm/lock} + +CONFIG_HDF_FILE="/etc/hhvm/config.hdf" +CONFIG_FILE="/etc/hhvm/server.ini" +SYSTEM_CONFIG_FILE="/etc/hhvm/php.ini" +MODE=daemon +USER=www +ARGS="--config ${CONFIG_FILE} --config ${SYSTEM_CONFIG_FILE} --config ${CONFIG_HDF_FILE}" + +if [ -f /etc/sysconfig/hhvm ]; then + . /etc/sysconfig/hhvm +fi + + +start() { + echo -n $"Starting $prog: " + dir=$(dirname ${pidfile}) + [ -d $dir ] || mkdir $dir + daemon ${HHVM} --mode ${MODE} --user ${USER} ${ARGS} + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch ${lockfile} +} + + +stop() { + echo -n $"Stopping $prog: " + killproc -p ${pidfile} ${HHVM} + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f ${lockfile} ${pidfile} + fi +} + +restart () { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p ${pidfile} ${HHVM} + RETVAL=$? + ;; + restart) + restart + ;; + *) + echo $"Usage: $prog {start|stop|status|restart}" + RETVAL=2 +esac + +exit $RETVAL diff --git a/install.sh b/install.sh index 210c0851..4866f30a 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ mkdir -p $home_dir/default $wwwlogs_dir $lnmp_dir/{src,conf} while : do echo - read -p "Do you want to upgrade operating system ? [y/n]: " upgrade_yn + read -p "Do you want to upgrade operating system? [y/n]: " upgrade_yn if [ "$upgrade_yn" != 'y' -a "$upgrade_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else @@ -45,7 +45,7 @@ do while : do echo - read -p "Do you want to install sendmail ? [y/n]: " sendmail_yn + read -p "Do you want to install sendmail? [y/n]: " sendmail_yn if [ "$sendmail_yn" != 'y' -a "$sendmail_yn" != 'n' ];then echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" else @@ -501,6 +501,23 @@ if [ "$Web_yn" == 'y' -o "$DB_yn" == 'y' ];then done fi +if [ "$OS" == 'CentOS' ];then + if [ -n "`cat /etc/redhat-release | grep -E ' 7\.| 6\.'`" -a -d "/lib64" ];then + while : + do + echo + read -p "Do you want to install HHVM? [y/n]: " HHVM_yn + if [ "$HHVM_yn" != 'y' -a "$HHVM_yn" != 'n' ];then + echo -e "\033[31minput error! Please only input 'y' or 'n'\033[0m" + else + break + fi + done + else + echo -e "\033[31mOnly support CentOS6.5 64bit, CentOS7 64bit! \033[0m" + fi +fi + chmod +x functions/*.sh init/* *.sh # init @@ -683,6 +700,11 @@ if [ ! -e "$home_dir/default/index.html" -a "$Web_yn" == 'y' ];then TEST 2>&1 | tee -a $lnmp_dir/install.log fi +if [ "$HHVM_yn" == 'y' ];then + . functions/hhvm_CentOS.sh + Install_hhvm_CentOS 2>&1 | tee -a $lnmp_dir/install.log +fi + echo "####################Congratulations########################" [ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`\033[32m$web_install_dir\033[0m" [ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`\033[32m$web_install_dir\033[0m\n`printf "%-32s" "Apache install dir":`\033[32m$apache_install_dir\033[0m" diff --git a/tools/db_bk.sh b/tools/db_bk.sh index 73f30324..25786844 100755 --- a/tools/db_bk.sh +++ b/tools/db_bk.sh @@ -15,14 +15,14 @@ OldFile=$backup_dir/DB_${DBname}_$(date +%Y%m%d --date="$expired_days days ago") DB_tmp=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep $DBname` [ -z "$DB_tmp" ] && { echo "[$DBname] not exist" >> $LogFile ; exit 1 ; } -if [ -f $OldFile ];then +if [ -e "$OldFile" ];then rm -f $OldFile echo "[$OldFile] Delete Old File Success" >> $LogFile else echo "[$OldFile] Delete Old Backup File" >> $LogFile fi -if [ -f $NewFile ];then +if [ -e "$NewFile" ];then echo "[$NewFile] The Backup File is exists,Can't Backup" >> $LogFile else $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --opt --databases $DBname > $DumpFile diff --git a/vhost.sh b/vhost.sh index 3f359bab..d11a4e57 100755 --- a/vhost.sh +++ b/vhost.sh @@ -14,6 +14,31 @@ printf " " . ./options.conf +HHVM_YN() +{ +if [ -e "/usr/bin/hhvm" -o -e "/usr/local/bin/hhvm" ];then + while : + do + echo + echo 'Please choose to use PHP or HHVM:' + echo -e "\t\033[32m1\033[0m. Use php" + echo -e "\t\033[32m2\033[0m. Use hhvm" + read -p "Please input a number:(Default 1 press Enter) " PHP_HHVM + [ -z "$PHP_HHVM" ] && PHP_HHVM=1 + if [ $PHP_HHVM != 1 -a $PHP_HHVM != 2 ];then + echo -e "\033[31minput error! Please only input number 1,2\033[0m" + else + break + fi + done +fi +if [ "$PHP_HHVM" == '2' ];then + NGX_CONF="fastcgi_pass unix:/var/run/hhvm/sock;\n\tfastcgi_index index.php;\n\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n\tinclude fastcgi_params;" +else + NGX_CONF="#fastcgi_pass remote_php_ip:9000;\n\tfastcgi_pass unix:/dev/shm/php-cgi.sock;\n\tfastcgi_index index.php;\n\tinclude fastcgi.conf;" +fi +} + Input_domain() { while : @@ -50,7 +75,7 @@ if [ "$moredomainame_yn" == 'y' ]; then while : do echo - read -p "Type domainname,example(blog.linuxeye.com bbs.linuxeye.com): " moredomain + read -p "Type domainname,example(linuxeye.com www.example.com): " moredomain if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then echo -e "\033[31minput error\033[0m" else @@ -202,10 +227,7 @@ if ( \$query_string ~* ".*[\;'\<\>].*" ){ $anti_hotlinking `echo -e $ngx_pagespeed` location ~ .*\.(php|php5)?$ { - #fastcgi_pass remote_php_ip:9000; - fastcgi_pass unix:/dev/shm/php-cgi.sock; - fastcgi_index index.php; - include fastcgi.conf; + `echo -e $NGX_CONF` } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { @@ -403,6 +425,7 @@ echo -e "`printf "%-32s" "Directory of:"`\033[32m$vhostdir\033[0m" } if [ -d "$web_install_dir" -a ! -d "$apache_install_dir" ];then + HHVM_YN Input_domain Ngx_pagespeed Nginx_anti_hotlinking From 0f0010ccbfe101f0c3d0d25ef9e0b01eb94b7db9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 7 Jan 2015 17:42:11 +0800 Subject: [PATCH 437/617] change README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d59b418..c6af8cc3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ - Fixes some security issues - You can freely choose to install database version (MySQL-5.6, MySQL-5.5, MariaDB-10.0, MariaDB-5.5, Percona-5.6, Percona-5.5) - You can freely choose to install PHP version (php-5.3, php-5.4, php-5.5, php-5.6, php-7/phpng(alpha)) -- You can freely choose to install PHP version (CentOS6.5 64bit, CentOS7 64bit) +- You can freely choose to install HHVM version (CentOS6.5 64bit, CentOS7 64bit) - You can freely choose to install Nginx or Tengine - You can freely choose to install Apache version (Apache-2.4, Apache-2.2) - According to their needs can to install ZendOPcache, xcache, APCU, eAccelerator, ionCube and ZendGuardLoader (php-5.4, php-5.3) From 723ba59c059bbb47dc24b6f39ff6ec88b7a7ebfe Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 13 Jan 2015 10:10:56 +0800 Subject: [PATCH 438/617] update percona --- functions/hhvm_CentOS.sh | 4 +++- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- vhost.sh | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index 6bb82fce..ffd112b6 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -64,6 +64,8 @@ EOF yum --enablerepo=remi -y install libwebp mysql mysql-devel mysql-libs +yum -y remove boost-system boost-filesystem + cat > /etc/yum.repos.d/gleez.repo << EOF [gleez] name=Gleez repo @@ -158,7 +160,7 @@ chmod +x /etc/init.d/hhvm chkconfig hhvm on service hhvm start fi -if [ -e "/usr/bin/hhvm" -o -e "/usr/local/bin/hhvm" ];then +if [ -e "/usr/bin/hhvm" ];then sed -i 's@/dev/shm/php-cgi.sock@/var/run/hhvm/sock@' $web_install_dir/conf/nginx.conf [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index d43daf8a..e0374701 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.40-36.1.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.41-37.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar zxf percona-server-5.5.40-36.1.tar.gz -cd percona-server-5.5.40-36.1 +tar zxf percona-server-5.5.41-37.0.tar.gz +cd percona-server-5.5.41-37.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -55,7 +55,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.5.40-36.1 +/bin/rm -rf percona-server-5.5.41-37.0 cd .. # my.cf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 1382312e..d34a895c 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.21-70.1.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.22-71.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar zxf percona-server-5.6.21-70.1.tar.gz -cd percona-server-5.6.21-70.1 +tar zxf percona-server-5.6.22-71.0.tar.gz +cd percona-server-5.6.22-71.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -54,7 +54,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.21-70.1 +/bin/rm -rf percona-server-5.6.22-71.0 cd .. # my.cf diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index c1103b9a..967da37c 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.5/phpMyAdmin-4.3.5-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.6/phpMyAdmin-4.3.6-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.5-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.5-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.6-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.6-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/vhost.sh b/vhost.sh index d11a4e57..0a7fe1f6 100755 --- a/vhost.sh +++ b/vhost.sh @@ -16,7 +16,7 @@ printf " HHVM_YN() { -if [ -e "/usr/bin/hhvm" -o -e "/usr/local/bin/hhvm" ];then +if [ -e "/usr/bin/hhvm" ];then while : do echo From 62ebd0311ffd61ba5baa7220909bfe9b0c254098 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 14 Jan 2015 11:36:47 +0800 Subject: [PATCH 439/617] hhvm systemd bug --- functions/hhvm_CentOS.sh | 1 + functions/php-mysql-client.sh | 23 ----------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100755 functions/php-mysql-client.sh diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index ffd112b6..885d2ce1 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -146,6 +146,7 @@ cat > /etc/systemd/system/hhvm.service << EOF Description=HHVM HipHop Virtual Machine (FCGI) [Service] +ExecStartPre=/usr/bin/mkdir /var/run/hhvm ; /usr/bin/chown www.www /var/run/hhvm ExecStart=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf [Install] diff --git a/functions/php-mysql-client.sh b/functions/php-mysql-client.sh deleted file mode 100755 index f0bedfbf..00000000 --- a/functions/php-mysql-client.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Author: yeho -# Blog: http://blog.linuxeye.com - -Install_PHP-MySQL-Client() -{ -cd $lnmp_dir/src -. ../functions/download.sh -. ../options.conf - -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.41.tar.gz && Download_src -tar zxf mysql-5.5.41.tar.gz -cd mysql-5.5.41 -cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir -make mysqlclient libmysql -mkdir -p $mysql_install_dir/{lib,bin} -/bin/cp libmysql/libmysqlclient* $mysql_install_dir/lib -/bin/cp scripts/mysql_config $mysql_install_dir/bin -/bin/cp -R include $mysql_install_dir -cd .. -/bin/rm -rf mysql-5.5.41 -cd .. -} From 6f1de3fdd01228ad1491ca31e38a6930e7c6ade4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 15 Jan 2015 15:29:05 +0800 Subject: [PATCH 440/617] added Supervisor --- functions/hhvm_CentOS.sh | 24 ++++++++++++++++++++++-- init/hhvm-init-CentOS6 | 2 +- init/init_CentOS.sh | 21 +++++++++++++++++++++ init/init_Debian.sh | 20 ++++++++++++++++++++ init/init_Ubuntu.sh | 20 ++++++++++++++++++++ install.sh | 8 ++++---- 6 files changed, 88 insertions(+), 7 deletions(-) diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index 885d2ce1..e45fd881 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -146,8 +146,8 @@ cat > /etc/systemd/system/hhvm.service << EOF Description=HHVM HipHop Virtual Machine (FCGI) [Service] -ExecStartPre=/usr/bin/mkdir /var/run/hhvm ; /usr/bin/chown www.www /var/run/hhvm -ExecStart=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +ExecStartPre=/usr/bin/rm -rf /var/run/hhvm ; /usr/bin/mkdir /var/run/hhvm ; /usr/bin/chown www.www /var/run/hhvm +ExecStart=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf [Install] WantedBy=multi-user.target @@ -167,5 +167,25 @@ if [ -e "/usr/bin/hhvm" ];then sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf service nginx reload fi + +# Supervisor +yum -y install python-setuptools +easy_install supervisor +echo_supervisord_conf > /etc/supervisord.conf +sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf +[ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF +[program:hhvm] +command=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +numprocs=1 ; number of processes copies to start (def 1) +directory=/tmp ; directory to cwd to before exec (def no cwd) +autostart=true ; start at supervisord start (default: true) +autorestart=unexpected ; whether/when to restart (default: unexpected) +stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) +EOF +src_url=https://github.com/Supervisor/initscripts/raw/master/redhat-init-mingalevme && Download_src +/bin/mv redhat-init-mingalevme /etc/init.d/supervisord +chmod +x /etc/init.d/supervisord +chkconfig supervisord on +service supervisord start cd .. } diff --git a/init/hhvm-init-CentOS6 b/init/hhvm-init-CentOS6 index 260d7633..e7c892b1 100755 --- a/init/hhvm-init-CentOS6 +++ b/init/hhvm-init-CentOS6 @@ -38,7 +38,7 @@ lockfile=${LOCKFILE-/var/run/hhvm/lock} CONFIG_HDF_FILE="/etc/hhvm/config.hdf" CONFIG_FILE="/etc/hhvm/server.ini" SYSTEM_CONFIG_FILE="/etc/hhvm/php.ini" -MODE=daemon +MODE=server USER=www ARGS="--config ${CONFIG_FILE} --config ${SYSTEM_CONFIG_FILE} --config ${CONFIG_HDF_FILE}" diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index d873db01..0bf76d74 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -4,6 +4,27 @@ cd src . ../functions/download.sh + +# add swapfile +Mem=`free -m | awk '/Mem:/{print $2}'` +Swap=`free -m | awk '/Swap:/{print $2}'` +if [ "$Swap" == '0' ] ;then +if [ $Mem -le 1024 ];then + dd if=/dev/zero of=/swapfile count=1024 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +elif [ $Mem -gt 1024 -a $Mem -le 2048 ];then + dd if=/dev/zero of=/swapfile count=2048 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +fi +cat >> /etc/fstab << EOF +/swapfile swap swap defaults 0 0 +EOF +fi + src_url=http://blog.linuxeye.com/lnmp/src/yum-3.4.3.tar.gz && Download_src tar zxf yum-3.4.3.tar.gz cd yum-3.4.3 diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 91fcece9..69439263 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -2,6 +2,26 @@ # Author: yeho # Blog: http://blog.linuxeye.com +# add swapfile +Mem=`free -m | awk '/Mem:/{print $2}'` +Swap=`free -m | awk '/Swap:/{print $2}'` +if [ "$Swap" == '0' ] ;then +if [ $Mem -le 1024 ];then + dd if=/dev/zero of=/swapfile count=1024 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +elif [ $Mem -gt 1024 -a $Mem -le 2048 ];then + dd if=/dev/zero of=/swapfile count=2048 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +fi +cat >> /etc/fstab << EOF +/swapfile swap swap defaults 0 0 +EOF +fi + for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do apt-get -y remove --purge $Package diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index eb70cb44..a8f6f5af 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -5,6 +5,26 @@ cd src . ../functions/download.sh +# add swapfile +Mem=`free -m | awk '/Mem:/{print $2}'` +Swap=`free -m | awk '/Swap:/{print $2}'` +if [ "$Swap" == '0' ] ;then +if [ $Mem -le 1024 ];then + dd if=/dev/zero of=/swapfile count=1024 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +elif [ $Mem -gt 1024 -a $Mem -le 2048 ];then + dd if=/dev/zero of=/swapfile count=2048 bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile +fi +cat >> /etc/fstab << EOF +/swapfile swap swap defaults 0 0 +EOF +fi + for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do apt-get -y remove --purge $Package diff --git a/install.sh b/install.sh index 4866f30a..dcd201d9 100755 --- a/install.sh +++ b/install.sh @@ -575,10 +575,10 @@ elif [ "$DB_version" == '6' ];then fi # PHP MySQL Client -if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' -a "$PHP_MySQL_driver" == '2' ];then - . functions/php-mysql-client.sh - Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log -fi +#if [ "$DB_yn" == 'n' -a "$PHP_yn" == 'y' -a "$PHP_MySQL_driver" == '2' ];then +# . functions/php-mysql-client.sh +# Install_PHP-MySQL-Client 2>&1 | tee -a $lnmp_dir/install.log +#fi # Apache if [ "$Apache_version" == '1' ];then From 11b85b543d7ab2c5a42c778b4c7798330833d19a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 21 Jan 2015 15:56:44 +0800 Subject: [PATCH 441/617] update hhvm --- functions/ImageMagick.sh | 8 ++++---- functions/hhvm_CentOS.sh | 12 +++++++++--- functions/tcmalloc.sh | 8 ++++---- init/hhvm-init-CentOS6 | 2 +- init/init_CentOS.sh | 2 +- init/init_Debian.sh | 2 +- init/init_Ubuntu.sh | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 99f8ee91..8700d09d 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,14 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-3.tar.gz && Download_src +src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-4.tar.gz && Download_src -tar xzf ImageMagick-6.9.0-3.tar.gz -cd ImageMagick-6.9.0-3 +tar xzf ImageMagick-6.9.0-4.tar.gz +cd ImageMagick-6.9.0-4 ./configure make && make install cd ../ -/bin/rm -rf ImageMagick-6.9.0-3 +/bin/rm -rf ImageMagick-6.9.0-4 ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index e45fd881..731309f1 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -30,8 +30,14 @@ enabled=1 gpgcheck=0 EOF fi -src_url=http://blog.linuxeye.com/lnmp/src/hhvm-3.4.2-2.el7.centos.x86_64.rpm && Download_src -yum -y localinstall hhvm-3.4.2-2.el7.centos.x86_64.rpm +cat > /etc/yum.repos.d/gleez.repo << EOF +[gleez] +name=Gleez repo +baseurl=http://yum.gleez.com/7/\$basearch/ +enabled=0 +gpgcheck=0 +EOF +yum --enablerepo=gleez -y install hhvm fi if [ "$CentOS_RHL" == '6' ];then @@ -73,7 +79,7 @@ baseurl=http://yum.gleez.com/6/\$basearch/ enabled=0 gpgcheck=0 EOF -yum --enablerepo=gleez -y install hhvm-stable +yum --enablerepo=gleez -y install hhvm fi userdel -r nginx diff --git a/functions/tcmalloc.sh b/functions/tcmalloc.sh index cad2357e..85d031c2 100755 --- a/functions/tcmalloc.sh +++ b/functions/tcmalloc.sh @@ -7,14 +7,14 @@ Install_tcmalloc() cd $lnmp_dir/src . ../functions/download.sh -src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.3.tar.gz && Download_src +src_url=https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.4.tar.gz && Download_src -tar xzf gperftools-2.3.tar.gz -cd gperftools-2.3 +tar xzf gperftools-2.4.tar.gz +cd gperftools-2.4 ./configure --enable-frame-pointers make && make install cd .. -/bin/rm -rf gperftools-2.3 +/bin/rm -rf gperftools-2.4 if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf diff --git a/init/hhvm-init-CentOS6 b/init/hhvm-init-CentOS6 index e7c892b1..8d4deba4 100755 --- a/init/hhvm-init-CentOS6 +++ b/init/hhvm-init-CentOS6 @@ -50,7 +50,7 @@ fi start() { echo -n $"Starting $prog: " dir=$(dirname ${pidfile}) - [ -d $dir ] || mkdir $dir + [ -d $dir ] || { mkdir $dir; chown $USER:$USER $dir; } daemon ${HHVM} --mode ${MODE} --user ${USER} ${ARGS} RETVAL=$? echo diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 0bf76d74..f92ec8c2 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -182,7 +182,7 @@ init q # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root +[ -z "`grep 'pool.ntp.org' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } service crond restart # iptables diff --git a/init/init_Debian.sh b/init/init_Debian.sh index 69439263..1959f929 100755 --- a/init/init_Debian.sh +++ b/init/init_Debian.sh @@ -102,7 +102,7 @@ init q # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +[ -z "`grep 'pool.ntp.org' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables diff --git a/init/init_Ubuntu.sh b/init/init_Ubuntu.sh index a8f6f5af..58a1bd89 100755 --- a/init/init_Ubuntu.sh +++ b/init/init_Ubuntu.sh @@ -120,7 +120,7 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root +[ -z "`grep 'pool.ntp.org' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables From e515048a02734cee298e74fd54e261df93963537 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 23 Jan 2015 15:41:04 +0800 Subject: [PATCH 442/617] update php version --- functions/ImageMagick.sh | 2 +- functions/ZendGuardLoader.sh | 8 ++++---- functions/hhvm_CentOS.sh | 2 +- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- functions/phpmyadmin.sh | 6 +++--- init/init_CentOS.sh | 5 ----- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 8700d09d..ac528aeb 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,7 +8,7 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://blog.linuxeye.com/lnmp/src/ImageMagick-6.9.0-4.tar.gz && Download_src +src_url=http://downloads.linuxeye.com/lnmp/src/ImageMagick-6.9.0-4.tar.gz && Download_src tar xzf ImageMagick-6.9.0-4.tar.gz cd ImageMagick-6.9.0-4 diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh index db83c087..1e2b7637 100755 --- a/functions/ZendGuardLoader.sh +++ b/functions/ZendGuardLoader.sh @@ -14,28 +14,28 @@ PHP_version=${php_version%.*} [ ! -e "$php_install_dir/lib/php/extensions/" ] && mkdir $php_install_dir/lib/php/extensions/ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then if [ "$PHP_version" == '5.4' ];then - src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 fi if [ "$PHP_version" == '5.3' ];then - src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 fi else if [ "$PHP_version" == '5.4' ];then - src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi if [ "$PHP_version" == '5.3' ];then - src_url=http://blog.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index 731309f1..e86750fc 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -82,7 +82,7 @@ EOF yum --enablerepo=gleez -y install hhvm fi -userdel -r nginx +userdel -r nginx;userdel -r saslauth rm -rf /var/run/hhvm/ /var/log/hhvm/ mkdir /var/run/hhvm/ /var/log/hhvm/ chown -R www.www /var/run/hhvm /var/log/hhvm diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index bd35504b..d2632b75 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.20.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.21.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -70,11 +70,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.20.tar.gz +tar xzf php-5.5.21.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.20 -p0 < fpm-race-condition.patch -cd php-5.5.20 +patch -d php-5.5.21 -p0 < fpm-race-condition.patch +cd php-5.5.21 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -255,6 +255,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.20 +/bin/rm -rf php-5.5.21 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 07f05602..52f2bab6 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.4.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.5.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.4.tar.gz +tar xzf php-5.6.5.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.4 -p0 < fpm-race-condition.patch -cd php-5.6.4 +patch -d php-5.6.5 -p0 < fpm-race-condition.patch +cd php-5.6.5 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -254,6 +254,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.4 +/bin/rm -rf php-5.6.5 cd .. } diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 967da37c..69c3d4f4 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.6/phpMyAdmin-4.3.6-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.7/phpMyAdmin-4.3.7-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.6-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.6-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.7-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.7-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index f92ec8c2..39727221 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -25,11 +25,6 @@ cat >> /etc/fstab << EOF EOF fi -src_url=http://blog.linuxeye.com/lnmp/src/yum-3.4.3.tar.gz && Download_src -tar zxf yum-3.4.3.tar.gz -cd yum-3.4.3 -./yummain.py install yum -y -cd .. sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all From 38ddb859c23bb37dd2598420d51a750b3fbe0bfb Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 24 Jan 2015 14:28:21 +0800 Subject: [PATCH 443/617] update php 5.4.36 to 5.4.37 --- functions/hhvm_CentOS.sh | 4 ++-- functions/php-5.4.sh | 10 +++++----- init/hhvm-init-CentOS6 | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index e86750fc..808dbafd 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -153,7 +153,7 @@ Description=HHVM HipHop Virtual Machine (FCGI) [Service] ExecStartPre=/usr/bin/rm -rf /var/run/hhvm ; /usr/bin/mkdir /var/run/hhvm ; /usr/bin/chown www.www /var/run/hhvm -ExecStart=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +ExecStart=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf [Install] WantedBy=multi-user.target @@ -181,7 +181,7 @@ echo_supervisord_conf > /etc/supervisord.conf sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf [ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF [program:hhvm] -command=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +command=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf numprocs=1 ; number of processes copies to start (def 1) directory=/tmp ; directory to cwd to before exec (def no cwd) autostart=true ; start at supervisord start (default: true) diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index cb5ee9e2..9a45b4de 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.36.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.37.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.36.tar.gz +tar xzf php-5.4.37.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.36 -p0 < fpm-race-condition.patch -cd php-5.4.36 +patch -d php-5.4.37 -p0 < fpm-race-condition.patch +cd php-5.4.37 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -240,6 +240,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.36 +/bin/rm -rf php-5.4.37 cd .. } diff --git a/init/hhvm-init-CentOS6 b/init/hhvm-init-CentOS6 index 8d4deba4..e15f8975 100755 --- a/init/hhvm-init-CentOS6 +++ b/init/hhvm-init-CentOS6 @@ -38,7 +38,7 @@ lockfile=${LOCKFILE-/var/run/hhvm/lock} CONFIG_HDF_FILE="/etc/hhvm/config.hdf" CONFIG_FILE="/etc/hhvm/server.ini" SYSTEM_CONFIG_FILE="/etc/hhvm/php.ini" -MODE=server +MODE=daemon USER=www ARGS="--config ${CONFIG_FILE} --config ${SYSTEM_CONFIG_FILE} --config ${CONFIG_HDF_FILE}" From efc605f857fe46a470e23eae21ac3cee1acb2ccb Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 29 Jan 2015 16:32:12 +0800 Subject: [PATCH 444/617] update glic --- functions/hhvm_CentOS.sh | 2 ++ functions/mariadb-10.0.sh | 1 - functions/mariadb-5.5.sh | 1 - functions/phpmyadmin.sh | 6 +++--- init/init_CentOS.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index 808dbafd..a3811571 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -174,6 +174,8 @@ if [ -e "/usr/bin/hhvm" ];then service nginx reload fi +rm -rf /etc/ld.so.conf.d/*_64.conf +ldconfig # Supervisor yum -y install python-setuptools easy_install supervisor diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index 499af8f2..d5cdaf6a 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -33,7 +33,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index d26c5dde..055a9f0d 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -33,7 +33,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 69c3d4f4..7890e794 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.7/phpMyAdmin-4.3.7-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.8/phpMyAdmin-4.3.8-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.7-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.7-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.8-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.8-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 39727221..3653d621 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -87,7 +87,7 @@ do yum -y install $Package done -yum -y update bash openssl +yum -y update bash openssl glibc # use gcc-4.4 if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then From 65c212d3309cb1353ed9a05fc88e9349c825950e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 30 Jan 2015 11:59:08 +0800 Subject: [PATCH 445/617] update apache 2.4.10 to 2.4.12 --- functions/apache-2.4.sh | 8 ++++---- install.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/apache-2.4.sh b/functions/apache-2.4.sh index 41ad3f57..0dcae903 100755 --- a/functions/apache-2.4.sh +++ b/functions/apache-2.4.sh @@ -12,7 +12,7 @@ cd $lnmp_dir/src src_url=http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz && Download_src -src_url=http://www.apache.org/dist/httpd/httpd-2.4.10.tar.gz && Download_src +src_url=http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gz && Download_src tar xzf pcre-8.36.tar.gz cd pcre-8.36 @@ -21,10 +21,10 @@ make && make install cd ../ useradd -M -s /sbin/nologin www -tar xzf httpd-2.4.10.tar.gz +tar xzf httpd-2.4.12.tar.gz tar xzf apr-1.5.1.tar.gz tar xzf apr-util-1.5.4.tar.gz -cd httpd-2.4.10 +cd httpd-2.4.12 /bin/cp -R ../apr-1.5.1 ./srclib/apr /bin/cp -R ../apr-util-1.5.4 ./srclib/apr-util ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=prefork --disable-userdir @@ -40,7 +40,7 @@ fi . /etc/profile cd .. -/bin/rm -rf httpd-2.4.10 +/bin/rm -rf httpd-2.4.12 /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd diff --git a/install.sh b/install.sh index dcd201d9..25e113fc 100755 --- a/install.sh +++ b/install.sh @@ -545,10 +545,10 @@ if [ "$gcc_sane_yn" == 'y' ];then fi # jemalloc or tcmalloc -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' ];then +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ];then . functions/jemalloc.sh Install_jemalloc | tee -a $lnmp_dir/install.log -elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' ];then +elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ];then . functions/tcmalloc.sh Install_tcmalloc | tee -a $lnmp_dir/install.log fi From f1b8baea75cad7da78a086ebd1414e15b4782dbe Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 3 Feb 2015 14:17:16 +0800 Subject: [PATCH 446/617] update MySQL version --- functions/ImageMagick.sh | 2 +- functions/hhvm_CentOS.sh | 36 ++++++++++++++++++------------------ functions/mysql-5.5.sh | 8 ++++---- functions/mysql-5.6.sh | 8 ++++---- install.sh | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index ac528aeb..8d2dcada 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,7 +8,7 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.linuxeye.com/lnmp/src/ImageMagick-6.9.0-4.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/imagemagick/6.9.0-sources/ImageMagick-6.9.0-4.tar.gz && Download_src tar xzf ImageMagick-6.9.0-4.tar.gz cd ImageMagick-6.9.0-4 diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index a3811571..fe7370df 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -177,23 +177,23 @@ fi rm -rf /etc/ld.so.conf.d/*_64.conf ldconfig # Supervisor -yum -y install python-setuptools -easy_install supervisor -echo_supervisord_conf > /etc/supervisord.conf -sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf -[ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF -[program:hhvm] -command=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf -numprocs=1 ; number of processes copies to start (def 1) -directory=/tmp ; directory to cwd to before exec (def no cwd) -autostart=true ; start at supervisord start (default: true) -autorestart=unexpected ; whether/when to restart (default: unexpected) -stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -EOF -src_url=https://github.com/Supervisor/initscripts/raw/master/redhat-init-mingalevme && Download_src -/bin/mv redhat-init-mingalevme /etc/init.d/supervisord -chmod +x /etc/init.d/supervisord -chkconfig supervisord on -service supervisord start +#yum -y install python-setuptools +#easy_install supervisor +#echo_supervisord_conf > /etc/supervisord.conf +#sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf +#[ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF +#[program:hhvm] +#command=/usr/bin/hhvm --mode daemon --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +#numprocs=1 ; number of processes copies to start (def 1) +#directory=/tmp ; directory to cwd to before exec (def no cwd) +#autostart=true ; start at supervisord start (default: true) +#autorestart=unexpected ; whether/when to restart (default: unexpected) +#stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) +#EOF +#src_url=https://github.com/Supervisor/initscripts/raw/master/redhat-init-mingalevme && Download_src +#/bin/mv redhat-init-mingalevme /etc/init.d/supervisord +#chmod +x /etc/init.d/supervisord +#chkconfig supervisord on +#service supervisord start cd .. } diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 6890d684..671378a4 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.41.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.42.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-5.5.41.tar.gz -cd mysql-5.5.41 +tar zxf mysql-5.5.42.tar.gz +cd mysql-5.5.42 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -52,7 +52,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.5.41 +/bin/rm -rf mysql-5.5.42 cd .. # my.cf diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 09a61dbe..7ee7e3e6 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz && Download_src +src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-5.6.22.tar.gz -cd mysql-5.6.22 +tar zxf mysql-5.6.23.tar.gz +cd mysql-5.6.23 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -51,7 +51,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mysql-5.6.22 +/bin/rm -rf mysql-5.6.23 cd .. # my.cf diff --git a/install.sh b/install.sh index 25e113fc..56d42e94 100755 --- a/install.sh +++ b/install.sh @@ -361,8 +361,8 @@ else else break fi - [ -n "`cat /etc/issue | grep 'Ubuntu 14'`" -a "$Magick" == '1' ] && Magick=9 done + [ -n "`cat /etc/issue | grep 'Ubuntu 14'`" -a "$Magick" == '1' ] && Magick=9 fi #while : From 5cd62ed3d193e647fdbc3288c717b35424627b39 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 8 Feb 2015 09:51:01 +0800 Subject: [PATCH 447/617] update percona 5.6.22-71.0 to 5.6.22-72.0 --- functions/percona-5.6.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index d34a895c..054cd238 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.22-71.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.22-72.0.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar zxf percona-server-5.6.22-71.0.tar.gz -cd percona-server-5.6.22-71.0 +tar zxf percona-server-5.6.22-72.0.tar.gz +cd percona-server-5.6.22-72.0 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -54,7 +54,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.22-71.0 +/bin/rm -rf percona-server-5.6.22-72.0 cd .. # my.cf diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 7890e794..69e3e7b6 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.8/phpMyAdmin-4.3.8-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.9/phpMyAdmin-4.3.9-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.8-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.8-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.9-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.9-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From da7cf2eb775d3618463f3e55bc5c7b7062472968 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Feb 2015 10:56:54 +0800 Subject: [PATCH 448/617] update php version --- conf/nginx.conf | 26 ++++++++++++++++++++------ conf/nginx_apache.conf | 30 ++++++++++++++++++++++-------- functions/mariadb-5.5.sh | 8 ++++---- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- 6 files changed, 61 insertions(+), 33 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index ac263497..f1477044 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -31,14 +31,28 @@ http { fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; +#Gzip Compression gzip on; - gzip_disable "msie6"; - gzip_vary on; - gzip_comp_level 2; - gzip_min_length 1k; - gzip_buffers 4 16k; + gzip_buffers 16 8k; + gzip_comp_level 6; gzip_http_version 1.1; - gzip_types text/plain application/x-javascript text/css application/xml application/javascript; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "msie6"; + +#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; ###################pureftpd AND phpmyadmin############################ server { diff --git a/conf/nginx_apache.conf b/conf/nginx_apache.conf index bbc17cc2..ccc3ca79 100644 --- a/conf/nginx_apache.conf +++ b/conf/nginx_apache.conf @@ -46,14 +46,28 @@ http { fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; - gzip on; - gzip_disable "msie6"; - gzip_vary on; - gzip_comp_level 2; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.1; - gzip_types text/plain application/x-javascript text/css application/xml application/javascript; +#Gzip Compression + gzip on; + gzip_buffers 16 8k; + gzip_comp_level 6; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "msie6"; + +#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; ###################pureftpd AND phpmyadmin############################ server { diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 055a9f0d..4f4a6be6 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=https://downloads.mariadb.org/f/mariadb-5.5.41/source/mariadb-5.5.41.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-5.5.42/source/mariadb-5.5.42.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-5.5.41.tar.gz -cd mariadb-5.5.41 +tar zxf mariadb-5.5.42.tar.gz +cd mariadb-5.5.42 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -54,7 +54,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-5.5.41 +/bin/rm -rf mariadb-5.5.42 cd .. # my.cf diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 9a45b4de..045498bd 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.37.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.38.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.37.tar.gz +tar xzf php-5.4.38.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.37 -p0 < fpm-race-condition.patch -cd php-5.4.37 +patch -d php-5.4.38 -p0 < fpm-race-condition.patch +cd php-5.4.38 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -240,6 +240,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.37 +/bin/rm -rf php-5.4.38 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index d2632b75..53aebb0f 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.21.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.22.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -70,11 +70,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.21.tar.gz +tar xzf php-5.5.22.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.21 -p0 < fpm-race-condition.patch -cd php-5.5.21 +patch -d php-5.5.22 -p0 < fpm-race-condition.patch +cd php-5.5.22 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -255,6 +255,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.21 +/bin/rm -rf php-5.5.22 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 52f2bab6..eada4f0e 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.5.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.6.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -69,11 +69,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.5.tar.gz +tar xzf php-5.6.6.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.5 -p0 < fpm-race-condition.patch -cd php-5.6.5 +patch -d php-5.6.6 -p0 < fpm-race-condition.patch +cd php-5.6.6 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -254,6 +254,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.5 +/bin/rm -rf php-5.6.6 cd .. } From dfd2c3a98aa3013770d6a60d81dd644205043a7f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Feb 2015 11:01:20 +0800 Subject: [PATCH 449/617] update phpMyAdmin 4.3.9 to 4.3.10 --- functions/phpmyadmin.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 69e3e7b6..b73c1a8a 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.9/phpMyAdmin-4.3.9-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.10/phpMyAdmin-4.3.10-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.9-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.9-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.10-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.10-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 5918115e83085ee1b98dc2af535da37646d68bdd Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 2 Mar 2015 14:20:34 +0800 Subject: [PATCH 450/617] update imagick bug --- functions/GraphicsMagick.sh | 4 ++-- functions/ImageMagick.sh | 13 ++++++------- functions/nginx.sh | 2 +- functions/tengine.sh | 2 +- install.sh | 1 - tools/mssh.exp | 6 +++--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/functions/GraphicsMagick.sh b/functions/GraphicsMagick.sh index c93af767..902c120a 100755 --- a/functions/GraphicsMagick.sh +++ b/functions/GraphicsMagick.sh @@ -12,7 +12,7 @@ src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1 tar xzf GraphicsMagick-1.3.20.tar.gz cd GraphicsMagick-1.3.20 -./configure --enable-shared +./configure --enable-shared --prefix=/usr/local/graphicsmagick make && make install cd ../ /bin/rm -rf GraphicsMagick-1.3.20 @@ -24,7 +24,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config + ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick make && make install cd ../ /bin/rm -rf gmagick-1.1.7RC2 diff --git a/functions/ImageMagick.sh b/functions/ImageMagick.sh index 8d2dcada..1c08fa21 100755 --- a/functions/ImageMagick.sh +++ b/functions/ImageMagick.sh @@ -8,15 +8,14 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/imagemagick/6.9.0-sources/ImageMagick-6.9.0-4.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/imagemagick/old-sources/6.x/6.8/ImageMagick-6.8.9-10.tar.gz && Download_src -tar xzf ImageMagick-6.9.0-4.tar.gz -cd ImageMagick-6.9.0-4 -./configure +tar xzf ImageMagick-6.8.9-10.tar.gz +cd ImageMagick-6.8.9-10 +./configure --prefix=/usr/local/imagemagick make && make install cd ../ -/bin/rm -rf ImageMagick-6.9.0-4 -ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick +/bin/rm -rf ImageMagick-6.8.9-10 if [ -e "$php_install_dir/bin/phpize" ];then src_url=http://pecl.php.net/get/imagick-3.1.2.tgz && Download_src @@ -25,7 +24,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then make clean export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config + ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick make && make install cd ../ /bin/rm -rf imagick-3.1.2 diff --git a/functions/nginx.sh b/functions/nginx.sh index 2ec4de7b..e2f3c4cd 100755 --- a/functions/nginx.sh +++ b/functions/nginx.sh @@ -47,7 +47,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $nginx_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/bin:\1@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $nginx_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile . /etc/profile cd ../../ diff --git a/functions/tengine.sh b/functions/tengine.sh index 88b8a411..b1f5b404 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -49,7 +49,7 @@ else kill -9 $$ fi -[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $tengine_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/bin:\1@" /etc/profile +[ -n "`cat /etc/profile | grep 'export PATH='`" -a -z "`cat /etc/profile | grep $tengine_install_dir`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/sbin:\1@" /etc/profile . /etc/profile cd ../../ diff --git a/install.sh b/install.sh index 56d42e94..8e63f468 100755 --- a/install.sh +++ b/install.sh @@ -362,7 +362,6 @@ else break fi done - [ -n "`cat /etc/issue | grep 'Ubuntu 14'`" -a "$Magick" == '1' ] && Magick=9 fi #while : diff --git a/tools/mssh.exp b/tools/mssh.exp index 9bd5f215..6eda97a4 100755 --- a/tools/mssh.exp +++ b/tools/mssh.exp @@ -107,7 +107,7 @@ if { $yesnoflag == 2 } { } expect { - "]" {send "$commands \r"} + "#" {send "$commands \r"} "assword:" { send "$passwd\r" puts "\nPASSWORDERROR: $ip Password error!!!\n" @@ -116,11 +116,11 @@ expect { } expect { - "]" {send "sleep 1 \r"} + "#" {send "sleep 1 \r"} } expect { - "]" {send "exit\r"} + "#" {send "exit\r"} } expect eof { From 8939a1737cb6cf22e6c79c7eeac59e9d9cf05f1a Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 3 Mar 2015 17:54:16 +0800 Subject: [PATCH 451/617] change VPN --- functions/get_public_ip.py | 4 +- functions/phpmyadmin.sh | 6 +- vpn_centos.sh | 232 +++++++++---------------------------- 3 files changed, 61 insertions(+), 181 deletions(-) diff --git a/functions/get_public_ip.py b/functions/get_public_ip.py index d67a5da0..6c643752 100755 --- a/functions/get_public_ip.py +++ b/functions/get_public_ip.py @@ -3,10 +3,10 @@ class Get_public_ip: def getip(self): try: - myip = self.visit("http://www.whereismyip.com/") + myip = self.visit("http://ipv4.icanhazip.com/") except: try: - myip = self.visit("http://20140507.ip138.com/ic.asp") + myip = self.visit("http://www.whereismyip.com/") except: myip = "So sorry!!!" return myip diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index b73c1a8a..00631c2c 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.10/phpMyAdmin-4.3.10-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.11/phpMyAdmin-4.3.11-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.10-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.10-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.11-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.11-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/vpn_centos.sh b/vpn_centos.sh index 34be0d66..92d0614a 100755 --- a/vpn_centos.sh +++ b/vpn_centos.sh @@ -1,10 +1,9 @@ #!/bin/bash +# # Author: yeho # Blog: http://blog.linuxeye.com # -# This script's project home is: -# http://blog.linuxeye.com/31.html -# https://github.com/lj2007331/lnmp +# Installs a PPTP VPN-only system for CentOS # Check if user is root [ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 @@ -17,211 +16,92 @@ printf " # For more information please visit http://blog.linuxeye.com/31.html # ####################################################################### " -[ ! -e "src" ] && mkdir src -cd src -. ../functions/download.sh -while : -do - echo - read -p "Please input private IP-Range(Default Range: 10.0.2): " iprange - [ -z "$iprange" ] && iprange="10.0.2" - if [ -z "`echo $iprange | grep -E "^10\.|^192\.168\.|^172\." | grep -o '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$'`" ];then - echo -e "\033[31minput error! Input format: xxx.xxx.xxx\033[0m" - else - break - fi -done +[ ! -e '/usr/bin/curl' ] && yum -y install curl + +VPN_IP=`curl ipv4.icanhazip.com` + +VPN_USER="linuxeye" +VPN_PASS="linuxeye" -echo -read -p "Please input PSK(Default PSK: psk): " MYPSK -[ -z "$MYPSK" ] && MYPSK="psk" +VPN_LOCAL="192.168.0.150" +VPN_REMOTE="192.168.0.151-200" while : do - echo - read -p "Please input username: " Username - [ -n "$Username" ] && break + echo + read -p "Please input username: " VPN_USER + [ -n "$VPN_USER" ] && break done while : do - echo - read -p "Please input password: " Password - [ -n "$Password" ] && break + echo + read -p "Please input password: " VPN_PASS + [ -n "$VPN_PASS" ] && break done clear -public_IP=`../functions/get_public_ip.py` - -get_char() -{ -SAVEDSTTY=`stty -g` -stty -echo -stty cbreak -dd if=/dev/tty bs=1 count=1 2> /dev/null -stty -raw -stty echo -stty $SAVEDSTTY -} - -echo "" -echo "ServerIP:$public_IP" -echo "" -echo "Server Local IP:$iprange.1" -echo "" -echo "Client Remote IP Range:$iprange.2-$iprange.254" -echo "" -echo "PSK:$MYPSK" -echo "" -echo "Press any key to start..." -char=`get_char` -clear if [ -n "`grep 'CentOS Linux release 7' /etc/redhat-release`" ];then - CentOS_REL=7 - for Package in wget ppp iptables iptables-services make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof vim-enhanced + #CentOS_REL=7 + if [ ! -e /etc/yum.repos.d/epel.repo ];then + cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 7 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF +fi + for Package in wget make openssl gcc-c++ ppp pptpd iptables iptables-services do yum -y install $Package done echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf elif [ -n "`grep 'CentOS release 6' /etc/redhat-release`" ];then - CentOS_REL=6 - for Package in wget ppp iptables make gcc gmp-devel xmlto bison flex xmlto libpcap-devel lsof vim-enhanced + #CentOS_REL=6 + for Package in wget make openssl gcc-c++ iptables ppp do yum -y install $Package done - sed -i 's@net.ipv4.ip_forward.*@net.ipv4.ip_forward = 1@g' /etc/sysctl.conf + sed -i 's@net.ipv4.ip_forward.*@net.ipv4.ip_forward = 1@g' /etc/sysctl.conf + rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm + yum -y install pptpd else echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" exit 1 fi -sysctl -p -mknod /dev/random c 1 9 -src_url=https://download.openswan.org/openswan/old/openswan-2.6/openswan-2.6.38.tar.gz && Download_src -tar xzf openswan-2.6.38.tar.gz -cd openswan-2.6.38 -make programs install -cd .. - -cat >/etc/ipsec.conf</etc/ipsec.secrets< /proc/sys/net/ipv4/ip_forward -cat > /usr/bin/zl2tpset << EOF -#!/bin/bash -for each in /proc/sys/net/ipv4/conf/* -do - echo 0 > \$each/accept_redirects - echo 0 > \$each/send_redirects -done -EOF +sysctl -p /etc/sysctl.conf -chmod +x /usr/bin/zl2tpset -/usr/bin/zl2tpset -[ -z "`grep zl2tpset /etc/rc.local`" ] && echo '/usr/bin/zl2tpset' >> /etc/rc.local -service ipsec restart -src_url=http://pkgs.fedoraproject.org/repo/pkgs/xl2tpd/xl2tpd-1.3.6.tar.gz/2f526cc0c36cf6d8a74f1fb2e08c18ec/xl2tpd-1.3.6.tar.gz && Download_src -tar xzf xl2tpd-1.3.6.tar.gz -cd xl2tpd-1.3.6 -make install - -[ ! -e "/var/run/xl2tpd" ] && mkdir /var/run/xl2tpd -[ ! -e "/etc/xl2tpd" ] && mkdir /etc/xl2tpd -cd .. - -cat >/etc/xl2tpd/xl2tpd.conf<> /etc/pptpd.conf # Local IP address of your VPN server +[ -z "`grep '^remoteip' /etc/pptpd.conf`" ] && echo "remoteip $VPN_REMOTE" >> /etc/pptpd.conf # Scope for your home network -cat >/etc/ppp/options.xl2tpd<> /etc/ppp/options.pptpd # Google DNS Primary + echo "ms-dns 209.244.0.3" >> /etc/ppp/options.pptpd # Level3 Primary + echo "ms-dns 208.67.222.222" >> /etc/ppp/options.pptpd # OpenDNS Primary +fi -cat > /etc/ppp/chap-secrets<> /etc/ppp/chap-secrets -NETWORK_INT=`route | grep default | awk '{print $NF}'` -iptables -t nat -A POSTROUTING -s ${iprange}.0/24 -o $NETWORK_INT -j MASQUERADE -iptables -I FORWARD -s ${iprange}.0/24 -j ACCEPT -iptables -I FORWARD -d ${iprange}.0/24 -j ACCEPT -iptables -I INPUT -p udp --dport 1701 -j ACCEPT -iptables -I INPUT -p udp --dport 500 -j ACCEPT -iptables -I INPUT -p udp --dport 4500 -j ACCEPT +ETH=`route | grep default | awk '{print $NF}'` +iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT +iptables -t nat -A POSTROUTING -o $ETH -j MASQUERADE service iptables save -service ipsec restart -xl2tpd -chkconfig ipsec on +service iptables restart + +service pptpd restart +chkconfig pptpd on clear -ipsec verify -printf " -Serverip:$public_IP -PSK:$MYPSK -username:$Username -password:$Password -" + +echo -e "You can now connect to your VPN via your external IP \033[32m${VPN_IP}\033[0m" + +echo -e "Username: \033[32m${VPN_USER}\033[0m" +echo -e "Password: \033[32m${VPN_PASS}\033[0m" From 06dc136c5ebc5ff325f1154a71ae7edc59085701 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 5 Mar 2015 12:15:50 +0800 Subject: [PATCH 452/617] update percona version --- functions/percona-5.5.sh | 8 ++++---- functions/percona-5.6.sh | 8 ++++---- functions/phpmyadmin.sh | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index e0374701..639c75fa 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.41-37.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/percona-server-5.5.42-37.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar zxf percona-server-5.5.41-37.0.tar.gz -cd percona-server-5.5.41-37.0 +tar zxf percona-server-5.5.42-37.1.tar.gz +cd percona-server-5.5.42-37.1 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -55,7 +55,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.5.41-37.0 +/bin/rm -rf percona-server-5.5.42-37.1 cd .. # my.cf diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 054cd238..68d2f82f 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -8,12 +8,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.22-72.0.tar.gz && Download_src +src_url=http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/tarball/percona-server-5.6.23-72.1.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir -tar zxf percona-server-5.6.22-72.0.tar.gz -cd percona-server-5.6.22-72.0 +tar zxf percona-server-5.6.23-72.1.tar.gz +cd percona-server-5.6.23-72.1 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -54,7 +54,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf percona-server-5.6.22-72.0 +/bin/rm -rf percona-server-5.6.23-72.1 cd .. # my.cf diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 00631c2c..424bc262 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.11/phpMyAdmin-4.3.11-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.11.1/phpMyAdmin-4.3.11.1-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.11-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.11-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.11.1-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.11.1-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From 68bef5240d6f70db744c707f861b4a92a5846477 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Mar 2015 11:02:53 +0800 Subject: [PATCH 453/617] update phpredis 2.2.5 to 2.2.7 --- README.md | 2 +- functions/php-5.3.sh | 14 ++++---------- functions/php-5.4.sh | 14 ++++---------- functions/php-5.5.sh | 14 ++++---------- functions/php-5.6.sh | 14 ++++---------- functions/php-7.sh | 14 ++++---------- functions/redis.sh | 8 ++++---- install.sh | 16 ---------------- uninstall.sh | 6 +++++- 9 files changed, 30 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index c6af8cc3..ed842d98 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ ./vhost.sh ``` -## Hown to backup +## How to backup ```bash ./backup_setup.sh # Set backup options diff --git a/functions/php-5.3.sh b/functions/php-5.3.sh index 93af477b..61b5fed4 100755 --- a/functions/php-5.3.sh +++ b/functions/php-5.3.sh @@ -42,14 +42,6 @@ make && make install cd ../ /bin/rm -rf mhash-0.9.9.9 -# linked library -if [ "$PHP_MySQL_driver" == '1' ];then - PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" -elif [ "$PHP_MySQL_driver" == '2' ];then - [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir - ln -s $db_install_dir/include /usr/include/mysql - PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -77,7 +69,8 @@ cd php-5.3.29 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ @@ -86,7 +79,8 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 045498bd..31a9b175 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -42,14 +42,6 @@ make && make install cd ../ /bin/rm -rf mhash-0.9.9.9 -# linked library -if [ "$PHP_MySQL_driver" == '1' ];then - PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" -elif [ "$PHP_MySQL_driver" == '2' ];then - [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir - ln -s $db_install_dir/include /usr/include/mysql - PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -77,7 +69,8 @@ cd php-5.4.38 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ @@ -86,7 +79,8 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 53aebb0f..9fef6fec 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -43,14 +43,6 @@ make && make install cd ../ /bin/rm -rf mhash-0.9.9.9 -# linked library -if [ "$PHP_MySQL_driver" == '1' ];then - PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" -elif [ "$PHP_MySQL_driver" == '2' ];then - [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir - ln -s $db_install_dir/include /usr/include/mysql - PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -79,7 +71,8 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ @@ -88,7 +81,8 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index eada4f0e..1f3630b8 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -42,14 +42,6 @@ make && make install cd ../ /bin/rm -rf mhash-0.9.9.9 -# linked library -if [ "$PHP_MySQL_driver" == '1' ];then - PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" -elif [ "$PHP_MySQL_driver" == '2' ];then - [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir - ln -s $db_install_dir/include /usr/include/mysql - PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -78,7 +70,8 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ @@ -87,7 +80,8 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ diff --git a/functions/php-7.sh b/functions/php-7.sh index e9f75ab8..71b14751 100755 --- a/functions/php-7.sh +++ b/functions/php-7.sh @@ -41,14 +41,6 @@ make && make install cd ../ /bin/rm -rf mhash-0.9.9.9 -# linked library -if [ "$PHP_MySQL_driver" == '1' ];then - PHP_MySQL_options="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd" -elif [ "$PHP_MySQL_driver" == '2' ];then - [ "$DB_yn" == 'n' ] && db_install_dir=$mysql_install_dir - ln -s $db_install_dir/include /usr/include/mysql - PHP_MySQL_options="--with-mysql=$db_install_dir --with-mysqli=$db_install_dir/bin/mysql_config --with-pdo-mysql=$db_install_dir/bin/mysql_config" -fi echo "$db_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -80,7 +72,8 @@ make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ @@ -89,7 +82,8 @@ CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path= --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp $PHP_MySQL_options --disable-fileinfo \ +--with-fpm-user=www --with-fpm-group=www --enable-fpm $PHP_cache_tmp --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ diff --git a/functions/redis.sh b/functions/redis.sh index 4f21b833..cb423af6 100755 --- a/functions/redis.sh +++ b/functions/redis.sh @@ -10,15 +10,15 @@ cd $lnmp_dir/src . ../options.conf if [ -e "$php_install_dir/bin/phpize" ];then - src_url=http://pecl.php.net/get/redis-2.2.5.tgz && Download_src - tar xzf redis-2.2.5.tgz - cd redis-2.2.5 + src_url=http://pecl.php.net/get/redis-2.2.7.tgz && Download_src + tar xzf redis-2.2.7.tgz + cd redis-2.2.7 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install cd .. - /bin/rm -rf redis-2.2.5 + /bin/rm -rf redis-2.2.7 if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/redis.so" ];then [ -z "`cat $php_install_dir/etc/php.ini | grep '^extension_dir'`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`\"@" $php_install_dir/etc/php.ini sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini diff --git a/install.sh b/install.sh index 8e63f468..18a7ad4b 100755 --- a/install.sh +++ b/install.sh @@ -196,22 +196,6 @@ else if [ $PHP_version != 1 -a $PHP_version != 2 -a $PHP_version != 3 -a $PHP_version != 4 -a $PHP_version != 5 ];then echo -e "\033[31minput error! Please only input number 1,2,3,4,5 \033[0m" else - PHP_MySQL_driver=1 - #while : - # do - # echo - # echo 'You can either use the mysqlnd or libmysql library to connect from PHP to MySQL:' - # echo -e "\t\033[32m1\033[0m. MySQL native driver (mysqlnd)" - # echo -e "\t\033[32m2\033[0m. MySQL Client Library (libmysql)" - # read -p "Please input a number:(Default 1 press Enter) " PHP_MySQL_driver - # [ -z "$PHP_MySQL_driver" ] && PHP_MySQL_driver=1 - # if [ $PHP_MySQL_driver != 1 -a $PHP_MySQL_driver != 2 ];then - # echo -e "\033[31minput error! Please only input number 1,2\033[0m" - # else - # break - # fi - #done - while : do echo diff --git a/uninstall.sh b/uninstall.sh index f2cdc7db..bc64d29a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -23,6 +23,8 @@ Uninstall() [ -e "$pureftpd_install_dir" ] && service pureftpd stop && rm -rf /etc/init.d/pureftpd [ -e "$redis_install_dir" ] && service redis-server stop && rm -rf /etc/init.d/redis-server [ -e "$memcached_install_dir" ] && service memcached stop && rm -rf /etc/init.d/memcached +[ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick +[ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick /bin/mv ${home_dir}{,_$(date +%F)} /bin/mv ${db_data_dir}{,_$(date +%F)} @@ -68,6 +70,8 @@ done [ -e "$pureftpd_install_dir" ] && echo '/etc/init.d/pureftpd' [ -e "$memcached_install_dir" ] && echo '/etc/init.d/memcached' [ -e "$redis_install_dir" ] && echo '/etc/init.d/redis-server' +[ -e "/usr/local/imagemagick" ] && echo '/usr/local/imagemagick' +[ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick' echo echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` @@ -83,4 +87,4 @@ do fi done -[ "$uninstall_yn" == 'y' ] && Uninstall +[ "$uninstall_yn" == 'y' ] && Uninstall From 9e63bb160f8da330d6aa046e0502d062f65f53ad Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 13 Mar 2015 17:18:06 +0800 Subject: [PATCH 454/617] Add LICENSE file --- LICENSE | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..5471dc10 --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From eee54f8af2bf217323b0793c83fae64d9770389d Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 18 Mar 2015 17:50:26 +0800 Subject: [PATCH 455/617] update MariaDB 10.0.14 to 10.0.17 --- functions/mariadb-10.0.sh | 11 ++++++----- functions/mariadb-5.5.sh | 3 ++- functions/mysql-5.5.sh | 3 ++- functions/mysql-5.6.sh | 3 ++- functions/percona-5.5.sh | 3 ++- functions/percona-5.6.sh | 3 ++- functions/phpmyadmin.sh | 6 +++--- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/functions/mariadb-10.0.sh b/functions/mariadb-10.0.sh index d5cdaf6a..78bc6d39 100755 --- a/functions/mariadb-10.0.sh +++ b/functions/mariadb-10.0.sh @@ -9,12 +9,12 @@ cd $lnmp_dir/src . ../functions/check_os.sh . ../options.conf -src_url=https://downloads.mariadb.org/f/mariadb-10.0.14/source/mariadb-10.0.14.tar.gz && Download_src +src_url=https://downloads.mariadb.org/f/mariadb-10.0.17/source/mariadb-10.0.17.tar.gz && Download_src useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-10.0.14.tar.gz -cd mariadb-10.0.14 +tar zxf mariadb-10.0.17.tar.gz +cd mariadb-10.0.17 if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -37,7 +37,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install if [ -d "$mariadb_install_dir" ];then echo -e "\033[32mMariaDB install successfully! \033[0m" @@ -54,7 +55,7 @@ chkconfig mysqld on' OS_Debian_Ubuntu='update-rc.d mysqld defaults' OS_command cd .. -/bin/rm -rf mariadb-10.0.14 +/bin/rm -rf mariadb-10.0.17 cd .. # my.cf diff --git a/functions/mariadb-5.5.sh b/functions/mariadb-5.5.sh index 4f4a6be6..d1dfaac2 100755 --- a/functions/mariadb-5.5.sh +++ b/functions/mariadb-5.5.sh @@ -37,7 +37,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mariadb_install_dir \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install if [ -d "$mariadb_install_dir" ];then echo -e "\033[32mMariaDB install successfully! \033[0m" diff --git a/functions/mysql-5.5.sh b/functions/mysql-5.5.sh index 671378a4..75e9b91a 100755 --- a/functions/mysql-5.5.sh +++ b/functions/mysql-5.5.sh @@ -36,7 +36,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install if [ -d "$mysql_install_dir" ];then echo -e "\033[32mMySQL install successfully! \033[0m" diff --git a/functions/mysql-5.6.sh b/functions/mysql-5.6.sh index 7ee7e3e6..9efbe3b1 100755 --- a/functions/mysql-5.6.sh +++ b/functions/mysql-5.6.sh @@ -35,7 +35,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install if [ -d "$mysql_install_dir" ];then echo -e "\033[32mMySQL install successfully! \033[0m" diff --git a/functions/percona-5.5.sh b/functions/percona-5.5.sh index 639c75fa..405d754f 100755 --- a/functions/percona-5.5.sh +++ b/functions/percona-5.5.sh @@ -35,7 +35,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install cd $percona_install_dir/lib/ ln -s libperconaserverclient.so libmysqlclient.so diff --git a/functions/percona-5.6.sh b/functions/percona-5.6.sh index 68d2f82f..91c1395c 100755 --- a/functions/percona-5.6.sh +++ b/functions/percona-5.6.sh @@ -34,7 +34,8 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ $EXE_LINKER -make && make install +make -j `grep processor /proc/cpuinfo | wc -l` +make install cd $percona_install_dir/lib/ ln -s libperconaserverclient.so libmysqlclient.so diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 424bc262..3be42acd 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.11.1/phpMyAdmin-4.3.11.1-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.12/phpMyAdmin-4.3.12-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.11.1-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.11.1-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.12-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.12-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php From cc21310c56efc046131aff6077756dc4ebff74b2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 25 Mar 2015 12:01:13 +0800 Subject: [PATCH 456/617] update php version --- functions/ZendGuardLoader.sh | 8 ++++---- functions/get_ip_area.py | 18 +++++++----------- functions/php-5.4.sh | 10 +++++----- functions/php-5.5.sh | 10 +++++----- functions/php-5.6.sh | 10 +++++----- functions/tengine.sh | 2 +- functions/test.sh | 4 +++- functions/zendopcache.sh | 10 +++++----- 8 files changed, 35 insertions(+), 37 deletions(-) diff --git a/functions/ZendGuardLoader.sh b/functions/ZendGuardLoader.sh index 1e2b7637..638f5f85 100755 --- a/functions/ZendGuardLoader.sh +++ b/functions/ZendGuardLoader.sh @@ -14,28 +14,28 @@ PHP_version=${php_version%.*} [ ! -e "$php_install_dir/lib/php/extensions/" ] && mkdir $php_install_dir/lib/php/extensions/ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then if [ "$PHP_version" == '5.4' ];then - src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 fi if [ "$PHP_version" == '5.3' ];then - src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 fi else if [ "$PHP_version" == '5.4' ];then - src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/lnmp/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi if [ "$PHP_version" == '5.3' ];then - src_url=http://downloads.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/lnmp/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so $php_install_dir/lib/php/extensions/ /bin/rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 diff --git a/functions/get_ip_area.py b/functions/get_ip_area.py index ae1ed330..ceb47b31 100755 --- a/functions/get_ip_area.py +++ b/functions/get_ip_area.py @@ -2,17 +2,13 @@ #coding:utf-8 try: import sys,urllib2 -# import sys,urllib2,json -# Python 2.4(CentOS/RHEL 5) does not support 'json' module - apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] + apiurl = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=%s" % sys.argv[1] content = urllib2.urlopen(apiurl).read() -# data = json.loads(content)['data'] -# code = json.loads(content)['code'] - data = eval(content)['data'] - code = eval(content)['code'] - if code == 0: - print data['country_id'] - else: - print data + content=eval(content) + ret = content['ret'] + country = content['country'] + if ret == 1: + #print country.decode('unicode_escape') + print country except: print "Usage:%s IP" % sys.argv[0] diff --git a/functions/php-5.4.sh b/functions/php-5.4.sh index 31a9b175..8342c523 100755 --- a/functions/php-5.4.sh +++ b/functions/php-5.4.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.4.38.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.4.39.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -61,11 +61,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.4.38.tar.gz +tar xzf php-5.4.39.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.4.38 -p0 < fpm-race-condition.patch -cd php-5.4.38 +patch -d php-5.4.39 -p0 < fpm-race-condition.patch +cd php-5.4.39 make clean if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then CFLAGS= CXXFLAGS= ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ @@ -234,6 +234,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.4.38 +/bin/rm -rf php-5.4.39 cd .. } diff --git a/functions/php-5.5.sh b/functions/php-5.5.sh index 9fef6fec..4b86296f 100755 --- a/functions/php-5.5.sh +++ b/functions/php-5.5.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.5.22.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.5.23.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -62,11 +62,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.5.22.tar.gz +tar xzf php-5.5.23.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.5.22 -p0 < fpm-race-condition.patch -cd php-5.5.22 +patch -d php-5.5.23 -p0 < fpm-race-condition.patch +cd php-5.5.23 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -249,6 +249,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.5.22 +/bin/rm -rf php-5.5.23 cd .. } diff --git a/functions/php-5.6.sh b/functions/php-5.6.sh index 1f3630b8..88e3b361 100755 --- a/functions/php-5.6.sh +++ b/functions/php-5.6.sh @@ -13,7 +13,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-5.6.6.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-5.6.7.tar.gz && Download_src tar xzf libiconv-1.14.tar.gz cd libiconv-1.14 @@ -61,11 +61,11 @@ make && make install cd ../ /bin/rm -rf mcrypt-2.6.8 -tar xzf php-5.6.6.tar.gz +tar xzf php-5.6.7.tar.gz useradd -M -s /sbin/nologin www wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1' -patch -d php-5.6.6 -p0 < fpm-race-condition.patch -cd php-5.6.6 +patch -d php-5.6.7 -p0 < fpm-race-condition.patch +cd php-5.6.7 make clean [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then @@ -248,6 +248,6 @@ elif [ "$Apache_version" == '1' -o "$Apache_version" == '2' ];then service httpd restart fi cd .. -/bin/rm -rf php-5.6.6 +/bin/rm -rf php-5.6.7 cd .. } diff --git a/functions/tengine.sh b/functions/tengine.sh index b1f5b404..ed46a159 100755 --- a/functions/tengine.sh +++ b/functions/tengine.sh @@ -40,7 +40,7 @@ elif [ "$je_tc_malloc" == '2' ];then chown -R www.www /tmp/tcmalloc fi -./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module +./configure --prefix=$tengine_install_dir --user=www --group=www --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module make && make install if [ -d "$tengine_install_dir" ];then echo -e "\033[32mTengine install successfully! \033[0m" diff --git a/functions/test.sh b/functions/test.sh index 7b806d89..246dd429 100755 --- a/functions/test.sh +++ b/functions/test.sh @@ -9,10 +9,12 @@ cd $lnmp_dir/src . ../options.conf public_IP=`../functions/get_public_ip.py` -if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then +if [ "`../functions/get_ip_area.py $public_IP`" == '\u4e2d\u56fd' ];then FLAG_IP=CN fi +echo $public_IP $FLAG_IP + if [ "$FLAG_IP"x == "CN"x ];then src_url=http://www.yahei.net/tz/tz.zip && Download_src unzip -q tz.zip -d $home_dir/default diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 3a77960c..87b3f4e9 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -7,10 +7,10 @@ Install_ZendOPcache() cd $lnmp_dir/src . ../options.conf -rm -rf ZendOptimizerPlus-master* -wget -c --no-check-certificate -O ZendOptimizerPlus-master.zip https://github.com/zendtech/ZendOptimizerPlus/archive/master.zip -unzip -q ZendOptimizerPlus-master.zip -cd ZendOptimizerPlus-master +rm -rf ZendOptimizerPlus-* +[ ! -e "ZendOptimizerPlus-7.0.4.tar.gz" ] && wget -c --no-check-certificate -O ZendOptimizerPlus-7.0.4.tar.gz https://github.com/zendtech/ZendOptimizerPlus/archive/v7.0.4.tar.gz +tar xzf ZendOptimizerPlus-7.0.4.tar.gz +cd ZendOptimizerPlus-7.0.4 make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config @@ -45,6 +45,6 @@ else echo -e "\033[31meZend OPcache module install failed, Please contact the author! \033[0m" fi cd .. -/bin/rm -rf ZendOptimizerPlus-master +/bin/rm -rf ZendOptimizerPlus-7.0.4 cd .. } From fa29a520c35317911e03ad800caa6983e2a8c082 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 2 Apr 2015 16:05:40 +0800 Subject: [PATCH 457/617] centos7.1 issues --- functions/check_os.sh | 4 +-- functions/hhvm_CentOS.sh | 4 +-- functions/phpmyadmin.sh | 6 ++--- init/init_CentOS.sh | 57 +++++++++++++++++++--------------------- install.sh | 2 +- vpn_centos.sh | 9 ++++--- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/functions/check_os.sh b/functions/check_os.sh index c478076d..4781f37e 100755 --- a/functions/check_os.sh +++ b/functions/check_os.sh @@ -4,9 +4,9 @@ if [ -f /etc/redhat-release ];then OS=CentOS -elif [ ! -z "`cat /etc/issue | grep bian`" ];then +elif [ -n "`cat /etc/issue | grep bian`" ];then OS=Debian -elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then +elif [ -n "`cat /etc/issue | grep Ubuntu`" ];then OS=Ubuntu else echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m" diff --git a/functions/hhvm_CentOS.sh b/functions/hhvm_CentOS.sh index fe7370df..50348f88 100755 --- a/functions/hhvm_CentOS.sh +++ b/functions/hhvm_CentOS.sh @@ -10,9 +10,9 @@ cd $lnmp_dir/src useradd -M -s /sbin/nologin www -if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then +if [ -n "$(grep ' 7\.' /etc/redhat-release)" ];then CentOS_RHL=7 -elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then +elif [ -n "$(grep ' 6\.' /etc/redhat-release)" ];then CentOS_RHL=6 fi diff --git a/functions/phpmyadmin.sh b/functions/phpmyadmin.sh index 3be42acd..c850168b 100755 --- a/functions/phpmyadmin.sh +++ b/functions/phpmyadmin.sh @@ -8,10 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.12/phpMyAdmin-4.3.12-all-languages.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.13/phpMyAdmin-4.3.13-all-languages.tar.gz && Download_src -tar xzf phpMyAdmin-4.3.12-all-languages.tar.gz -/bin/mv phpMyAdmin-4.3.12-all-languages $home_dir/default/phpMyAdmin +tar xzf phpMyAdmin-4.3.13-all-languages.tar.gz +/bin/mv phpMyAdmin-4.3.13-all-languages $home_dir/default/phpMyAdmin /bin/cp $home_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} mkdir $home_dir/default/phpMyAdmin/{upload,save} sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $home_dir/default/phpMyAdmin/config.inc.php diff --git a/init/init_CentOS.sh b/init/init_CentOS.sh index 3653d621..a0e0a822 100755 --- a/init/init_CentOS.sh +++ b/init/init_CentOS.sh @@ -28,41 +28,38 @@ fi sed -i 's@^exclude@#exclude@' /etc/yum.conf yum clean all -#public_IP=`../functions/get_public_ip.py` -#if [ "`../functions/get_ip_area.py $public_IP`" == 'CN' ];then - if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then - if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo - sed -i 's@\$releasever@7@g' /etc/yum.repos.d/CentOS-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo - fi - elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then - if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo - sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo - fi - elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then - if [ -n "$(cat /etc/redhat-release | grep 'Red Hat')" ];then - /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo - sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS-Base.repo - sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo - fi +if [ -n "`grep ' 7\.' /etc/redhat-release`" ];then + if [ -n "`grep 'Red Hat' /etc/redhat-release`" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo + sed -i 's@\$releasever@7@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo + fi +elif [ -n "`grep ' 6\.' /etc/redhat-release`" ];then + if [ -n "`grep 'Red Hat' /etc/redhat-release`" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo + sed -i 's@\$releasever@6@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo fi +elif [ -n "`grep ' 5\.' /etc/redhat-release`" ];then + if [ -n "`grep 'Red Hat' /etc/redhat-release`" ];then + /bin/mv /etc/yum.repos.d/CentOS-Base.repo{,_bk} + wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo + sed -i 's@\$releasever@5@g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/CentOS-Base.repo + fi +fi - yum makecache -#fi +yum makecache -if [ -n "$(cat /etc/redhat-release | grep ' 7\.')" ];then +if [ -n "`grep ' 7\.' /etc/redhat-release`" ];then yum -y install iptables-services systemctl mask firewalld.service systemctl enable iptables.service -elif [ -n "$(cat /etc/redhat-release | grep ' 6\.')" ];then +elif [ -n "`grep ' 6\.' /etc/redhat-release`" ];then yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" -elif [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then +elif [ -n "`grep ' 5\.' /etc/redhat-release`" ];then yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" fi @@ -165,11 +162,11 @@ net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p -if [ -n "$(cat /etc/redhat-release | grep '5\.')" ];then +if [ -n "`grep ' 5\.' /etc/redhat-release`" ];then sed -i 's@^[3-6]:2345:respawn@#&@g' /etc/inittab sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n -elif [ -n "$(cat /etc/redhat-release | grep '6\.')" ];then +elif [ -n "`grep ' 6\.' /etc/redhat-release`" ];then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf fi diff --git a/install.sh b/install.sh index 18a7ad4b..e05b20f8 100755 --- a/install.sh +++ b/install.sh @@ -485,7 +485,7 @@ if [ "$Web_yn" == 'y' -o "$DB_yn" == 'y' ];then fi if [ "$OS" == 'CentOS' ];then - if [ -n "`cat /etc/redhat-release | grep -E ' 7\.| 6\.'`" -a -d "/lib64" ];then + if [ -n "`grep -E ' 7\.| 6\.' /etc/redhat-release`" -a -d "/lib64" ];then while : do echo diff --git a/vpn_centos.sh b/vpn_centos.sh index 92d0614a..f087d39e 100755 --- a/vpn_centos.sh +++ b/vpn_centos.sh @@ -43,7 +43,7 @@ done clear -if [ -n "`grep 'CentOS Linux release 7' /etc/redhat-release`" ];then +if [ -f /etc/redhat-release -a -n "`grep ' 7\.' /etc/redhat-release`" ];then #CentOS_REL=7 if [ ! -e /etc/yum.repos.d/epel.repo ];then cat > /etc/yum.repos.d/epel.repo << EOF @@ -61,7 +61,7 @@ fi yum -y install $Package done echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf -elif [ -n "`grep 'CentOS release 6' /etc/redhat-release`" ];then +elif [ -f /etc/redhat-release -a -n "`grep ' 6\.' /etc/redhat-release`" ];then #CentOS_REL=6 for Package in wget make openssl gcc-c++ iptables ppp do @@ -92,9 +92,12 @@ fi echo "$VPN_USER pptpd $VPN_PASS *" >> /etc/ppp/chap-secrets ETH=`route | grep default | awk '{print $NF}'` -iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT +[ -z "`grep '1723 -j ACCEPT' /etc/sysconfig/iptables`" ] && iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT +[ -z "`grep 'gre -j ACCEPT' /etc/sysconfig/iptables`" ] && iptables -I INPUT 5 -p gre -j ACCEPT iptables -t nat -A POSTROUTING -o $ETH -j MASQUERADE service iptables save +sed -i 's@^-A INPUT -j REJECT --reject-with icmp-host-prohibited@#-A INPUT -j REJECT --reject-with icmp-host-prohibited@' /etc/sysconfig/iptables +sed -i 's@^-A FORWARD -j REJECT --reject-with icmp-host-prohibited@#-A FORWARD -j REJECT --reject-with icmp-host-prohibited@' /etc/sysconfig/iptables service iptables restart service pptpd restart From 27b62f739157278d19ae5502ce33a94427b6a85c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 3 Apr 2015 12:15:01 +0800 Subject: [PATCH 458/617] changed README.md --- README.md | 24 +++++++++++++----------- conf/index.html | 10 ++++++++++ functions/ngx_pagespeed.sh | 15 ++++++--------- functions/zendopcache.sh | 1 - 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ed842d98..9aabafc8 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,14 @@ ```bash yum -y install wget screen # for CentOS/Redhat #apt-get -y install wget screen # for Debian/Ubuntu - wget http://blog.linuxeye.com/lnmp.tar.gz - #or wget http://blog.linuxeye.com/lnmp-full.tar.gz # include source packages + wget http://mirrors.linuxeye.com/lnmp.tar.gz + # or download include source packages + wget http://mirrors.linuxeye.com/lnmp-full.tar.gz tar xzf lnmp.tar.gz + # or tar xzf lnmp-full.tar.gz cd lnmp - chmod +x install.sh - # Prevent interrupt the installation process. If the network is down, you can execute commands `screen -r lnmp` network reconnect the installation window. + # Prevent interrupt the installation process. If the network is down, + # you can execute commands `screen -r lnmp` network reconnect the installation window. screen -S lnmp ./install.sh ``` @@ -50,31 +52,31 @@ ## How to manage service Nginx/Tengine: ```bash - service nginx {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest} + service nginx {start|stop|status|restart|reload|configtest} ``` MySQL/MariaDB/Percona: ```bash - service mysqld {start|stop|restart|reload|force-reload|status} + service mysqld {start|stop|restart|reload|status} ``` PHP: ```bash - service php-fpm {start|stop|force-quit|restart|reload|status} + service php-fpm {start|stop|restart|reload|status} ``` Apache: ```bash - service httpd {start|restart|graceful|graceful-stop|stop} + service httpd {start|restart|stop} ``` Pure-Ftpd: ```bash - service pureftpd {start|stop|restart|condrestart|status} + service pureftpd {start|stop|restart|status} ``` Redis: ```bash - service redis-server {start|stop|status|restart|condrestart|try-restart|reload|force-reload} + service redis-server {start|stop|status|restart|reload} ``` Memcached: ```bash - service memcached {start|stop|status|restart|reload|force-reload} + service memcached {start|stop|status|restart|reload} ``` ## How to upgrade diff --git a/conf/index.html b/conf/index.html index b9389350..dd3d16d1 100644 --- a/conf/index.html +++ b/conf/index.html @@ -32,6 +32,16 @@

LNM

          PayPal:  lj2007331@gmail.com

          alipay:  lj2007331@gmail.com

+
+ +

diff --git a/functions/ngx_pagespeed.sh b/functions/ngx_pagespeed.sh index 1b7f4c95..5ca6c120 100755 --- a/functions/ngx_pagespeed.sh +++ b/functions/ngx_pagespeed.sh @@ -8,13 +8,10 @@ cd $lnmp_dir/src . ../functions/download.sh . ../options.conf -rm -rf ngx_pagespeed* -src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.2.tar.gz && Download_src -[ -s "ngx_pagespeed-1.9.32.2-beta.zip" ] && echo "ngx_pagespeed-1.9.32.2-beta.zip found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.2-beta.zip https://github.com/pagespeed/ngx_pagespeed/archive/master.zip +src_url=https://dl.google.com/dl/page-speed/psol/1.9.32.3.tar.gz && Download_src +[ -s "ngx_pagespeed-1.9.32.3-beta.tar.gz" ] && echo "ngx_pagespeed-1.9.32.3-beta.tar.gz found" || wget -c --no-check-certificate -O ngx_pagespeed-1.9.32.3-beta.tar.gz https://github.com/pagespeed/ngx_pagespeed/archive/v1.9.32.3-beta.tar.gz -unzip -q ngx_pagespeed-1.9.32.2-beta.zip -/bin/mv ngx_pagespeed-master ngx_pagespeed-1.9.32.2-beta -tar xzf 1.9.32.2.tar.gz -C ngx_pagespeed-1.9.32.2-beta +tar xzf ngx_pagespeed-1.9.32.3-beta.tar.gz if [ "$Nginx_version" == '1' ];then cd nginx-1.6.2 @@ -24,9 +21,9 @@ if [ "$Nginx_version" == '1' ];then rm -rf $$ if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ] ;then - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -pthread' else - ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.2-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' + ./configure $nginx_configure_arguments --add-module=../ngx_pagespeed-1.9.32.3-beta --with-cc-opt='-DLINUX=2 -D_REENTRANT -D_LARGEFILE64_SOURCE -march=i686 -pthread' fi make @@ -43,7 +40,7 @@ if [ "$Nginx_version" == '1' ];then fi cd ../ elif [ "$Nginx_version" == '2' ];then - $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.2-beta + $web_install_dir/sbin/dso_tool --add-module=$lnmp_dir/src/ngx_pagespeed-1.9.32.3-beta if [ -f "$web_install_dir/modules/ngx_pagespeed.so" ];then sed -i "s@^dso\(.*\)@dso\1\n\tload ngx_pagespeed.so;@" $web_install_dir/conf/nginx.conf mkdir /var/ngx_pagespeed_cache diff --git a/functions/zendopcache.sh b/functions/zendopcache.sh index 87b3f4e9..ba44b41e 100755 --- a/functions/zendopcache.sh +++ b/functions/zendopcache.sh @@ -7,7 +7,6 @@ Install_ZendOPcache() cd $lnmp_dir/src . ../options.conf -rm -rf ZendOptimizerPlus-* [ ! -e "ZendOptimizerPlus-7.0.4.tar.gz" ] && wget -c --no-check-certificate -O ZendOptimizerPlus-7.0.4.tar.gz https://github.com/zendtech/ZendOptimizerPlus/archive/v7.0.4.tar.gz tar xzf ZendOptimizerPlus-7.0.4.tar.gz cd ZendOptimizerPlus-7.0.4 From e451e0236244b493eaeafdc24349a928321be52c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 3 Apr 2015 16:13:32 +0800 Subject: [PATCH 459/617] changed index --- conf/index.html | 15 +++------------ conf/index_cn.html | 5 +++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/conf/index.html b/conf/index.html index dd3d16d1..5385aa47 100644 --- a/conf/index.html +++ b/conf/index.html @@ -4,7 +4,7 @@ LNMP and LAMP setup script - + diff --git a/config/index_cn.html b/config/index_cn.html index 658795c3..32d851f8 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -1,12 +1,11 @@ + OneinStack - PHP/JAVA环境一键部署工具 - - - + + diff --git a/include/init_Debian.sh b/include/init_Debian.sh index faab8a2a..175e0199 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -91,7 +91,7 @@ init q # Update time ntpdate pool.ntp.org -[ -z "`grep 'ntpdate' /var/spool/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ -z "`grep 'ntpdate' /var/spool/cron/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index c69cbad4..a1ab6b5c 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -109,7 +109,7 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -[ -z "`grep 'ntpdate' /var/spool/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ -z "`grep 'ntpdate' /var/spool/cron/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 662e9876..7694d045 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -44,7 +44,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 3bb6b6bb..ee76738c 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -44,7 +44,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password diff --git a/vhost.sh b/vhost.sh index 55289822..a60b4e9c 100755 --- a/vhost.sh +++ b/vhost.sh @@ -168,16 +168,17 @@ else LISTENOPT='443 ssl spdy' fi -openssl req -new -newkey rsa:2048 -sha256 -nodes -out $web_install_dir/conf/${domain}.csr -keyout $web_install_dir/conf/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 -/bin/cp $web_install_dir/conf/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} -/bin/cp $web_install_dir/conf/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} -openssl x509 -req -days 36500 -sha256 -in $web_install_dir/conf/${domain}.csr -signkey $web_install_dir/conf/${domain}.key -out $web_install_dir/conf/${domain}.crt > /dev/null 2>&1 +[ ! -d "$web_install_dir/conf/ssl" ] && mkdir $web_install_dir/conf/ssl +openssl req -new -newkey rsa:2048 -sha256 -nodes -out $web_install_dir/conf/ssl/${domain}.csr -keyout $web_install_dir/conf/ssl/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 +/bin/cp $web_install_dir/conf/ssl/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} +/bin/cp $web_install_dir/conf/ssl/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} +openssl x509 -req -days 36500 -sha256 -in $web_install_dir/conf/ssl/${domain}.csr -signkey $web_install_dir/conf/ssl/${domain}.key -out $web_install_dir/conf/ssl/${domain}.crt > /dev/null 2>&1 } Print_ssl() { -echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$web_install_dir/conf/${domain}.crt${CEND}" -echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$web_install_dir/conf/${domain}.key${CEND}" -echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$web_install_dir/conf/${domain}.csr${CEND}" +echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$web_install_dir/conf/ssl/${domain}.crt${CEND}" +echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$web_install_dir/conf/ssl/${domain}.key${CEND}" +echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$web_install_dir/conf/ssl/${domain}.csr${CEND}" } @@ -217,8 +218,8 @@ fi if [ "$nginx_ssl_yn" == 'y' ]; then Nginx_ssl - Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/$domain.crt;\nssl_certificate_key $web_install_dir/conf/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") - Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://\$server_name/\$1 permanent;\n}") + Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/ssl/$domain.crt;\nssl_certificate_key $web_install_dir/conf/ssl/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") + Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") else Nginx_conf='listen 80;' fi @@ -320,6 +321,7 @@ fi } Nginx_rewrite() { +[ ! -d "$web_install_dir/conf/rewrite" ] && mkdir $web_install_dir/conf/rewrite while : do echo @@ -332,7 +334,7 @@ do done if [ "$rewrite_yn" == 'n' ];then rewrite="none" - touch "$web_install_dir/conf/$rewrite.conf" + touch "$web_install_dir/conf/rewrite/$rewrite.conf" else echo echo "Please input the rewrite of programme :" @@ -344,9 +346,9 @@ else echo "You choose rewrite=${CMSG}$rewrite${CEND}" [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n }") if [ -e "config/$rewrite.conf" ];then - /bin/cp config/$rewrite.conf $web_install_dir/conf/$rewrite.conf + /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf else - touch "$web_install_dir/conf/$rewrite.conf" + touch "$web_install_dir/conf/rewrite/$rewrite.conf" fi fi } @@ -463,7 +465,7 @@ $Nginx_conf server_name $domain$moredomainame; $N_log index index.html index.htm index.php; -include $web_install_dir/conf/$rewrite.conf; +include $web_install_dir/conf/rewrite/$rewrite.conf; root $vhostdir; $Nginx_redirect $anti_hotlinking @@ -500,7 +502,7 @@ printf " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/$rewrite.conf${CEND}" +[ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } @@ -657,7 +659,7 @@ echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Apache Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/$rewrite.conf${CEND}" +[ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } From 27b5a70a6819df8a54ede886f04377fc656045ca Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 7 Apr 2016 14:54:03 +0800 Subject: [PATCH 568/617] Add --with-config-file-scan-dir --- apps.conf | 14 +++++----- include/GraphicsMagick.sh | 12 +++++---- include/ImageMagick.sh | 6 +++-- include/ZendGuardLoader.sh | 4 +-- include/apcu.sh | 5 ++-- include/eaccelerator-0.9.sh | 36 ++++++++++++------------- include/eaccelerator-1.0-dev.sh | 36 ++++++++++++------------- include/init_CentOS.sh | 10 ++++++- include/init_Debian.sh | 8 ++++-- include/init_Ubuntu.sh | 8 ++++-- include/ioncube.sh | 8 ++---- include/memcached.sh | 11 +++++--- include/php-5.3.sh | 9 ++++--- include/php-5.4.sh | 9 ++++--- include/php-5.5.sh | 34 ++++++++++++----------- include/php-5.6.sh | 34 ++++++++++++----------- include/php-7.sh | 43 +++++++++++++++-------------- include/redis.sh | 6 +++-- include/xcache.sh | 48 ++++++++++++++++----------------- include/zendopcache.sh | 5 ++-- vhost.sh | 22 ++++++++------- 21 files changed, 206 insertions(+), 162 deletions(-) diff --git a/apps.conf b/apps.conf index 5e1b3a8f..666da21f 100644 --- a/apps.conf +++ b/apps.conf @@ -1,6 +1,6 @@ # newest software version # Web -nginx_version=1.9.12 +nginx_version=1.9.14 tengine_version=2.1.1 tomcat_7_version=7.0.68 @@ -17,7 +17,7 @@ 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.12 +mariadb_10_1_version=10.1.13 mariadb_10_0_version=10.0.24 mariadb_5_5_version=5.5.48 @@ -28,14 +28,14 @@ percona_5_5_version=5.5.48-37.8 # JDK jdk_6_version=1.6.0_45 jdk_7_version=1.7.0_80 -jdk_8_version=1.8.0_74 +jdk_8_version=1.8.0_77 # PHP php_3_version=5.3.29 php_4_version=5.4.45 -php_5_version=5.5.33 -php_6_version=5.6.19 -php_7_version=7.0.4 +php_5_version=5.5.34 +php_6_version=5.6.20 +php_7_version=7.0.5 zendopcache_version=7.0.5 xcache_version=3.2.0 @@ -69,4 +69,4 @@ phpMyAdmin_version=4.4.15.5 jemalloc_version=4.1.0 # tcmalloc -tcmalloc_version=2.4.90 +tcmalloc_version=2.5 diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 3a4fef3c..1742fe6c 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -25,9 +25,9 @@ Install_php-gmagick() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - src_url=https://pecl.php.net/get/gmagick-2.0.2RC1.tgz && Download_src - tar xzf gmagick-2.0.2RC1.tgz - cd gmagick-2.0.2RC1 + src_url=https://pecl.php.net/get/gmagick-2.0.2RC2.tgz && Download_src + tar xzf gmagick-2.0.2RC2.tgz + cd gmagick-2.0.2RC2 else src_url=http://pecl.php.net/get/gmagick-$gmagick_version.tgz && Download_src tar xzf gmagick-$gmagick_version.tgz @@ -42,8 +42,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then rm -rf gmagick-$gmagick_version if [ -f "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ];then - [ -z "`grep '^extension_dir' $php_install_dir/etc/php.ini`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"`$php_install_dir/bin/php-config --extension-dir`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "gmagick.so"@' $php_install_dir/etc/php.ini + cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF +[gmagick] +extension=gmagick.so +EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo "${CFAILURE}PHP Gmagick module install failed, Please contact the author! ${CEND}" diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index b27f714c..0c2e9a3f 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -42,8 +42,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then rm -rf imagick-$imagick_version if [ -f "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ];then - [ -z "`grep '^extension_dir' $php_install_dir/etc/php.ini`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"`$php_install_dir/bin/php-config --extension-dir`\"@" $php_install_dir/etc/php.ini - sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "imagick.so"@' $php_install_dir/etc/php.ini + cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF +[imagick] +extension=imagick.so +EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 294e3e11..0d90a9a8 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -75,9 +75,9 @@ else fi if [ -f "`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so" ];then - cat >> $php_install_dir/etc/php.ini << EOF + cat > $php_install_dir/etc/php.d/ext-zendGuardLoader.ini << EOF [Zend Guard Loader] -zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so" +zend_extension=`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 diff --git a/include/apcu.sh b/include/apcu.sh index 74a01e70..852dbc19 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -19,8 +19,9 @@ $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/apcu.so" ];then - cat >> $php_install_dir/etc/php.ini << EOF -extension = apcu.so + cat > $php_install_dir/etc/php.d/ext-apcu.ini << EOF +[apcu] +extension=apcu.so apc.enabled=1 apc.shm_size=32M apc.ttl=7200 diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index aa56e01b..25a16d19 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -21,25 +21,25 @@ make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat >> $php_install_dir/etc/php.ini << EOF + cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] -zend_extension="`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" -eaccelerator.shm_size="64" -eaccelerator.cache_dir="/var/eaccelerator_cache" -eaccelerator.enable="1" -eaccelerator.optimizer="1" -eaccelerator.check_mtime="1" -eaccelerator.debug="0" -eaccelerator.filter="" -eaccelerator.shm_max="0" -eaccelerator.shm_ttl="0" -eaccelerator.shm_prune_period="0" -eaccelerator.shm_only="0" -eaccelerator.compress="0" -eaccelerator.compress_level="9" -eaccelerator.keys = "disk_only" -eaccelerator.sessions = "disk_only" -eaccelerator.content = "disk_only" +zend_extension=`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so +eaccelerator.shm_size=64 +eaccelerator.cache_dir=/var/eaccelerator_cache +eaccelerator.enable=1 +eaccelerator.optimizer=1 +eaccelerator.check_mtime=1 +eaccelerator.debug=0 +eaccelerator.filter= +eaccelerator.shm_max=0 +eaccelerator.shm_ttl=0 +eaccelerator.shm_prune_period=0 +eaccelerator.shm_only=0 +eaccelerator.compress=0 +eaccelerator.compress_level=9 +eaccelerator.keys=disk_only +eaccelerator.sessions=disk_only +eaccelerator.content=disk_only EOF echo "${CSUCCESS}Accelerator module install successfully! ${CEND}" cd .. diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index b43d5ba5..24c4401f 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -21,25 +21,25 @@ $php_install_dir/bin/phpize make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat >> $php_install_dir/etc/php.ini << EOF + cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] -zend_extension="`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" -eaccelerator.shm_size="64" -eaccelerator.cache_dir="/var/eaccelerator_cache" -eaccelerator.enable="1" -eaccelerator.optimizer="1" -eaccelerator.check_mtime="1" -eaccelerator.debug="0" -eaccelerator.filter="" -eaccelerator.shm_max="0" -eaccelerator.shm_ttl="0" -eaccelerator.shm_prune_period="0" -eaccelerator.shm_only="0" -eaccelerator.compress="0" -eaccelerator.compress_level="9" -eaccelerator.keys = "disk_only" -eaccelerator.sessions = "disk_only" -eaccelerator.content = "disk_only" +zend_extension=`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so +eaccelerator.shm_size=64 +eaccelerator.cache_dir=/var/eaccelerator_cache +eaccelerator.enable=1 +eaccelerator.optimizer=1 +eaccelerator.check_mtime=1 +eaccelerator.debug=0 +eaccelerator.filter= +eaccelerator.shm_max=0 +eaccelerator.shm_ttl=0 +eaccelerator.shm_prune_period=0 +eaccelerator.shm_only=0 +eaccelerator.compress=0 +eaccelerator.compress_level=9 +eaccelerator.keys=disk_only +eaccelerator.sessions=disk_only +eaccelerator.content=disk_only EOF echo "${CSUCCESS}Accelerator module install successfully! ${CEND}" cd .. diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 409da793..63a83fe1 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -101,7 +101,7 @@ net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 65536 -net.ipv4.tcp_max_tw_buckets = 20000 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 @@ -120,8 +120,16 @@ elif [ "$CentOS_RHEL_version" == '6' ];then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n + [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF +net.netfilter.nf_conntrack_max = 1048576 +net.netfilter.nf_conntrack_tcp_timeout_established = 1200 +EOF elif [ "$CentOS_RHEL_version" == '7' ];then sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf + [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF +net.netfilter.nf_conntrack_max = 1048576 +net.netfilter.nf_conntrack_tcp_timeout_established = 1200 +EOF fi init q diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 175e0199..fef46a45 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -72,7 +72,7 @@ net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 65536 -net.ipv4.tcp_max_tw_buckets = 20000 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 @@ -129,7 +129,11 @@ fi FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` [ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules -echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces +cat > /etc/network/if-pre-up.d/iptables << EOF +#!/bin/bash +/sbin/iptables-restore < /etc/iptables.up.rules +EOF +chmod +x /etc/network/if-pre-up.d/iptables service ssh restart . ~/.bashrc diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index a1ab6b5c..1ec82806 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -91,7 +91,7 @@ net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 65536 -net.ipv4.tcp_max_tw_buckets = 20000 +net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 @@ -147,7 +147,11 @@ fi FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` [ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules -echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces +cat > /etc/network/if-pre-up.d/iptables << EOF +#!/bin/bash +/sbin/iptables-restore < /etc/iptables.up.rules +EOF +chmod +x /etc/network/if-pre-up.d/iptables service ssh restart . ~/.bashrc diff --git a/include/ioncube.sh b/include/ioncube.sh index 03f7d956..889396a1 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -40,14 +40,10 @@ else fi rm -rf ioncube -if [ -n "`grep '^\[opcache\]' $php_install_dir/etc/php.ini`" -a -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then - sed -i "s@^\[opcache\]@[ionCube Loader]\nzend_extension=\"$zend_extension\"\n[opcache]@" $php_install_dir/etc/php.ini -elif [ -z "`grep '^\[ionCube Loader\]' $php_install_dir/etc/php.ini`" ];then - cat >> $php_install_dir/etc/php.ini << EOF +cat > $php_install_dir/etc/php.d/ext-ioncube.ini << EOF [ionCube Loader] -zend_extension="$zend_extension" +zend_extension=$zend_extension EOF -fi [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart cd .. } diff --git a/include/memcached.sh b/include/memcached.sh index 28a9fc25..fddf0872 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -60,8 +60,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ];then - [ -z "`grep '^extension_dir' $php_install_dir/etc/php.ini`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"`$php_install_dir/bin/php-config --extension-dir`\"@" $php_install_dir/etc/php.ini - [ -z "`grep 'memcache.so' $php_install_dir/etc/php.ini`" ] && sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcache.so"@' $php_install_dir/etc/php.ini + cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF +extension=memcache.so +EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart echo "${CSUCCESS}PHP memcache module install successfully! ${CEND}" cd .. @@ -103,8 +104,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ];then - [ -z "`grep '^extension_dir' $php_install_dir/etc/php.ini`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"`$php_install_dir/bin/php-config --extension-dir`\"@" $php_install_dir/etc/php.ini - [ -z "`grep 'memcached.so' $php_install_dir/etc/php.ini`" ] && sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "memcached.so"\nmemcached.use_sasl = 1@' $php_install_dir/etc/php.ini + cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF +extension=memcached.so +memcached.use_sasl=1 +EOF echo "${CSUCCESS}PHP memcached module install successfully! ${CEND}" cd .. rm -rf memcached-$memcached_pecl_version diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 375d1e55..03c4c82a 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -68,8 +68,9 @@ patch -p1 < ../php5.3patch patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -if [[ $Apache_version =~ ^[1-2]$ ]];then +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -80,6 +81,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -108,6 +110,7 @@ fi # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d /bin/cp php.ini-production $php_install_dir/etc/php.ini sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini @@ -123,7 +126,7 @@ sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/ph sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini -if [[ ! $Apache_version =~ ^[1-2]$ ]];then +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -218,7 +221,7 @@ EOF #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]];then +elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then service httpd restart fi cd .. diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 2f6dcdd6..b34369db 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -63,8 +63,9 @@ patch -d php-$php_4_version -p0 < fpm-race-condition.patch cd php-$php_4_version make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -if [[ $Apache_version =~ ^[1-2]$ ]];then +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -75,6 +76,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -102,6 +104,7 @@ fi # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d /bin/cp php.ini-production $php_install_dir/etc/php.ini sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini @@ -117,7 +120,7 @@ sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/ph sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini -if [[ ! $Apache_version =~ ^[1-2]$ ]];then +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -212,7 +215,7 @@ EOF #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]];then +elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then service httpd restart fi cd .. diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 551e4adc..8a19ff6d 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -63,8 +63,9 @@ cd php-$php_5_version make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]];then +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -75,6 +76,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -102,6 +104,7 @@ fi # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d /bin/cp php.ini-production $php_install_dir/etc/php.ini sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini @@ -117,20 +120,21 @@ sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/ph sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini -if [ "$PHP_cache" == '1' ];then - sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini - sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini - sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini -fi +[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.enable_cli=1 +;opcache.optimization_level=0 +EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]];then +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -225,7 +229,7 @@ EOF #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]];then +elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then service httpd restart fi cd .. diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 4aea3c3a..40d052f6 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -62,8 +62,9 @@ cd php-$php_6_version make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]];then +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -74,6 +75,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -101,6 +103,7 @@ fi # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d /bin/cp php.ini-production $php_install_dir/etc/php.ini sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini @@ -116,20 +119,21 @@ sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/ph sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini -if [ "$PHP_cache" == '1' ];then - sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini - sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini - sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini -fi +[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.enable_cli=1 +;opcache.optimization_level=0 +EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]];then +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -224,7 +228,7 @@ EOF #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]];then +elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then service httpd restart fi cd .. diff --git a/include/php-7.sh b/include/php-7.sh index 91ac5519..8123c9a2 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -63,8 +63,9 @@ make clean ./buildconf [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]];then +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -75,6 +76,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ @@ -102,6 +104,7 @@ fi # wget -c http://pear.php.net/go-pear.phar # $php_install_dir/bin/php go-pear.phar +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d /bin/cp php.ini-production $php_install_dir/etc/php.ini sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini @@ -118,25 +121,25 @@ sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/et sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini -if [ "$PHP_cache" == '1' ];then - sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini - sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini - sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.validate_timestamps.*@opcache.validate_timestamps=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.use_cwd.*@opcache.use_cwd=1@' $php_install_dir/etc/php.ini - sed -i 's@^opcache.max_accelerated_files.*@opcache.max_accelerated_files=100000@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.max_wasted_percentage.*@opcache.max_wasted_percentage=5@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.consistency_checks.*@opcache.consistency_checks=0@' $php_install_dir/etc/php.ini - sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini -fi +[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=100000 +opcache.max_wasted_percentage=5 +opcache.use_cwd=1 +opcache.validate_timestamps=1 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.consistency_checks=0 +;opcache.optimization_level=0 +EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]];then +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -231,7 +234,7 @@ EOF #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]];then +elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then service httpd restart fi cd .. diff --git a/include/redis.sh b/include/redis.sh index ad1cafd5..b75956dc 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -69,8 +69,10 @@ if [ -e "$php_install_dir/bin/phpize" ];then ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ];then - [ -z "`grep '^extension_dir' $php_install_dir/etc/php.ini`" ] && sed -i "s@extension_dir = \"ext\"@extension_dir = \"ext\"\nextension_dir = \"`$php_install_dir/bin/php-config --extension-dir`\"@" $php_install_dir/etc/php.ini - [ -z "`grep 'redis.so' $php_install_dir/etc/php.ini`" ] && sed -i 's@^extension_dir\(.*\)@extension_dir\1\nextension = "redis.so"@' $php_install_dir/etc/php.ini + cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF +[redis] +extension=redis.so +EOF echo "${CSUCCESS}PHP Redis module install successfully! ${CEND}" cd .. rm -rf redis-$redis_pecl_version diff --git a/include/xcache.sh b/include/xcache.sh index 93a8b7a5..18a2e72e 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -24,34 +24,34 @@ if [ -f "`$php_install_dir/bin/php-config --extension-dir`/xcache.so" ];then chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache touch /tmp/xcache;chown ${run_user}.$run_user /tmp/xcache - cat >> $php_install_dir/etc/php.ini << EOF + cat > $php_install_dir/etc/php.d/ext-xcache.ini << EOF [xcache-common] -extension = "xcache.so" +extension=xcache.so [xcache.admin] -xcache.admin.enable_auth = On -xcache.admin.user = "admin" -xcache.admin.pass = "$xcache_admin_md5_pass" +xcache.admin.enable_auth=On +xcache.admin.user=admin +xcache.admin.pass="$xcache_admin_md5_pass" [xcache] -xcache.size = $(expr $Memory_limit / 2)M -xcache.count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) -xcache.slots = 8K -xcache.ttl = 3600 -xcache.gc_interval = 300 -xcache.var_size = 4M -xcache.var_count = $(expr `cat /proc/cpuinfo | grep -c processor` + 1) -xcache.var_slots = 8K -xcache.var_ttl = 0 -xcache.var_maxttl = 0 -xcache.var_gc_interval = 300 -xcache.test = Off -xcache.readonly_protection = Off -xcache.shm_scheme = "mmap" -xcache.mmap_path = "/tmp/xcache" -xcache.coredump_directory = "" -xcache.cacher = On -xcache.stat = On -xcache.optimizer = Off +xcache.size=$(expr $Memory_limit / 2)M +xcache.count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.slots=8K +xcache.ttl=3600 +xcache.gc_interval=300 +xcache.var_size=4M +xcache.var_count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.var_slots=8K +xcache.var_ttl=0 +xcache.var_maxttl=0 +xcache.var_gc_interval=300 +xcache.test=Off +xcache.readonly_protection=Off +xcache.shm_scheme=mmap +xcache.mmap_path=/tmp/xcache +xcache.coredump_directory= +xcache.cacher=On +xcache.stat=On +xcache.optimizer=Off [xcache.coverager] ; enabling this feature will impact performance diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 3f725955..be90a652 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -20,9 +20,10 @@ $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then - cat >> $php_install_dir/etc/php.ini << EOF + cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] -zend_extension="`$php_install_dir/bin/php-config --extension-dir`/opcache.so" +zend_extension=opcache.so +opcache.enable=1 opcache.memory_consumption=$Memory_limit opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 diff --git a/vhost.sh b/vhost.sh index a60b4e9c..37ac399e 100755 --- a/vhost.sh +++ b/vhost.sh @@ -216,14 +216,6 @@ else echo "domain=$domain" fi -if [ "$nginx_ssl_yn" == 'y' ]; then - Nginx_ssl - Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/ssl/$domain.crt;\nssl_certificate_key $web_install_dir/conf/ssl/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") - Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") -else - Nginx_conf='listen 80;' -fi - while : do echo @@ -268,6 +260,18 @@ if [ "$moredomainame_yn" == 'y' ]; then fi fi +if [ "$nginx_ssl_yn" == 'y' ]; then + Nginx_ssl + Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/ssl/$domain.crt;\nssl_certificate_key $web_install_dir/conf/ssl/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") + if [ "$moredomainame_yn" == 'y' ]; then + Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain$moredomainame;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") + else + Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") + fi +else + Nginx_conf='listen 80;' +fi + while : do echo @@ -344,7 +348,7 @@ else rewrite="other" fi echo "You choose rewrite=${CMSG}$rewrite${CEND}" - [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n }") + [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") if [ -e "config/$rewrite.conf" ];then /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf else From 7519b3ba1f8346da7c470b19ee8e1ad0d8837bcc Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 12 Apr 2016 19:39:29 +0800 Subject: [PATCH 569/617] Add OpenResty --- README.md | 6 +-- apps.conf | 3 +- include/apache-2.2.sh | 12 +++-- include/apache-2.4.sh | 12 +++-- include/check_web.sh | 1 + include/demo.sh | 1 + include/init_CentOS.sh | 7 +-- include/init_Debian.sh | 1 + include/init_Ubuntu.sh | 1 + include/openresty.sh | 111 +++++++++++++++++++++++++++++++++++++++++ include/upgrade_web.sh | 57 +++++++++++++++++++++ include/zendopcache.sh | 2 +- install.sh | 25 ++++++---- options.conf | 1 + uninstall.sh | 2 + upgrade.sh | 8 ++- 16 files changed, 224 insertions(+), 26 deletions(-) create mode 100644 include/openresty.sh diff --git a/README.md b/README.md index 6c4e391d..f88601bf 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`(Linux, Nginx/Tengine, MySQL in a production environment/MariaDB/Percona, PHP), applicable to CentOS 5~7(including RedHat), Debian 6~8, Ubuntu 12.04~15.04 of 32 and 64. +This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~15 of 32 and 64. Script properties: - Continually updated - Source compiler installation, most stable source is the latest version, and download from the official site - Some security optimization - Providing a plurality of database versions (MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5,Percona-5.7, Percona-5.6, Percona-5.5) -- Providing multiple PHP versions (php-5.3, php-5.4, php-5.5, php-5.6, php-7) -- Provide Nginx, Tengine +- Providing multiple PHP versions (php-7, php-5.6, php-5.5, php-5.4, php-5.3) +- Provide Nginx, Tengine, OpenResty - Providing a plurality of Apache version (Apache-2.4, Apache-2.2) - According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php encryption and decryption tool ionCube, ZendGuardLoader - Installation Pureftpd, phpMyAdmin according to their needs diff --git a/apps.conf b/apps.conf index 666da21f..4c9f96ec 100644 --- a/apps.conf +++ b/apps.conf @@ -2,12 +2,13 @@ # Web nginx_version=1.9.14 tengine_version=2.1.1 +openresty_version=1.9.7.4 tomcat_7_version=7.0.68 tomcat_8_version=8.0.30 apache_2_version=2.2.31 -apache_4_version=2.4.18 +apache_4_version=2.4.20 pcre_version=8.38 apr_version=1.5.2 apr_util_version=1.5.4 diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 86bb75eb..3189605c 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -44,11 +44,11 @@ chmod +x /etc/init.d/httpd sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf -if [ "$Nginx_version" == '3' -a ! -e "$web_install_dir/sbin/nginx" ];then +if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' -o -e "$web_install_dir/sbin/nginx" ];then +elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 @@ -96,6 +96,12 @@ NameVirtualHost *:$TMP_PORT Allow from all DirectoryIndex index.html index.php + + SetHandler server-status + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 + EOF @@ -115,7 +121,7 @@ ServerSignature Off Include conf/vhost/*.conf EOF -if [ "$Nginx_version" != '3' -o -e "$web_install_dir/sbin/nginx" ];then +if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/mod_remoteip.c && Download_src $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 1ac6710a..22035a3e 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -57,11 +57,11 @@ chmod +x /etc/init.d/httpd sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf -if [ "$Nginx_version" == '3' -a ! -e "$web_install_dir/sbin/nginx" ];then +if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' -o -e "$web_install_dir/sbin/nginx" ];then +elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 @@ -109,6 +109,12 @@ cat >> $apache_install_dir/conf/vhost/0.conf << EOF Allow from all DirectoryIndex index.html index.php + + SetHandler server-status + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 + EOF @@ -128,7 +134,7 @@ ServerSignature Off Include conf/vhost/*.conf EOF -if [ "$Nginx_version" != '3' -o -e "$web_install_dir/sbin/nginx" ];then +if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ];then cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader X-Forwarded-For diff --git a/include/check_web.sh b/include/check_web.sh index 9cd4ee39..62e89f33 100644 --- a/include/check_web.sh +++ b/include/check_web.sh @@ -10,3 +10,4 @@ [ -e "$nginx_install_dir/sbin/nginx" ] && web_install_dir=$nginx_install_dir [ -e "$tengine_install_dir/sbin/nginx" ] && web_install_dir=$tengine_install_dir +[ -e "$openresty_install_dir/nginx/sbin/nginx" ] && web_install_dir=$openresty_install_dir/nginx diff --git a/include/demo.sh b/include/demo.sh index fc41ec3d..539e5915 100644 --- a/include/demo.sh +++ b/include/demo.sh @@ -39,5 +39,6 @@ if [ -e "$php_install_dir/bin/php" ];then fi fi chown -R ${run_user}.$run_user $wwwroot_dir/default +[ -e /usr/bin/systemctl ] && systemctl daemon-reload cd .. } diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 63a83fe1..c0852674 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -96,6 +96,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 +fs.inotify.max_user_instances = 1024 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 @@ -179,15 +180,15 @@ service sshd restart if [ ! -e "`which tmux`" ];then cd src src_url=http://mirrors.linuxeye.com/oneinstack/src/libevent-2.0.22-stable.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/tmux-2.1.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/tmux-2.2.tar.gz && Download_src tar xzf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable ./configure make && make install cd .. - tar xzf tmux-2.1.tar.gz - cd tmux-2.1 + tar xzf tmux-2.2.tar.gz + cd tmux-2.2 CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure make && make install cd ../../ diff --git a/include/init_Debian.sh b/include/init_Debian.sh index fef46a45..3fb390d6 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -66,6 +66,7 @@ sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 +fs.inotify.max_user_instances = 1024 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 1ec82806..c3fd6489 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -85,6 +85,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 +fs.inotify.max_user_instances = 1024 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 diff --git a/include/openresty.sh b/include/openresty.sh new file mode 100644 index 00000000..56e339a0 --- /dev/null +++ b/include/openresty.sh @@ -0,0 +1,111 @@ +#!/bin/bash +# Author: yeho +# 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_OpenResty() { +cd $oneinstack_dir/src +src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src +src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src + +tar xzf pcre-$pcre_version.tar.gz +cd pcre-$pcre_version +./configure +make && make install +cd .. + +id -u $run_user >/dev/null 2>&1 +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + +tar xzf openresty-$openresty_version.tar.gz +cd openresty-$openresty_version + +# close debug +openresty_version_tmp=${openresty_version%.*} +sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug + +if [ "$je_tc_malloc" == '1' ];then + malloc_module="--with-ld-opt='-ljemalloc'" +elif [ "$je_tc_malloc" == '2' ];then + malloc_module='--with-google_perftools_module' + mkdir /tmp/tcmalloc + chown -R ${run_user}.$run_user /tmp/tcmalloc +fi + +[ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir +./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module +make && make install +if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then + cd .. + rm -rf openresty-$openresty_version + echo "${CSUCCESS}OpenResty install successfully! ${CEND}" +else + rm -rf $openresty_install_dir + echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}" + kill -9 $$ +fi + +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$openresty_install_dir/nginx/sbin:\$PATH" >> /etc/profile +[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $openresty_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$openresty_install_dir/nginx/sbin:\1@" /etc/profile +. /etc/profile + +[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } +[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } +cd .. + +sed -i "s@/usr/local/nginx@$openresty_install_dir/nginx@g" /etc/init.d/nginx + +mv $openresty_install_dir/nginx/conf/nginx.conf{,_bk} +if [[ $Apache_version =~ ^[1-2]$ ]];then + /bin/cp config/nginx_apache.conf $openresty_install_dir/nginx/conf/nginx.conf +elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ];then + /bin/cp config/nginx_tomcat.conf $openresty_install_dir/nginx/conf/nginx.conf +else + /bin/cp config/nginx.conf $openresty_install_dir/nginx/conf/nginx.conf + [ "$PHP_yn" == 'y' ] && [ -z "`grep '/php-fpm_status' $openresty_install_dir/nginx/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $openresty_install_dir/nginx/conf/nginx.conf +fi +cat > $openresty_install_dir/nginx/conf/proxy.conf << EOF +proxy_connect_timeout 300s; +proxy_send_timeout 900; +proxy_read_timeout 900; +proxy_buffer_size 32k; +proxy_buffers 4 64k; +proxy_busy_buffers_size 128k; +proxy_redirect off; +proxy_hide_header Vary; +proxy_set_header Accept-Encoding ''; +proxy_set_header Referer \$http_referer; +proxy_set_header Cookie \$http_cookie; +proxy_set_header Host \$host; +proxy_set_header X-Real-IP \$remote_addr; +proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; +EOF +sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf +sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf +sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf + +# logrotate nginx log +cat > /etc/logrotate.d/nginx << EOF +$wwwlogs_dir/*nginx.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate + [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` +endscript +} +EOF + +ldconfig +service nginx start +} diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 967110ca..4a3bb08f 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -49,6 +49,7 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) /bin/cp objs/nginx $nginx_install_dir/sbin/nginx kill -USR2 `cat /var/run/nginx.pid` + sleep 1 kill -QUIT `cat /var/run/nginx.pid.oldbin` echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Nginx_version${CEND} to ${CWARNING}$NEW_Nginx_version${CEND}" else @@ -105,6 +106,7 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then chmod +x $tengine_install_dir/sbin/* make install kill -USR2 `cat /var/run/nginx.pid` + sleep 1 kill -QUIT `cat /var/run/nginx.pid.oldbin` echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Tengine_version${CEND} to ${CWARNING}$NEW_Tengine_version${CEND}" else @@ -114,3 +116,58 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then fi cd .. } + +Upgrade_OpenResty() { +cd $oneinstack_dir/src +[ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}The OpenResty is not installed on your system! ${CEND}" && exit 1 +OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1` +OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`" +echo +echo "Current OpenResty Version: ${CMSG}$OLD_OpenResty_version${CEND}" +while : +do + echo + read -p "Please input upgrade OpenResty Version(example: 1.9.7.19): " NEW_OpenResty_version + if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then + [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 + if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then + echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}OpenResty version does not exist! ${CEND}" + fi + else + echo "${CWARNING}input error! The upgrade OpenResty version is the same as the old version${CEND}" + fi +done + +if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then + echo "[${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] found" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf openresty-$NEW_OpenResty_version.tar.gz + cd openresty-$NEW_OpenResty_version + make clean + openresty_version_tmp=${NEW_OpenResty_version%.*} + sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug + $openresty_install_dir/nginx/sbin/nginx -V &> $$ + openresty_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` + rm -rf $$ + [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'" + [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module + make + if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then + /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d) + make install + kill -USR2 `cat /var/run/nginx.pid` + sleep 1 + kill -QUIT `cat /var/run/nginx.pid.oldbin` + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_OpenResty_version${CEND} to ${CWARNING}$NEW_OpenResty_version${CEND}" + else + echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}" + fi + cd .. +fi +cd .. +} diff --git a/include/zendopcache.sh b/include/zendopcache.sh index be90a652..00e4e8a9 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -22,7 +22,7 @@ make && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] -zend_extension=opcache.so +zend_extension=`$php_install_dir/bin/php-config --extension-dir`/opcache.so opcache.enable=1 opcache.memory_consumption=$Memory_limit opcache.interned_strings_buffer=8 diff --git a/install.sh b/install.sh index 1541f36d..98d46709 100755 --- a/install.sh +++ b/install.sh @@ -67,19 +67,21 @@ while :; do echo echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else if [ "$Web_yn" == 'y' ];then - # Nginx/Tegine + # Nginx/Tegine/OpenResty while :; do echo echo 'Please select Nginx server:' echo -e "\t${CMSG}1${CEND}. Install Nginx" echo -e "\t${CMSG}2${CEND}. Install Tengine" - echo -e "\t${CMSG}3${CEND}. Do not install" + echo -e "\t${CMSG}3${CEND}. Install OpenResty" + echo -e "\t${CMSG}4${CEND}. Do not install" read -p "Please input a number:(Default 1 press Enter) " Nginx_version [ -z "$Nginx_version" ] && Nginx_version=1 - if [[ ! $Nginx_version =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + if [[ ! $Nginx_version =~ ^[1-4]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" else - [ "$Nginx_version" != '3' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; Nginx_version=Other; } - [ "$Nginx_version" != '3' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$openresty_install_dir/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; Nginx_version=Other; } break fi done @@ -393,7 +395,7 @@ while :; do echo done # check jemalloc or tcmalloc -if [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' -o "$DB_yn" == 'y' ];then +if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ];then while :; do echo 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 @@ -567,6 +569,9 @@ if [ "$Nginx_version" == '1' ];then elif [ "$Nginx_version" == '2' ];then . include/tengine.sh Install_Tengine 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Nginx_version" == '3' ];then + . include/openresty.sh + Install_OpenResty 2>&1 | tee -a $oneinstack_dir/install.log fi # JDK @@ -637,9 +642,9 @@ fi [ -d "$db_install_dir/support-files" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && /etc/init.d/mysqld start echo "####################Congratulations########################" -[ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`${CMSG}$web_install_dir${CEND}" -[ "$Web_yn" == 'y' -a "$Nginx_version" != '3' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx/Tengine install dir":`${CMSG}$web_install_dir${CEND}\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" -[ "$Web_yn" == 'y' -a "$Nginx_version" == '3' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" +[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}" +[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" +[ "$Web_yn" == 'y' -a "$Nginx_version" == '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" [[ "$Tomcat_version" =~ ^[1,2]$ ]] && echo -e "\n`printf "%-32s" "Tomcat install dir":`${CMSG}$tomcat_install_dir${CEND}" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`${CMSG}$db_install_dir${CEND}" [ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database data dir:"`${CMSG}$db_data_dir${CEND}" diff --git a/options.conf b/options.conf index b85c98b5..f3afc6dc 100644 --- a/options.conf +++ b/options.conf @@ -7,6 +7,7 @@ run_user=www # set the default install path, you can freely specify nginx_install_dir=/usr/local/nginx tengine_install_dir=/usr/local/tengine +openresty_install_dir=/usr/local/openresty apache_install_dir=/usr/local/apache tomcat_install_dir=/usr/local/tomcat diff --git a/uninstall.sh b/uninstall.sh index 6ffd717d..5ef3c975 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -62,6 +62,7 @@ echo "${CWARNING}You will uninstall OneinStack, Please backup your configure fil Print_web() { [ -d "$nginx_install_dir" ] && echo "$nginx_install_dir" [ -d "$tengine_install_dir" ] && echo "$tengine_install_dir" +[ -d "$openresty_install_dir" ] && echo "$openresty_install_dir" [ -e "/etc/init.d/nginx" ] && echo '/etc/init.d/nginx' [ -e "/etc/logrotate.d/nginx" ] && echo '/etc/logrotate.d/nginx' @@ -78,6 +79,7 @@ Print_web() { Uninstall_Web() { [ -d "$nginx_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $nginx_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$nginx_install_dir/sbin:@@" /etc/profile; } [ -d "$tengine_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $tengine_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$tengine_install_dir/sbin:@@" /etc/profile; } +[ -d "$openresty_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $openresty_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$openresty_install_dir/nginx/sbin:@@" /etc/profile; } [ -d "$apache_install_dir" ] && { service httpd stop > /dev/null 2>&1; rm -rf $apache_install_dir /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@$apache_install_dir/bin:@@" /etc/profile; } [ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; rm -rf $tomcat_install_dir /etc/init.d/tomcat; /etc/logrotate.d/tomcat; } [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } diff --git a/upgrade.sh b/upgrade.sh index ffe9f1d8..6251f3bc 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -42,7 +42,7 @@ PUBLIC_IPADDR=`./include/get_public_ipaddr.py` Usage(){ printf " Usage: $0 [ ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}redis${CEND} | ${CMSG}phpmyadmin${CEND} ] -${CMSG}web${CEND} --->Upgrade Nginx/Tengine +${CMSG}web${CEND} --->Upgrade Nginx/Tengine/OpenResty ${CMSG}db${CEND} --->Upgrade MySQL/MariaDB/Percona ${CMSG}php${CEND} --->Upgrade PHP ${CMSG}redis${CEND} --->Upgrade Redis @@ -56,7 +56,7 @@ while : do printf " What Are You Doing? -\t${CMSG}1${CEND}. Upgrade Nginx/Tengine +\t${CMSG}1${CEND}. Upgrade Nginx/Tengine/OpenResty \t${CMSG}2${CEND}. Upgrade MySQL/MariaDB/Percona \t${CMSG}3${CEND}. Upgrade PHP \t${CMSG}4${CEND}. Upgrade Redis @@ -74,6 +74,8 @@ What Are You Doing? Upgrade_Nginx elif [ -e "$tengine_install_dir/sbin/nginx" ];then Upgrade_Tengine + elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ];then + Upgrade_OpenResty fi ;; @@ -109,6 +111,8 @@ elif [ $# == 1 ];then Upgrade_Nginx elif [ -e "$tengine_install_dir/sbin/nginx" ];then Upgrade_Tengine + elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ];then + Upgrade_OpenResty fi ;; From 0b2ade83351de2defa20fa647bb8ef17544e1573 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 19 Apr 2016 17:47:22 +0800 Subject: [PATCH 570/617] Add Shadowsocks-libev --- apps.conf | 8 +- include/init_CentOS.sh | 2 +- include/init_Debian.sh | 2 +- include/init_Ubuntu.sh | 2 +- include/nginx.sh | 9 +- include/openresty.sh | 9 +- include/tengine.sh | 9 +- include/upgrade_web.sh | 8 +- init.d/Shadowsocks-libev-init | 124 +++++++++ ...adowsocks-init => Shadowsocks-python-init} | 2 +- shadowsocks.sh | 242 ++++++++++++------ upgrade.sh | 1 + 12 files changed, 312 insertions(+), 106 deletions(-) create mode 100755 init.d/Shadowsocks-libev-init rename init.d/{Shadowsocks-init => Shadowsocks-python-init} (97%) diff --git a/apps.conf b/apps.conf index 4c9f96ec..658f2961 100644 --- a/apps.conf +++ b/apps.conf @@ -4,7 +4,7 @@ nginx_version=1.9.14 tengine_version=2.1.1 openresty_version=1.9.7.4 -tomcat_7_version=7.0.68 +tomcat_7_version=7.0.69 tomcat_8_version=8.0.30 apache_2_version=2.2.31 @@ -14,9 +14,9 @@ apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.11 -mysql_5_6_version=5.6.29 -mysql_5_5_version=5.5.48 +mysql_5_7_version=5.7.12 +mysql_5_6_version=5.6.30 +mysql_5_5_version=5.5.49 mariadb_10_1_version=10.1.13 mariadb_10_0_version=10.0.24 diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index c0852674..62da61c9 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -96,7 +96,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 1024 +fs.inotify.max_user_instances = 8192 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 3fb390d6..a93a5c0d 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -66,7 +66,7 @@ sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 1024 +fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index c3fd6489..47b0aaf3 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -85,7 +85,7 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 1024 +fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 diff --git a/include/nginx.sh b/include/nginx.sh index 34a4b883..3d32c52b 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -13,15 +13,10 @@ cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src -tar xzf pcre-$pcre_version.tar.gz -cd pcre-$pcre_version -./configure -make && make install -cd .. - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +tar xzf pcre-$pcre_version.tar.gz tar xzf nginx-$nginx_version.tar.gz cd nginx-$nginx_version # Modify Nginx version @@ -41,7 +36,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir -./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module +./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ];then cd .. diff --git a/include/openresty.sh b/include/openresty.sh index 56e339a0..8b25b6a9 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -13,15 +13,10 @@ cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src -tar xzf pcre-$pcre_version.tar.gz -cd pcre-$pcre_version -./configure -make && make install -cd .. - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +tar xzf pcre-$pcre_version.tar.gz tar xzf openresty-$openresty_version.tar.gz cd openresty-$openresty_version @@ -38,7 +33,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir -./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module +./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then cd .. diff --git a/include/tengine.sh b/include/tengine.sh index d3d562b0..81a6a3c6 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -13,15 +13,10 @@ cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz && Download_src -tar xzf pcre-$pcre_version.tar.gz -cd pcre-$pcre_version -./configure -make && make install -cd .. - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +tar xzf pcre-$pcre_version.tar.gz tar xzf tengine-$tengine_version.tar.gz cd tengine-$tengine_version # Modify Tengine version @@ -39,7 +34,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir -./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared $malloc_module +./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ];then cd .. diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 4a3bb08f..62eec873 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -22,6 +22,8 @@ do if [ "$NEW_Nginx_version" != "$OLD_Nginx_version" ];then [ ! -e "nginx-$NEW_Nginx_version.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-$NEW_Nginx_version.tar.gz > /dev/null 2>&1 if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] successfully! " break else @@ -74,6 +76,8 @@ do if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ];then [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1 if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! " break else @@ -131,6 +135,8 @@ do if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! " break else @@ -155,7 +161,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then rm -rf $$ [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'" [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d) diff --git a/init.d/Shadowsocks-libev-init b/init.d/Shadowsocks-libev-init new file mode 100755 index 00000000..5741680d --- /dev/null +++ b/init.d/Shadowsocks-libev-init @@ -0,0 +1,124 @@ +#!/bin/bash +# +# Script to run Shadowsocks in daemon mode at boot time. +# ScriptAuthor: icyboy +# Revision 1.0 - 14th Sep 2013 +#==================================================================== +# Run level information: +# chkconfig: 2345 99 99 +# Description: lightweight secured scoks5 proxy +# processname: ss-server +# Author: Max Lv ; +# Run "/sbin/chkconfig --add shadowsocks" to add the Run levels. +#==================================================================== + +#==================================================================== +# Paths and variables and system checks. + +# Source function library +. /etc/rc.d/init.d/functions + +# Check that networking is up. +# +[ ${NETWORKING} ="yes" ] || exit 0 + +# Daemon +NAME=shadowsocks-server +DAEMON=/usr/local/bin/ss-server + +# Path to the configuration file. +# +CONF=/etc/shadowsocks/config.json + +#USER="nobody" +#GROUP="nobody" + +# Take care of pidfile permissions +mkdir /var/run/$NAME 2>/dev/null || true +#chown "$USER:$GROUP" /var/run/$NAME + +# Check the configuration file exists. +# +if [ ! -f $CONF ] ; then +echo "The configuration file cannot be found!" +exit 0 +fi + +# Path to the lock file. +# +LOCK_FILE=/var/lock/subsys/shadowsocks + +# Path to the pid file. +# +PID=/var/run/$NAME/pid + + +#==================================================================== + +#==================================================================== +# Run controls: + +RETVAL=0 + +# Start shadowsocks as daemon. +# +start() { +if [ -f $LOCK_FILE ]; then +echo "$NAME is already running!" +exit 0 +else +echo -n $"Starting ${NAME}: " +#daemon --check $DAEMON --user $USER "$DAEMON -f $PID -c $CONF > /dev/null" +daemon $DAEMON -u -c $CONF -f $PID +fi + +RETVAL=$? +[ $RETVAL -eq 0 ] && success +echo +[ $RETVAL -eq 0 ] && touch $LOCK_FILE +return $RETVAL +} + + +# Stop shadowsocks. +# +stop() { +echo -n $"Shutting down ${NAME}: " +killproc -p ${PID} +RETVAL=$? +[ $RETVAL -eq 0 ] +rm -f $LOCK_FILE +rm -f ${PID} +echo +return $RETVAL +} + +# See how we were called. +case "$1" in +start) +start +;; +stop) +stop +;; +restart) +stop +start +;; +condrestart) +if [ -f $LOCK_FILE ]; then +stop +start +RETVAL=$? +fi +;; +status) +status $DAEMON +RETVAL=$? +;; +*) +echo $"Usage: $0 {start|stop|restart|condrestart|status}" +RETVAL=1 +esac + +exit $RETVAL diff --git a/init.d/Shadowsocks-init b/init.d/Shadowsocks-python-init similarity index 97% rename from init.d/Shadowsocks-init rename to init.d/Shadowsocks-python-init index bc01b471..44b5abc4 100755 --- a/init.d/Shadowsocks-init +++ b/init.d/Shadowsocks-python-init @@ -6,7 +6,7 @@ # description: Shadowsocks start/stop/status/restart script Shadowsocks_bin=/usr/bin/ssserver -Shadowsocks_conf=/etc/shadowsocks.json +Shadowsocks_conf=/etc/shadowsocks/config.json #Shadowsocks_USAGE is the message if this script is called without any options Shadowsocks_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}" diff --git a/shadowsocks.sh b/shadowsocks.sh index 011c49c6..8e5fa309 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -3,7 +3,7 @@ # BLOG: https://blog.linuxeye.com # # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# Install Shadowsocks(Python) Server +# Install Shadowsocks Server # # Project home page: # http://oneinstack.com @@ -14,7 +14,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+ # -# Install Shadowsocks(Python) Server # +# Install Shadowsocks Server # # For more information please visit http://oneinstack.com # ####################################################################### " @@ -32,20 +32,97 @@ PUBLIC_IPADDR=`../include/get_public_ipaddr.py` [ "$CentOS_RHEL_version" == '5' ] && { echo "${CWARNING}Shadowsocks only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } -Install_shadowsocks(){ +Check_shadowsocks() { + [ -f /usr/local/bin/ss-server ] && SS_version=1 + [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 +} + +AddUser_shadowsocks() { +while : +do + echo + read -p "Please input password for shadowsocks: " Shadowsocks_password + [ -n "`echo $Shadowsocks_password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } + (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" +done +} + +Iptables_set() { +if [ -e '/etc/sysconfig/iptables' ];then + Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1` +elif [ -e '/etc/iptables.up.rules' ];then + Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1` +fi + +if [ -n "$Shadowsocks_Already_port" ];then + Shadowsocks_Default_port=`expr $Shadowsocks_Already_port + 1` +else + Shadowsocks_Default_port=9001 +fi + +while : +do + echo + read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port + [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port + if [ $Shadowsocks_port -ge 9000 >/dev/null 2>&1 -a $Shadowsocks_port -le 10000 >/dev/null 2>&1 ];then + break + else + echo "${CWARNING}input error! Input range: 9001~9999${CEND}" + fi +done + +if [ "$OS" == 'CentOS' ];then + if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ];then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + service iptables save + fi +elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ];then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi +else + echo "${CWARNING}This port is already in iptables${CEND}" +fi + +} + +Def_parameter() { if [ "$OS" == 'CentOS' ]; then - for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel + while :; do echo + echo 'Please select Shadowsocks server version:' + echo -e "\t${CMSG}1${CEND}. Install Shadowsocks-libev" + echo -e "\t${CMSG}2${CEND}. Install Shadowsocks-python" + read -p "Please input a number:(Default 1 press Enter) " SS_version + [ -z "$SS_version" ] && SS_version=1 + if [[ ! $SS_version =~ ^[1-2]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi + done + AddUser_shadowsocks + Iptables_set + for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git do yum -y install $Package done elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + SS_version=2 + AddUser_shadowsocks + Iptables_set apt-get -y update - for Package in python-dev python-pip curl wget unzip gcc swig automake make perl cpio + for Package in python-dev python-pip curl wget unzip gcc swig automake make perl cpio git do apt-get -y install $Package done fi +} +Install_shadowsocks-python() { src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src which pip > /dev/null 2>&1 @@ -57,19 +134,37 @@ if [ -f /usr/bin/pip ]; then pip install gevent pip install shadowsocks if [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ]; then - /bin/cp ../init.d/Shadowsocks-init /etc/init.d/shadowsocks + /bin/cp ../init.d/Shadowsocks-python-init /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks else echo - echo "${CQUESTION}Shadowsocks install failed! Please visit http://oneinstack.com${CEND}" + echo "${CQUESTION}Shadowsocks-python install failed! Please visit http://oneinstack.com${CEND}" exit 1 fi fi } +Install_shadowsocks-libev() { +git clone https://github.com/shadowsocks/shadowsocks-libev.git +cd shadowsocks-libev +./configure +make && make install +cd .. +if [ -f /usr/local/bin/ss-server ];then + /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks + chmod +x /etc/init.d/shadowsocks + [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } +else + echo + echo "${CQUESTION}Shadowsocks-libev install failed! Please visit http://oneinstack.com${CEND}" + exit 1 +fi + +} + Uninstall_shadowsocks(){ while : do @@ -83,75 +178,59 @@ do done if [ "$Shadowsocks_yn" == 'y' ]; then - [ -n "`ps -ef | grep -v grep | grep -i "ssserver"`" ] && /etc/init.d/shadowsocks stop + [ -n "`ps -ef | grep -v grep | grep -iE "ssserver|ss-server"`" ] && /etc/init.d/shadowsocks stop [ "$OS" == 'CentOS' ] && chkconfig --del shadowsocks [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove - - rm -rf /etc/shadowsocks.json /var/run/shadowsocks.pid /etc/init.d/shadowsocks - pip uninstall -y shadowsocks - if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks uninstall success! ${CEND}" - else - echo "${CFAILURE}Shadowsocks uninstall failed! ${CEND}" + rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks + if [ "$SS_version" == '1' ];then + rm -f /usr/local/bin/ss-local + rm -f /usr/local/bin/ss-tunnel + rm -f /usr/local/bin/ss-server + rm -f /usr/local/bin/ss-manager + rm -f /usr/local/bin/ss-redir + rm -f /usr/local/lib/libshadowsocks.a + rm -f /usr/local/lib/libshadowsocks.la + rm -f /usr/local/include/shadowsocks.h + rm -f /usr/local/lib/pkgconfig/shadowsocks-libev.pc + rm -f /usr/local/share/man/man1/ss-local.1 + rm -f /usr/local/share/man/man1/ss-tunnel.1 + rm -f /usr/local/share/man/man1/ss-server.1 + rm -f /usr/local/share/man/man1/ss-manager.1 + rm -f /usr/local/share/man/man1/ss-redir.1 + rm -f /usr/local/share/man/man8/shadowsocks.8 + if [ $? -eq 0 ]; then + echo "${CSUCCESS}Shadowsocks-libev uninstall success! ${CEND}" + else + echo "${CFAILURE}Shadowsocks-libev uninstall failed! ${CEND}" + fi + elif [ "$SS_version" == '2' ];then + pip uninstall -y shadowsocks + if [ $? -eq 0 ]; then + echo "${CSUCCESS}Shadowsocks-python uninstall success! ${CEND}" + else + echo "${CFAILURE}Shadowsocks-python uninstall failed! ${CEND}" + fi fi else echo "${CMSG}Shadowsocks uninstall cancelled! ${CEND}" fi } -AddUser_shadowsocks(){ -while : -do - echo - read -p "Please input password for shadowsocks: " Shadowsocks_password - [ -n "`echo $Shadowsocks_password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } - (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" -done -} - -Iptables_set(){ -if [ -e '/etc/sysconfig/iptables' ];then - Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1` -elif [ -e '/etc/iptables.up.rules' ];then - Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1` -fi - -if [ -n "$Shadowsocks_Already_port" ];then - Shadowsocks_Default_port=`expr $Shadowsocks_Already_port + 1` -else - Shadowsocks_Default_port=9001 -fi - -while : -do - echo - read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port - [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port - if [ $Shadowsocks_port -ge 9000 >/dev/null 2>&1 -a $Shadowsocks_port -le 10000 >/dev/null 2>&1 ];then - break - else - echo "${CWARNING}input error! Input range: 9001~9999${CEND}" - fi -done - -if [ "$OS" == 'CentOS' ];then - if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ];then - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - service iptables save - fi -elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ];then - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi -else - echo "${CWARNING}This port is already in iptables${CEND}" -fi - +Config_shadowsocks(){ +[ ! -d '/etc/shadowsocks' ] && mkdir /etc/shadowsocks +[ "$SS_version" == '1' ] && cat > /etc/shadowsocks/config.json< /etc/shadowsocks.json< /etc/shadowsocks/config.json< Date: Thu, 28 Apr 2016 16:15:19 +0800 Subject: [PATCH 571/617] Problem building php-5.3 with openssl --- apps.conf | 12 ++++++------ include/mariadb-10.0.sh | 4 ++-- include/mariadb-10.1.sh | 4 ++-- include/mariadb-5.5.sh | 4 ++-- include/mysql-5.5.sh | 4 ++-- include/mysql-5.6.sh | 4 ++-- include/mysql-5.7.sh | 4 ++-- include/percona-5.5.sh | 4 ++-- include/percona-5.6.sh | 4 ++-- include/percona-5.7.sh | 4 ++-- include/php-5.3.sh | 39 +++++++++++++++++++++++++++++++++++---- 11 files changed, 59 insertions(+), 28 deletions(-) diff --git a/apps.conf b/apps.conf index 658f2961..1e6edc0a 100644 --- a/apps.conf +++ b/apps.conf @@ -1,6 +1,6 @@ # newest software version # Web -nginx_version=1.9.14 +nginx_version=1.10.0 tengine_version=2.1.1 openresty_version=1.9.7.4 @@ -20,7 +20,7 @@ mysql_5_5_version=5.5.49 mariadb_10_1_version=10.1.13 mariadb_10_0_version=10.0.24 -mariadb_5_5_version=5.5.48 +mariadb_5_5_version=5.5.49 percona_5_7_version=5.7.11-4 percona_5_6_version=5.6.29-76.2 @@ -29,14 +29,14 @@ percona_5_5_version=5.5.48-37.8 # JDK jdk_6_version=1.6.0_45 jdk_7_version=1.7.0_80 -jdk_8_version=1.8.0_77 +jdk_8_version=1.8.0_92 # PHP php_3_version=5.3.29 php_4_version=5.4.45 -php_5_version=5.5.34 -php_6_version=5.6.20 -php_7_version=7.0.5 +php_5_version=5.5.35 +php_6_version=5.6.21 +php_7_version=7.0.6 zendopcache_version=7.0.5 xcache_version=3.2.0 diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 6fa1aac8..571da828 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -78,7 +78,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -137,7 +137,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 337c75e5..bb8e8867 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -78,7 +78,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -137,7 +137,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index b7353ba7..5565c6a3 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -78,7 +78,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -138,7 +138,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 62d3caac..c581d469 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -94,7 +94,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -153,7 +153,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index e1cfdae5..5769be30 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -92,7 +92,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -152,7 +152,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 644b5347..dadf0b19 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -106,7 +106,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -167,7 +167,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index f7cdf389..00d762ac 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -93,7 +93,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -152,7 +152,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 9b6822fc..36edc509 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -92,7 +92,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -152,7 +152,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 8c9e18c1..7d06cba3 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -106,7 +106,7 @@ max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 -max_allowed_packet = 4M +max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M @@ -166,7 +166,7 @@ wait_timeout = 28800 [mysqldump] quick -max_allowed_packet = 16M +max_allowed_packet = 500M [myisamchk] key_buffer_size = 8M diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 03c4c82a..8dae39b6 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -61,6 +61,37 @@ rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +# Problem building php-5.3 with openssl +if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then + if [ -e '/usr/local/openssl/lib/libcrypto.a' ];then + OpenSSL_args='--with-openssl=/usr/local/openssl' + else + src_url=http://mirrors.linuxeye.com/oneinstack/src/openssl-1.0.0s.tar.gz && Download_src + tar xzf openssl-1.0.0s.tar.gz + cd openssl-1.0.0s + ./config --prefix=/usr/local/openssl -fPIC shared zlib + make && make install + cd .. + [ -e '/usr/local/openssl/lib/libcrypto.a' ] && { OpenSSL_args='--with-openssl=/usr/local/openssl'; rm -rf openssl-1.0.0s; } || OpenSSL_args='--with-openssl' + fi + if [ "$Ubuntu_version" == '16' ];then + if [ -e '/usr/local/curl/lib/libcurl.a' ];then + Curl_args='--with-curl=/usr/local/curl' + else + src_url=http://mirrors.linuxeye.com/oneinstack/src/curl-7.29.0.tar.gz && Download_src + tar xzf curl-7.29.0.tar.gz + cd curl-7.29.0 + LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl + make && make install + cd .. + [ -e '/usr/local/curl/lib/libcurl.a' ] && { Curl_args='--with-curl=/usr/local/curl'; rm -rf curl-7.29.0; } || Curl_args='--with-curl' + fi + fi +else + OpenSSL_args='--with-openssl' + Curl_args='--with-curl' +fi + tar xzf php-$php_3_version.tar.gz patch -d php-$php_3_version -p0 < fpm-race-condition.patch cd php-$php_3_version @@ -75,8 +106,8 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--enable-sysvsem --enable-inline-optimization $Curl_args --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug else @@ -86,8 +117,8 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--enable-sysvsem --enable-inline-optimization $Curl_args --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi From 4e696c1b202d789098e082313e866bfbfad9261c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 9 May 2016 11:10:00 +0800 Subject: [PATCH 572/617] Install MySQL from Generic Binaries --- apps.conf | 4 +-- include/check_os.sh | 4 +++ include/check_port.py | 12 ++++++++ include/download.sh | 2 +- include/mysql-5.6.sh | 37 +++++++++-------------- include/mysql-5.7.sh | 53 ++++++++++----------------------- include/tomcat-7.sh | 1 + include/tomcat-8.sh | 1 + include/upgrade_db.sh | 69 +++++++++++++++++++++---------------------- vhost.sh | 2 +- 10 files changed, 85 insertions(+), 100 deletions(-) create mode 100755 include/check_port.py diff --git a/apps.conf b/apps.conf index 1e6edc0a..7e3ff656 100644 --- a/apps.conf +++ b/apps.conf @@ -19,7 +19,7 @@ mysql_5_6_version=5.6.30 mysql_5_5_version=5.5.49 mariadb_10_1_version=10.1.13 -mariadb_10_0_version=10.0.24 +mariadb_10_0_version=10.0.25 mariadb_5_5_version=5.5.49 percona_5_7_version=5.7.11-4 @@ -41,7 +41,7 @@ php_7_version=7.0.6 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.8.8-10 +ImageMagick_version=6.9.3-10 imagick_version=3.3.0 GraphicsMagick_version=1.3.23 gmagick_version=1.1.7RC3 diff --git a/include/check_os.sh b/include/check_os.sh index 1b3d62bf..e521da89 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -17,6 +17,10 @@ elif [ -n "`grep bian /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Debian OS=Debian [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } Debian_version=`lsb_release -sr | awk -F. '{print $1}'` +elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deepin' ];then + OS=Debian + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + Debian_version=`lsb_release -sr | awk -F. '{print $1}'` elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' ];then OS=Ubuntu [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } diff --git a/include/check_port.py b/include/check_port.py new file mode 100755 index 00000000..effed50a --- /dev/null +++ b/include/check_port.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import sys,os,socket +def IsOpen(ip,port): + s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) + try: + s.connect((ip,int(port))) + s.shutdown(2) + print True + except: + print False +if __name__ == '__main__': + IsOpen(sys.argv[1],int(sys.argv[2])) diff --git a/include/download.sh b/include/download.sh index 9fc77510..91119dbb 100644 --- a/include/download.sh +++ b/include/download.sh @@ -9,7 +9,7 @@ # https://github.com/lj2007331/oneinstack Download_src() { - [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || wget -c --no-check-certificate $src_url + [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget -c --no-check-certificate $src_url; sleep 1; } if [ ! -e "${src_url##*/}" ];then echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" kill -9 $$ diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 5769be30..4b6a8dbc 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -10,37 +10,28 @@ Install_MySQL-5-6() { cd $oneinstack_dir/src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-$mysql_5_6_version.tar.gz && Download_src + +if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 +else + [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 +fi + +src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz && Download_src id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql +[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-$mysql_5_6_version.tar.gz -cd mysql-$mysql_5_6_version + +tar zxf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz +mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* $mysql_install_dir if [ "$je_tc_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe elif [ "$je_tc_malloc" == '2' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe fi -make clean -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir -cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_DATADIR=$mysql_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 \ --DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ --DWITH_EMBEDDED_SERVER=1 \ -$EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` -make install if [ -d "$mysql_install_dir/support-files" ];then echo "${CSUCCESS}MySQL install successfully! ${CEND}" diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index dadf0b19..07322e86 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -11,50 +11,27 @@ 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.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 .. +if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 +else + [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 fi -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -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 +src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz && Download_src -src_url=$DOWN_ADDR_MYSQL/mysql-$mysql_5_7_version.tar.gz && Download_src id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-$mysql_5_7_version.tar.gz -cd mysql-$mysql_5_7_version -make clean -cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_DATADIR=$mysql_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 \ --DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ --DWITH_EMBEDDED_SERVER=1 \ -$EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` -make install + +tar zxf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz +mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* $mysql_install_dir +if [ "$je_tc_malloc" == '1' ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe +elif [ "$je_tc_malloc" == '2' ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe +fi if [ -d "$mysql_install_dir/support-files" ];then echo "${CSUCCESS}MySQL install successfully! ${CEND}" @@ -67,6 +44,8 @@ else fi /bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld +sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld +sed -i "s@^datadir=.*@datadir=$mysql_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 diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 7694d045..a0d92471 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -21,6 +21,7 @@ id -u $run_user >/dev/null 2>&1 tar xzf apache-tomcat-$tomcat_7_version.tar.gz [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir /bin/cp -R apache-tomcat-$tomcat_7_version/* $tomcat_install_dir +rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ -e "$tomcat_install_dir/conf/server.xml" ];then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index ee76738c..eea8b05b 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -21,6 +21,7 @@ id -u $run_user >/dev/null 2>&1 tar xzf apache-tomcat-$tomcat_8_version.tar.gz [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir /bin/cp -R apache-tomcat-$tomcat_8_version/* $tomcat_install_dir +rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ -e "$tomcat_install_dir/conf/server.xml" ];then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 57f79670..7438140c 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -24,6 +24,7 @@ elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then DB=Percona OLD_DB_version=$OLD_DB_version_tmp else + [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.sohu.com/mysql || DOWN_ADDR=http://cdn.mysql.com/Downloads DB=MySQL OLD_DB_version=$OLD_DB_version_tmp fi @@ -58,6 +59,7 @@ echo echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}" [ -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'"; } +[ -e /usr/local/lib/libjemalloc.so -a -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; } while : do @@ -71,8 +73,8 @@ do DB_name=percona-server-$NEW_DB_version DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz elif [ "$DB" == 'MySQL' ];then - DB_name=mysql-$NEW_DB_version - DB_URL=http://cdn.mysql.com/Downloads/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz + [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-$NEW_DB_version + DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz fi [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 @@ -93,8 +95,8 @@ if [ -e "$DB_name.tar.gz" ];then char=`get_char` if [ "$DB" == 'MariaDB' ];then service mysqld stop - mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d"`} - mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d"`} + mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir tar xzf $DB_name.tar.gz [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir @@ -150,8 +152,8 @@ $EXE_LINKER fi make -j `grep processor /proc/cpuinfo | wc -l` service mysqld stop - mv ${percona_install_dir}{,_old_`date +"%Y%m%d"`} - mv ${percona_data_dir}{,_old_`date +"%Y%m%d"`} + mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} [ ! -d "$percona_install_dir" ] && mkdir -p $percona_install_dir mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir make install @@ -169,10 +171,10 @@ $EXE_LINKER $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" elif [ "$DB" == 'MySQL' ];then - tar zxf $DB_name.tar.gz - cd $DB_name - make clean if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ];then + tar zxf $DB_name.tar.gz + cd $DB_name + make clean cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ -DMYSQL_DATADIR=$mysql_data_dir \ -DSYSCONFDIR=/etc \ @@ -189,35 +191,30 @@ $EXE_LINKER -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ $EXE_LINKER - else - cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_DATADIR=$mysql_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 \ --DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ --DWITH_EMBEDDED_SERVER=1 \ -$EXE_LINKER - fi - make -j `grep processor /proc/cpuinfo | wc -l` - service mysqld stop - mv ${mysql_install_dir}{,_old_`date +"%Y%m%d"`} - mv ${mysql_data_dir}{,_old_`date +"%Y%m%d"`} - [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir - mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - make install - cd .. - 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 + + make -j `grep processor /proc/cpuinfo | wc -l` + service mysqld stop + mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir + 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 + else + tar zxf $DB_name.tar.gz + service mysqld stop + mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir + mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir + mv $DB_name/* $mysql_install_dir/ + [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.6' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir fi + chown mysql.mysql -R $mysql_data_dir [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf service mysqld start diff --git a/vhost.sh b/vhost.sh index 37ac399e..a263391a 100755 --- a/vhost.sh +++ b/vhost.sh @@ -256,7 +256,7 @@ if [ "$moredomainame_yn" == 'y' ]; then fi done [ "$nginx_ssl_yn" == 'y' ] && HTTP_flag=https || HTTP_flag=http - [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n\trewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n\t}") + [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") fi fi From 37fd7529c10259d64f900c1ba20c85b41af96a54 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 May 2016 09:22:10 +0800 Subject: [PATCH 573/617] Update include/ImageMagick.sh --- include/ImageMagick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 0c2e9a3f..b687674b 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -10,7 +10,7 @@ Install_ImageMagick() { cd $oneinstack_dir/src -src_url=http://downloads.sourceforge.net/project/imagemagick/old-sources/6.x/6.8/ImageMagick-$ImageMagick_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/ImageMagick-$ImageMagick_version.tar.gz && Download_src tar xzf ImageMagick-$ImageMagick_version.tar.gz cd ImageMagick-$ImageMagick_version From c64ee6576e7acabe4ed4c28377e614e2943aebe9 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 27 May 2016 11:10:53 +0800 Subject: [PATCH 574/617] Update apps.conf --- apps.conf | 20 +++++++------- config/index_cn.html | 2 +- include/ImageMagick.sh | 8 +++--- include/init_Debian.sh | 6 ++--- include/init_Ubuntu.sh | 4 +-- include/mysql-5.5.sh | 41 ++++++++++++----------------- include/mysql-5.6.sh | 2 ++ include/percona-5.7.sh | 1 + include/php-5.3.sh | 2 ++ include/php-5.4.sh | 1 + include/php-5.5.sh | 1 + include/php-5.6.sh | 1 + include/php-7.sh | 1 + include/redis.sh | 2 +- include/upgrade_db.sh | 56 +++++++++------------------------------- include/upgrade_redis.sh | 2 +- tools/db_bk.sh | 2 +- vhost.sh | 4 +-- 18 files changed, 61 insertions(+), 95 deletions(-) diff --git a/apps.conf b/apps.conf index 7e3ff656..5bf8e4e5 100644 --- a/apps.conf +++ b/apps.conf @@ -18,13 +18,13 @@ mysql_5_7_version=5.7.12 mysql_5_6_version=5.6.30 mysql_5_5_version=5.5.49 -mariadb_10_1_version=10.1.13 +mariadb_10_1_version=10.1.14 mariadb_10_0_version=10.0.25 mariadb_5_5_version=5.5.49 percona_5_7_version=5.7.11-4 -percona_5_6_version=5.6.29-76.2 -percona_5_5_version=5.5.48-37.8 +percona_5_6_version=5.6.30-76.3 +percona_5_5_version=5.5.49-37.9 # JDK jdk_6_version=1.6.0_45 @@ -34,15 +34,15 @@ jdk_8_version=1.8.0_92 # PHP php_3_version=5.3.29 php_4_version=5.4.45 -php_5_version=5.5.35 -php_6_version=5.6.21 -php_7_version=7.0.6 +php_5_version=5.5.36 +php_6_version=5.6.22 +php_7_version=7.0.7 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.3-10 -imagick_version=3.3.0 +ImageMagick_version=6.9.4-4 +imagick_version=3.4.1 GraphicsMagick_version=1.3.23 gmagick_version=1.1.7RC3 libiconv_version=1.14 @@ -54,7 +54,7 @@ mhash_version=0.9.9.9 pureftpd_version=1.0.42 # Redis -redis_version=3.0.7 +redis_version=3.2.0 redis_pecl_version=2.2.7 # Memcached @@ -67,7 +67,7 @@ memcache_pecl_version=3.0.8 phpMyAdmin_version=4.4.15.5 # jemalloc -jemalloc_version=4.1.0 +jemalloc_version=4.2.0 # tcmalloc tcmalloc_version=2.5 diff --git a/config/index_cn.html b/config/index_cn.html index 32d851f8..712e554b 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -28,7 +28,7 @@

OneinStack 创建FTP虚拟账号执行脚本:  ./pureftpd_vhost.sh

Github项目地址:  https://github.com/lj2007331/oneinstack

OneinStack官网:  http://oneinstack.com

-

QQ群:  213014293 486321919 438311066(满) 235258658(满)

+

QQ群:  558540514(付费千人群) 556824757(新) 213014293(满) 486321919(满) 438311066(满) 235258658(满)

赞助我们:

          支付宝:  lj2007331@gmail.com

          PayPal:  lj2007331@gmail.com

diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index b687674b..78b05ad2 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -24,10 +24,10 @@ cd .. Install_php-imagick() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - src_url=https://pecl.php.net/get/imagick-3.4.1.tgz && Download_src - tar xzf imagick-3.4.1.tgz - cd imagick-3.4.1 + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then + src_url=https://pecl.php.net/get/imagick-3.3.0.tgz && Download_src + tar xzf imagick-3.3.0.tgz + cd imagick-3.3.0 else src_url=http://pecl.php.net/get/imagick-$imagick_version.tgz && Download_src tar xzf imagick-$imagick_version.tgz diff --git a/include/init_Debian.sh b/include/init_Debian.sh index a93a5c0d..50ed5802 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -20,7 +20,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate ntpdate do apt-get -y install $Package done @@ -85,14 +85,12 @@ EOF sysctl -p sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup -sed -i 's@^[3-6]:23:respawn@#&@g' /etc/inittab -sed -i "s@^ctrlaltdel@#&@" /etc/inittab sed -i 's@^# en_US.UTF-8@en_US.UTF-8@' /etc/locale.gen init q # Update time ntpdate pool.ntp.org -[ -z "`grep 'ntpdate' /var/spool/cron/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 47b0aaf3..24bcde25 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -20,7 +20,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz ntpdate do apt-get -y install $Package done @@ -110,7 +110,7 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -[ -z "`grep 'ntpdate' /var/spool/cron/crontabs/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart # iptables diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index c581d469..42fad360 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -10,39 +10,28 @@ Install_MySQL-5-5() { cd $oneinstack_dir/src -src_url=http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-$mysql_5_5_version.tar.gz && Download_src + +if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 +else + [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 +fi + +src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz && Download_src id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql +[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-$mysql_5_5_version.tar.gz -cd mysql-$mysql_5_5_version + +tar xzf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz +mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* $mysql_install_dir if [ "$je_tc_malloc" == '1' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe elif [ "$je_tc_malloc" == '2' ];then - EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe fi -make clean -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir -cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_DATADIR=$mysql_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 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ --DWITH_EMBEDDED_SERVER=1 \ -$EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` -make install if [ -d "$mysql_install_dir/support-files" ];then echo "${CSUCCESS}MySQL install successfully! ${CEND}" @@ -55,6 +44,8 @@ else fi /bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld +sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld +sed -i "s@^datadir=.*@datadir=$mysql_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 diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 4b6a8dbc..661a5cc5 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -44,6 +44,8 @@ else fi /bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld +sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld +sed -i "s@^datadir=.*@datadir=$mysql_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 diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 7d06cba3..74aadd0e 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -49,6 +49,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ +-DWITH_ZLIB=system \ -DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 8dae39b6..5fd1702e 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -16,6 +16,8 @@ src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhas src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/php5.3patch && Download_src src_url=http://www.php.net/distributions/php-$php_3_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz diff --git a/include/php-5.4.sh b/include/php-5.4.sh index b34369db..db227819 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -15,6 +15,7 @@ src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_ver src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src src_url=http://www.php.net/distributions/php-$php_4_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 8a19ff6d..8dcffad2 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -15,6 +15,7 @@ src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_ver src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 40d052f6..969b8dc0 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -14,6 +14,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz diff --git a/include/php-7.sh b/include/php-7.sh index 8123c9a2..683328b0 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -14,6 +14,7 @@ src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz diff --git a/include/redis.sh b/include/redis.sh index b75956dc..efe53696 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -23,7 +23,7 @@ make if [ -f "src/redis-server" ];then mkdir -p $redis_install_dir/{bin,etc,var} - /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ /bin/cp redis.conf $redis_install_dir/etc/ ln -s $redis_install_dir/bin/* /usr/local/bin/ sed -i 's@pidfile.*@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 7438140c..4eb21a07 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -73,7 +73,7 @@ do DB_name=percona-server-$NEW_DB_version DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz elif [ "$DB" == 'MySQL' ];then - [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-$NEW_DB_version + [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-${NEW_DB_version}-linux2.6-${SYS_BIT_b} DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz fi [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 @@ -171,49 +171,17 @@ $EXE_LINKER $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" elif [ "$DB" == 'MySQL' ];then - if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ];then - tar zxf $DB_name.tar.gz - cd $DB_name - make clean - cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \ --DMYSQL_DATADIR=$mysql_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 \ --DWITH_READLINE=1 \ --DENABLED_LOCAL_INFILE=1 \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ --DWITH_EMBEDDED_SERVER=1 \ -$EXE_LINKER - - make -j `grep processor /proc/cpuinfo | wc -l` - service mysqld stop - mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir - 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 - else - tar zxf $DB_name.tar.gz - service mysqld stop - mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir - mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - mv $DB_name/* $mysql_install_dir/ - [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe - [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe - [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.6' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - fi + tar zxf $DB_name.tar.gz + service mysqld stop + mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir + mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir + mv $DB_name/* $mysql_install_dir/ + [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir chown mysql.mysql -R $mysql_data_dir [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index 4fed1b0c..80234daa 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -47,7 +47,7 @@ if [ -e "redis-$NEW_Redis_version.tar.gz" ];then if [ -f "src/redis-server" ];then echo "Restarting Redis..." service redis-server stop - /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ service redis-server start echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}" else diff --git a/tools/db_bk.sh b/tools/db_bk.sh index 060bd5c9..1eb45904 100755 --- a/tools/db_bk.sh +++ b/tools/db_bk.sh @@ -32,7 +32,7 @@ fi if [ -e "$NewFile" ];then echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile else - $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --opt --databases $DBname > $DumpFile + $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile cd $backup_dir tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1 echo "[$NewFile] Backup success ">> $LogFile diff --git a/vhost.sh b/vhost.sh index a263391a..b78140ba 100755 --- a/vhost.sh +++ b/vhost.sh @@ -208,7 +208,7 @@ do done if [ -e "$web_install_dir/conf/vhost/$domain.conf" -o -e "$apache_install_dir/conf/vhost/$domain.conf" -o -e "$tomcat_install_dir/conf/vhost/$domain.xml" ]; then - [ -e "$web_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Nginx/Tengine already exist! \nYou can delete ${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND} and re-create" + [ -e "$web_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Nginx/Tengine/OpenResty already exist! \nYou can delete ${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND} and re-create" [ -e "$apache_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Apache already exist! \nYou can delete ${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND} and re-create" [ -e "$tomcat_install_dir/conf/vhost/$domain.xml" ] && echo -e "$domain in the Tomcat already exist! \nYou can delete ${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND} and re-create" exit @@ -361,7 +361,7 @@ Nginx_log() { while : do echo - read -p "Allow Nginx/Tengine access_log? [y/n]: " access_yn + read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn if [[ ! $access_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else From a55e7ceb3b7631b63928cf947cad20e576be56a8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 31 May 2016 09:50:04 +0800 Subject: [PATCH 575/617] remove unneeded spaces & convert indentation to spaces --- apps.conf | 4 +- backup.sh | 2 +- backup_setup.sh | 24 ++- config/index.html | 6 +- config/index_cn.html | 6 +- config/nginx.conf | 2 +- config/nginx_apache.conf | 2 +- config/nginx_tomcat.conf | 2 +- config/pure-ftpd.conf | 14 +- config/server.xml | 2 +- include/GraphicsMagick.sh | 6 +- include/ZendGuardLoader.sh | 40 ++--- include/apache-2.2.sh | 12 +- include/apache-2.4.sh | 16 +- include/check_dir.sh | 19 +++ include/check_os.sh | 8 +- include/check_port.py | 2 +- include/color.sh | 10 +- include/eaccelerator-1.0-dev.sh | 4 +- include/get_ipaddr.py | 2 +- include/hhvm_CentOS.sh | 12 +- include/init_CentOS.sh | 42 ++--- include/init_Debian.sh | 26 +-- include/init_Ubuntu.sh | 32 ++-- include/ioncube.sh | 10 +- include/jdk-1.7.sh | 2 +- include/mariadb-10.0.sh | 18 +-- include/mariadb-10.1.sh | 18 +-- include/mariadb-5.5.sh | 14 +- include/memcached.sh | 22 +-- include/mysql-5.5.sh | 10 +- include/mysql-5.6.sh | 12 +- include/mysql-5.7.sh | 16 +- include/nginx.sh | 8 +- include/openresty.sh | 8 +- include/percona-5.5.sh | 14 +- include/percona-5.6.sh | 16 +- include/percona-5.7.sh | 16 +- include/php-5.3.sh | 30 ++-- include/php-5.4.sh | 28 ++-- include/php-5.5.sh | 24 +-- include/php-5.6.sh | 22 +-- include/php-7.sh | 28 ++-- include/pureftpd.sh | 8 +- include/redis.sh | 4 +- include/tcmalloc.sh | 2 +- include/tengine.sh | 16 +- include/tomcat-7.sh | 24 +-- include/tomcat-8.sh | 24 +-- include/upgrade_db.sh | 16 +- include/upgrade_phpmyadmin.sh | 2 +- include/upgrade_redis.sh | 2 +- include/upgrade_web.sh | 6 +- include/xcache.sh | 6 +- include/zendopcache.sh | 4 +- init.d/Memcached-init-CentOS | 2 +- init.d/Memcached-init-Ubuntu | 16 +- init.d/Nginx-init-CentOS | 40 ++--- init.d/Nginx-init-Ubuntu | 274 ++++++++++++++++---------------- init.d/Redis-server-init-CentOS | 6 +- init.d/Redis-server-init-Ubuntu | 68 ++++---- init.d/Shadowsocks-python-init | 16 +- init.d/Supervisor-init-CentOS | 24 +-- init.d/Tomcat-init | 10 +- install.sh | 70 ++++---- options.conf | 6 +- pureftpd_vhost.sh | 32 ++-- reset_db_root_password.sh | 6 +- shadowsocks.sh | 28 ++-- tools/ckssh.py | 4 +- tools/db_bk.sh | 4 +- tools/mabs.sh | 192 +++++++++++----------- tools/mscp.exp | 222 +++++++++++++------------- tools/mssh.exp | 166 +++++++++---------- tools/thread.sh | 48 +++--- tools/website_bk.sh | 2 +- uninstall.sh | 44 ++--- upgrade.sh | 18 +-- vhost.sh | 42 ++--- 79 files changed, 1040 insertions(+), 1025 deletions(-) create mode 100644 include/check_dir.sh diff --git a/apps.conf b/apps.conf index 5bf8e4e5..2d8f35f5 100644 --- a/apps.conf +++ b/apps.conf @@ -41,9 +41,9 @@ php_7_version=7.0.7 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.4-4 +ImageMagick_version=6.9.4-5 imagick_version=3.4.1 -GraphicsMagick_version=1.3.23 +GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 libiconv_version=1.14 libmcrypt_version=2.5.8 diff --git a/backup.sh b/backup.sh index 8e497f90..b71fe1f5 100755 --- a/backup.sh +++ b/backup.sh @@ -65,5 +65,5 @@ elif [ "$backup_destination" == 'local,remote' ];then [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK - ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log + ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log fi diff --git a/backup_setup.sh b/backup_setup.sh index ecfaf182..de188dd1 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -18,20 +18,21 @@ printf " ####################################################################### " +. ./options.conf . ./include/color.sh -. ./include/check_db.sh +. ./include/check_dir.sh # Check if user is root [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -while : +while : do echo echo 'Please select your backup destination:' echo -e "\t${CMSG}1${CEND}. Only Localhost" echo -e "\t${CMSG}2${CEND}. Only Remote host" echo -e "\t${CMSG}3${CEND}. Localhost and Remote host" - read -p "Please input a number:(Default 1 press Enter) " DESC_BK + read -p "Please input a number:(Default 1 press Enter) " DESC_BK [ -z "$DESC_BK" ] && DESC_BK=1 if [[ ! $DESC_BK =~ ^[1-3]$ ]];then echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" @@ -64,14 +65,11 @@ done [ "$CONTENT_BK" == '2' ] && sed -i 's@^backup_content=.*@backup_content=web@' ./options.conf [ "$CONTENT_BK" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf -. ./options.conf -. ./include/check_db.sh - while : do echo echo "Please enter the directory for save the backup file: " - read -p "(Default directory: $backup_dir): " NEW_backup_dir + read -p "(Default directory: $backup_dir): " NEW_backup_dir [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then echo "${CWARNING}input error! ${CEND}" @@ -85,7 +83,7 @@ while : do echo echo "Pleas enter a valid backup number of days: " - read -p "(Default days: 5): " expired_days + read -p "(Default days: 5): " expired_days [ -z "$expired_days" ] && expired_days=5 [ -n "`echo $expired_days | sed -n "/^[0-9]\+$/p"`" ] && break || echo "${CWARNING}input error! Please only enter numbers! ${CEND}" done @@ -116,7 +114,7 @@ if [ "$CONTENT_BK" != '1' ];then do echo echo "Please enter one or more name for website, separate multiple website names with commas: " - read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name + read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name website_name=`echo $website_name | tr -d ' '` [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`" W_tmp=0 @@ -134,7 +132,7 @@ echo "You have to backup the content:" [ "$CONTENT_BK" != '2' ] && echo "Database: ${CMSG}$db_name${CEND}" [ "$CONTENT_BK" != '1' ] && echo "Website: ${CMSG}$website_name${CEND}" -if [[ "$DESC_BK" =~ ^[2,3]$ ]];then +if [[ "$DESC_BK" =~ ^[2,3]$ ]];then > tools/iplist.txt while : do @@ -143,10 +141,10 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]];then [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue echo read -p "Please enter the remote host port(Default: 22) : " remote_port - [ -z "$remote_port" ] && remote_port=22 + [ -z "$remote_port" ] && remote_port=22 echo read -p "Please enter the remote host user(Default: root) : " remote_user - [ -z "$remote_user" ] && remote_user=root + [ -z "$remote_user" ] && remote_user=root echo read -p "Please enter the remote host password: " remote_password IPcode=$(echo "ibase=16;$(echo "$remote_ip" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') @@ -158,7 +156,7 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]];then [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}" while : do - read -p "Do you want to add more host ? [y/n]: " more_host_yn + read -p "Do you want to add more host ? [y/n]: " more_host_yn if [[ ! "$more_host_yn" =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else diff --git a/config/index.html b/config/index.html index 5436c485..bb1a0871 100644 --- a/config/index.html +++ b/config/index.html @@ -12,9 +12,9 @@ } .links {color: #009900} #main { - margin-right: auto; - margin-left: auto; - width: 920px; + margin-right: auto; + margin-left: auto; + width: 920px; } diff --git a/config/index_cn.html b/config/index_cn.html index 712e554b..54e8184b 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -12,9 +12,9 @@ } .links {color: #009900} #main { - margin-right: auto; - margin-left: auto; - width: 920px; + margin-right: auto; + margin-left: auto; + width: 920px; } diff --git a/config/nginx.conf b/config/nginx.conf index 953cab2c..386ca1bf 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -23,7 +23,7 @@ http { keepalive_timeout 120; server_tokens off; tcp_nodelay on; - + fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index 54acf13c..862b4da6 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -23,7 +23,7 @@ http { keepalive_timeout 120; server_tokens off; tcp_nodelay on; - + fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index 5b90b040..a6af8930 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -23,7 +23,7 @@ http { keepalive_timeout 120; server_tokens off; tcp_nodelay on; - + fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; diff --git a/config/pure-ftpd.conf b/config/pure-ftpd.conf index 707afe93..4758a0db 100644 --- a/config/pure-ftpd.conf +++ b/config/pure-ftpd.conf @@ -5,7 +5,7 @@ # # ############################################################ -# If you want to run Pure-FTPd with this configuration +# If you want to run Pure-FTPd with this configuration # instead of command-line options, please run the # following command : # @@ -91,7 +91,7 @@ SyslogFacility ftp -# Don't resolve host names in log files. Logs are less verbose, but +# Don't resolve host names in log files. Logs are less verbose, but # it uses less bandwidth. Set this to "yes" on very busy servers or # if you don't have a working DNS. @@ -151,7 +151,7 @@ UnixAuthentication yes # user wasn't found, another try # will be done with /etc/passwd and # /etc/shadow. If the SQL authentication fails because the password was wrong, # the authentication chain stops here. Authentication methods are chained in -# the order they are given. +# the order they are given. @@ -361,8 +361,8 @@ CreateHomeDir no -# This option is useful with servers where anonymous upload is -# allowed. As /var/ftp is in /var, it save some space and protect +# This option is useful with servers where anonymous upload is +# allowed. As /var/ftp is in /var, it save some space and protect # the log files. When the partition is more that X percent full, # new uploads are disallowed. @@ -440,7 +440,7 @@ CustomerProof yes # for remote clients if they don't use UTF-8. # Works only if pure-ftpd has been compiled with --with-rfc2640 -# FileSystemCharset big5 -# ClientCharset big5 +# FileSystemCharset big5 +# ClientCharset big5 AllowOverwrite on AllowStoreRestart on diff --git a/config/server.xml b/config/server.xml index 5a6db165..60dca227 100644 --- a/config/server.xml +++ b/config/server.xml @@ -28,7 +28,7 @@ acceptCount="1000" debug="0" disableUploadTimeout="true" - useBodyEncodingForURI="true" + useBodyEncodingForURI="true" enableLookups="false" URIEncoding="UTF-8" /> diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 1742fe6c..bccdb456 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -12,7 +12,7 @@ Install_GraphicsMagick() { cd $oneinstack_dir/src src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/$GraphicsMagick_version/GraphicsMagick-$GraphicsMagick_version.tar.gz && Download_src -tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz +tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz cd GraphicsMagick-$GraphicsMagick_version ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static make && make install @@ -26,11 +26,11 @@ cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then src_url=https://pecl.php.net/get/gmagick-2.0.2RC2.tgz && Download_src - tar xzf gmagick-2.0.2RC2.tgz + tar xzf gmagick-2.0.2RC2.tgz cd gmagick-2.0.2RC2 else src_url=http://pecl.php.net/get/gmagick-$gmagick_version.tgz && Download_src - tar xzf gmagick-$gmagick_version.tgz + tar xzf gmagick-$gmagick_version.tgz cd gmagick-$gmagick_version fi make clean diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 0d90a9a8..8b1ac5a8 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -15,62 +15,62 @@ cd $oneinstack_dir/src PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` PHP_main_version=${PHP_version%.*} -[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` +[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` if [ "$OS_BIT" == '64' ] ;then if [ "$PHP_main_version" == '5.6' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src - tar xzf zend-loader-php5.6-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.6-linux-x86_64 + tar xzf zend-loader-php5.6-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + rm -rf zend-loader-php5.6-linux-x86_64 fi if [ "$PHP_main_version" == '5.5' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src - tar xzf zend-loader-php5.5-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.5-linux-x86_64 + tar xzf zend-loader-php5.5-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + rm -rf zend-loader-php5.5-linux-x86_64 fi if [ "$PHP_main_version" == '5.4' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 fi if [ "$PHP_main_version" == '5.3' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 fi else if [ "$PHP_main_version" == '5.6' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.6-linux-i386.tar.gz && Download_src - tar xzf zend-loader-php5.6-linux-i386.tar.gz - /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.6-linux-i386 + tar xzf zend-loader-php5.6-linux-i386.tar.gz + /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + rm -rf zend-loader-php5.6-linux-i386 fi if [ "$PHP_main_version" == '5.5' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.5-linux-i386.tar.gz && Download_src tar xzf zend-loader-php5.5-linux-i386.tar.gz - /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf zend-loader-php5.5-linux-x386 fi if [ "$PHP_main_version" == '5.4' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src - tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi if [ "$PHP_main_version" == '5.3' ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src - tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` + rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 fi fi @@ -85,7 +85,7 @@ EOF echo "${CSUCCESS}ZendGuardLoader module install successfully! ${CEND}" [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo "${CFAILURE}ZendGuardLoader module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}ZendGuardLoader module install failed, Please contact the author! ${CEND}" fi cd .. } diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 3189605c..86192a8c 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -10,10 +10,10 @@ Install_Apache-2-2() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_2_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_2_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf httpd-$apache_2_version.tar.gz cd httpd-$apache_2_version @@ -31,7 +31,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -48,7 +48,7 @@ if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then +elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 @@ -85,7 +85,7 @@ NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP + ServerName $TMP_IP ErrorLog "$wwwlogs_dir/error_apache.log" CustomLog "$wwwlogs_dir/access_apache.log" common @@ -100,7 +100,7 @@ NameVirtualHost *:$TMP_PORT SetHandler server-status Order Deny,Allow Deny from all - Allow from 127.0.0.1 + Allow from 127.0.0.1 EOF diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 22035a3e..d73b1001 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -11,9 +11,9 @@ Install_Apache-2-4() { cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-$apr_version.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-util-$apr_util_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_4_version.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-$apr_version.tar.gz && Download_src +src_url=http://archive.apache.org/dist/apr/apr-util-$apr_util_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_4_version.tar.gz && Download_src tar xzf pcre-$pcre_version.tar.gz cd pcre-$pcre_version @@ -22,7 +22,7 @@ make && make install cd .. id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf httpd-$apache_4_version.tar.gz tar xzf apr-$apr_version.tar.gz @@ -44,7 +44,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -61,7 +61,7 @@ if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then +elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 @@ -97,7 +97,7 @@ cat >> $apache_install_dir/conf/vhost/0.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP + ServerName $TMP_IP ErrorLog "$wwwlogs_dir/error_apache.log" CustomLog "$wwwlogs_dir/access_apache.log" common @@ -113,7 +113,7 @@ cat >> $apache_install_dir/conf/vhost/0.conf << EOF SetHandler server-status Order Deny,Allow Deny from all - Allow from 127.0.0.1 + Allow from 127.0.0.1 EOF diff --git a/include/check_dir.sh b/include/check_dir.sh new file mode 100644 index 00000000..a099855a --- /dev/null +++ b/include/check_dir.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Author: yeho +# 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 + +# check MySQL 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 "$percona_install_dir/support-files" ] && { db_install_dir=$percona_install_dir; db_data_dir=$percona_data_dir; } + +# check Nginx dir +[ -e "$nginx_install_dir/sbin/nginx" ] && web_install_dir=$nginx_install_dir +[ -e "$tengine_install_dir/sbin/nginx" ] && web_install_dir=$tengine_install_dir +[ -e "$openresty_install_dir/nginx/sbin/nginx" ] && web_install_dir=$openresty_install_dir/nginx diff --git a/include/check_os.sh b/include/check_os.sh index e521da89..1538b3e2 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -15,15 +15,15 @@ if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];t [ -n "`grep ' 5\.' /etc/redhat-release`" -o -n "`grep 'Aliyun Linux release5' /etc/issue`" ] && CentOS_RHEL_version=5 elif [ -n "`grep bian /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Debian' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } Debian_version=`lsb_release -sr | awk -F. '{print $1}'` elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deepin' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } - Debian_version=`lsb_release -sr | awk -F. '{print $1}'` + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + Debian_version=`lsb_release -sr | awk -F. '{print $1}'` elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' ];then OS=Ubuntu - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } Ubuntu_version=`lsb_release -sr | awk -F. '{print $1}'` else echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" diff --git a/include/check_port.py b/include/check_port.py index effed50a..a5c8709e 100755 --- a/include/check_port.py +++ b/include/check_port.py @@ -5,7 +5,7 @@ def IsOpen(ip,port): try: s.connect((ip,int(port))) s.shutdown(2) - print True + print True except: print False if __name__ == '__main__': diff --git a/include/color.sh b/include/color.sh index bbbd29a5..7f0717f8 100644 --- a/include/color.sh +++ b/include/color.sh @@ -10,11 +10,11 @@ echo=echo for cmd in echo /bin/echo; do - $cmd >/dev/null 2>&1 || continue - if ! $cmd -e "" | grep -qE '^-e'; then - echo=$cmd - break - fi + $cmd >/dev/null 2>&1 || continue + if ! $cmd -e "" | grep -qE '^-e'; then + echo=$cmd + break + fi done CSI=$($echo -e "\033[") CEND="${CSI}0m" diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index 24c4401f..c97f61ed 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -13,8 +13,8 @@ cd $oneinstack_dir/src src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz -tar xzf eaccelerator-eaccelerator-42067ac.tar.gz -cd eaccelerator-eaccelerator-42067ac +tar xzf eaccelerator-eaccelerator-42067ac.tar.gz +cd eaccelerator-eaccelerator-42067ac make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config diff --git a/include/get_ipaddr.py b/include/get_ipaddr.py index d5ba89de..d2f121c5 100755 --- a/include/get_ipaddr.py +++ b/include/get_ipaddr.py @@ -18,5 +18,5 @@ def Get_local_ip(): return "127.0.0.1" if __name__ == "__main__": - IPADDR = Get_local_ip() + IPADDR = Get_local_ip() print IPADDR diff --git a/include/hhvm_CentOS.sh b/include/hhvm_CentOS.sh index 41e91349..a9934a41 100644 --- a/include/hhvm_CentOS.sh +++ b/include/hhvm_CentOS.sh @@ -12,7 +12,7 @@ Install_hhvm_CentOS() { cd $oneinstack_dir/src id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user if [ "$CentOS_RHEL_version" == '7' ];then if [ -e /etc/yum.repos.d/epel.repo_bk ];then @@ -43,7 +43,7 @@ if [ "$CentOS_RHEL_version" == '6' ];then if [ -e /etc/yum.repos.d/epel.repo_bk ];then /bin/mv /etc/yum.repos.d/epel.repo{_bk,} elif [ ! -e /etc/yum.repos.d/epel.repo ];then - cat > /etc/yum.repos.d/epel.repo << EOF + cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch @@ -69,7 +69,7 @@ enabled=1 gpgcheck=0 EOF yum --disablerepo=epel -y install mysql mysql-devel mysql-libs - yum --disablerepo=epel -y install hhvm + yum --disablerepo=epel -y install hhvm fi userdel -r nginx;userdel -r saslauth @@ -137,9 +137,9 @@ post_max_size = 50000000 EOF if [ -e "$web_install_dir/sbin/nginx" -a -e "/usr/bin/hhvm" -a ! -e "$php_install_dir" ];then - sed -i 's@/dev/shm/php-cgi.sock@/var/log/hhvm/sock@' $web_install_dir/conf/nginx.conf - [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf - sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf + sed -i 's@/dev/shm/php-cgi.sock@/var/log/hhvm/sock@' $web_install_dir/conf/nginx.conf + [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf + sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf service nginx reload fi diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 62da61c9..a92a1129 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -14,11 +14,11 @@ yum clean all yum makecache if [ "$CentOS_RHEL_version" == '7' ];then - yum -y install iptables-services + yum -y install iptables-services systemctl mask firewalld.service systemctl enable iptables.service elif [ "$CentOS_RHEL_version" == '6' ];then - yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" + yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" elif [ "$CentOS_RHEL_version" == '5' ];then yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" fi @@ -58,9 +58,9 @@ sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab init q # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc -# history size +# history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile [ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc @@ -85,8 +85,8 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Set DNS #cat > /etc/resolv.conf << EOF -#nameserver 114.114.114.114 -#nameserver 8.8.8.8 +#nameserver 114.114.114.114 +#nameserver 8.8.8.8 #EOF # alias vi @@ -96,17 +96,17 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 8192 -net.ipv4.tcp_fin_timeout = 30 +fs.inotify.max_user_instances = 8192 +net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 65536 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 65535 +net.core.somaxconn = 65535 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_max_orphans = 262144 @@ -118,24 +118,24 @@ if [ "$CentOS_RHEL_version" == '5' ];then sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n elif [ "$CentOS_RHEL_version" == '6' ];then - sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init + sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.netfilter.nf_conntrack_max = 1048576 +net.netfilter.nf_conntrack_max = 1048576 net.netfilter.nf_conntrack_tcp_timeout_established = 1200 EOF elif [ "$CentOS_RHEL_version" == '7' ];then - sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf + sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.netfilter.nf_conntrack_max = 1048576 +net.netfilter.nf_conntrack_max = 1048576 net.netfilter.nf_conntrack_tcp_timeout_established = 1200 EOF fi init q # Update time -ntpdate pool.ntp.org +ntpdate pool.ntp.org [ -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } service crond restart @@ -144,10 +144,10 @@ if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep ':INPUT DROP' /etc/sysconfig/ IPTABLES_STATUS=yes else IPTABLES_STATUS=no -fi +fi if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/sysconfig/iptables' ] && /bin/mv /etc/sysconfig/iptables{,_bk} + [ -e '/etc/sysconfig/iptables' ] && /bin/mv /etc/sysconfig/iptables{,_bk} cat > /etc/sysconfig/iptables << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -172,15 +172,15 @@ EOF fi FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/sysconfig/iptables` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/sysconfig/iptables +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/sysconfig/iptables service iptables restart service sshd restart # install tmux if [ ! -e "`which tmux`" ];then cd src - src_url=http://mirrors.linuxeye.com/oneinstack/src/libevent-2.0.22-stable.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/tmux-2.2.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/libevent-2.0.22-stable.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/tmux-2.2.tar.gz && Download_src tar xzf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable ./configure @@ -203,7 +203,7 @@ fi # install htop if [ ! -e "`which htop`" ];then cd src - src_url=http://hisham.hm/htop/releases/2.0.0/htop-2.0.0.tar.gz && Download_src + 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 diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 50ed5802..62dfd43b 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -17,19 +17,19 @@ dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade +[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate ntpdate +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc do apt-get -y install $Package done # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc -# history size -[ -z "`cat ~/.bashrc | grep ^HISTSIZE`" ] && echo 'HISTSIZE=100' >> ~/.bashrc +# history size +[ -z "`cat ~/.bashrc | grep ^HISTSIZE`" ] && echo 'HISTSIZE=100' >> ~/.bashrc [ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf @@ -66,30 +66,30 @@ sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 8192 +fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 65536 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 65535 +net.core.somaxconn = 65535 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p -sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup +sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup sed -i 's@^# en_US.UTF-8@en_US.UTF-8@' /etc/locale.gen init q # Update time -ntpdate pool.ntp.org +ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart @@ -101,7 +101,7 @@ else fi if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} + [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -125,8 +125,8 @@ COMMIT EOF fi -FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules +FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules cat > /etc/network/if-pre-up.d/iptables << EOF #!/bin/bash diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 24bcde25..2e1e2c15 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -17,7 +17,7 @@ dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update # check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade +[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz ntpdate @@ -25,11 +25,11 @@ do apt-get -y install $Package done -if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then +if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then apt-get -y install libcloog-ppl1 apt-get -y remove bison cd src - src_url=http://ftp.gnu.org/gnu/bison/bison-2.7.1.tar.gz && Download_src + src_url=http://ftp.gnu.org/gnu/bison/bison-2.7.1.tar.gz && Download_src tar xzf bison-2.7.1.tar.gz cd bison-2.7.1 ./configure @@ -48,10 +48,10 @@ fi #[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc -# history size -sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc +# history size +sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc [ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf @@ -85,31 +85,31 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # /etc/sysctl.conf [ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 8192 +fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 -net.ipv4.tcp_fin_timeout = 30 +net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 65536 +net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 65535 +net.core.somaxconn = 65535 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_max_orphans = 262144 EOF sysctl -p -sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup +sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup sed -i 's@^@#@g' /etc/init/tty[3-6].conf echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local -sed -i 's@^@#@g' /etc/init/control-alt-delete.conf +sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time -ntpdate pool.ntp.org +ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } service cron restart @@ -121,7 +121,7 @@ else fi if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} + [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -145,8 +145,8 @@ COMMIT EOF fi -FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules +FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` +[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules cat > /etc/network/if-pre-up.d/iptables << EOF #!/bin/bash diff --git a/include/ioncube.sh b/include/ioncube.sh index 889396a1..93a869e2 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -22,18 +22,18 @@ else tar xzf ioncube_loaders_lin_x86.tar.gz fi -[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` +[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` if [ "$PHP_main_version" == '5.6' ];then - /bin/cp ioncube/ioncube_loader_lin_5.6.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ioncube/ioncube_loader_lin_5.6.so `$php_install_dir/bin/php-config --extension-dir` zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.6.so" elif [ "$PHP_main_version" == '5.5' ];then - /bin/cp ioncube/ioncube_loader_lin_5.5.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ioncube/ioncube_loader_lin_5.5.so `$php_install_dir/bin/php-config --extension-dir` zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.5.so" elif [ "$PHP_main_version" == '5.4' ];then - /bin/cp ioncube/ioncube_loader_lin_5.4.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ioncube/ioncube_loader_lin_5.4.so `$php_install_dir/bin/php-config --extension-dir` zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.4.so" elif [ "$PHP_main_version" == '5.3' ];then - /bin/cp ioncube/ioncube_loader_lin_5.3.so `$php_install_dir/bin/php-config --extension-dir` + /bin/cp ioncube/ioncube_loader_lin_5.3.so `$php_install_dir/bin/php-config --extension-dir` zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.3.so" else exit 1 diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index a8d98054..980af957 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -19,7 +19,7 @@ src_url=http://mirrors.linuxeye.com/jdk/$JDK_FILE && Download_src [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` -tar xzf $JDK_FILE +tar xzf $JDK_FILE if [ -d "$JDK_NAME" ];then rm -rf $JAVA_dir; mkdir -p $JAVA_dir diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 571da828..32b458b3 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -15,7 +15,7 @@ cd $oneinstack_dir/src LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 src_url=$DOWN_ADDR/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src @@ -23,9 +23,9 @@ id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz +tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* $mariadb_install_dir +mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* $mariadb_install_dir if [ "$je_tc_malloc" == '1' ];then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe elif [ "$je_tc_malloc" == '2' ];then @@ -36,7 +36,7 @@ if [ -d "$mariadb_install_dir/support-files" ];then echo "${CSUCCESS}MariaDB install successfully! ${CEND}" else rm -rf $mariadb_install_dir - echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ fi @@ -77,7 +77,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -99,7 +99,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $mariadb_data_dir/mysql-error.log slow_query_log = 1 @@ -146,7 +146,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -178,7 +178,7 @@ $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_in chown mysql.mysql -R $mariadb_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -190,7 +190,7 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.proxies $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.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 service mysqld stop } diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index bb8e8867..f0dcb4fa 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -15,7 +15,7 @@ cd $oneinstack_dir/src LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 src_url=$DOWN_ADDR/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src @@ -23,9 +23,9 @@ id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz +tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* $mariadb_install_dir +mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* $mariadb_install_dir if [ "$je_tc_malloc" == '1' ];then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe elif [ "$je_tc_malloc" == '2' ];then @@ -36,7 +36,7 @@ if [ -d "$mariadb_install_dir/support-files" ];then echo "${CSUCCESS}MariaDB install successfully! ${CEND}" else rm -rf $mariadb_install_dir - echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ fi @@ -77,7 +77,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -99,7 +99,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $mariadb_data_dir/mysql-error.log slow_query_log = 1 @@ -146,7 +146,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -178,7 +178,7 @@ $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_in chown mysql.mysql -R $mariadb_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -190,7 +190,7 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.proxies $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.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 service mysqld stop } diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 5565c6a3..bde7ac94 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -15,7 +15,7 @@ cd $oneinstack_dir/src LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 src_url=$DOWN_ADDR/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src @@ -23,9 +23,9 @@ id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz +tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* $mariadb_install_dir +mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* $mariadb_install_dir if [ "$je_tc_malloc" == '1' ];then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe elif [ "$je_tc_malloc" == '2' ];then @@ -77,7 +77,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -147,7 +147,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -179,7 +179,7 @@ $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_in chown mysql.mysql -R $mariadb_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -191,7 +191,7 @@ $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.proxies $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;" $mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;" rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.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 service mysqld stop } diff --git a/include/memcached.sh b/include/memcached.sh index fddf0872..0292af0d 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -26,10 +26,10 @@ if [ -d "$memcached_install_dir/include/memcached" ];then cd .. rm -rf memcached-$memcached_version ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached - [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached + [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached service memcached start else @@ -52,8 +52,8 @@ if [ -e "$php_install_dir/bin/phpize" ];then cd pecl-memcache-php7 else src_url=http://pecl.php.net/get/memcache-$memcache_pecl_version.tgz && Download_src - tar xzf memcache-$memcache_pecl_version.tgz - cd memcache-$memcache_pecl_version + tar xzf memcache-$memcache_pecl_version.tgz + cd memcache-$memcache_pecl_version fi make clean $php_install_dir/bin/phpize @@ -68,7 +68,7 @@ EOF cd .. rm -rf memcache-$memcache_pecl_version else - echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" fi fi cd .. @@ -81,16 +81,16 @@ if [ -e "$php_install_dir/bin/phpize" ];then # php memcached extension tar xzf libmemcached-$libmemcached_version.tar.gz cd libmemcached-$libmemcached_version - [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure + [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure ./configure --with-memcached=$memcached_install_dir make && make install cd .. rm -rf libmemcached-$libmemcached_version if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git - #cd php-memcached + #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git + #cd php-memcached src_url=http://mirrors.linuxeye.com/oneinstack/src/php-memcached-php7.tgz && Download_src tar xzf php-memcached-php7.tgz cd php-memcached-php7 @@ -113,7 +113,7 @@ EOF rm -rf memcached-$memcached_pecl_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" fi fi cd .. diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 42fad360..8cb08536 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -84,7 +84,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -106,7 +106,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $mysql_data_dir/mysql-error.log slow_query_log = 1 @@ -153,7 +153,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -185,7 +185,7 @@ $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_instal chown mysql.mysql -R $mysql_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -198,7 +198,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 [ -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 service mysqld stop } diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 661a5cc5..2d25f704 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -67,7 +67,7 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $mysql_install_dir +basedir = $mysql_install_dir datadir = $mysql_data_dir pid-file = $mysql_data_dir/mysql.pid user = mysql @@ -84,7 +84,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -106,7 +106,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $mysql_data_dir/mysql-error.log slow_query_log = 1 @@ -154,7 +154,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -186,7 +186,7 @@ $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_instal chown mysql.mysql -R $mysql_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -198,7 +198,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 -echo "$mysql_install_dir/lib" > /etc/ld.so.conf.d/mysql.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 diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 07322e86..c0b99aca 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -22,10 +22,10 @@ src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}. id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir +[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir -tar zxf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz +tar zxf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* $mysql_install_dir if [ "$je_tc_malloc" == '1' ];then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe @@ -67,7 +67,7 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $mysql_install_dir +basedir = $mysql_install_dir datadir = $mysql_data_dir pid-file = $mysql_data_dir/mysql.pid user = mysql @@ -84,7 +84,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -106,7 +106,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $mysql_data_dir/mysql-error.log slow_query_log = 1 @@ -155,7 +155,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -187,7 +187,7 @@ $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysq chown mysql.mysql -R $mysql_data_dir [ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -196,7 +196,7 @@ $mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' $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 +echo "$mysql_install_dir/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig service mysqld stop } diff --git a/include/nginx.sh b/include/nginx.sh index 3d32c52b..7fccf9df 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -14,7 +14,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz tar xzf nginx-$nginx_version.tar.gz @@ -44,11 +44,11 @@ if [ -e "$nginx_install_dir/conf/nginx.conf" ];then echo "${CSUCCESS}Nginx install successfully! ${CEND}" else rm -rf $nginx_install_dir - echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" + echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $nginx_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile . /etc/profile @@ -86,7 +86,7 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $nginx_install_dir/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF diff --git a/include/openresty.sh b/include/openresty.sh index 8b25b6a9..f2496131 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -14,7 +14,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz tar xzf openresty-$openresty_version.tar.gz @@ -41,11 +41,11 @@ if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then echo "${CSUCCESS}OpenResty install successfully! ${CEND}" else rm -rf $openresty_install_dir - echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}" + echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}" kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$openresty_install_dir/nginx/sbin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$openresty_install_dir/nginx/sbin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $openresty_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$openresty_install_dir/nginx/sbin:\1@" /etc/profile . /etc/profile @@ -83,7 +83,7 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 00d762ac..a4e05bee 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -16,8 +16,8 @@ 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_5_version.tar.gz -cd percona-server-$percona_5_5_version +tar zxf percona-server-$percona_5_5_version.tar.gz +cd percona-server-$percona_5_5_version if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -40,7 +40,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +make -j `grep processor /proc/cpuinfo | wc -l` make install if [ -d "$percona_install_dir/support-files" ];then @@ -92,7 +92,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -114,7 +114,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $percona_data_dir/mysql-error.log slow_query_log = 1 @@ -161,7 +161,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -193,7 +193,7 @@ $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_in 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 +[ -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 diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 36edc509..82355206 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -16,8 +16,8 @@ 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_6_version.tar.gz -cd percona-server-$percona_5_6_version +tar zxf percona-server-$percona_5_6_version.tar.gz +cd percona-server-$percona_5_6_version if [ "$je_tc_malloc" == '1' ];then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" elif [ "$je_tc_malloc" == '2' ];then @@ -39,13 +39,13 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +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_6_version + rm -rf percona-server-$percona_5_6_version else rm -rf $percona_install_dir echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" @@ -91,7 +91,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -113,7 +113,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $percona_data_dir/mysql-error.log slow_query_log = 1 @@ -161,7 +161,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -193,7 +193,7 @@ $percona_install_dir/scripts/mysql_install_db --user=mysql --basedir=$percona_in 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 +[ -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 diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 74aadd0e..a87eaaa4 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -30,8 +30,8 @@ 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 +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 @@ -54,13 +54,13 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +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 + rm -rf percona-server-$percona_5_7_version else rm -rf $percona_install_dir echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" @@ -106,7 +106,7 @@ back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 -table_open_cache = 128 +table_open_cache = 128 max_allowed_packet = 500M binlog_cache_size = 1M max_heap_table_size = 8M @@ -128,7 +128,7 @@ ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed -expire_logs_days = 7 +expire_logs_days = 7 log_error = $percona_data_dir/mysql-error.log slow_query_log = 1 @@ -176,7 +176,7 @@ read_buffer = 4M write_buffer = 4M EOF -sed -i "s@max_connections.*@max_connections = $(($Mem/2))@" /etc/my.cnf +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 @@ -208,7 +208,7 @@ $percona_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$pe 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 +[ -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 diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 5fd1702e..1c5efd8d 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -44,7 +44,7 @@ cd mhash-$mhash_version ./configure make && make install cd .. -rm -rf mhash-$mhash_version +rm -rf mhash-$mhash_version echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -58,14 +58,14 @@ ldconfig ./configure make && make install cd .. -rm -rf mcrypt-$mcrypt_version +rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user # Problem building php-5.3 with openssl if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then - if [ -e '/usr/local/openssl/lib/libcrypto.a' ];then + if [ -e '/usr/local/openssl/lib/libcrypto.a' ];then OpenSSL_args='--with-openssl=/usr/local/openssl' else src_url=http://mirrors.linuxeye.com/oneinstack/src/openssl-1.0.0s.tar.gz && Download_src @@ -81,7 +81,7 @@ if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then Curl_args='--with-curl=/usr/local/curl' else src_url=http://mirrors.linuxeye.com/oneinstack/src/curl-7.29.0.tar.gz && Download_src - tar xzf curl-7.29.0.tar.gz + tar xzf curl-7.29.0.tar.gz cd curl-7.29.0 LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl make && make install @@ -97,7 +97,7 @@ fi tar xzf php-$php_3_version.tar.gz patch -d php-$php_3_version -p0 < fpm-race-condition.patch cd php-$php_3_version -patch -p1 < ../php5.3patch +patch -p1 < ../php5.3patch patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir @@ -136,7 +136,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -178,10 +178,10 @@ if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ] [global] pid = run/php-fpm.pid error_log = log/php-fpm.log -log_level = warning +log_level = warning emergency_restart_threshold = 30 -emergency_restart_interval = 60s +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -193,11 +193,11 @@ daemonize = yes listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 -listen.owner = $run_user -listen.group = $run_user +listen.owner = $run_user +listen.group = $run_user listen.mode = 0666 -user = $run_user -group = $run_user +user = $run_user +group = $run_user pm = dynamic pm.max_children = 12 @@ -222,7 +222,7 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF - [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf + [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf @@ -251,7 +251,7 @@ EOF sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi - #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf + #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then diff --git a/include/php-5.4.sh b/include/php-5.4.sh index db227819..6800f60a 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -24,7 +24,7 @@ cd libiconv-$libiconv_version ./configure --prefix=/usr/local make && make install cd .. -rm -rf libiconv-$libiconv_version +rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version @@ -35,14 +35,14 @@ cd libltdl ./configure --enable-ltdl-install make && make install cd ../../ -rm -rf libmcrypt-$libmcrypt_version +rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure make && make install cd .. -rm -rf mhash-$mhash_version +rm -rf mhash-$mhash_version echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig @@ -54,10 +54,10 @@ ldconfig ./configure make && make install cd .. -rm -rf mcrypt-$mcrypt_version +rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf php-$php_4_version.tar.gz patch -d php-$php_4_version -p0 < fpm-race-condition.patch @@ -98,7 +98,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -140,10 +140,10 @@ if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ] [global] pid = run/php-fpm.pid error_log = log/php-fpm.log -log_level = warning +log_level = warning emergency_restart_threshold = 30 -emergency_restart_interval = 60s +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -155,11 +155,11 @@ daemonize = yes listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 -listen.owner = $run_user -listen.group = $run_user +listen.owner = $run_user +listen.group = $run_user listen.mode = 0666 -user = $run_user -group = $run_user +user = $run_user +group = $run_user pm = dynamic pm.max_children = 12 @@ -184,7 +184,7 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF - [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf + [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf @@ -213,7 +213,7 @@ EOF sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi - #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf + #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 8dcffad2..c3cfdeed 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -57,7 +57,7 @@ cd .. rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf php-$php_5_version.tar.gz patch -d php-$php_5_version -p0 < fpm-race-condition.patch cd php-$php_5_version @@ -98,7 +98,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -154,10 +154,10 @@ if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ] [global] pid = run/php-fpm.pid error_log = log/php-fpm.log -log_level = warning +log_level = warning emergency_restart_threshold = 30 -emergency_restart_interval = 60s +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -169,16 +169,16 @@ daemonize = yes listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 -listen.owner = $run_user +listen.owner = $run_user listen.group = $run_user listen.mode = 0666 -user = $run_user -group = $run_user +user = $run_user +group = $run_user pm = dynamic -pm.max_children = 12 -pm.start_servers = 8 -pm.min_spare_servers = 6 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 pm.process_idle_timeout = 10s @@ -198,7 +198,7 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF - [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf + [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf @@ -227,7 +227,7 @@ EOF sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi - #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf + #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 969b8dc0..784c4ef6 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -56,7 +56,7 @@ cd .. rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf php-$php_6_version.tar.gz cd php-$php_6_version @@ -97,7 +97,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -153,10 +153,10 @@ if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ] [global] pid = run/php-fpm.pid error_log = log/php-fpm.log -log_level = warning +log_level = warning emergency_restart_threshold = 30 -emergency_restart_interval = 60s +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -168,16 +168,16 @@ daemonize = yes listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 -listen.owner = $run_user +listen.owner = $run_user listen.group = $run_user listen.mode = 0666 -user = $run_user +user = $run_user group = $run_user pm = dynamic -pm.max_children = 12 -pm.start_servers = 8 -pm.min_spare_servers = 6 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 pm.process_idle_timeout = 10s @@ -197,7 +197,7 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF - [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf + [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf @@ -226,7 +226,7 @@ EOF sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi - #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf + #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then diff --git a/include/php-7.sh b/include/php-7.sh index 683328b0..775e632c 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -56,9 +56,9 @@ cd .. rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user -tar xzf php-$php_7_version.tar.gz +tar xzf php-$php_7_version.tar.gz cd php-$php_7_version make clean ./buildconf @@ -98,7 +98,7 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile . /etc/profile @@ -159,10 +159,10 @@ if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ] [global] pid = run/php-fpm.pid error_log = log/php-fpm.log -log_level = warning +log_level = warning emergency_restart_threshold = 30 -emergency_restart_interval = 60s +emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes @@ -174,16 +174,16 @@ daemonize = yes listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 -listen.owner = $run_user -listen.group = $run_user +listen.owner = $run_user +listen.group = $run_user listen.mode = 0666 -user = $run_user -group = $run_user +user = $run_user +group = $run_user pm = dynamic -pm.max_children = 12 -pm.start_servers = 8 -pm.min_spare_servers = 6 +pm.max_children = 12 +pm.start_servers = 8 +pm.min_spare_servers = 6 pm.max_spare_servers = 12 pm.max_requests = 2048 pm.process_idle_timeout = 10s @@ -203,7 +203,7 @@ env[TMPDIR] = /tmp env[TEMP] = /tmp EOF - [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf + [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf if [ $Mem -le 3000 ];then sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf @@ -232,7 +232,7 @@ EOF sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi - #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf + #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then diff --git a/include/pureftpd.sh b/include/pureftpd.sh index b4bc9f3a..6fcf0641 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -34,12 +34,12 @@ if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then chmod +x /etc/init.d/pureftpd [ "$OS" == 'CentOS' ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; [ -z "`grep ^'# Default-Start' /etc/init.d/pureftpd`" ] && sed -i "s@^# chkconfig.*@# chkconfig&\n# Default-Start: 2 3 4 5\n# Default-Stop: 0 1 6@" /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } - [ "$Debian_version" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd + [ "$Debian_version" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd cd ../../ /bin/cp config/pure-ftpd.conf $pureftpd_install_dir/etc - sed -i "s@^PureDB.*@PureDB $pureftpd_install_dir/etc/pureftpd.pdb@" $pureftpd_install_dir/etc/pure-ftpd.conf - sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" $pureftpd_install_dir/etc/pure-ftpd.conf + sed -i "s@^PureDB.*@PureDB $pureftpd_install_dir/etc/pureftpd.pdb@" $pureftpd_install_dir/etc/pure-ftpd.conf + sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" $pureftpd_install_dir/etc/pure-ftpd.conf ulimit -s unlimited service pureftpd start @@ -50,7 +50,7 @@ if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT service iptables save fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then if [ -z "`grep '20000:30000' /etc/iptables.up.rules`" ];then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT diff --git a/include/redis.sh b/include/redis.sh index efe53696..9c37cfb7 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -36,8 +36,8 @@ if [ -f "src/redis-server" ];then echo "${CSUCCESS}Redis-server install successfully! ${CEND}" cd .. rm -rf redis-$redis_version - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Redis-server-init-CentOS /etc/init.d/redis-server; chkconfig --add redis-server; chkconfig redis-server on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { useradd -M -s /sbin/nologin redis; chown -R redis:redis $redis_install_dir/var/; /bin/cp ../init.d/Redis-server-init-Ubuntu /etc/init.d/redis-server; update-rc.d redis-server defaults; } + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Redis-server-init-CentOS /etc/init.d/redis-server; chkconfig --add redis-server; chkconfig redis-server on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { useradd -M -s /sbin/nologin redis; chown -R redis:redis $redis_install_dir/var/; /bin/cp ../init.d/Redis-server-init-Ubuntu /etc/init.d/redis-server; update-rc.d redis-server defaults; } sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf #sysctl -p diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index 2335f913..d491dc97 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -12,7 +12,7 @@ Install_tcmalloc() { cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/gperftools-$tcmalloc_version.tar.gz && Download_src -tar xzf gperftools-$tcmalloc_version.tar.gz +tar xzf gperftools-$tcmalloc_version.tar.gz cd gperftools-$tcmalloc_version ./configure --enable-frame-pointers make && make install diff --git a/include/tengine.sh b/include/tengine.sh index 81a6a3c6..1a829005 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -14,11 +14,11 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && src_url=http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz -tar xzf tengine-$tengine_version.tar.gz -cd tengine-$tengine_version +tar xzf tengine-$tengine_version.tar.gz +cd tengine-$tengine_version # Modify Tengine version #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h @@ -38,7 +38,7 @@ fi make && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ];then cd .. - rm -rf tengine-$tengine_version + rm -rf tengine-$tengine_version echo "${CSUCCESS}Tengine install successfully! ${CEND}" else rm -rf $tengine_install_dir @@ -46,12 +46,12 @@ else kill -9 $$ fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$tengine_install_dir/sbin:\$PATH" >> /etc/profile +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$tengine_install_dir/sbin:\$PATH" >> /etc/profile [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $tengine_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/sbin:\1@" /etc/profile . /etc/profile -[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } +[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } +[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } cd .. sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx @@ -84,7 +84,7 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $tengine_install_dir/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $tengine_install_dir/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf +[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf uname -r | awk -F'.' '{if ($1$2>=39)S=0;else S=1}{exit S}' && [ -z "`grep 'reuse_port on;' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@worker_connections 51200;@worker_connections 51200;\n reuse_port on;@" $tengine_install_dir/conf/nginx.conf # worker_cpu_affinity diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index a0d92471..7bae61c9 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -26,18 +26,18 @@ rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ -e "$tomcat_install_dir/conf/server.xml" ];then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib cd $tomcat_install_dir/lib - [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina + [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina cd $tomcat_install_dir/lib/catalina jar xf ../catalina.jar sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties sed -i 's@^server.number=.*@server.number=7@' org/apache/catalina/util/ServerInfo.properties sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties jar cf ../catalina.jar ./* - cd ../../bin - rm -rf $tomcat_install_dir/lib/catalina - [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel + cd ../../bin + rm -rf $tomcat_install_dir/lib/catalina + [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev - tar xzf tomcat-native.tar.gz + tar xzf tomcat-native.tar.gz cd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config @@ -54,7 +54,7 @@ CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" EOF cd ../../../;rm -rf tomcat-native-* chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} cd $oneinstack_dir/src /bin/cp ../config/server.xml $tomcat_install_dir/conf sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml @@ -65,7 +65,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -81,7 +81,7 @@ EOF prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF - # logrotate tomcat catalina.out + # logrotate tomcat catalina.out cat > /etc/logrotate.d/tomcat << EOF $tomcat_install_dir/logs/catalina.out { daily @@ -101,7 +101,7 @@ controlRole readwrite \ unregister EOF cat > $tomcat_install_dir/conf/jmxremote.password << EOF -monitorRole `cat /dev/urandom | head -1 | md5sum | head -c 8` +monitorRole `cat /dev/urandom | head -1 | md5sum | head -c 8` # controlRole R&D EOF chown -R $run_user.$run_user $tomcat_install_dir @@ -109,13 +109,13 @@ EOF sed -i "s@JAVA_HOME=.*@JAVA_HOME=$JAVA_HOME@" /etc/init.d/tomcat sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=$tomcat_install_dir@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=$run_user@" /etc/init.d/tomcat - [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat; chkconfig tomcat on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults + [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat; chkconfig tomcat on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat install successfully! ${CEND}" fi else rm -rf $tomcat_install_dir - echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" kill -9 $$ fi service tomcat start diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index eea8b05b..1d906ff1 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -26,18 +26,18 @@ rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ -e "$tomcat_install_dir/conf/server.xml" ];then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib cd $tomcat_install_dir/lib - [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina + [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina cd $tomcat_install_dir/lib/catalina jar xf ../catalina.jar sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties sed -i 's@^server.number=.*@server.number=8@' org/apache/catalina/util/ServerInfo.properties sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties jar cf ../catalina.jar ./* - cd ../../bin - rm -rf $tomcat_install_dir/lib/catalina - [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev - tar xzf tomcat-native.tar.gz + cd ../../bin + rm -rf $tomcat_install_dir/lib/catalina + [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev + tar xzf tomcat-native.tar.gz cd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config @@ -54,7 +54,7 @@ CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" EOF cd ../../../;rm -rf tomcat-native-* chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} cd $oneinstack_dir/src /bin/cp ../config/server.xml $tomcat_install_dir/conf sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml @@ -65,7 +65,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -77,7 +77,7 @@ EOF cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF - EOF @@ -101,7 +101,7 @@ controlRole readwrite \ unregister EOF cat > $tomcat_install_dir/conf/jmxremote.password << EOF -monitorRole `cat /dev/urandom | head -1 | md5sum | head -c 8` +monitorRole `cat /dev/urandom | head -1 | md5sum | head -c 8` # controlRole R&D EOF chown -R $run_user.$run_user $tomcat_install_dir @@ -109,13 +109,13 @@ EOF sed -i "s@JAVA_HOME=.*@JAVA_HOME=$JAVA_HOME@" /etc/init.d/tomcat sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=$tomcat_install_dir@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=$run_user@" /etc/init.d/tomcat - [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat;chkconfig tomcat on; } + [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat;chkconfig tomcat on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat install successfully! ${CEND}" fi else rm -rf $tomcat_install_dir - echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" kill -9 $$ fi service tomcat start diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 4eb21a07..c893b482 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -77,7 +77,7 @@ do DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz fi [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 - + if [ -e "$DB_name.tar.gz" ];then echo "Download [${CMSG}$DB_name.tar.gz${CEND}] successfully! " else @@ -93,7 +93,7 @@ if [ -e "$DB_name.tar.gz" ];then echo "[${CMSG}$DB_name.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` - if [ "$DB" == 'MariaDB' ];then + if [ "$DB" == 'MariaDB' ];then service mysqld stop mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} @@ -109,16 +109,16 @@ if [ -e "$DB_name.tar.gz" ];then $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir chown mysql.mysql -R $mariadb_data_dir service mysqld start - $mariadb_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql + $mariadb_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql service mysqld restart $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" elif [ "$DB" == 'Percona' ];then - tar zxf $DB_name.tar.gz - cd $DB_name - make clean - if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ];then + tar zxf $DB_name.tar.gz + cd $DB_name + make clean + if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ];then cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DMYSQL_DATADIR=$percona_data_dir \ -DSYSCONFDIR=/etc \ @@ -191,6 +191,6 @@ $EXE_LINKER $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" - fi + fi fi } diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 7555ee2c..03698255 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -35,7 +35,7 @@ if [ -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ];then echo "[${CMSG}phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` - tar xzf phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz + tar xzf phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz rm -rf $wwwroot_dir/default/phpMyAdmin /bin/mv phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages $wwwroot_dir/default/phpMyAdmin /bin/cp $wwwroot_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index 80234daa..cf9bf747 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -51,7 +51,7 @@ if [ -e "redis-$NEW_Redis_version.tar.gz" ];then service redis-server start echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}" else - echo "${CFAILURE}Upgrade Redis failed! ${CEND}" + echo "${CFAILURE}Upgrade Redis failed! ${CEND}" fi cd .. fi diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 62eec873..609c6bb2 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -55,7 +55,7 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then kill -QUIT `cat /var/run/nginx.pid.oldbin` echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Nginx_version${CEND} to ${CWARNING}$NEW_Nginx_version${CEND}" else - echo "${CFAILURE}Upgrade Nginx failed! ${CEND}" + echo "${CFAILURE}Upgrade Nginx failed! ${CEND}" fi cd .. fi @@ -114,7 +114,7 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then kill -QUIT `cat /var/run/nginx.pid.oldbin` echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Tengine_version${CEND} to ${CWARNING}$NEW_Tengine_version${CEND}" else - echo "${CFAILURE}Upgrade Tengine failed! ${CEND}" + echo "${CFAILURE}Upgrade Tengine failed! ${CEND}" fi cd .. fi @@ -171,7 +171,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then kill -QUIT `cat /var/run/nginx.pid.oldbin` echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_OpenResty_version${CEND} to ${CWARNING}$NEW_OpenResty_version${CEND}" else - echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}" + echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}" fi cd .. fi diff --git a/include/xcache.sh b/include/xcache.sh index 18a2e72e..647a8628 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -13,7 +13,7 @@ Install_XCache() cd $oneinstack_dir/src src_url=http://xcache.lighttpd.net/pub/Releases/$xcache_version/xcache-$xcache_version.tar.gz && Download_src -tar xzf xcache-$xcache_version.tar.gz +tar xzf xcache-$xcache_version.tar.gz cd xcache-$xcache_version make clean $php_install_dir/bin/phpize @@ -34,12 +34,12 @@ xcache.admin.pass="$xcache_admin_md5_pass" [xcache] xcache.size=$(expr $Memory_limit / 2)M -xcache.count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.slots=8K xcache.ttl=3600 xcache.gc_interval=300 xcache.var_size=4M -xcache.var_count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.var_count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) xcache.var_slots=8K xcache.var_ttl=0 xcache.var_maxttl=0 diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 00e4e8a9..1d9a5509 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -13,8 +13,8 @@ Install_ZendOPcache() cd $oneinstack_dir/src src_url=https://pecl.php.net/get/zendopcache-$zendopcache_version.tgz && Download_src -tar xzf zendopcache-$zendopcache_version.tgz -cd zendopcache-$zendopcache_version +tar xzf zendopcache-$zendopcache_version.tgz +cd zendopcache-$zendopcache_version make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config diff --git a/init.d/Memcached-init-CentOS b/init.d/Memcached-init-CentOS index b53fac92..17c50a40 100755 --- a/init.d/Memcached-init-CentOS +++ b/init.d/Memcached-init-CentOS @@ -42,7 +42,7 @@ stop () { echo if [ $RETVAL -eq 0 ] ; then rm -f /var/lock/subsys/memcached - rm -f /var/run/memcached/memcached.pid + rm -f /var/run/memcached/memcached.pid fi } diff --git a/init.d/Memcached-init-Ubuntu b/init.d/Memcached-init-Ubuntu index 0176832f..edeb534f 100755 --- a/init.d/Memcached-init-Ubuntu +++ b/init.d/Memcached-init-Ubuntu @@ -1,15 +1,15 @@ #! /bin/sh # - + PORT=11211 USER=memcached MAXCONN=1024 OPTIONS="-l 127.0.0.1" DAEMON=/usr/local/memcached/bin/memcached - + RETVAL=0 prog="/usr/local/memcached/bin/memcached" - + start_instance() { echo -n $"Starting $prog ($1): " start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS @@ -18,7 +18,7 @@ start_instance() { [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 PORT=`expr $PORT + 1` } - + stop_instance() { echo -n $"Stopping $prog ($1): " start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON @@ -35,7 +35,7 @@ start () { if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then chown $USER /var/run/memcached fi - + start_instance default 256; #start_instance block 16; #start_instance content 128; @@ -57,12 +57,12 @@ stop () { #stop_instance update; #stop_instance views; } - + restart () { stop start } - + # See how we were called. case "$1" in start) @@ -81,5 +81,5 @@ case "$1" in echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" exit 1 esac - + exit $? diff --git a/init.d/Nginx-init-CentOS b/init.d/Nginx-init-CentOS index 29f63321..bd58a9fd 100755 --- a/init.d/Nginx-init-CentOS +++ b/init.d/Nginx-init-CentOS @@ -2,31 +2,31 @@ # # nginx - this script starts and stops the nginx daemon # -# chkconfig: - 85 15 +# chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx -# config: /usr/local/nginx/conf/nginx.conf +# config: /usr/local/nginx/conf/nginx.conf # pidfile: /var/run/nginx.pid - + # Source function library. . /etc/rc.d/init.d/functions - + # Source networking configuration. . /etc/sysconfig/network - + # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 - + nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) - + NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" - + [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx - + lockfile=/var/lock/subsys/nginx - + make_dirs() { # make required directories user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` @@ -44,7 +44,7 @@ make_dirs() { fi done } - + start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 @@ -56,7 +56,7 @@ start() { [ $retval -eq 0 ] && touch $lockfile return $retval } - + stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT @@ -65,14 +65,14 @@ stop() { [ $retval -eq 0 ] && rm -f $lockfile return $retval } - + restart() { configtest || return $? stop - sleep 3 + sleep 3 start } - + reload() { configtest || return $? echo -n $"Reloading $prog: " @@ -80,23 +80,23 @@ reload() { RETVAL=$? echo } - + force_reload() { restart } - + configtest() { $nginx -t -c $NGINX_CONF_FILE } - + rh_status() { status $prog } - + rh_status_q() { rh_status >/dev/null 2>&1 } - + case "$1" in start) rh_status_q && exit 0 diff --git a/init.d/Nginx-init-Ubuntu b/init.d/Nginx-init-Ubuntu index 770a95db..841a5d38 100755 --- a/init.d/Nginx-init-Ubuntu +++ b/init.d/Nginx-init-Ubuntu @@ -9,13 +9,13 @@ # Description: nginx init.d dash script for Ubuntu <=9.10. ### END INIT INFO #------------------------------------------------------------------------------ -# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx +# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx # daemon for ubuntu 9.10 and lesser version numbered releases. # # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server. This \ -# script will manage the initiation of the \ -# server and it's process state. +# script will manage the initiation of the \ +# server and it's process state. # # processname: nginx # config: /usr/local/nginx/conf/nginx.conf @@ -27,77 +27,77 @@ # # Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com # Notes: nginx init.d dash script for Ubuntu <=9.10. -# +# # This script's project home is: -# http://code.google.com/p/nginx-init-ubuntu/ +# http://code.google.com/p/nginx-init-ubuntu/ # #------------------------------------------------------------------------------ # Functions #------------------------------------------------------------------------------ . /lib/lsb/init-functions - + #------------------------------------------------------------------------------ # Consts #------------------------------------------------------------------------------ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/nginx/sbin/nginx - + PS="nginx" -PIDNAME="nginx" #lets you do $PS-slave +PIDNAME="nginx" #lets you do $PS-slave PIDFILE=$PIDNAME.pid #pid file PIDSPATH=/var/run - + DESCRIPTION="Nginx Server..." - + RUNAS=root #user to run as - + SCRIPT_OK=0 #ala error codes SCRIPT_ERROR=1 #ala error codes TRUE=1 #boolean FALSE=0 #boolean - + lockfile=/var/lock/subsys/nginx NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" - + #------------------------------------------------------------------------------ # Simple Tests #------------------------------------------------------------------------------ - + #test if nginx is a file and executable test -x $DAEMON || exit 0 - + # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi - + #set exit condition #set -e - + #------------------------------------------------------------------------------ # Functions #------------------------------------------------------------------------------ - + setFilePerms(){ - + if [ -f $PIDSPATH/$PIDFILE ]; then chmod 400 $PIDSPATH/$PIDFILE fi } - + configtest() { - $DAEMON -t -c $NGINX_CONF_FILE + $DAEMON -t -c $NGINX_CONF_FILE } - + getPSCount() { - return `pgrep -f $PS | wc -l` + return `pgrep -f $PS | wc -l` } - + isRunning() { if [ $1 ]; then pidof_daemon $1 PID=$? - + if [ $PID -gt 0 ]; then return 1 else @@ -106,7 +106,7 @@ isRunning() { else pidof_daemon PID=$? - + if [ $PID -gt 0 ]; then return 1 else @@ -114,13 +114,13 @@ isRunning() { fi fi } - + #courtesy of php-fpm wait_for_pid () { try=0 - + while test $try -lt 35 ; do - + case "$1" in 'created') if [ -f "$2" ] ; then @@ -128,7 +128,7 @@ wait_for_pid () { break fi ;; - + 'removed') if [ ! -f "$2" ] ; then try='' @@ -136,45 +136,45 @@ wait_for_pid () { fi ;; esac - + #echo -n . try=`expr $try + 1` sleep 1 done } - + status(){ - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then echo "$PIDNAME found running with processes: `pidof $PS`" else echo "$PIDNAME is NOT running." fi - - + + } - + removePIDFile(){ - if [ $1 ]; then + if [ $1 ]; then if [ -f $1 ]; then - rm -f $1 - fi + rm -f $1 + fi else - #Do default removal - if [ -f $PIDSPATH/$PIDFILE ]; then - rm -f $PIDSPATH/$PIDFILE - fi + #Do default removal + if [ -f $PIDSPATH/$PIDFILE ]; then + rm -f $PIDSPATH/$PIDFILE + fi fi } - + start() { log_daemon_msg "Starting $DESCRIPTION" - - isRunning - isAlive=$? - + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then log_end_msg $SCRIPT_ERROR else @@ -184,109 +184,109 @@ start() { log_end_msg $SCRIPT_OK fi } - + stop() { - log_daemon_msg "Stopping $DESCRIPTION" - - isRunning - isAlive=$? + log_daemon_msg "Stopping $DESCRIPTION" + + isRunning + isAlive=$? if [ "${isAlive}" -eq $TRUE ]; then start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + if [ -n "$try" ] ; then log_end_msg $SCRIPT_ERROR else removePIDFile - log_end_msg $SCRIPT_OK + log_end_msg $SCRIPT_OK fi - + else log_end_msg $SCRIPT_ERROR fi } - + reload() { - configtest || return $? - - log_daemon_msg "Reloading (via HUP) $DESCRIPTION" - + configtest || return $? + + log_daemon_msg "Reloading (via HUP) $DESCRIPTION" + isRunning if [ $? -eq $TRUE ]; then - `killall -HUP $PS` #to be safe - + `killall -HUP $PS` #to be safe + log_end_msg $SCRIPT_OK else log_end_msg $SCRIPT_ERROR fi } - + quietupgrade() { - log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" - + log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" + isRunning isAlive=$? if [ "${isAlive}" -eq $TRUE ]; then - kill -USR2 `cat $PIDSPATH/$PIDFILE` - kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + kill -USR2 `cat $PIDSPATH/$PIDFILE` + kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - - log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" - - kill -HUP `cat $PIDSPATH/$PIDFILE` - kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + + log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" + + kill -HUP `cat $PIDSPATH/$PIDFILE` + kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_ok - fi + + log_end_msg $SCRIPT_ok + fi else log_end_msg $SCRIPT_ERROR fi } - + terminate() { log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" - - PIDS=`pidof $PS` || true - - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - kill $i + + PIDS=`pidof $PS` || true + + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + kill $i wait_for_pid 'removed' $PIDSPATH/$PIDFILE - removePIDFile - fi - done - - log_end_msg $SCRIPT_OK + removePIDFile + fi + done + + log_end_msg $SCRIPT_OK } - + destroy() { - log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" - killall $PS -q >> /dev/null 2>&1 - log_end_msg $SCRIPT_OK + log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" + killall $PS -q >> /dev/null 2>&1 + log_end_msg $SCRIPT_OK } - + pidof_daemon() { PIDS=`pidof $PS` || true - + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - + for i in $PIDS; do if [ "$i" = "$PIDS2" ]; then return 1 @@ -294,43 +294,43 @@ pidof_daemon() { done return 0 } - + case "$1" in start) - start + start ;; stop) - stop + stop ;; restart|force-reload) - stop - sleep 3 - start + stop + sleep 3 + start ;; reload) - $1 - ;; + $1 + ;; status) - status - ;; + status + ;; configtest) $1 ;; quietupgrade) - $1 - ;; + $1 + ;; terminate) - $1 - ;; + $1 + ;; destroy) - $1 - ;; + $1 + ;; *) - FULLPATH=/etc/init.d/$PS - echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" - echo " The 'destroy' command should only be used as a last resort." - exit 1 - ;; + FULLPATH=/etc/init.d/$PS + echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" + echo " The 'destroy' command should only be used as a last resort." + exit 1 + ;; esac - + exit 0 diff --git a/init.d/Redis-server-init-CentOS b/init.d/Redis-server-init-CentOS index f94517be..044865eb 100755 --- a/init.d/Redis-server-init-CentOS +++ b/init.d/Redis-server-init-CentOS @@ -2,10 +2,10 @@ # # redis - this script starts and stops the redis-server daemon # -# chkconfig: - 85 15 +# chkconfig: - 85 15 # description: Redis is a persistent key-value database # processname: redis-server -# config: /usr/local/redis/etc/redis.conf +# config: /usr/local/redis/etc/redis.conf # config: /etc/sysconfig/redis # pidfile: /var/run/redis.pid @@ -95,7 +95,7 @@ case "$1" in ;; condrestart|try-restart) rh_status_q || exit 0 - ;; + ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2 diff --git a/init.d/Redis-server-init-Ubuntu b/init.d/Redis-server-init-Ubuntu index 0f160ee3..90888e80 100755 --- a/init.d/Redis-server-init-Ubuntu +++ b/init.d/Redis-server-init-Ubuntu @@ -1,14 +1,14 @@ #! /bin/sh ### BEGIN INIT INFO -# Provides: redis-server -# Required-Start: $syslog -# Required-Stop: $syslog -# Should-Start: $local_fs -# Should-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: redis-server - Persistent key-value db -# Description: redis-server - Persistent key-value db +# Provides: redis-server +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: redis-server - Persistent key-value db +# Description: redis-server - Persistent key-value db ### END INIT INFO @@ -26,35 +26,35 @@ set -e case "$1" in start) - echo -n "Starting $DESC: " - touch $PIDFILE - chown redis:redis $PIDFILE - if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS - then - echo "$NAME." - else - echo "failed" - fi - ;; + echo -n "Starting $DESC: " + touch $PIDFILE + chown redis:redis $PIDFILE + if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS + then + echo "$NAME." + else + echo "failed" + fi + ;; stop) - echo -n "Stopping $DESC: " - if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON - then - echo "$NAME." - else - echo "failed" - fi - rm -f $PIDFILE - ;; + echo -n "Stopping $DESC: " + if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON + then + echo "$NAME." + else + echo "failed" + fi + rm -f $PIDFILE + ;; restart|force-reload) - ${0} stop - ${0} start - ;; + ${0} stop + ${0} start + ;; *) - echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac exit 0 diff --git a/init.d/Shadowsocks-python-init b/init.d/Shadowsocks-python-init index 44b5abc4..569c452a 100755 --- a/init.d/Shadowsocks-python-init +++ b/init.d/Shadowsocks-python-init @@ -15,7 +15,7 @@ Shadowsocks_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32m SHUTDOWN_WAIT=20 Shadowsocks_pid(){ - echo `ps -ef | grep $Shadowsocks_bin | grep -v grep | tr -s " "|cut -d" " -f2` + echo `ps -ef | grep $Shadowsocks_bin | grep -v grep | tr -s " "|cut -d" " -f2` } start() { @@ -26,9 +26,9 @@ start() { $Shadowsocks_bin -c $Shadowsocks_conf -d start RETVAL=$? if [ "$RETVAL" = "0" ]; then - echo -e "\e[00;32mStarting Shadowsocks\e[00m" + echo -e "\e[00;32mStarting Shadowsocks\e[00m" else - echo -e "\e[00;32mShadowsocks start Failed\e[00m" + echo -e "\e[00;32mShadowsocks start Failed\e[00m" fi status fi @@ -70,10 +70,10 @@ stop(){ } case $1 in - start) + start) start ;; - stop) + stop) stop ;; restart) @@ -81,10 +81,10 @@ case $1 in start ;; status) - status + status ;; *) - echo -e $Shadowsocks_USAGE + echo -e $Shadowsocks_USAGE ;; -esac +esac exit 0 diff --git a/init.d/Supervisor-init-CentOS b/init.d/Supervisor-init-CentOS index 51a0c7e9..d3c6e0d5 100755 --- a/init.d/Supervisor-init-CentOS +++ b/init.d/Supervisor-init-CentOS @@ -69,26 +69,26 @@ running() start() { echo "Starting supervisord: " - - if [ -e $PIDFILE ]; then - echo "ALREADY STARTED" - return 1 - fi - # start supervisord with options from sysconfig (stuff like -c) + if [ -e $PIDFILE ]; then + echo "ALREADY STARTED" + return 1 + fi + + # start supervisord with options from sysconfig (stuff like -c) $SUPERVISORD $OPTIONS - - # show initial startup status - $SUPERVISORCTL $OPTIONS status - - # only create the subsyslock if we created the PIDFILE + + # show initial startup status + $SUPERVISORCTL $OPTIONS status + + # only create the subsyslock if we created the PIDFILE [ -e $PIDFILE ] && touch $LOCKFILE } stop() { echo -n "Stopping supervisord: " $SUPERVISORCTL $OPTIONS shutdown - if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then + if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then echo "Waiting roughly 60 seconds for $PIDFILE to be removed after child processes exit" for sleep in 2 2 2 2 4 4 4 4 8 8 8 8 last; do if [ ! -e $PIDFILE ] ; then diff --git a/init.d/Tomcat-init b/init.d/Tomcat-init index d97c1f07..8ac3ccff 100755 --- a/init.d/Tomcat-init +++ b/init.d/Tomcat-init @@ -1,6 +1,6 @@ #!/bin/bash # -# chkconfig: - 95 15 +# chkconfig: - 95 15 # description: Tomcat start/stop/status script #Location of JAVA_HOME (bin files) @@ -89,7 +89,7 @@ case $1 in start ;; - stop) + stop) stop ;; @@ -99,11 +99,11 @@ case $1 in ;; status) - status + status ;; *) - echo -e $TOMCAT_USAGE + echo -e $TOMCAT_USAGE ;; -esac +esac exit 0 diff --git a/install.sh b/install.sh index 98d46709..01e544b5 100755 --- a/install.sh +++ b/install.sh @@ -24,13 +24,12 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./options.conf . ./include/color.sh . ./include/check_os.sh -. ./include/check_db.sh -. ./include/check_web.sh +. ./include/check_dir.sh . ./include/download.sh . ./include/get_char.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } # get the IP information IPADDR=`./include/get_ipaddr.py` @@ -44,7 +43,7 @@ mkdir -p $wwwroot_dir/default $wwwlogs_dir if [ -e "/etc/ssh/sshd_config" ];then [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && ssh_port=22 || ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'` while :; do echo - read -p "Please input SSH port(Default: $ssh_port): " SSH_PORT + read -p "Please input SSH port(Default: $ssh_port): " SSH_PORT [ -z "$SSH_PORT" ] && SSH_PORT=$ssh_port if [ $SSH_PORT -eq 22 >/dev/null 2>&1 -o $SSH_PORT -gt 1024 >/dev/null 2>&1 -a $SSH_PORT -lt 65535 >/dev/null 2>&1 ];then break @@ -52,11 +51,11 @@ if [ -e "/etc/ssh/sshd_config" ];then echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}" fi done - + if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$SSH_PORT" != '22' ];then sed -i "s@^#Port.*@&\nPort $SSH_PORT@" /etc/ssh/sshd_config elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ];then - sed -i "s@^Port.*@Port $SSH_PORT@" /etc/ssh/sshd_config + sed -i "s@^Port.*@Port $SSH_PORT@" /etc/ssh/sshd_config fi fi @@ -96,7 +95,7 @@ while :; do echo if [[ ! $Apache_version =~ ^[1-3]$ ]];then echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" else - [ "$Apache_version" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; Apache_version=Other; } + [ "$Apache_version" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; Apache_version=Other; } break fi done @@ -111,7 +110,7 @@ while :; do echo # if [[ ! $Tomcat_version =~ ^[1-3]$ ]];then # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" # else - # [ "$Tomcat_version" != '3' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } + # [ "$Tomcat_version" != '3' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } # if [ "$Tomcat_version" == '1' ];then # while :; do echo # echo 'Please select JDK version:' @@ -207,11 +206,11 @@ while :; do echo echo "${CWARNING}input error! Please only input number 1,2,3,4,5${CEND}" else while :; do echo - read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn + read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn if [[ ! $PHP_cache_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - if [ "$PHP_cache_yn" == 'y' ];then + if [ "$PHP_cache_yn" == 'y' ];then if [ $PHP_version == 1 ];then while :; do echo 'Please select a opcode cache of the PHP:' @@ -306,7 +305,7 @@ while :; do echo fi done fi - + if [ "$PHP_version" != '5' ];then while :; do echo read -p "Do you want to install ionCube? [y/n]: " ionCube_yn @@ -317,7 +316,7 @@ while :; do echo fi done fi - + # ImageMagick or GraphicsMagick while :; do echo read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn @@ -368,7 +367,7 @@ if [[ $PHP_version =~ ^[1-5]$ ]] || [ -e "$php_install_dir/bin/phpize" ];then if [[ ! $phpMyAdmin_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - [ "$phpMyAdmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpMyAdmin_yn=Other; } + [ "$phpMyAdmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpMyAdmin_yn=Other; } break fi done @@ -394,7 +393,7 @@ while :; do echo fi done -# check jemalloc or tcmalloc +# check jemalloc or tcmalloc if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ];then while :; do echo read -p "Do you want to use jemalloc or tcmalloc optimize Database and Web server? [y/n]: " je_tc_malloc_yn @@ -466,23 +465,23 @@ fi # Database if [ "$DB_version" == '1' ];then - . include/mysql-5.7.sh - Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log + . include/mysql-5.7.sh + Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '2' ];then - . include/mysql-5.6.sh - Install_MySQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log + . include/mysql-5.6.sh + Install_MySQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '3' ];then . include/mysql-5.5.sh Install_MySQL-5-5 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '4' ];then . include/mariadb-10.1.sh - Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log + Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '5' ];then . include/mariadb-10.0.sh - Install_MariaDB-10-0 2>&1 | tee -a $oneinstack_dir/install.log + Install_MariaDB-10-0 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '6' ];then . include/mariadb-5.5.sh - Install_MariaDB-5-5 2>&1 | tee -a $oneinstack_dir/install.log + 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 @@ -490,16 +489,16 @@ 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" == '9' ];then - . include/percona-5.5.sh - Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log + . include/percona-5.5.sh + Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log fi # Apache if [ "$Apache_version" == '1' ];then - . include/apache-2.4.sh + . include/apache-2.4.sh Install_Apache-2-4 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$Apache_version" == '2' ];then - . include/apache-2.2.sh + . include/apache-2.2.sh Install_Apache-2-2 2>&1 | tee -a $oneinstack_dir/install.log fi @@ -543,7 +542,7 @@ if [ "$PHP_cache" == '1' ] && [[ "$PHP_version" =~ ^[1,2]$ ]];then . include/zendopcache.sh Install_ZendOPcache 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$PHP_cache" == '2' ];then - . include/xcache.sh + . include/xcache.sh Install_XCache 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$PHP_cache" == '3' ];then . include/apcu.sh @@ -597,7 +596,7 @@ fi # Pure-FTPd if [ "$FTP_yn" == 'y' ];then . include/pureftpd.sh - Install_PureFTPd 2>&1 | tee -a $oneinstack_dir/install.log + Install_PureFTPd 2>&1 | tee -a $oneinstack_dir/install.log fi # phpMyAdmin @@ -624,26 +623,25 @@ fi # index example if [ ! -e "$wwwroot_dir/default/index.html" -a "$Web_yn" == 'y' ];then . include/demo.sh - DEMO 2>&1 | tee -a $oneinstack_dir/install.log + DEMO 2>&1 | tee -a $oneinstack_dir/install.log fi # get web_install_dir and db_install_dir -. include/check_db.sh -. include/check_web.sh +. include/check_dir.sh # HHVM if [ "$HHVM_yn" == 'y' ];then - . include/hhvm_CentOS.sh - Install_hhvm_CentOS 2>&1 | tee -a $oneinstack_dir/install.log + . include/hhvm_CentOS.sh + Install_hhvm_CentOS 2>&1 | tee -a $oneinstack_dir/install.log fi -# Starting DB +# Starting DB [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} [ -d "$db_install_dir/support-files" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && /etc/init.d/mysqld start echo "####################Congratulations########################" [ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}" -[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" +[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" [ "$Web_yn" == 'y' -a "$Nginx_version" == '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" [[ "$Tomcat_version" =~ ^[1,2]$ ]] && echo -e "\n`printf "%-32s" "Tomcat install dir":`${CMSG}$tomcat_install_dir${CEND}" [ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`${CMSG}$db_install_dir${CEND}" @@ -651,11 +649,11 @@ echo "####################Congratulations########################" [ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database user:"`${CMSG}root${CEND}" [ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database password:"`${CMSG}${dbrootpwd}${CEND}" [ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`${CMSG}$php_install_dir${CEND}" -[ "$PHP_cache" == '1' ] && echo "`printf "%-32s" "Opcache Control Panel url:"`${CMSG}http://$IPADDR/ocp.php${CEND}" +[ "$PHP_cache" == '1' ] && echo "`printf "%-32s" "Opcache Control Panel url:"`${CMSG}http://$IPADDR/ocp.php${CEND}" [ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache Control Panel url:"`${CMSG}http://$IPADDR/xcache${CEND}" [ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache user:"`${CMSG}admin${CEND}" [ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache password:"`${CMSG}$xcache_admin_pass${CEND}" -[ "$PHP_cache" == '3' ] && echo "`printf "%-32s" "APC Control Panel url:"`${CMSG}http://$IPADDR/apc.php${CEND}" +[ "$PHP_cache" == '3' ] && echo "`printf "%-32s" "APC Control Panel url:"`${CMSG}http://$IPADDR/apc.php${CEND}" [ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator Control Panel url:"`${CMSG}http://$IPADDR/control.php${CEND}" [ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator user:"`${CMSG}admin${CEND}" [ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator password:"`${CMSG}eAccelerator${CEND}" diff --git a/options.conf b/options.conf index f3afc6dc..b316993d 100644 --- a/options.conf +++ b/options.conf @@ -36,7 +36,7 @@ wwwroot_dir=/data/wwwroot wwwlogs_dir=/data/wwwlogs ######################################################################### -# automatically generated, You can't change +# automatically generated, You can't change dbrootpwd= ######################################################################### @@ -55,8 +55,8 @@ backup_content= # aliyun OSS Bucket, You can't change oss_bucket= -# The backup of the database, You can't change +# The backup of the database, You can't change db_name= -# The backup of the website, You can't change +# The backup of the website, You can't change website_name= diff --git a/pureftpd_vhost.sh b/pureftpd_vhost.sh index 18d1499f..ac8f6764 100755 --- a/pureftpd_vhost.sh +++ b/pureftpd_vhost.sh @@ -22,7 +22,7 @@ printf " . ./include/color.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } [ ! -d "$pureftpd_install_dir" ] && { echo "${CFAILURE}The ftp server does not exist! ${CEND}"; exit 1; } @@ -30,7 +30,7 @@ FTP_conf=$pureftpd_install_dir/etc/pure-ftpd.conf FTP_tmp_passfile=$pureftpd_install_dir/etc/pureftpd_psss.tmp Puredbfile=$pureftpd_install_dir/etc/pureftpd.pdb Passwdfile=$pureftpd_install_dir/etc/pureftpd.passwd -FTP_bin=$pureftpd_install_dir/bin/pure-pw +FTP_bin=$pureftpd_install_dir/bin/pure-pw [ -z "`grep ^PureDB $FTP_conf`" ] && { echo "${CFAILURE}pure-ftpd is not own password database${CEND}" ; exit 1; } USER() { @@ -50,7 +50,7 @@ PASSWORD() { while : do echo - read -p "Please input the password: " Password + read -p "Please input the password: " Password [ -n "`echo $Password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } if (( ${#Password} >= 5 ));then echo -e "${Password}\n$Password" > $FTP_tmp_passfile @@ -65,7 +65,7 @@ DIRECTORY() { while : do echo - read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory + read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory if [ -z "$Directory" ]; then Directory="$wwwroot_dir" fi @@ -89,17 +89,17 @@ What Are You Doing? \t${CMSG}6${CEND}. ShowUser \t${CMSG}q${CEND}. Exit " - read -p "Please input the correct option: " Number + read -p "Please input the correct option: " Number if [[ ! $Number =~ ^[1-6,q]$ ]];then - echo "${CFAILURE}input error! Please only input 1 ~ 6 and q${CEND}" + echo "${CFAILURE}input error! Please only input 1 ~ 6 and q${CEND}" else case "$Number" in 1) USER - [ -e "$Passwdfile" ] && [ -n "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] is already existed! ${CEND}"; continue; } + [ -e "$Passwdfile" ] && [ -n "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] is already existed! ${CEND}"; continue; } PASSWORD;DIRECTORY $FTP_bin useradd $User -f $Passwdfile -u $run_user -g $run_user -d $Directory -m < $FTP_tmp_passfile - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 echo "#####################################" echo echo "[$User] create successful! " @@ -114,8 +114,8 @@ What Are You Doing? USER [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } DIRECTORY - $FTP_bin usermod $User -f $Passwdfile -d $Directory -m - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + $FTP_bin usermod $User -f $Passwdfile -d $Directory -m + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 echo "#####################################" echo echo "[$User] modify a successful! " @@ -130,7 +130,7 @@ What Are You Doing? [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } PASSWORD $FTP_bin passwd $User -f $Passwdfile -m < $FTP_tmp_passfile - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 echo "#####################################" echo echo "[$User] Password changed successfully! " @@ -146,9 +146,9 @@ What Are You Doing? else $FTP_bin list fi - + USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } $FTP_bin userdel $User -f $Passwdfile -m $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 echo @@ -157,15 +157,15 @@ What Are You Doing? 5) if [ ! -e "$Passwdfile" ];then - echo "${CQUESTION}User was not existed! ${CEND}" + echo "${CQUESTION}User was not existed! ${CEND}" else - $FTP_bin list + $FTP_bin list fi ;; 6) USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } $FTP_bin show $User ;; diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index 519c0d93..6e1ff633 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -20,10 +20,10 @@ printf " . ./options.conf . ./include/color.sh -. ./include/check_db.sh +. ./include/check_dir.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } Reset_db_root_password() { @@ -47,7 +47,7 @@ if [ $status_Localhost == '0' -a $status_127 == '0' ]; then echo "The new password: ${CMSG}${New_dbrootpwd}${CEND}" echo else - echo "${CFAILURE}Reset Database root password failed! ${CEND}" + echo "${CFAILURE}Reset Database root password failed! ${CEND}" fi } Reset_db_root_password diff --git a/shadowsocks.sh b/shadowsocks.sh index 8e5fa309..da90f6e5 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -3,7 +3,7 @@ # BLOG: https://blog.linuxeye.com # # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# Install Shadowsocks Server +# Install Shadowsocks Server # # Project home page: # http://oneinstack.com @@ -26,7 +26,7 @@ cd src . ../include/download.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } PUBLIC_IPADDR=`../include/get_public_ipaddr.py` @@ -34,7 +34,7 @@ PUBLIC_IPADDR=`../include/get_public_ipaddr.py` Check_shadowsocks() { [ -f /usr/local/bin/ss-server ] && SS_version=1 - [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 + [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 } AddUser_shadowsocks() { @@ -76,13 +76,13 @@ if [ "$OS" == 'CentOS' ];then if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ];then iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - service iptables save + service iptables save fi -elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then +elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ];then iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - iptables-save > /etc/iptables.up.rules + iptables-save > /etc/iptables.up.rules fi else echo "${CWARNING}This port is already in iptables${CEND}" @@ -110,7 +110,7 @@ if [ "$OS" == 'CentOS' ]; then do yum -y install $Package done -elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then +elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then SS_version=2 AddUser_shadowsocks Iptables_set @@ -122,7 +122,7 @@ elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then fi } -Install_shadowsocks-python() { +Install_shadowsocks-python() { src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src which pip > /dev/null 2>&1 @@ -169,7 +169,7 @@ Uninstall_shadowsocks(){ while : do echo - read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn + read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn if [[ ! $Shadowsocks_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else @@ -179,8 +179,8 @@ done if [ "$Shadowsocks_yn" == 'y' ]; then [ -n "`ps -ef | grep -v grep | grep -iE "ssserver|ss-server"`" ] && /etc/init.d/shadowsocks stop - [ "$OS" == 'CentOS' ] && chkconfig --del shadowsocks - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove + [ "$OS" == 'CentOS' ] && chkconfig --del shadowsocks + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks if [ "$SS_version" == '1' ];then rm -f /usr/local/bin/ss-local @@ -236,7 +236,7 @@ EOF "local_address":"127.0.0.1", "local_port":1080, "port_password":{ - "$Shadowsocks_port":"$Shadowsocks_password" + "$Shadowsocks_port":"$Shadowsocks_password" }, "timeout":300, "method":"aes-256-cfb", @@ -247,7 +247,7 @@ EOF AddUser_Config_shadowsocks(){ [ ! -e /etc/shadowsocks/config.json ] && { echo "${CFAILURE}Shadowsocks is not installed! ${CEND}"; exit 1; } -[ -z "`grep \"$Shadowsocks_port\" /etc/shadowsocks/config.json`" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"$Shadowsocks_port\":\"$Shadowsocks_password\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } +[ -z "`grep \"$Shadowsocks_port\" /etc/shadowsocks/config.json`" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"$Shadowsocks_port\":\"$Shadowsocks_password\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } } Print_User_shadowsocks(){ @@ -267,7 +267,7 @@ install) [ "$SS_version" == '1' ] && Install_shadowsocks-libev [ "$SS_version" == '2' ] && Install_shadowsocks-python Config_shadowsocks - service shadowsocks start + service shadowsocks start Print_User_shadowsocks ;; adduser) diff --git a/tools/ckssh.py b/tools/ckssh.py index 24d4988c..fa665449 100755 --- a/tools/ckssh.py +++ b/tools/ckssh.py @@ -7,7 +7,7 @@ sk.settimeout(1) try: sk.connect((sys.argv[1],int(sys.argv[2]))) - print 'ok' + print 'ok' except Exception: - print 'no' + print 'no' sk.close() diff --git a/tools/db_bk.sh b/tools/db_bk.sh index 1eb45904..6a21cb6a 100755 --- a/tools/db_bk.sh +++ b/tools/db_bk.sh @@ -9,7 +9,7 @@ # https://github.com/lj2007331/oneinstack . ../options.conf -. ../include/check_db.sh +. ../include/check_dir.sh DBname=$1 LogFile=$backup_dir/db.log @@ -32,7 +32,7 @@ fi if [ -e "$NewFile" ];then echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile else - $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile + $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile cd $backup_dir tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1 echo "[$NewFile] Backup success ">> $LogFile diff --git a/tools/mabs.sh b/tools/mabs.sh index 2f1b8182..1dbc2022 100755 --- a/tools/mabs.sh +++ b/tools/mabs.sh @@ -6,36 +6,36 @@ # ignore rule ignore_init() { - # ignore password - array_ignore_pwd_length=0 - if [ -f ./ignore_pwd ]; then - while read IGNORE_PWD - do - array_ignore_pwd[$array_ignore_pwd_length]=$IGNORE_PWD - let array_ignore_pwd_length=$array_ignore_pwd_length+1 - done < ./ignore_pwd - fi - - # ignore ip address - array_ignore_ip_length=0 - if [ -f ./ignore_ip ]; then - while read IGNORE_IP - do - array_ignore_ip[$array_ignore_ip_length]=$IGNORE_IP - let array_ignore_ip_length=$array_ignore_ip_length+1 - done < ./ignore_ip - fi + # ignore password + array_ignore_pwd_length=0 + if [ -f ./ignore_pwd ]; then + while read IGNORE_PWD + do + array_ignore_pwd[$array_ignore_pwd_length]=$IGNORE_PWD + let array_ignore_pwd_length=$array_ignore_pwd_length+1 + done < ./ignore_pwd + fi + + # ignore ip address + array_ignore_ip_length=0 + if [ -f ./ignore_ip ]; then + while read IGNORE_IP + do + array_ignore_ip[$array_ignore_ip_length]=$IGNORE_IP + let array_ignore_ip_length=$array_ignore_ip_length+1 + done < ./ignore_ip + fi } show_version() { - echo "version: 1.0" - echo "updated date: 2014-06-08" + echo "version: 1.0" + echo "updated date: 2014-06-08" } show_usage() { - echo -e "`printf %-16s "Usage: $0"` [-h|--help]" + echo -e "`printf %-16s "Usage: $0"` [-h|--help]" echo -e "`printf %-16s ` [-v|-V|--version]" echo -e "`printf %-16s ` [-l|--iplist ... ]" echo -e "`printf %-16s ` [-c|--config ... ]" @@ -61,42 +61,42 @@ eval set -- "$TEMP" while : do - [ -z "$1" ] && break; - case "$1" in - -h|--help) - show_usage; exit 0 - ;; - -v|-V|--version) - show_version; exit 0 - ;; - -l|--iplist) - IPLIST=$2; shift 2 - ;; - -c|--config) - CONFIG_FILE=$2; shift 2 - ;; - -t|--sshtimeout) - SSHTIMEOUT=$2; shift 2 - ;; - -T|--fttimeout) - SCPTIMEOUT=$2; shift 2 - ;; - -L|--bwlimit) - BWLIMIT=$2; shift 2 - ;; - --log) - LOG_FILE=$2; shift 2 - ;; - -n|--ignore) - IGNRFLAG="ignr"; shift - ;; - --) - shift - ;; - *) - echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 - ;; - esac + [ -z "$1" ] && break; + case "$1" in + -h|--help) + show_usage; exit 0 + ;; + -v|-V|--version) + show_version; exit 0 + ;; + -l|--iplist) + IPLIST=$2; shift 2 + ;; + -c|--config) + CONFIG_FILE=$2; shift 2 + ;; + -t|--sshtimeout) + SSHTIMEOUT=$2; shift 2 + ;; + -T|--fttimeout) + SCPTIMEOUT=$2; shift 2 + ;; + -L|--bwlimit) + BWLIMIT=$2; shift 2 + ;; + --log) + LOG_FILE=$2; shift 2 + ;; + -n|--ignore) + IGNRFLAG="ignr"; shift + ;; + --) + shift + ;; + *) + echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 + ;; + esac done ################ main ####################### @@ -111,46 +111,46 @@ while [[ $IP_init -le $IP_count ]] do egrep -v '^#|^$' $IPLIST | sed -n "$IP_init,$(expr $IP_init + 50)p" > $IPLIST.tmp - IPSEQ=0 + IPSEQ=0 - while read IP PORT USER PASSWD PASSWD_2ND PASSWD_3RD PASSWD_4TH OTHERS + while read IP PORT USER PASSWD PASSWD_2ND PASSWD_3RD PASSWD_4TH OTHERS # while read Line do - [ -z "`echo $IP | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|CNS'`" ] && continue - if [ "`python ./ckssh.py $IP $PORT`" == 'no' ];then - [ ! -e ipnologin.txt ] && > ipnologin.txt - [ -z "`grep $IP ipnologin.txt | grep $(date +%F)`" ] && echo "`date +%F_%H%M` $IP" >> ipnologin.txt - continue - fi - - #[ -e "~/.ssh/known_hosts" ] && grep $IP ~/.ssh/known_hosts | sed -i "/$IP/d" ~/.ssh/known_hosts - - let IPSEQ=$IPSEQ+1 - - if [ $IGNRFLAG == "ignr" ]; then - ignore_init - ignored_flag=0 - - i=0 - while [ $i -lt $array_ignore_pwd_length ] - do - [ ${PASSWD}x == ${array_ignore_pwd[$i]}x ] && ignored_flag=1 && break - let i=$i+1 - done - - [ $ignored_flag -eq 1 ] && continue - - j=0 - while [ $j -lt $array_ignore_ip_length ] - do - [ ${IP}x == ${array_ignore_ip[$j]}x ] && ignored_flag=1 && break - let j=$j+1 - done - - [ $ignored_flag -eq 1 ] && continue - fi - - PASSWD_USE=$PASSWD + [ -z "`echo $IP | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|CNS'`" ] && continue + if [ "`python ./ckssh.py $IP $PORT`" == 'no' ];then + [ ! -e ipnologin.txt ] && > ipnologin.txt + [ -z "`grep $IP ipnologin.txt | grep $(date +%F)`" ] && echo "`date +%F_%H%M` $IP" >> ipnologin.txt + continue + fi + + #[ -e "~/.ssh/known_hosts" ] && grep $IP ~/.ssh/known_hosts | sed -i "/$IP/d" ~/.ssh/known_hosts + + let IPSEQ=$IPSEQ+1 + + if [ $IGNRFLAG == "ignr" ]; then + ignore_init + ignored_flag=0 + + i=0 + while [ $i -lt $array_ignore_pwd_length ] + do + [ ${PASSWD}x == ${array_ignore_pwd[$i]}x ] && ignored_flag=1 && break + let i=$i+1 + done + + [ $ignored_flag -eq 1 ] && continue + + j=0 + while [ $j -lt $array_ignore_ip_length ] + do + [ ${IP}x == ${array_ignore_ip[$j]}x ] && ignored_flag=1 && break + let j=$j+1 + done + + [ $ignored_flag -eq 1 ] && continue + fi + + PASSWD_USE=$PASSWD IPcode=$(echo "ibase=16;$(echo "$IP" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') Portcode=$(echo "ibase=16;$(echo "$PORT" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') @@ -158,7 +158,7 @@ do PWcode=$(echo "ibase=16;$(echo "$PASSWD_USE" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') Othercode=$(echo "ibase=16;$(echo "$OTHERS" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') #echo $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode - ./thread.sh $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode | tee logs/$IP.log & + ./thread.sh $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode | tee logs/$IP.log & done < $IPLIST.tmp sleep 3 IP_init=$(expr $IP_init + 50) diff --git a/tools/mscp.exp b/tools/mscp.exp index 3616f392..dd32eb58 100755 --- a/tools/mscp.exp +++ b/tools/mscp.exp @@ -1,23 +1,23 @@ -#!/usr/bin/expect -- +#!/usr/bin/expect -- proc Usage_Exit {self} { - puts "" - puts "Usage: $self ip user passwd port sourcefile destdir direction bwlimit timeout" - puts "" - puts " sourcefile: a file or directory to be transferred" - puts " 需要拷贝目录时目录名后不要带 /, 否则会拷贝该目录下的所有文件" - puts " destdir: the location that the sourcefile to be put into" - puts " direction: pull or push" - puts " pull: remote -> local" - puts " push: local -> remote" - puts " bwlimit: bandwidth limit, kbit/s, 0 means no limit" - puts " timeout: timeout of expect, s, -1 means no timeout" - puts "" - exit 1 + puts "" + puts "Usage: $self ip user passwd port sourcefile destdir direction bwlimit timeout" + puts "" + puts " sourcefile: a file or directory to be transferred" + puts " 需要拷贝目录时目录名后不要带 /, 否则会拷贝该目录下的所有文件" + puts " destdir: the location that the sourcefile to be put into" + puts " direction: pull or push" + puts " pull: remote -> local" + puts " push: local -> remote" + puts " bwlimit: bandwidth limit, kbit/s, 0 means no limit" + puts " timeout: timeout of expect, s, -1 means no timeout" + puts "" + exit 1 } if { [llength $argv] < 9 } { - Usage_Exit $argv0 + Usage_Exit $argv0 } set ipcode [lindex $argv 0] @@ -41,118 +41,118 @@ for {} {1} {} { if { $direction == "pull" } { - if { $bwlimit > 0 } { - spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir - } elseif { $bwlimit == 0 } { - spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir - } else { - Usage_Exit $argv0 - } + if { $bwlimit > 0 } { + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + } elseif { $bwlimit == 0 } { + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + } else { + Usage_Exit $argv0 + } } elseif { $direction == "push" } { - if { $bwlimit > 0 } { - spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir - } elseif { $bwlimit == 0 } { - spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir - } else { - Usage_Exit $argv0 - } + if { $bwlimit > 0 } { + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + } elseif { $bwlimit == 0 } { + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + } else { + Usage_Exit $argv0 + } } else { - Usage_Exit $argv0 + Usage_Exit $argv0 } -expect { - - "assword:" { - send "$passwd\r" - break; - } - - "yes/no)?" { - set yesnoflag 1 - send "yes\r" - break; - } - - "FATAL" { - puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" - exit 1 - } - - timeout { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 - } - - "No route to host" { - puts "\nCONNECTERROR: $ip No route to host!!!\n" - exit 1 - } - - "Connection Refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 - } - - "Connection refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 - } - - "Host key verification failed" { - puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" - exit 1 - } - - "Illegal host key" { - puts "\nCONNECTERROR: $ip Illegal host key!!!\n" - exit 1 - } - - "Connection Timed Out" { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 - } - - "Interrupted system call" { - puts "\n$ip Interrupted system call!!!\n" - } +expect { + + "assword:" { + send "$passwd\r" + break; + } + + "yes/no)?" { + set yesnoflag 1 + send "yes\r" + break; + } + + "FATAL" { + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 + } + + timeout { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "No route to host" { + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 + } + + "Connection Refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Connection refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Host key verification failed" { + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 + } + + "Illegal host key" { + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 + } + + "Connection Timed Out" { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "Interrupted system call" { + puts "\n$ip Interrupted system call!!!\n" + } } } if { $yesnoflag == 1 } { - expect { - "assword:" { - send "$passwd\r" - } - - "yes/no)?" { - set yesnoflag 2 - send "yes\r" - } - } + expect { + "assword:" { + send "$passwd\r" + } + + "yes/no)?" { + set yesnoflag 2 + send "yes\r" + } + } } if { $yesnoflag == 2 } { - expect { - "assword:" { - send "$passwd\r" - } - } + expect { + "assword:" { + send "$passwd\r" + } + } } expect { - "assword:" { - send "$passwd\r" - puts "\nPASSWORDERROR: $ip Password error!!!\n" - exit 1 - } - - eof { - puts "OK_SCP: $ip\n" - exit 0; - } + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } + + eof { + puts "OK_SCP: $ip\n" + exit 0; + } } diff --git a/tools/mssh.exp b/tools/mssh.exp index 82026fb7..8d7e2ea4 100755 --- a/tools/mssh.exp +++ b/tools/mssh.exp @@ -1,8 +1,8 @@ #!/usr/bin/expect -- if { [llength $argv] < 4 } { - puts "Usage: $argv0 ip user passwd port commands timeout" - exit 1 + puts "Usage: $argv0 ip user passwd port commands timeout" + exit 1 } match_max 600000 @@ -26,104 +26,104 @@ for {} {1} {} { spawn /usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port $ip -expect { - - "assword:" { - send "$passwd\r" - break; - } - - "yes/no)?" { - set yesnoflag 1 - send "yes\r" - break; - } - - "FATAL" { - puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" - exit 1 - } - - timeout { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 - } - - "No route to host" { - puts "\nCONNECTERROR: $ip No route to host!!!\n" - exit 1 - } - - "Connection Refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 - } - - "Connection refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 - } - - "Host key verification failed" { - puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" - exit 1 - } - - "Illegal host key" { - puts "\nCONNECTERROR: $ip Illegal host key!!!\n" - exit 1 - } - - "Connection Timed Out" { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 - } - - "Interrupted system call" { - puts "\n$ip Interrupted system call!!!\n" - } +expect { + + "assword:" { + send "$passwd\r" + break; + } + + "yes/no)?" { + set yesnoflag 1 + send "yes\r" + break; + } + + "FATAL" { + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 + } + + timeout { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "No route to host" { + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 + } + + "Connection Refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Connection refused" { + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 + } + + "Host key verification failed" { + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 + } + + "Illegal host key" { + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 + } + + "Connection Timed Out" { + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 + } + + "Interrupted system call" { + puts "\n$ip Interrupted system call!!!\n" + } } } if { $yesnoflag == 1 } { - expect { - "assword:" { - send "$passwd\r" - } - - "yes/no)?" { - set yesnoflag 2 - send "yes\r" - } - } + expect { + "assword:" { + send "$passwd\r" + } + + "yes/no)?" { + set yesnoflag 2 + send "yes\r" + } + } } if { $yesnoflag == 2 } { - expect { - "assword:" { - send "$passwd\r" - } - } + expect { + "assword:" { + send "$passwd\r" + } + } } expect { - "@" {send "$commands \r"} - "assword:" { - send "$passwd\r" - puts "\nPASSWORDERROR: $ip Password error!!!\n" - exit 1 - } + "@" {send "$commands \r"} + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } } expect { - "@" {send "sleep 1\r"} + "@" {send "sleep 1\r"} } expect { - "@" {send "exit\r"} + "@" {send "exit\r"} } expect eof { - puts "OK_SSH: $ip\n" - exit 0; + puts "OK_SSH: $ip\n" + exit 0; } diff --git a/tools/thread.sh b/tools/thread.sh index 02aeb8b4..576cf383 100755 --- a/tools/thread.sh +++ b/tools/thread.sh @@ -16,30 +16,30 @@ BWLIMIT=$8 while read eachline do - [ -z "`echo $eachline | grep -E '^com|^file'`" ] && continue - - myKEYWORD=`echo $eachline | awk -F"$myIFS" '{ print $1 }'` - myCONFIGLINE=`echo $eachline | awk -F"$myIFS" '{ print $2 }'` - - if [ "$myKEYWORD"x == "file"x ]; then - SOURCEFILE=`echo $myCONFIGLINE | awk '{ print $1 }'` - DESTDIR=`echo $myCONFIGLINE | awk '{ print $2 }'` - DIRECTION=`echo $myCONFIGLINE | awk '{ print $3 }'` - ./mscp.exp $IP $USER $PASSWD $PORT $SOURCEFILE $DESTDIR $DIRECTION $BWLIMIT $SCPTIMEOUT - - [ $? -ne 0 ] && echo -e "\033[31mSCP Try Out All Password Failed\033[0m\n" - - elif [ "$myKEYWORD"x == "com"x ]; then - ./mssh.exp $IP $USER $PASSWD $PORT "${myCONFIGLINE}" $SSHTIMEOUT - [ $? -ne 0 ] && echo -e "\033[31mSSH Try Out All Password Failed\033[0m\n" - - else - echo "ERROR: configuration wrong! [$eachline] " - echo " where KEYWORD should not be [$myKEYWORD], but 'com' or 'file'" - echo " if you dont want to run it, you can comment it with '#'" - echo "" - exit - fi + [ -z "`echo $eachline | grep -E '^com|^file'`" ] && continue + + myKEYWORD=`echo $eachline | awk -F"$myIFS" '{ print $1 }'` + myCONFIGLINE=`echo $eachline | awk -F"$myIFS" '{ print $2 }'` + + if [ "$myKEYWORD"x == "file"x ]; then + SOURCEFILE=`echo $myCONFIGLINE | awk '{ print $1 }'` + DESTDIR=`echo $myCONFIGLINE | awk '{ print $2 }'` + DIRECTION=`echo $myCONFIGLINE | awk '{ print $3 }'` + ./mscp.exp $IP $USER $PASSWD $PORT $SOURCEFILE $DESTDIR $DIRECTION $BWLIMIT $SCPTIMEOUT + + [ $? -ne 0 ] && echo -e "\033[31mSCP Try Out All Password Failed\033[0m\n" + + elif [ "$myKEYWORD"x == "com"x ]; then + ./mssh.exp $IP $USER $PASSWD $PORT "${myCONFIGLINE}" $SSHTIMEOUT + [ $? -ne 0 ] && echo -e "\033[31mSSH Try Out All Password Failed\033[0m\n" + + else + echo "ERROR: configuration wrong! [$eachline] " + echo " where KEYWORD should not be [$myKEYWORD], but 'com' or 'file'" + echo " if you dont want to run it, you can comment it with '#'" + echo "" + exit + fi done < $CONFIG_FILE diff --git a/tools/website_bk.sh b/tools/website_bk.sh index d884db83..cee9022d 100755 --- a/tools/website_bk.sh +++ b/tools/website_bk.sh @@ -24,7 +24,7 @@ if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ];then else echo "[$OldFile] Delete Old Backup File" >> $LogFile fi - + if [ -e "$NewFile" ];then echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile else diff --git a/uninstall.sh b/uninstall.sh index 5ef3c975..f4eafe18 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -21,23 +21,23 @@ printf " . ./options.conf . ./include/color.sh . ./include/get_char.sh -. ./include/check_db.sh +. ./include/check_dir.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } Usage(){ printf " Usage: $0 [ ${CMSG}all${CEND} | ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}hhvm${CEND} | ${CMSG}pureftpd${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} ] -${CMSG}all${CEND} --->Uninstall All +${CMSG}all${CEND} --->Uninstall All ${CMSG}web${CEND} --->Uninstall Nginx/Tengine/Apache/Tomcat ${CMSG}db${CEND} --->Uninstall MySQL/MariaDB/Percona ${CMSG}php${CEND} --->Uninstall PHP -${CMSG}hhvm${CEND} --->Uninstall HHVM -${CMSG}pureftpd${CEND} --->Uninstall PureFtpd +${CMSG}hhvm${CEND} --->Uninstall HHVM +${CMSG}pureftpd${CEND} --->Uninstall PureFtpd ${CMSG}redis${CEND} --->Uninstall Redis -${CMSG}memcached${CEND} --->Uninstall Memcached +${CMSG}memcached${CEND} --->Uninstall Memcached " } @@ -60,7 +60,7 @@ echo "${CWARNING}You will uninstall OneinStack, Please backup your configure fil } Print_web() { -[ -d "$nginx_install_dir" ] && echo "$nginx_install_dir" +[ -d "$nginx_install_dir" ] && echo "$nginx_install_dir" [ -d "$tengine_install_dir" ] && echo "$tengine_install_dir" [ -d "$openresty_install_dir" ] && echo "$openresty_install_dir" [ -e "/etc/init.d/nginx" ] && echo '/etc/init.d/nginx' @@ -115,8 +115,8 @@ Print_PHP() { Uninstall_PHP() { [ -e "$php_install_dir/bin/phpize" -a -e "$php_install_dir/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf $php_install_dir /etc/init.d/php-fpm; } [ -e "$php_install_dir/bin/phpize" -a ! -e "$php_install_dir/etc/php-fpm.conf" ] && rm -rf $php_install_dir -[ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick -[ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick +[ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick +[ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick sed -i "s@$php_install_dir/bin:@@" /etc/profile echo "${CMSG}PHP uninstall completed${CEND}" } @@ -137,7 +137,7 @@ echo "${CMSG}HHVM uninstall completed${CEND}" Print_PureFtpd() { [ -e "$pureftpd_install_dir" ] && echo "$pureftpd_install_dir" -[ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd" +[ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd" } Uninstall_PureFtpd() { @@ -174,14 +174,14 @@ while : do printf " What Are You Doing? -\t${CMSG}0${CEND}. Uninstall All -\t${CMSG}1${CEND}. Uninstall Nginx/Tengine/Apache/Tomcat -\t${CMSG}2${CEND}. Uninstall MySQL/MariaDB/Percona -\t${CMSG}3${CEND}. Uninstall PHP -\t${CMSG}4${CEND}. Uninstall HHVM -\t${CMSG}5${CEND}. Uninstall PureFtpd -\t${CMSG}6${CEND}. Uninstall Redis -\t${CMSG}7${CEND}. Uninstall Memcached +\t${CMSG}0${CEND}. Uninstall All +\t${CMSG}1${CEND}. Uninstall Nginx/Tengine/Apache/Tomcat +\t${CMSG}2${CEND}. Uninstall MySQL/MariaDB/Percona +\t${CMSG}3${CEND}. Uninstall PHP +\t${CMSG}4${CEND}. Uninstall HHVM +\t${CMSG}5${CEND}. Uninstall PureFtpd +\t${CMSG}6${CEND}. Uninstall Redis +\t${CMSG}7${CEND}. Uninstall Memcached \t${CMSG}q${CEND}. Exit " echo @@ -305,22 +305,22 @@ elif [ $# == 1 ];then hhvm) Print_HHVM Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_HHVM || exit + [ "$uninstall_yn" == 'y' ] && Uninstall_HHVM || exit ;; pureftpd) Print_PureFtpd Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_PureFtpd || exit + [ "$uninstall_yn" == 'y' ] && Uninstall_PureFtpd || exit ;; redis) Print_Redis Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Redis || exit + [ "$uninstall_yn" == 'y' ] && Uninstall_Redis || exit ;; memcached) Print_Memcached Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Memcached || exit + [ "$uninstall_yn" == 'y' ] && Uninstall_Memcached || exit ;; *) Usage diff --git a/upgrade.sh b/upgrade.sh index 995ebf5a..9ebe9d83 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -13,7 +13,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# upgrade Web,Database,PHP,Redis,phpMyAdmin for OneinStack # +# upgrade Web,Database,PHP,Redis,phpMyAdmin for OneinStack # # For more information please visit http://oneinstack.com # ####################################################################### " @@ -24,7 +24,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./options.conf . ./include/color.sh . ./include/check_os.sh -. ./include/check_db.sh +. ./include/check_dir.sh . ./include/download.sh . ./include/get_char.sh . ./include/upgrade_web.sh @@ -34,9 +34,9 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./include/upgrade_phpmyadmin.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -# get the IP information +# get the IP information PUBLIC_IPADDR=`./include/get_public_ipaddr.py` [ "`./include/get_ipaddr_state.py $PUBLIC_IPADDR`" == '\u4e2d\u56fd' ] && IPADDR_STATE=CN @@ -116,23 +116,23 @@ elif [ $# == 1 ];then Upgrade_OpenResty fi ;; - + db) Upgrade_DB ;; - + php) Upgrade_PHP ;; - + redis) Upgrade_Redis ;; - + phpmyadmin) Upgrade_phpMyAdmin ;; - + *) Usage ;; diff --git a/vhost.sh b/vhost.sh index b78140ba..8b81d391 100755 --- a/vhost.sh +++ b/vhost.sh @@ -19,11 +19,11 @@ printf " . ./options.conf . ./include/color.sh -. ./include/check_web.sh +. ./include/check_dir.sh . ./include/get_char.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } Usage() { printf " @@ -255,7 +255,7 @@ if [ "$moredomainame_yn" == 'y' ]; then break fi done - [ "$nginx_ssl_yn" == 'y' ] && HTTP_flag=https || HTTP_flag=http + [ "$nginx_ssl_yn" == 'y' ] && HTTP_flag=https || HTTP_flag=http [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") fi fi @@ -298,7 +298,7 @@ Nginx_anti_hotlinking() { while : do echo - read -p "Do you want to add hotlink protection? [y/n]: " anti_hotlinking_yn + read -p "Do you want to add hotlink protection? [y/n]: " anti_hotlinking_yn if [[ ! $anti_hotlinking_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else @@ -312,7 +312,7 @@ else domain_allow="*.$domain $domain" fi -if [ "$anti_hotlinking_yn" == 'y' ];then +if [ "$anti_hotlinking_yn" == 'y' ];then if [ "$moredomainame_yn" == 'y' ]; then domain_allow_all=$domain_allow$moredomainame else @@ -333,7 +333,7 @@ do if [[ ! $rewrite_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi done if [ "$rewrite_yn" == 'n' ];then @@ -345,14 +345,14 @@ else echo "${CMSG}wordpress${CEND},${CMSG}discuz${CEND},${CMSG}opencart${CEND},${CMSG}thinkphp${CEND},${CMSG}laravel${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND} rewrite was exist." read -p "(Default rewrite: other):" rewrite if [ "$rewrite" == "" ]; then - rewrite="other" + rewrite="other" fi echo "You choose rewrite=${CMSG}$rewrite${CEND}" [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") if [ -e "config/$rewrite.conf" ];then - /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf + /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf else - touch "$web_install_dir/conf/rewrite/$rewrite.conf" + touch "$web_install_dir/conf/rewrite/$rewrite.conf" fi fi } @@ -361,11 +361,11 @@ Nginx_log() { while : do echo - read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn + read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn if [[ ! $access_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi done if [ "$access_yn" == 'n' ]; then @@ -506,7 +506,7 @@ printf " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" +[ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } @@ -535,7 +535,7 @@ Create_apache_conf() { [ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost cat > $apache_install_dir/conf/vhost/$domain.conf << EOF - ServerAdmin admin@linuxeye.com + ServerAdmin admin@linuxeye.com DocumentRoot "$vhostdir" ServerName $domain $Apache_Domain_alias @@ -663,7 +663,7 @@ echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Apache Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" +[ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } @@ -715,7 +715,7 @@ Del_NGX_Vhost() { if [ -n "$Domain_List" ];then echo echo "Virtualhost list:" - echo ${CMSG}$Domain_List${CEND} + echo ${CMSG}$Domain_List${CEND} while : do echo @@ -730,7 +730,7 @@ Del_NGX_Vhost() { while : do echo - read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn + read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn if [[ ! $Del_Vhost_wwwroot_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else @@ -759,7 +759,7 @@ Del_NGX_Vhost() { Del_Apache_Vhost() { if [ -e "$apache_install_dir/conf/httpd.conf" ];then if [ -e "$web_install_dir/sbin/nginx" ];then - rm -rf $apache_install_dir/conf/vhost/${domain}.conf + rm -rf $apache_install_dir/conf/vhost/${domain}.conf /etc/init.d/httpd restart else Domain_List=`ls $apache_install_dir/conf/vhost | grep -v '0.conf' | sed "s@.conf@@g"` @@ -813,7 +813,7 @@ Del_Tomcat_Vhost() { if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -e "$web_install_dir/sbin/nginx" ];then if [ -n "`grep vhost-${domain} $tomcat_install_dir/conf/server.xml`" ];then - sed -i /vhost-${domain}/d $tomcat_install_dir/conf/server.xml + 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 @@ -844,7 +844,7 @@ Del_Tomcat_Vhost() { break fi done - + if [ "$Del_Vhost_wwwroot_yn" == 'y' ];then echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` @@ -857,7 +857,7 @@ Del_Tomcat_Vhost() { break fi done - + else echo "${CWARNING}Virtualhost was not exist! ${CEND}" fi @@ -866,7 +866,7 @@ Del_Tomcat_Vhost() { } if [ $# == 0 ];then - Add_Vhost + Add_Vhost elif [ $# == 1 ];then case $1 in add) From d575b2210ed5096f647981a2523602ab15fa0a76 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 1 Jun 2016 22:02:42 +0800 Subject: [PATCH 576/617] Update apps.conf --- apps.conf | 4 ++-- include/GraphicsMagick.sh | 4 ++-- include/ImageMagick.sh | 4 ++-- include/apache-2.2.sh | 2 +- include/apache-2.4.sh | 4 ++-- include/apcu.sh | 2 +- include/check_os.sh | 2 ++ include/eaccelerator-0.9.sh | 2 +- include/eaccelerator-1.0-dev.sh | 2 +- include/get_ipaddr_state.py | 2 +- include/init_CentOS.sh | 6 +++--- include/init_Ubuntu.sh | 2 +- include/jemalloc.sh | 2 +- include/memcached.sh | 8 ++++---- include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/php-5.3.sh | 14 +++++++------- include/php-5.4.sh | 10 +++++----- include/php-5.5.sh | 10 +++++----- include/php-5.6.sh | 10 +++++----- include/php-7.sh | 10 +++++----- include/pureftpd.sh | 2 +- include/redis.sh | 4 ++-- include/tcmalloc.sh | 2 +- include/tengine.sh | 2 +- include/tomcat-7.sh | 2 +- include/tomcat-8.sh | 2 +- include/upgrade_db.sh | 2 +- include/upgrade_redis.sh | 2 +- include/upgrade_web.sh | 6 +++--- include/xcache.sh | 2 +- include/zendopcache.sh | 2 +- shadowsocks.sh | 2 +- 36 files changed, 71 insertions(+), 69 deletions(-) diff --git a/apps.conf b/apps.conf index 2d8f35f5..b0cecfef 100644 --- a/apps.conf +++ b/apps.conf @@ -1,6 +1,6 @@ # newest software version # Web -nginx_version=1.10.0 +nginx_version=1.10.1 tengine_version=2.1.1 openresty_version=1.9.7.4 @@ -64,7 +64,7 @@ memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 # phpMyadmin -phpMyAdmin_version=4.4.15.5 +phpMyAdmin_version=4.4.15.6 # jemalloc jemalloc_version=4.2.0 diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index bccdb456..ee4f947d 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -15,7 +15,7 @@ src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/$ tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz cd GraphicsMagick-$GraphicsMagick_version ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static -make && make install +make -j ${THREAD} && make install cd .. rm -rf GraphicsMagick-$GraphicsMagick_version cd .. @@ -37,7 +37,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick - make && make install + make -j ${THREAD} && make install cd .. rm -rf gmagick-$gmagick_version diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 78b05ad2..6934f161 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/ImageMagick-$ImageMagick_vers tar xzf ImageMagick-$ImageMagick_version.tar.gz cd ImageMagick-$ImageMagick_version ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static -make && make install +make -j ${THREAD} && make install cd .. rm -rf ImageMagick-$ImageMagick_version cd .. @@ -37,7 +37,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick - make && make install + make -j ${THREAD} && make install cd .. rm -rf imagick-$imagick_version diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 86192a8c..ef3c9ca8 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -20,7 +20,7 @@ cd httpd-$apache_2_version [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir -make && make install +make -j ${THREAD} && make install if [ -e "$apache_install_dir/conf/httpd.conf" ];then echo "${CSUCCESS}Apache install successfully! ${CEND}" cd .. diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index d73b1001..2e951bab 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -18,7 +18,7 @@ src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_4_version.tar.gz tar xzf pcre-$pcre_version.tar.gz cd pcre-$pcre_version ./configure -make && make install +make -j ${THREAD} && make install cd .. id -u $run_user >/dev/null 2>&1 @@ -33,7 +33,7 @@ cd httpd-$apache_4_version /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir -make && make install +make -j ${THREAD} && make install if [ -e "$apache_install_dir/conf/httpd.conf" ];then echo "${CSUCCESS}Apache install successfully! ${CEND}" cd .. diff --git a/include/apcu.sh b/include/apcu.sh index 852dbc19..15abcea8 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -17,7 +17,7 @@ cd apcu-$apcu_version make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config -make && make install +make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/apcu.so" ];then cat > $php_install_dir/etc/php.d/ext-apcu.ini << EOF [apcu] diff --git a/include/check_os.sh b/include/check_os.sh index 1538b3e2..922082c6 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -39,3 +39,5 @@ else SYS_BIG_FLAG=i586 SYS_BIT_a=x86;SYS_BIT_b=i686; fi + +THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index 25a16d19..b5427f7e 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -17,7 +17,7 @@ cd eaccelerator-0.9.6.1 make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config -make && make install +make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index c97f61ed..b2133116 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -18,7 +18,7 @@ cd eaccelerator-eaccelerator-42067ac make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config -make && make install +make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF diff --git a/include/get_ipaddr_state.py b/include/get_ipaddr_state.py index 58ab8122..e30fd4cc 100755 --- a/include/get_ipaddr_state.py +++ b/include/get_ipaddr_state.py @@ -3,7 +3,7 @@ try: import sys,urllib2,socket socket.setdefaulttimeout(10) - apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] + apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] content = urllib2.urlopen(apiurl).read() data = eval(content)['data'] code = eval(content)['code'] diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index a92a1129..ee21b03e 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -184,13 +184,13 @@ if [ ! -e "`which tmux`" ];then tar xzf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable ./configure - make && make install + make -j ${THREAD} && make install cd .. tar xzf tmux-2.2.tar.gz cd tmux-2.2 CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure - make && make install + make -j ${THREAD} && make install cd ../../ if [ "$OS_BIT" == '64' ];then @@ -207,7 +207,7 @@ if [ ! -e "`which htop`" ];then tar xzf htop-2.0.0.tar.gz cd htop-2.0.0 ./configure - make && make install + make -j ${THREAD} && make install cd ../../ fi . /etc/profile diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 2e1e2c15..42889c67 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -33,7 +33,7 @@ if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then tar xzf bison-2.7.1.tar.gz cd bison-2.7.1 ./configure - make && make install + make -j ${THREAD} && make install cd .. rm -rf bison-2.7.1 cd .. diff --git a/include/jemalloc.sh b/include/jemalloc.sh index f5952d23..de1b4a6b 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/jemalloc-$jemalloc_version.ta tar xjf jemalloc-$jemalloc_version.tar.bz2 cd jemalloc-$jemalloc_version LDFLAGS="${LDFLAGS} -lrt" ./configure -make && make install +make -j ${THREAD} && make install if [ -f "/usr/local/lib/libjemalloc.so" ];then if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ];then ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 diff --git a/include/memcached.sh b/include/memcached.sh index 0292af0d..2d2e9b09 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -20,7 +20,7 @@ tar xzf memcached-$memcached_version.tar.gz cd memcached-$memcached_version [ ! -d "$memcached_install_dir" ] && mkdir -p $memcached_install_dir ./configure --prefix=$memcached_install_dir -make && make install +make -j ${THREAD} && make install if [ -d "$memcached_install_dir/include/memcached" ];then echo "${CSUCCESS}memcached install successfully! ${CEND}" cd .. @@ -58,7 +58,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config - make && make install + make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ];then cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF extension=memcache.so @@ -84,7 +84,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure ./configure --with-memcached=$memcached_install_dir - make && make install + make -j ${THREAD} && make install cd .. rm -rf libmemcached-$libmemcached_version @@ -102,7 +102,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config - make && make install + make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ];then cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF extension=memcached.so diff --git a/include/nginx.sh b/include/nginx.sh index 7fccf9df..2bcbf07c 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -37,7 +37,7 @@ fi [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make && make install +make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ];then cd .. rm -rf nginx-$nginx_version diff --git a/include/openresty.sh b/include/openresty.sh index f2496131..0f1f3510 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -34,7 +34,7 @@ fi [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make && make install +make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then cd .. rm -rf openresty-$openresty_version diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index a4e05bee..08c8644e 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -40,7 +40,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 82355206..41deca71 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -39,7 +39,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index a87eaaa4..d0a54cde 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -54,7 +54,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER -make -j `grep processor /proc/cpuinfo | wc -l` +make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 1c5efd8d..febf291c 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -24,25 +24,25 @@ tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch cd libiconv-$libiconv_version ./configure --prefix=/usr/local -make && make install +make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure -make && make install +make -j ${THREAD} && make install ldconfig cd libltdl ./configure --enable-ltdl-install -make && make install +make -j ${THREAD} && make install cd ../../ rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mhash-$mhash_version @@ -56,7 +56,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz cd mcrypt-$mcrypt_version ldconfig ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mcrypt-$mcrypt_version @@ -72,7 +72,7 @@ if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then tar xzf openssl-1.0.0s.tar.gz cd openssl-1.0.0s ./config --prefix=/usr/local/openssl -fPIC shared zlib - make && make install + make -j ${THREAD} && make install cd .. [ -e '/usr/local/openssl/lib/libcrypto.a' ] && { OpenSSL_args='--with-openssl=/usr/local/openssl'; rm -rf openssl-1.0.0s; } || OpenSSL_args='--with-openssl' fi @@ -84,7 +84,7 @@ if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then tar xzf curl-7.29.0.tar.gz cd curl-7.29.0 LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl - make && make install + make -j ${THREAD} && make install cd .. [ -e '/usr/local/curl/lib/libcurl.a' ] && { Curl_args='--with-curl=/usr/local/curl'; rm -rf curl-7.29.0; } || Curl_args='--with-curl' fi diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 6800f60a..3620ee17 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -22,25 +22,25 @@ tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch cd libiconv-$libiconv_version ./configure --prefix=/usr/local -make && make install +make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure -make && make install +make -j ${THREAD} && make install ldconfig cd libltdl ./configure --enable-ltdl-install -make && make install +make -j ${THREAD} && make install cd ../../ rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mhash-$mhash_version @@ -52,7 +52,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz cd mcrypt-$mcrypt_version ldconfig ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mcrypt-$mcrypt_version diff --git a/include/php-5.5.sh b/include/php-5.5.sh index c3cfdeed..1ce75be8 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -22,25 +22,25 @@ tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch cd libiconv-$libiconv_version ./configure --prefix=/usr/local -make && make install +make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure -make && make install +make -j ${THREAD} && make install ldconfig cd libltdl ./configure --enable-ltdl-install -make && make install +make -j ${THREAD} && make install cd ../../ rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mhash-$mhash_version @@ -52,7 +52,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz cd mcrypt-$mcrypt_version ldconfig ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mcrypt-$mcrypt_version diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 784c4ef6..e15adf85 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -21,25 +21,25 @@ tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch cd libiconv-$libiconv_version ./configure --prefix=/usr/local -make && make install +make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure -make && make install +make -j ${THREAD} && make install ldconfig cd libltdl ./configure --enable-ltdl-install -make && make install +make -j ${THREAD} && make install cd ../../ rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mhash-$mhash_version @@ -51,7 +51,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz cd mcrypt-$mcrypt_version ldconfig ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mcrypt-$mcrypt_version diff --git a/include/php-7.sh b/include/php-7.sh index 775e632c..69065fa5 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -21,25 +21,25 @@ tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch cd libiconv-$libiconv_version ./configure --prefix=/usr/local -make && make install +make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure -make && make install +make -j ${THREAD} && make install ldconfig cd libltdl ./configure --enable-ltdl-install -make && make install +make -j ${THREAD} && make install cd ../../ rm -rf libmcrypt-$libmcrypt_version tar xzf mhash-$mhash_version.tar.gz cd mhash-$mhash_version ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mhash-$mhash_version @@ -51,7 +51,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz cd mcrypt-$mcrypt_version ldconfig ./configure -make && make install +make -j ${THREAD} && make install cd .. rm -rf mcrypt-$mcrypt_version diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 6fcf0641..ef15cbf7 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -20,7 +20,7 @@ id -u $run_user >/dev/null 2>&1 cd pure-ftpd-$pureftpd_version [ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 -make && make install +make -j ${THREAD} && make install if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then echo "${CSUCCESS}Pure-Ftp install successfully! ${CEND}" [ ! -e "$pureftpd_install_dir/etc" ] && mkdir $pureftpd_install_dir/etc diff --git a/include/redis.sh b/include/redis.sh index 9c37cfb7..485af74a 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -19,7 +19,7 @@ if [ "$OS_BIT" == '32' ];then sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings fi -make +make -j ${THREAD} if [ -f "src/redis-server" ];then mkdir -p $redis_install_dir/{bin,etc,var} @@ -67,7 +67,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config - make && make install + make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ];then cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF [redis] diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index d491dc97..6777e3ff 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/gperftools-$tcmalloc_version. tar xzf gperftools-$tcmalloc_version.tar.gz cd gperftools-$tcmalloc_version ./configure --enable-frame-pointers -make && make install +make -j ${THREAD} && make install if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf diff --git a/include/tengine.sh b/include/tengine.sh index 1a829005..8547f775 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -35,7 +35,7 @@ fi [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make && make install +make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ];then cd .. rm -rf tengine-$tengine_version diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 7bae61c9..a24758de 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -41,7 +41,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then cd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config - make && make install + make -j ${THREAD} && make install if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 1d906ff1..21ca971e 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -41,7 +41,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then cd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config - make && make install + make -j ${THREAD} && make install if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index c893b482..4185469d 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -150,7 +150,7 @@ $EXE_LINKER -DDEFAULT_COLLATION=utf8mb4_general_ci \ $EXE_LINKER fi - make -j `grep processor /proc/cpuinfo | wc -l` + make -j ${THREAD} service mysqld stop mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index cf9bf747..1caca899 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -42,7 +42,7 @@ if [ -e "redis-$NEW_Redis_version.tar.gz" ];then sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings fi - make + make -j ${THREAD} if [ -f "src/redis-server" ];then echo "Restarting Redis..." diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 609c6bb2..e6a47497 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -46,7 +46,7 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` rm -rf $$ ./configure $nginx_configure_arguments - make + make -j ${THREAD} if [ -f "objs/nginx" ];then /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) /bin/cp objs/nginx $nginx_install_dir/sbin/nginx @@ -100,7 +100,7 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` rm -rf $$ ./configure $tengine_configure_arguments - make + make -j ${THREAD} if [ -f "objs/nginx" ];then /bin/mv $tengine_install_dir/sbin/nginx $tengine_install_dir/sbin/nginx$(date +%m%d) /bin/mv $tengine_install_dir/sbin/dso_tool $tengine_install_dir/sbin/dso_tool$(date +%m%d) @@ -162,7 +162,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'" [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module - make + make -j ${THREAD} if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d) make install diff --git a/include/xcache.sh b/include/xcache.sh index 647a8628..69bb9d96 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -18,7 +18,7 @@ cd xcache-$xcache_version make clean $php_install_dir/bin/phpize ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config -make && make install +make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/xcache.so" ];then /bin/cp -R htdocs $wwwroot_dir/default/xcache chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 1d9a5509..176e89ba 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -18,7 +18,7 @@ cd zendopcache-$zendopcache_version make clean $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config -make && make install +make -j ${THREAD} && make install if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] diff --git a/shadowsocks.sh b/shadowsocks.sh index da90f6e5..fa8397c6 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -151,7 +151,7 @@ Install_shadowsocks-libev() { git clone https://github.com/shadowsocks/shadowsocks-libev.git cd shadowsocks-libev ./configure -make && make install +make -j ${THREAD} && make install cd .. if [ -f /usr/local/bin/ss-server ];then /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks From 426b7d24763d6aaef2df64be104cc3c6292d2091 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 3 Jun 2016 16:02:18 +0800 Subject: [PATCH 577/617] remove unneeded spaces --- apps.conf | 2 +- backup_setup.sh | 31 ++++---------- include/upgrade_db.sh | 7 +-- include/upgrade_php.sh | 4 +- include/upgrade_phpmyadmin.sh | 4 +- include/upgrade_redis.sh | 4 +- include/upgrade_web.sh | 12 ++---- pureftpd_vhost.sh | 22 ++-------- reset_db_root_password.sh | 4 +- shadowsocks.sh | 12 ++---- tools/mabs.sh | 3 +- uninstall.sh | 3 +- upgrade.sh | 3 +- vhost.sh | 80 +++++++++-------------------------- 14 files changed, 48 insertions(+), 143 deletions(-) diff --git a/apps.conf b/apps.conf index b0cecfef..65ce85a9 100644 --- a/apps.conf +++ b/apps.conf @@ -2,7 +2,7 @@ # Web nginx_version=1.10.1 tengine_version=2.1.1 -openresty_version=1.9.7.4 +openresty_version=1.9.7.5 tomcat_7_version=7.0.69 tomcat_8_version=8.0.30 diff --git a/backup_setup.sh b/backup_setup.sh index de188dd1..ed0279ce 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -25,9 +25,7 @@ printf " # Check if user is root [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -while : -do - echo +while :; do echo echo 'Please select your backup destination:' echo -e "\t${CMSG}1${CEND}. Only Localhost" echo -e "\t${CMSG}2${CEND}. Only Remote host" @@ -45,9 +43,7 @@ done [ "$DESC_BK" == '2' ] && sed -i 's@^backup_destination=.*@backup_destination=remote@' ./options.conf [ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf -while : -do - echo +while :; do echo echo 'Please select your backup content:' echo -e "\t${CMSG}1${CEND}. Only Database" echo -e "\t${CMSG}2${CEND}. Only Website" @@ -65,9 +61,7 @@ done [ "$CONTENT_BK" == '2' ] && sed -i 's@^backup_content=.*@backup_content=web@' ./options.conf [ "$CONTENT_BK" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf -while : -do - echo +while :; do echo echo "Please enter the directory for save the backup file: " read -p "(Default directory: $backup_dir): " NEW_backup_dir [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" @@ -79,9 +73,7 @@ do done sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf -while : -do - echo +while :; do echo echo "Pleas enter a valid backup number of days: " read -p "(Default days: 5): " expired_days [ -z "$expired_days" ] && expired_days=5 @@ -91,9 +83,7 @@ sed -i "s@^expired_days=.*@expired_days=$expired_days@" ./options.conf if [ "$CONTENT_BK" != '2' ];then databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"` - while : - do - echo + while :; do echo echo "Please enter one or more name for database, separate multiple database names with commas: " read -p "(Default database: `echo $databases | tr ' ' ','`) " db_name db_name=`echo $db_name | tr -d ' '` @@ -110,9 +100,7 @@ fi if [ "$CONTENT_BK" != '1' ];then websites=`ls $wwwroot_dir | grep -vw default` - while : - do - echo + while :; do echo echo "Please enter one or more name for website, separate multiple website names with commas: " read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name website_name=`echo $website_name | tr -d ' '` @@ -134,9 +122,7 @@ echo "You have to backup the content:" if [[ "$DESC_BK" =~ ^[2,3]$ ]];then > tools/iplist.txt - while : - do - echo + while :; do echo read -p "Please enter the remote host ip: " remote_ip [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue echo @@ -154,8 +140,7 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]];then ./tools/mssh.exp ${IPcode}P $remote_user ${PWcode}P ${Portcode}P true 10 if [ $? -eq 0 ];then [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}" - while : - do + while :; do read -p "Do you want to add more host ? [y/n]: " more_host_yn if [[ ! "$more_host_yn" =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 4185469d..52f1b71c 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -30,8 +30,7 @@ else fi #backup -while : -do +while :; do $db_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "quit" >/dev/null 2>&1 if [ $? -eq 0 ];then break @@ -61,9 +60,7 @@ 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 -a -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; } -while : -do - echo +while :; do echo read -p "Please input upgrade $DB Version(example: $OLD_DB_version): " NEW_DB_version if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ]; then if [ "$DB" == 'MariaDB' ];then diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 2cf1a890..0de1e1e0 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -14,9 +14,7 @@ cd $oneinstack_dir/src echo OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade PHP Version: " NEW_PHP_version if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ]; then [ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1 diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 03698255..2507798b 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -14,9 +14,7 @@ cd $oneinstack_dir/src OLD_phpMyAdmin_version=`grep Version $wwwroot_dir/default/phpMyAdmin/README | awk '{print $2}'` echo "Current phpMyAdmin Version: ${CMSG}$OLD_phpMyAdmin_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade phpMyAdmin Version(example: 4.4.15): " NEW_phpMyAdmin_version if [ "$NEW_phpMyAdmin_version" != "$OLD_phpMyAdmin_version" ];then [ ! -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/$NEW_phpMyAdmin_version/phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz > /dev/null 2>&1 diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index 1caca899..b9f1b9e7 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -13,9 +13,7 @@ cd $oneinstack_dir/src [ ! -d "$redis_install_dir" ] && echo "${CWARNING}The Redis is not installed on your system! ${CEND}" && exit 1 OLD_Redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'` echo "Current Redis Version: ${CMSG}$OLD_Redis_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade Redis Version(example: 3.0.5): " NEW_Redis_version if [ "$NEW_Redis_version" != "$OLD_Redis_version" ];then [ ! -e "redis-$NEW_Redis_version.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_Redis_version.tar.gz > /dev/null 2>&1 diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index e6a47497..422a38df 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -15,9 +15,7 @@ OLD_Nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` OLD_Nginx_version=${OLD_Nginx_version_tmp##*/} echo echo "Current Nginx Version: ${CMSG}$OLD_Nginx_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade Nginx Version(example: 1.9.15): " NEW_Nginx_version if [ "$NEW_Nginx_version" != "$OLD_Nginx_version" ];then [ ! -e "nginx-$NEW_Nginx_version.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-$NEW_Nginx_version.tar.gz > /dev/null 2>&1 @@ -69,9 +67,7 @@ OLD_Tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` OLD_Tengine_version="`echo ${OLD_Tengine_version_tmp#*/} | awk '{print $1}'`" echo echo "Current Tengine Version: ${CMSG}$OLD_Tengine_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade Tengine Version(example: 2.1.15): " NEW_Tengine_version if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ];then [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1 @@ -128,9 +124,7 @@ OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1` OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`" echo echo "Current OpenResty Version: ${CMSG}$OLD_OpenResty_version${CEND}" -while : -do - echo +while :; do echo read -p "Please input upgrade OpenResty Version(example: 1.9.7.19): " NEW_OpenResty_version if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 diff --git a/pureftpd_vhost.sh b/pureftpd_vhost.sh index ac8f6764..945bf982 100755 --- a/pureftpd_vhost.sh +++ b/pureftpd_vhost.sh @@ -34,9 +34,7 @@ FTP_bin=$pureftpd_install_dir/bin/pure-pw [ -z "`grep ^PureDB $FTP_conf`" ] && { echo "${CFAILURE}pure-ftpd is not own password database${CEND}" ; exit 1; } USER() { -while : -do - echo +while :; do echo read -p "Please input a username: " User if [ -z "$User" ]; then echo "${CWARNING}username can't be NULL! ${CEND}" @@ -47,9 +45,7 @@ done } PASSWORD() { -while : -do - echo +while :; do echo read -p "Please input the password: " Password [ -n "`echo $Password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } if (( ${#Password} >= 5 ));then @@ -62,9 +58,7 @@ done } DIRECTORY() { -while : -do -echo +while :; do echo read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory if [ -z "$Directory" ]; then Directory="$wwwroot_dir" @@ -77,8 +71,7 @@ echo done } -while : -do +while :; do printf " What Are You Doing? \t${CMSG}1${CEND}. UserAdd @@ -109,7 +102,6 @@ What Are You Doing? echo "You directory is : ${CMSG}$Directory${CEND}" echo ;; - 2) USER [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } @@ -124,7 +116,6 @@ What Are You Doing? echo "You new directory is : ${CMSG}$Directory${CEND}" echo ;; - 3) USER [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } @@ -139,7 +130,6 @@ What Are You Doing? echo "You new password is : ${CMSG}$Password${CEND}" echo ;; - 4) if [ ! -e "$Passwdfile" ];then echo "${CQUESTION}User was not existed! ${CEND}" @@ -154,7 +144,6 @@ What Are You Doing? echo echo "[$User] have been deleted! " ;; - 5) if [ ! -e "$Passwdfile" ];then echo "${CQUESTION}User was not existed! ${CEND}" @@ -162,17 +151,14 @@ What Are You Doing? $FTP_bin list fi ;; - 6) USER [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } $FTP_bin show $User ;; - q) exit ;; - esac fi done diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index 6e1ff633..b390d388 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -28,9 +28,7 @@ printf " Reset_db_root_password() { [ ! -d "$db_install_dir" ] && { echo "${CFAILURE}The Database is not installed on your system! ${CEND}"; exit 1; } -while : -do - echo +while :; do echo read -p "Please input the root password of database: " New_dbrootpwd [ -n "`echo $New_dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } (( ${#New_dbrootpwd} >= 5 )) && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" diff --git a/shadowsocks.sh b/shadowsocks.sh index fa8397c6..262a044e 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -38,9 +38,7 @@ Check_shadowsocks() { } AddUser_shadowsocks() { -while : -do - echo +while :; do echo read -p "Please input password for shadowsocks: " Shadowsocks_password [ -n "`echo $Shadowsocks_password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" @@ -60,9 +58,7 @@ else Shadowsocks_Default_port=9001 fi -while : -do - echo +while :; do echo read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port if [ $Shadowsocks_port -ge 9000 >/dev/null 2>&1 -a $Shadowsocks_port -le 10000 >/dev/null 2>&1 ];then @@ -166,9 +162,7 @@ fi } Uninstall_shadowsocks(){ -while : -do - echo +while :; do echo read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn if [[ ! $Shadowsocks_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" diff --git a/tools/mabs.sh b/tools/mabs.sh index 1dbc2022..6eac6c7d 100755 --- a/tools/mabs.sh +++ b/tools/mabs.sh @@ -59,8 +59,7 @@ TEMP=`getopt -o hvVl:c:t:T:L:n --long help,version,iplist:,config:,sshtimeout:,f eval set -- "$TEMP" -while : -do +while :; do [ -z "$1" ] && break; case "$1" in -h|--help) diff --git a/uninstall.sh b/uninstall.sh index f4eafe18..54aa0ec8 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -170,8 +170,7 @@ echo "${CMSG}Memcached uninstall completed${CEND}" } Menu(){ -while : -do +while :; do printf " What Are You Doing? \t${CMSG}0${CEND}. Uninstall All diff --git a/upgrade.sh b/upgrade.sh index 9ebe9d83..f5997050 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -53,8 +53,7 @@ ${CMSG}phpmyadmin${CEND} --->Upgrade phpMyAdmin } Menu(){ -while : -do +while :; do printf " What Are You Doing? \t${CMSG}1${CEND}. Upgrade Nginx/Tengine/OpenResty diff --git a/vhost.sh b/vhost.sh index 8b81d391..ecb03b35 100755 --- a/vhost.sh +++ b/vhost.sh @@ -37,9 +37,7 @@ ${CMSG}del${CEND} --->Delete Virtualhost Choose_env() { if [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then Number=111 - while : - do - echo + while :; do echo echo 'Please choose to use environment:' echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use java" @@ -57,9 +55,7 @@ if [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml [ "$Choose_number" == '3' ] && NGX_FLAG=hhvm elif [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ];then Number=110 - while : - do - echo + while :; do echo echo 'Please choose to use environment:' echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use java" @@ -78,9 +74,7 @@ elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server NGX_FLAG=php elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then Number=101 - while : - do - echo + while :; do echo echo 'Please choose to use environment:' echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use hhvm" @@ -96,9 +90,7 @@ elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server [ "$Choose_number" == '2' ] && NGX_FLAG=hhvm elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then Number=011 - while : - do - echo + while :; do echo echo 'Please choose to use environment:' echo -e "\t${CMSG}1${CEND}. Use java" echo -e "\t${CMSG}2${CEND}. Use hhvm" @@ -184,9 +176,7 @@ echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$web_install_dir/conf/ssl/${domain} Input_Add_domain() { if [ -e "$web_install_dir/sbin/nginx" ];then - while : - do - echo + while :; do echo read -p "Do you want to setup SSL under Nginx? [y/n]: " nginx_ssl_yn if [[ ! $nginx_ssl_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -196,9 +186,7 @@ if [ -e "$web_install_dir/sbin/nginx" ];then done fi -while : -do - echo +while :; do echo read -p "Please input domain(example: www.linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo "${CWARNING}input error! ${CEND}" @@ -216,9 +204,7 @@ else echo "domain=$domain" fi -while : -do - echo +while :; do echo read -p "Do you want to add more domain name? [y/n]: " moredomainame_yn if [[ ! $moredomainame_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -228,9 +214,7 @@ do done if [ "$moredomainame_yn" == 'y' ]; then - while : - do - echo + while :; do echo read -p "Type domainname or IP(example: linuxeye.com 121.43.8.8): " moredomain if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then echo "${CWARNING}input error! ${CEND}" @@ -245,9 +229,7 @@ if [ "$moredomainame_yn" == 'y' ]; then Tomcat_Domain_alias=$(for D in `echo $moredomainame`; do echo "$D"; done) if [ -e "$web_install_dir/sbin/nginx" ];then - while : - do - echo + while :; do echo read -p "Do you want to redirect from $moredomain to $domain? [y/n]: " redirect_yn if [[ ! $redirect_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -272,9 +254,7 @@ else Nginx_conf='listen 80;' fi -while : -do - echo +while :; do echo echo "Please input the directory for the domain:$domain :" read -p "(Default directory: $wwwroot_dir/$domain): " vhostdir if [ -n "$vhostdir" -a -z "`echo $vhostdir | grep '^/'`" ];then @@ -295,9 +275,7 @@ done } Nginx_anti_hotlinking() { -while : -do - echo +while :; do echo read -p "Do you want to add hotlink protection? [y/n]: " anti_hotlinking_yn if [[ ! $anti_hotlinking_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -326,9 +304,7 @@ fi Nginx_rewrite() { [ ! -d "$web_install_dir/conf/rewrite" ] && mkdir $web_install_dir/conf/rewrite -while : -do - echo +while :; do echo read -p "Allow Rewrite rule? [y/n]: " rewrite_yn if [[ ! $rewrite_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -358,9 +334,7 @@ fi } Nginx_log() { -while : -do - echo +while :; do echo read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn if [[ ! $access_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -511,9 +485,7 @@ echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" } Apache_log() { -while : -do - echo +while :; do echo read -p "Allow Apache access_log? [y/n]: " access_yn if [[ ! $access_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -716,9 +688,7 @@ Del_NGX_Vhost() { echo echo "Virtualhost list:" echo ${CMSG}$Domain_List${CEND} - while : - do - echo + while :; do echo read -p "Please input a domain you want to delete: " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo "${CWARNING}input error! ${CEND}" @@ -727,9 +697,7 @@ Del_NGX_Vhost() { Directory=`grep ^root $web_install_dir/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}'` rm -rf $web_install_dir/conf/vhost/${domain}.conf $web_install_dir/sbin/nginx -s reload - while : - do - echo + while :; do echo read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn if [[ ! $Del_Vhost_wwwroot_yn =~ ^[y,n]$ ]];then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" @@ -767,9 +735,7 @@ Del_Apache_Vhost() { echo echo "Virtualhost list:" echo ${CMSG}$Domain_List${CEND} - while : - do - echo + while :; do echo read -p "Please input a domain you want to delete: " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then echo "${CWARNING}input error! ${CEND}" @@ -778,9 +744,7 @@ Del_Apache_Vhost() { Directory=`grep '^ Date: Sun, 12 Jun 2016 16:37:06 +0800 Subject: [PATCH 578/617] Added addons.sh --- addons.sh | 338 ++++++++++++++++++++++++++++++++++ apps.conf | 16 +- include/GraphicsMagick.sh | 2 +- include/ZendGuardLoader.sh | 4 +- include/redis.sh | 8 +- include/upgrade_db.sh | 2 +- include/upgrade_php.sh | 2 +- include/upgrade_phpmyadmin.sh | 4 +- include/upgrade_redis.sh | 4 +- include/upgrade_web.sh | 12 +- include/zendopcache.sh | 4 +- pureftpd_vhost.sh | 2 +- reset_db_root_password.sh | 2 +- uninstall.sh | 6 +- 14 files changed, 371 insertions(+), 35 deletions(-) create mode 100755 addons.sh diff --git a/addons.sh b/addons.sh new file mode 100755 index 00000000..9b3cba0b --- /dev/null +++ b/addons.sh @@ -0,0 +1,338 @@ +#!/bin/bash +# Author: yeho +# 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 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +printf " +####################################################################### +# OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # +# Install/Uninstall PHP Extensions # +# For more information please visit http://oneinstack.com # +####################################################################### +" + +# get pwd +sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf + +. ./apps.conf +. ./options.conf +. ./include/color.sh +. ./include/memory.sh +. ./include/check_os.sh +. ./include/download.sh +. ./include/get_char.sh + +. ./include/zendopcache.sh +. ./include/xcache.sh +. ./include/apcu.sh +. ./include/eaccelerator-0.9.sh +. ./include/eaccelerator-1.0-dev.sh + +. ./include/ZendGuardLoader.sh +. ./include/ioncube.sh + +. ./include/ImageMagick.sh +. ./include/GraphicsMagick.sh + +. ./include/memcached.sh + +. ./include/redis.sh + +# Check if user is root +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } + +# Check PHP +if [ -e "$php_install_dir/bin/phpize" ];then + PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'` +else + echo "${CWARNING}PHP is not installed on your system! You can use to uninstall and reinstall PHP Extensions${CEND}"; exit 1 +fi + +# Check PHP Extensions +Check_PHP_Extension() { +[ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP $PHP_extension module already installed! ${CEND}"; exit 1; } +} + +# restart PHP +Restart_PHP() { +[ -e "$apache_install_dir/conf/httpd.conf" ] && /etc/init.d/httpd restart || /etc/init.d/php-fpm restart +} + +# Check succ +Check_succ() { +[ -f "`$php_install_dir/bin/php-config --extension-dir`/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module install successfully! ${CEND}"; } +} + +# Uninstall succ +Uninstall_succ() { +[ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { rm -rf $php_install_dir/etc/php.d/ext-${PHP_extension}.ini; Restart_PHP; echo; echo "${CMSG}PHP $PHP_extension module uninstall completed${CEND}"; } || { echo; echo "${CWARNING}$PHP_extension module does not exist! ${CEND}"; } +} + +# PHP 5.5,5,6,7.0 install opcache +Install_opcache() { +$php_install_dir/bin/phpize +./configure --with-php-config=$php_install_dir/bin/php-config +make -j ${THREAD} && make install +cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.enable_cli=1 +;opcache.optimization_level=0 +EOF +} + +ACTION_FUN() { +while :; do + echo + echo 'Please select an action:' + echo -e "\t${CMSG}1${CEND}. install" + echo -e "\t${CMSG}2${CEND}. uninstall" + read -p "Please input a number:(Default 1 press Enter) " ACTION + [ -z "$ACTION" ] && ACTION=1 + if [[ ! $ACTION =~ ^[1,2]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi +done +} + +while :;do + printf " +What Are You Doing? +\t${CMSG}1${CEND}. Install/Uninstall PHP opcode cache +\t${CMSG}2${CEND}. Install/Uninstall ZendGuardLoader/ionCube PHP Extension +\t${CMSG}3${CEND}. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension +\t${CMSG}4${CEND}. Install/Uninstall memcached/memcache +\t${CMSG}5${CEND}. Install/Uninstall Redis +\t${CMSG}q${CEND}. Exit +" + read -p "Please input the correct option: " Number + if [[ ! $Number =~ ^[1-5,q]$ ]];then + echo "${CFAILURE}input error! Please only input 1 ~ 5 and q${CEND}" + else + case "$Number" in + 1) + ACTION_FUN + while :; do echo + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Zend OPcache" + echo -e "\t${CMSG}2${CEND}. XCache" + echo -e "\t${CMSG}3${CEND}. APCU" + echo -e "\t${CMSG}4${CEND}. eAccelerator" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-4]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + [ $PHP_cache = 1 ] && PHP_extension=opcache + [ $PHP_cache = 2 ] && PHP_extension=xcache + [ $PHP_cache = 3 ] && PHP_extension=apcu + [ $PHP_cache = 4 ] && PHP_extension=eaccelerator + break + fi + done + if [ $ACTION = 1 ];then + Check_PHP_Extension + if [ -e $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini ];then + echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install $PHP_extension! ${CEND}"; echo; exit 1 + else + if [ $PHP_cache = 1 ];then + cd $oneinstack_dir/src + if [[ $PHP_version =~ ^5.[3-4]$ ]];then + Install_ZendOPcache + elif [ "$PHP_version" == '5.5' ];then + src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src + tar xzf php-$php_5_version.tar.gz + cd php-$php_5_version/ext/opcache + Install_opcache + elif [ "$PHP_version" == '5.6' ];then + src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src + tar xzf php-$php_6_version.tar.gz + cd php-$php_6_version/ext/opcache + Install_opcache + elif [ "$PHP_version" == '7.0' ];then + src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src + tar xzf php-$php_7_version.tar.gz + cd php-$php_7_version/ext/opcache + Install_opcache + fi + Check_succ + elif [ $PHP_cache = 2 ];then + if [[ $PHP_version =~ ^5.[3-6]$ ]];then + while :; do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" + done + Install_XCache + Check_succ + else + echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 + fi + elif [ $PHP_cache = 3 ];then + if [[ $PHP_version =~ ^5.[3-5]$ ]];then + Install_APCU + Check_succ + else + echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1 + fi + elif [ $PHP_cache = 4 ];then + if [ "$PHP_version" == '5.3' ];then + Install_eAccelerator-0-9 + Check_succ + elif [ "$PHP_version" == '5.4' ];then + Install_eAccelerator-1-0-dev + Check_succ + else + echo "${CWARNING}Your php does not support eAccelerator! ${CEND}"; exit 1 + fi + fi + fi + else + Uninstall_succ + fi + ;; + 2) + ACTION_FUN + while :; do echo + echo 'Please select ZendGuardLoader/ionCube:' + echo -e "\t${CMSG}1${CEND}. ZendGuardLoader" + echo -e "\t${CMSG}2${CEND}. ionCube Loader" + read -p "Please input a number:(Default 1 press Enter) " Loader + [ -z "$Loader" ] && Loader=1 + if [[ ! $Loader =~ ^[1,2]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + [ $Loader = 1 ] && PHP_extension=ZendGuardLoader + [ $Loader = 2 ] && PHP_extension=ioncube + break + fi + done + if [ $ACTION = 1 ];then + Check_PHP_Extension + if [[ $PHP_version =~ ^5.[3-6]$ ]];then + if [ $Loader = 1 ];then + if [ -e $php_install_dir/etc/php.d/ext-opcache.ini ];then + echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 + else + Install_ZendGuardLoader + Check_succ + fi + elif [ $Loader = 2 ];then + Install_ionCube + Restart_PHP; echo "${CSUCCESS}PHP $PHP_extension module install successfully! ${CEND}"; + fi + else + echo; echo "${CWARNING}Your php does not support $PHP_extension! ${CEND}"; + fi + else + Uninstall_succ + fi + ;; + 3) + ACTION_FUN + while :; do echo + echo 'Please select ImageMagick/GraphicsMagick:' + echo -e "\t${CMSG}1${CEND}. ImageMagick" + echo -e "\t${CMSG}2${CEND}. GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [[ ! $Magick =~ ^[1,2]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + [ $Magick = 1 ] && PHP_extension=imagick + [ $Magick = 2 ] && PHP_extension=gmagick + break + fi + done + if [ $ACTION = 1 ];then + Check_PHP_Extension + if [ $Magick = 1 ];then + [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick + Install_php-imagick + Check_succ + elif [ $Magick = 2 ];then + [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick + Install_php-gmagick + Check_succ + fi + else + Uninstall_succ + [ -d "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick + [ -d "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick + fi + ;; + 4) + ACTION_FUN + while :; do echo + echo 'Please select memcache/memcached PHP Extension:' + echo -e "\t${CMSG}1${CEND}. memcache PHP Extension" + echo -e "\t${CMSG}2${CEND}. memcached PHP Extension" + echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension" + read -p "Please input a number:(Default 1 press Enter) " Memcache + [ -z "$Memcache" ] && Memcache=1 + if [[ ! $Memcache =~ ^[1-3]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + [ $Memcache = 1 ] && PHP_extension=memcache + [ $Memcache = 2 ] && PHP_extension=memcached + break + fi + done + if [ $ACTION = 1 ];then + if [ $Memcache = 1 ];then + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + Check_PHP_Extension + Install_php-memcache + Check_succ + elif [ $Memcache = 2 ];then + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + Check_PHP_Extension + Install_php-memcached + Check_succ + elif [ $Memcache = 3 ];then + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + PHP_extension=memcache && Check_PHP_Extension + Install_php-memcache + PHP_extension=memcached && Check_PHP_Extension + Install_php-memcached + [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" -a "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module install successfully! ${CEND}"; } + fi + else + PHP_extension=memcache && Uninstall_succ + PHP_extension=memcached && Uninstall_succ + [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } + fi + ;; + 5) + ACTION_FUN + PHP_extension=redis + if [ $ACTION = 1 ];then + [ ! -d "$redis_install_dir" ] && Install_redis-server + Check_PHP_Extension + Install_php-redis + else + Uninstall_succ + [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } + fi + ;; + q) + exit + ;; + esac + fi +done diff --git a/apps.conf b/apps.conf index 65ce85a9..a9a76da5 100644 --- a/apps.conf +++ b/apps.conf @@ -2,7 +2,7 @@ # Web nginx_version=1.10.1 tengine_version=2.1.1 -openresty_version=1.9.7.5 +openresty_version=1.9.15.1 tomcat_7_version=7.0.69 tomcat_8_version=8.0.30 @@ -14,15 +14,15 @@ apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.12 -mysql_5_6_version=5.6.30 -mysql_5_5_version=5.5.49 +mysql_5_7_version=5.7.13 +mysql_5_6_version=5.6.31 +mysql_5_5_version=5.5.50 mariadb_10_1_version=10.1.14 mariadb_10_0_version=10.0.25 mariadb_5_5_version=5.5.49 -percona_5_7_version=5.7.11-4 +percona_5_7_version=5.7.12-5 percona_5_6_version=5.6.30-76.3 percona_5_5_version=5.5.49-37.9 @@ -41,7 +41,7 @@ php_7_version=7.0.7 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.4-5 +ImageMagick_version=6.9.4-8 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 @@ -55,7 +55,7 @@ pureftpd_version=1.0.42 # Redis redis_version=3.2.0 -redis_pecl_version=2.2.7 +redis_pecl_version=2.2.8 # Memcached memcached_version=1.4.25 @@ -67,7 +67,7 @@ memcache_pecl_version=3.0.8 phpMyAdmin_version=4.4.15.6 # jemalloc -jemalloc_version=4.2.0 +jemalloc_version=4.2.1 # tcmalloc tcmalloc_version=2.5 diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index ee4f947d..cea10600 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -48,7 +48,7 @@ extension=gmagick.so EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo "${CFAILURE}PHP Gmagick module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" fi fi cd .. diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 8b1ac5a8..12969b1f 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -82,10 +82,10 @@ zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 EOF - echo "${CSUCCESS}ZendGuardLoader module install successfully! ${CEND}" + echo "${CSUCCESS}PHP ZendGuardLoader module install successfully! ${CEND}" [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo "${CFAILURE}ZendGuardLoader module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" fi cd .. } diff --git a/include/redis.sh b/include/redis.sh index 485af74a..b49f85d7 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -54,11 +54,9 @@ Install_php-redis() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone -b php7 https://github.com/phpredis/phpredis.git - #cd phpredis - src_url=http://mirrors.linuxeye.com/oneinstack/src/phpredis-php7.tgz && Download_src - tar xzf phpredis-php7.tgz - cd phpredis-php7 + src_url=http://pecl.php.net/get/redis-3.0.0.tgz && Download_src + tar xzf redis-3.0.0.tgz + cd redis-3.0.0 else src_url=http://pecl.php.net/get/redis-$redis_pecl_version.tgz && Download_src tar xzf redis-$redis_pecl_version.tgz diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 52f1b71c..cb0af2d4 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -10,7 +10,7 @@ Upgrade_DB() { cd $oneinstack_dir/src -[ ! -e "$db_install_dir/bin/mysql" ] && echo "${CWARNING}The MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$db_install_dir/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1 OLD_DB_version_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'` DB_tmp=`echo $OLD_DB_version_tmp | awk -F'-' '{print $2}'` if [ "$DB_tmp" == 'MariaDB' ];then diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 0de1e1e0..1da58f88 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -10,7 +10,7 @@ Upgrade_PHP() { cd $oneinstack_dir/src -[ ! -e "$php_install_dir" ] && echo "${CWARNING}The PHP is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$php_install_dir" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1 echo OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 2507798b..06fda89a 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -10,7 +10,7 @@ Upgrade_phpMyAdmin() { cd $oneinstack_dir/src -[ ! -e "$wwwroot_dir/default/phpMyAdmin" ] && echo "${CWARNING}The phpMyAdmin is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$wwwroot_dir/default/phpMyAdmin" ] && echo "${CWARNING}phpMyAdmin is not installed on your system! ${CEND}" && exit 1 OLD_phpMyAdmin_version=`grep Version $wwwroot_dir/default/phpMyAdmin/README | awk '{print $2}'` echo "Current phpMyAdmin Version: ${CMSG}$OLD_phpMyAdmin_version${CEND}" @@ -25,7 +25,7 @@ while :; do echo echo "${CWARNING}phpMyAdmin version does not exist! ${CEND}" fi else - echo "${CWARNING}input error! The upgrade phpMyAdmin version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade phpMyAdmin version is the same as the old version${CEND}" fi done diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index b9f1b9e7..3f5a6594 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -10,7 +10,7 @@ Upgrade_Redis() { cd $oneinstack_dir/src -[ ! -d "$redis_install_dir" ] && echo "${CWARNING}The Redis is not installed on your system! ${CEND}" && exit 1 +[ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1 OLD_Redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'` echo "Current Redis Version: ${CMSG}$OLD_Redis_version${CEND}" while :; do echo @@ -24,7 +24,7 @@ while :; do echo echo "${CWARNING}Redis version does not exist! ${CEND}" fi else - echo "${CWARNING}input error! The upgrade Redis version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Redis version is the same as the old version${CEND}" fi done diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 422a38df..2d9837ee 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -10,7 +10,7 @@ Upgrade_Nginx() { cd $oneinstack_dir/src -[ ! -e "$nginx_install_dir/sbin/nginx" ] && echo "${CWARNING}The Nginx is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$nginx_install_dir/sbin/nginx" ] && echo "${CWARNING}Nginx is not installed on your system! ${CEND}" && exit 1 OLD_Nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` OLD_Nginx_version=${OLD_Nginx_version_tmp##*/} echo @@ -28,7 +28,7 @@ while :; do echo echo "${CWARNING}Nginx version does not exist! ${CEND}" fi else - echo "${CWARNING}input error! The upgrade Nginx version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Nginx version is the same as the old version${CEND}" fi done @@ -62,7 +62,7 @@ cd .. Upgrade_Tengine() { cd $oneinstack_dir/src -[ ! -e "$tengine_install_dir/sbin/nginx" ] && echo "${CWARNING}The Tengine is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$tengine_install_dir/sbin/nginx" ] && echo "${CWARNING}Tengine is not installed on your system! ${CEND}" && exit 1 OLD_Tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` OLD_Tengine_version="`echo ${OLD_Tengine_version_tmp#*/} | awk '{print $1}'`" echo @@ -80,7 +80,7 @@ while :; do echo echo "${CWARNING}Tengine version does not exist! ${CEND}" fi else - echo "${CWARNING}input error! The upgrade Tengine version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Tengine version is the same as the old version${CEND}" fi done @@ -119,7 +119,7 @@ cd .. Upgrade_OpenResty() { cd $oneinstack_dir/src -[ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}The OpenResty is not installed on your system! ${CEND}" && exit 1 +[ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}OpenResty is not installed on your system! ${CEND}" && exit 1 OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1` OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`" echo @@ -137,7 +137,7 @@ while :; do echo echo "${CWARNING}OpenResty version does not exist! ${CEND}" fi else - echo "${CWARNING}input error! The upgrade OpenResty version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade OpenResty version is the same as the old version${CEND}" fi done diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 176e89ba..92786d8e 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -33,12 +33,12 @@ opcache.fast_shutdown=1 opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - echo "${CSUCCESS}Zend OPcache module install successfully! ${CEND}" + echo "${CSUCCESS}PHP OPcache module install successfully! ${CEND}" cd .. rm -rf zendopcache-$zendopcache_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else - echo "${CFAILURE}Zend OPcache module install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" fi cd .. } diff --git a/pureftpd_vhost.sh b/pureftpd_vhost.sh index 945bf982..a6bd030d 100755 --- a/pureftpd_vhost.sh +++ b/pureftpd_vhost.sh @@ -24,7 +24,7 @@ printf " # Check if user is root [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -[ ! -d "$pureftpd_install_dir" ] && { echo "${CFAILURE}The ftp server does not exist! ${CEND}"; exit 1; } +[ ! -d "$pureftpd_install_dir" ] && { echo "${CFAILURE}FTP server does not exist! ${CEND}"; exit 1; } FTP_conf=$pureftpd_install_dir/etc/pure-ftpd.conf FTP_tmp_passfile=$pureftpd_install_dir/etc/pureftpd_psss.tmp diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index b390d388..b4600c20 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -27,7 +27,7 @@ printf " Reset_db_root_password() { -[ ! -d "$db_install_dir" ] && { echo "${CFAILURE}The Database is not installed on your system! ${CEND}"; exit 1; } +[ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; } while :; do echo read -p "Please input the root password of database: " New_dbrootpwd [ -n "`echo $New_dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } diff --git a/uninstall.sh b/uninstall.sh index 54aa0ec8..df08815a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -152,7 +152,7 @@ Print_Redis() { Uninstall_Redis() { [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } -[ -e "$php_install_dir/bin/phpize" ] && sed -i '/redis.so/d' $php_install_dir/etc/php.ini +[ -e "$php_install_dir/etc/php.d/ext-redis.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-redis.ini echo "${CMSG}Redis uninstall completed${CEND}" } @@ -164,8 +164,8 @@ Print_Memcached() { Uninstall_Memcached() { [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } -[ -e "$php_install_dir/bin/phpize" ] && sed -i '/memcache.so/d' $php_install_dir/etc/php.ini -[ -e "$php_install_dir/bin/phpize" ] && sed -i '/memcached.so/d' $php_install_dir/etc/php.ini +[ -e "$php_install_dir/etc/php.d/ext-memcache.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcache.ini +[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini echo "${CMSG}Memcached uninstall completed${CEND}" } From a36fca01b325b69bb827f16dba0a23bb09e21f61 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Thu, 16 Jun 2016 09:39:43 +0800 Subject: [PATCH 579/617] Added Apache SSL --- README.md | 7 +++ addons.sh | 2 +- config/index.html | 6 +- config/index_cn.html | 6 +- include/apache-2.2.sh | 2 - include/apache-2.4.sh | 1 + include/init_CentOS.sh | 1 + include/nginx.sh | 4 +- include/openresty.sh | 4 +- include/tengine.sh | 4 +- include/tomcat-6.sh | 123 ++++++++++++++++++++++++++++++++++++++ include/upgrade_web.sh | 8 ++- install.sh | 34 ++++++++--- uninstall.sh | 2 +- upgrade.sh | 2 +- apps.conf => versions.txt | 18 +++--- vhost.sh | 61 +++++++++++++++---- 17 files changed, 242 insertions(+), 43 deletions(-) create mode 100644 include/tomcat-6.sh rename apps.conf => versions.txt (96%) diff --git a/README.md b/README.md index f88601bf..6bb61f0a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,13 @@ screen -S lnmp // if network interruption, you can execute the command `scree ./install.sh // Do not sh install.sh or bash install.sh such execution ``` +## How to add PHP Extensions +```bash +cd ~/oneinstack // Must enter the directory execution under oneinstack +./addons.sh // Do not sh addons.sh or bash addons.sh such execution + +``` + ## How to add a virtual host ```bash diff --git a/addons.sh b/addons.sh index 9b3cba0b..b9d8a515 100755 --- a/addons.sh +++ b/addons.sh @@ -21,7 +21,7 @@ printf " # get pwd sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf -. ./apps.conf +. ./versions.txt . ./options.conf . ./include/color.sh . ./include/memory.sh diff --git a/config/index.html b/config/index.html index bb1a0871..550a8757 100644 --- a/config/index.html +++ b/config/index.html @@ -22,17 +22,17 @@

Congratulations, OneinStack a successful installation!

-

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona
+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc.

+

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona
+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc.

Check environment:  Proberv phpinfo Opcache phpMyAdmin

Create Web virtual running script:  ./vhost.sh

Create FTP virtual running script:  ./pureftpd_vhost.sh

-

For feedback, questions, and to follow the progress of the project:   http://oneinstack.com

+

For feedback, questions, and to follow the progress of the project:   https://oneinstack.com

Author email:  

Donate:

          PayPal:  lj2007331@gmail.com

          AliPay:  lj2007331@gmail.com

- +
diff --git a/config/index_cn.html b/config/index_cn.html index 54e8184b..68de0d04 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -22,18 +22,18 @@

Congratulations, OneinStack安装成功!

-

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc. 脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

+

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc. 脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

查看本地环境:  探针 phpinfo Opcache phpMyAdmin(为了更安全,建议phpMyAdmin目录重命名!)

创建WEB虚拟主机执行脚本:  ./vhost.sh

创建FTP虚拟账号执行脚本:  ./pureftpd_vhost.sh

Github项目地址:  https://github.com/lj2007331/oneinstack

-

OneinStack官网:  http://oneinstack.com

+

OneinStack官网:  https://oneinstack.com

QQ群:  558540514(付费千人群) 556824757(新) 213014293(满) 486321919(满) 438311066(满) 235258658(满)

赞助我们:

          支付宝:  lj2007331@gmail.com

          PayPal:  lj2007331@gmail.com

- +
diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index ef3c9ca8..a922f5d0 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -56,8 +56,6 @@ elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];the fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf -sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf -sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf sed -i "s@^@@" $apache_install_dir/conf/httpd.conf diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 2e951bab..39b9c565 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -71,6 +71,7 @@ sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .p sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf +sed -i 's@^#LoadModule\(.*\)mod_ssl.so@LoadModule\1mod_ssl.so@' $apache_install_dir/conf/httpd.conf sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf sed -i "s@^@@" $apache_install_dir/conf/httpd.conf diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index ee21b03e..e4fb2772 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -14,6 +14,7 @@ yum clean all yum makecache if [ "$CentOS_RHEL_version" == '7' ];then + yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server" yum -y install iptables-services systemctl mask firewalld.service systemctl enable iptables.service diff --git a/include/nginx.sh b/include/nginx.sh index 2bcbf07c..86f729cb 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -12,12 +12,14 @@ Install_Nginx() { cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src +src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz tar xzf nginx-$nginx_version.tar.gz +tar xzf openssl-$openssl_version.tar.gz cd nginx-$nginx_version # Modify Nginx version #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h @@ -36,7 +38,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir -./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module +./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ];then cd .. diff --git a/include/openresty.sh b/include/openresty.sh index 0f1f3510..f32e3a3b 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -12,12 +12,14 @@ Install_OpenResty() { cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src +src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz tar xzf openresty-$openresty_version.tar.gz +tar xzf openssl-$openssl_version.tar.gz cd openresty-$openresty_version # close debug @@ -33,7 +35,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir -./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module +./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then cd .. diff --git a/include/tengine.sh b/include/tengine.sh index 8547f775..60133412 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -12,12 +12,14 @@ Install_Tengine() { cd $oneinstack_dir/src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src src_url=http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz && Download_src +src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user tar xzf pcre-$pcre_version.tar.gz tar xzf tengine-$tengine_version.tar.gz +tar xzf openssl-$openssl_version.tar.gz cd tengine-$tengine_version # Modify Tengine version #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h @@ -34,7 +36,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir -./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module +./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ];then cd .. diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh new file mode 100644 index 00000000..294f665e --- /dev/null +++ b/include/tomcat-6.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# Author: yeho +# 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_tomcat-6() { +cd $oneinstack_dir/src +. /etc/profile + +src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/apache-tomcat-$tomcat_6_version.tar.gz && Download_src +src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/catalina-jmx-remote.jar && Download_src + +id -u $run_user >/dev/null 2>&1 +[ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } + +tar xzf apache-tomcat-$tomcat_6_version.tar.gz +[ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir +/bin/cp -R apache-tomcat-$tomcat_6_version/* $tomcat_install_dir +rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} + +if [ -e "$tomcat_install_dir/conf/server.xml" ];then + /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib + cd $tomcat_install_dir/lib + [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina + cd $tomcat_install_dir/lib/catalina + jar xf ../catalina.jar + sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties + sed -i 's@^server.number=.*@server.number=6@' org/apache/catalina/util/ServerInfo.properties + sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties + jar cf ../catalina.jar ./* + cd ../../bin + rm -rf $tomcat_install_dir/lib/catalina + [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev + tar xzf tomcat-native.tar.gz + cd tomcat-native-*-src/jni/native/ + rm -rf /usr/local/apr + ./configure --with-apr=/usr/bin/apr-1-config + make -j ${THREAD} && make install + if [ -d "/usr/local/apr/lib" ];then + [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 + cat > $tomcat_install_dir/bin/setenv.sh << EOF +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" +# -Djava.rmi.server.hostname=$IPADDR +# -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password +# -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access +# -Dcom.sun.management.jmxremote.ssl=false" +EOF + cd ../../../;rm -rf tomcat-native-* + chmod +x $tomcat_install_dir/bin/*.sh + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + cd $oneinstack_dir/src + /bin/cp ../config/server.xml $tomcat_install_dir/conf + sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + sed -i /ThreadLocalLeakPreventionListener/d $tomcat_install_dir/conf/server.xml + if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then + if [ "$OS" == 'CentOS' ];then + if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ];then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi + fi + fi + + [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost + cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + + + + +EOF + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF +$tomcat_install_dir/logs/catalina.out { +daily +rotate 5 +missingok +dateext +compress +notifempty +copytruncate +} +EOF + [ -z "`grep ' /dev/null 2>&1 if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] successfully! " break @@ -72,7 +74,9 @@ while :; do echo if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ];then [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1 if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! " break @@ -129,7 +133,9 @@ while :; do echo if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz tar xzf pcre-$pcre_version.tar.gz echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! " break @@ -155,7 +161,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then rm -rf $$ [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'" [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d) diff --git a/install.sh b/install.sh index 01e544b5..d5594b5c 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ printf " # get pwd sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf -. ./apps.conf +. ./versions.txt . ./options.conf . ./include/color.sh . ./include/check_os.sh @@ -104,13 +104,14 @@ while :; do echo # echo 'Please select tomcat server:' # echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" # echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" - # echo -e "\t${CMSG}3${CEND}. Do not install" - # read -p "Please input a number:(Default 3 press Enter) " Tomcat_version - # [ -z "$Tomcat_version" ] && Tomcat_version=3 - # if [[ ! $Tomcat_version =~ ^[1-3]$ ]];then - # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + # echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" + # echo -e "\t${CMSG}4${CEND}. Do not install" + # read -p "Please input a number:(Default 4 press Enter) " Tomcat_version + # [ -z "$Tomcat_version" ] && Tomcat_version=4 + # if [[ ! $Tomcat_version =~ ^[1-4]$ ]];then + # echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" # else - # [ "$Tomcat_version" != '3' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } + # [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } # if [ "$Tomcat_version" == '1' ];then # while :; do echo # echo 'Please select JDK version:' @@ -124,8 +125,7 @@ while :; do echo # break # fi # done - # fi - # if [ "$Tomcat_version" == '2' ];then + # elif [ "$Tomcat_version" == '2' ];then # while :; do echo # echo 'Please select JDK version:' # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" @@ -139,6 +139,19 @@ while :; do echo # break # fi # done + # elif [ "$Tomcat_version" == '3' ];then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[2-3]$ ]];then + # echo "${CWARNING}input error! Please only input number 2,3${CEND}" + # else + # break + # fi + # done # fi # break # fi @@ -591,6 +604,9 @@ if [ "$Tomcat_version" == '1' ];then elif [ "$Tomcat_version" == '2' ];then . include/tomcat-7.sh Install_tomcat-7 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Tomcat_version" == '3' ];then + . include/tomcat-6.sh + Install_tomcat-6 2>&1 | tee -a $oneinstack_dir/install.log fi # Pure-FTPd diff --git a/uninstall.sh b/uninstall.sh index df08815a..017c7404 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -165,7 +165,7 @@ Print_Memcached() { Uninstall_Memcached() { [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } [ -e "$php_install_dir/etc/php.d/ext-memcache.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcache.ini -[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini +[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini echo "${CMSG}Memcached uninstall completed${CEND}" } diff --git a/upgrade.sh b/upgrade.sh index f5997050..a5162eb2 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -20,7 +20,7 @@ printf " # get pwd sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf -. ./apps.conf +. ./versions.txt . ./options.conf . ./include/color.sh . ./include/check_os.sh diff --git a/apps.conf b/versions.txt similarity index 96% rename from apps.conf rename to versions.txt index a9a76da5..03778362 100644 --- a/apps.conf +++ b/versions.txt @@ -3,12 +3,14 @@ nginx_version=1.10.1 tengine_version=2.1.1 openresty_version=1.9.15.1 +openssl_version=1.0.2h -tomcat_7_version=7.0.69 tomcat_8_version=8.0.30 +tomcat_7_version=7.0.69 +tomcat_6_version=6.0.45 -apache_2_version=2.2.31 apache_4_version=2.4.20 +apache_2_version=2.2.31 pcre_version=8.38 apr_version=1.5.2 apr_util_version=1.5.4 @@ -27,16 +29,16 @@ percona_5_6_version=5.6.30-76.3 percona_5_5_version=5.5.49-37.9 # JDK -jdk_6_version=1.6.0_45 -jdk_7_version=1.7.0_80 jdk_8_version=1.8.0_92 +jdk_7_version=1.7.0_80 +jdk_6_version=1.6.0_45 # PHP -php_3_version=5.3.29 -php_4_version=5.4.45 -php_5_version=5.5.36 -php_6_version=5.6.22 php_7_version=7.0.7 +php_6_version=5.6.22 +php_5_version=5.5.36 +php_4_version=5.4.45 +php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 diff --git a/vhost.sh b/vhost.sh index ecb03b35..f3ff5639 100755 --- a/vhost.sh +++ b/vhost.sh @@ -124,7 +124,7 @@ elif [ "$NGX_FLAG" == 'hhvm' ];then fi } -Nginx_ssl() { +Create_SSL() { printf " You are about to be asked to enter information that will be incorporated into your certificate request. @@ -160,17 +160,17 @@ else LISTENOPT='443 ssl spdy' fi -[ ! -d "$web_install_dir/conf/ssl" ] && mkdir $web_install_dir/conf/ssl -openssl req -new -newkey rsa:2048 -sha256 -nodes -out $web_install_dir/conf/ssl/${domain}.csr -keyout $web_install_dir/conf/ssl/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 -/bin/cp $web_install_dir/conf/ssl/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} -/bin/cp $web_install_dir/conf/ssl/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} -openssl x509 -req -days 36500 -sha256 -in $web_install_dir/conf/ssl/${domain}.csr -signkey $web_install_dir/conf/ssl/${domain}.key -out $web_install_dir/conf/ssl/${domain}.crt > /dev/null 2>&1 +[ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL +openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 +/bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} +/bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} +openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1 } Print_ssl() { -echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$web_install_dir/conf/ssl/${domain}.crt${CEND}" -echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$web_install_dir/conf/ssl/${domain}.key${CEND}" -echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$web_install_dir/conf/ssl/${domain}.csr${CEND}" +echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}" +echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}" +echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}" } @@ -184,8 +184,20 @@ if [ -e "$web_install_dir/sbin/nginx" ];then break fi done +elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachectl" ];then + while :; do echo + read -p "Do you want to setup SSL under Apache? [y/n]: " apache_ssl_yn + if [[ ! $apache_ssl_yn =~ ^[y,n]$ ]];then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done fi +[ "$apache_ssl_yn" == 'y' ] && PATH_SSL=$apache_install_dir/conf/ssl +[ "$nginx_ssl_yn" == 'y' ] && PATH_SSL=$web_install_dir/conf/ssl + while :; do echo read -p "Please input domain(example: www.linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then @@ -243,13 +255,19 @@ if [ "$moredomainame_yn" == 'y' ]; then fi if [ "$nginx_ssl_yn" == 'y' ]; then - Nginx_ssl - Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/ssl/$domain.crt;\nssl_certificate_key $web_install_dir/conf/ssl/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") + Create_SSL + Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") + Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") if [ "$moredomainame_yn" == 'y' ]; then Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain$moredomainame;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") else Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") fi +elif [ "$apache_ssl_yn" == 'y' ]; then + Create_SSL + Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") + [ -z "`grep 'Listen 443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@Listen 80@&\nListen 443@" $apache_install_dir/conf/httpd.conf + [ -z "`grep 'ServerName 0.0.0.0:443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@ServerName 0.0.0.0:80@&\nServerName 0.0.0.0:443@" $apache_install_dir/conf/httpd.conf else Nginx_conf='listen 80;' fi @@ -524,6 +542,26 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF
EOF +[ "$apache_ssl_yn" == 'y' ] && cat >> $apache_install_dir/conf/vhost/$domain.conf << EOF + + ServerAdmin admin@linuxeye.com + DocumentRoot "$vhostdir" + ServerName $domain + $Apache_Domain_alias + $Apache_SSL + ErrorLog "$wwwlogs_dir/${domain}_error_apache.log" + $A_log + + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + $R_TMP + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + + +EOF echo $apache_install_dir/bin/apachectl -t @@ -601,6 +639,7 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF DocumentRoot "$vhostdir" ServerName $domain $Apache_Domain_alias + $Apache_SSL ErrorLog "$wwwlogs_dir/${domain}_error_apache.log" $A_log From d4817956dc875e1e524fa285e6eba355bc899e79 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 20 Jun 2016 22:01:08 +0800 Subject: [PATCH 580/617] Add Let's Encrypt --- README.md | 2 +- addons.sh | 85 +++++++++++++++++++++--- backup.sh | 2 +- backup_setup.sh | 4 +- include/GraphicsMagick.sh | 2 +- include/ImageMagick.sh | 2 +- include/ZendGuardLoader.sh | 2 +- include/apache-2.2.sh | 2 +- include/apache-2.4.sh | 2 +- include/apcu.sh | 2 +- include/check_dir.sh | 2 +- include/check_os.sh | 8 +-- include/color.sh | 2 +- include/demo.sh | 2 +- include/download.sh | 2 +- include/eaccelerator-0.9.sh | 2 +- include/eaccelerator-1.0-dev.sh | 2 +- include/get_char.sh | 2 +- include/hhvm_CentOS.sh | 14 +--- include/init_CentOS.sh | 13 ++-- include/init_Debian.sh | 20 +++--- include/init_Ubuntu.sh | 17 +++-- include/ioncube.sh | 2 +- include/jdk-1.6.sh | 2 +- include/jdk-1.7.sh | 2 +- include/jdk-1.8.sh | 2 +- include/jemalloc.sh | 2 +- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/memcached.sh | 2 +- include/memory.sh | 2 +- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/php-5.3.sh | 2 +- include/php-5.4.sh | 2 +- include/php-5.5.sh | 2 +- include/php-5.6.sh | 2 +- include/php-7.sh | 2 +- include/phpmyadmin.sh | 2 +- include/pureftpd.sh | 2 +- include/redis.sh | 2 +- include/tcmalloc.sh | 2 +- include/tengine.sh | 2 +- include/tomcat-6.sh | 2 +- include/tomcat-7.sh | 2 +- include/tomcat-8.sh | 2 +- include/upgrade_db.sh | 2 +- include/upgrade_php.sh | 2 +- include/upgrade_phpmyadmin.sh | 2 +- include/upgrade_redis.sh | 2 +- include/upgrade_web.sh | 2 +- include/xcache.sh | 2 +- include/zendopcache.sh | 2 +- install.sh | 4 +- options.conf | 2 +- pureftpd_vhost.sh | 4 +- reset_db_root_password.sh | 4 +- shadowsocks.sh | 8 +-- tools/db_bk.sh | 2 +- tools/website_bk.sh | 2 +- uninstall.sh | 4 +- upgrade.sh | 4 +- versions.txt | 4 +- vhost.sh | 112 ++++++++++++++++++++++++-------- 71 files changed, 271 insertions(+), 146 deletions(-) diff --git a/README.md b/README.md index 6bb61f0a..a714e937 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Script properties: - Installation Pureftpd, phpMyAdmin according to their needs - Install memcached, redis according to their needs - Tcmalloc can use according to their needs or jemalloc optimize MySQL, Nginx -- Providing add a virtual host script +- Providing add a virtual host script, include Let's Encrypt SSL certificate - Provide Nginx/Tengine, MySQL/MariaDB/Percona, PHP, Redis, phpMyAdmin upgrade script - Provide local backup and remote backup (rsync between servers) script - Provided under HHVM install CentOS 6,7 diff --git a/addons.sh b/addons.sh index b9d8a515..c0d150f5 100755 --- a/addons.sh +++ b/addons.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Install/Uninstall PHP Extensions # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " @@ -50,9 +50,8 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # Check PHP if [ -e "$php_install_dir/bin/phpize" ];then - PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'` -else - echo "${CWARNING}PHP is not installed on your system! You can use to uninstall and reinstall PHP Extensions${CEND}"; exit 1 + PHP_version_detail=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + PHP_version=`echo $PHP_version_detail | awk -F. '{print $1"."$2}'` fi # Check PHP Extensions @@ -95,6 +94,44 @@ opcache.enable_cli=1 EOF } +Install_letsencrypt() { +if [ "$CentOS_RHEL_version" == '7' ];then + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 7 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF +elif [ "$CentOS_RHEL_version" == '6' ];then + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 6 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF +fi + +cd $oneinstack_dir/src +src_url=https://dl.eff.org/certbot-auto && Download_src +/bin/mv certbot-auto /usr/local/bin/ +chmod +x /usr/local/bin/certbot-auto +certbot-auto --help all +certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client install successfully! ${CEND}" +} + +Uninstall_letsencrypt() { +rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt +[ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root +sed -i '/certbot-auto/d' $Cron_file +echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; +} + ACTION_FUN() { while :; do echo @@ -117,13 +154,15 @@ What Are You Doing? \t${CMSG}1${CEND}. Install/Uninstall PHP opcode cache \t${CMSG}2${CEND}. Install/Uninstall ZendGuardLoader/ionCube PHP Extension \t${CMSG}3${CEND}. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension -\t${CMSG}4${CEND}. Install/Uninstall memcached/memcache -\t${CMSG}5${CEND}. Install/Uninstall Redis +\t${CMSG}4${CEND}. Install/Uninstall fileinfo PHP Extension +\t${CMSG}5${CEND}. Install/Uninstall memcached/memcache +\t${CMSG}6${CEND}. Install/Uninstall Redis +\t${CMSG}7${CEND}. Install/Uninstall Let's Encrypt client \t${CMSG}q${CEND}. Exit " read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-5,q]$ ]];then - echo "${CFAILURE}input error! Please only input 1 ~ 5 and q${CEND}" + if [[ ! $Number =~ ^[1-7,q]$ ]];then + echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}" else case "$Number" in 1) @@ -277,6 +316,24 @@ What Are You Doing? fi ;; 4) + ACTION_FUN + PHP_extension=fileinfo + if [ $ACTION = 1 ];then + Check_PHP_Extension + cd $oneinstack_dir/src + src_url=http://www.php.net/distributions/php-$PHP_version_detail.tar.gz && Download_src + tar xzf php-$PHP_version_detail.tar.gz + cd php-$PHP_version_detail/ext/fileinfo + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + echo 'extension=fileinfo.so' > $php_install_dir/etc/php.d/ext-fileinfo.ini + Check_succ + else + Uninstall_succ + fi + ;; + 5) ACTION_FUN while :; do echo echo 'Please select memcache/memcached PHP Extension:' @@ -318,7 +375,7 @@ What Are You Doing? [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } fi ;; - 5) + 6) ACTION_FUN PHP_extension=redis if [ $ACTION = 1 ];then @@ -330,6 +387,14 @@ What Are You Doing? [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } fi ;; + 7) + ACTION_FUN + if [ $ACTION = 1 ];then + Install_letsencrypt + else + Uninstall_letsencrypt + fi + ;; q) exit ;; diff --git a/backup.sh b/backup.sh index b71fe1f5..a989e444 100755 --- a/backup.sh +++ b/backup.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack cd tools diff --git a/backup_setup.sh b/backup_setup.sh index ed0279ce..818a595b 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Setup the backup parameters # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index cea10600..89f4b3c3 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_GraphicsMagick() { diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 6934f161..66771803 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_ImageMagick() { diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 12969b1f..4f9d1f50 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_ZendGuardLoader() diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index a922f5d0..97b469a0 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Apache-2-2() { diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 39b9c565..2872e37f 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Apache-2-4() { diff --git a/include/apcu.sh b/include/apcu.sh index 15abcea8..42c0ffab 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_APCU() { diff --git a/include/check_dir.sh b/include/check_dir.sh index a099855a..054c61ca 100644 --- a/include/check_dir.sh +++ b/include/check_dir.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack # check MySQL dir diff --git a/include/check_os.sh b/include/check_os.sh index 922082c6..5c7af585 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then @@ -15,15 +15,15 @@ if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];t [ -n "`grep ' 5\.' /etc/redhat-release`" -o -n "`grep 'Aliyun Linux release5' /etc/issue`" ] && CentOS_RHEL_version=5 elif [ -n "`grep bian /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Debian' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Debian_version=`lsb_release -sr | awk -F. '{print $1}'` elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deepin' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Debian_version=`lsb_release -sr | awk -F. '{print $1}'` elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' ];then OS=Ubuntu - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; } + [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Ubuntu_version=`lsb_release -sr | awk -F. '{print $1}'` else echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" diff --git a/include/color.sh b/include/color.sh index 7f0717f8..e2a214a4 100644 --- a/include/color.sh +++ b/include/color.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack echo=echo diff --git a/include/demo.sh b/include/demo.sh index 539e5915..07e5dc15 100644 --- a/include/demo.sh +++ b/include/demo.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack DEMO() { diff --git a/include/download.sh b/include/download.sh index 91119dbb..c46c6d4f 100644 --- a/include/download.sh +++ b/include/download.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Download_src() { diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index b5427f7e..416f9669 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_eAccelerator-0-9() { diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index b2133116..a8757a21 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_eAccelerator-1-0-dev() { diff --git a/include/get_char.sh b/include/get_char.sh index 63152ebf..49d28996 100644 --- a/include/get_char.sh +++ b/include/get_char.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack get_char() { diff --git a/include/hhvm_CentOS.sh b/include/hhvm_CentOS.sh index a9934a41..09255cae 100644 --- a/include/hhvm_CentOS.sh +++ b/include/hhvm_CentOS.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_hhvm_CentOS() { @@ -15,10 +15,7 @@ id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user if [ "$CentOS_RHEL_version" == '7' ];then - if [ -e /etc/yum.repos.d/epel.repo_bk ];then - /bin/mv /etc/yum.repos.d/epel.repo{_bk,} - elif [ ! -e /etc/yum.repos.d/epel.repo ];then - cat > /etc/yum.repos.d/epel.repo << EOF + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch #baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch @@ -27,7 +24,6 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF - fi cat > /etc/yum.repos.d/hhvm.repo << EOF [hhvm] name=gleez hhvm-repo @@ -40,10 +36,7 @@ EOF fi if [ "$CentOS_RHEL_version" == '6' ];then - if [ -e /etc/yum.repos.d/epel.repo_bk ];then - /bin/mv /etc/yum.repos.d/epel.repo{_bk,} - elif [ ! -e /etc/yum.repos.d/epel.repo ];then - cat > /etc/yum.repos.d/epel.repo << EOF + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch @@ -52,7 +45,6 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF - fi for Package in libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel libevent-devel libcurl-devel libmemcached-devel lcms2 inotify-tools do diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index e4fb2772..d4acc9bf 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack sed -i 's@^exclude@#exclude@' /etc/yum.conf @@ -59,11 +59,11 @@ sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab init q # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc +[ -z "`grep ^PS1 ~/.bashrc`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc # history size sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile -[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf @@ -75,7 +75,6 @@ cat >> /etc/security/limits.conf <> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -91,11 +90,11 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #EOF # alias vi -[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc +[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc # /etc/sysctl.conf sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf -[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF +[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 fs.inotify.max_user_instances = 8192 net.ipv4.tcp_fin_timeout = 30 @@ -137,7 +136,7 @@ init q # Update time ntpdate pool.ntp.org -[ -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } +[ ! -e "/var/spool/cron/root" -o -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } service crond restart # iptables diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 62dfd43b..bff876e5 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* @@ -26,14 +26,15 @@ do done # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history size -[ -z "`cat ~/.bashrc | grep ^HISTSIZE`" ] && echo 'HISTSIZE=100' >> ~/.bashrc -[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`grep ^HISTSIZE ~/.bashrc`" ] && echo 'HISTSIZE=100' >> ~/.bashrc +[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf +[ -z "`grep 'session required pam_limits.so' /etc/pam.d/common-session`" ] && echo 'session required pam_limits.so' >> /etc/pam.d/common-session sed -i '/^# End of file/,$d' /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -58,13 +62,13 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #EOF # alias vi -[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc -[ -z "`cat /etc/vim/vimrc | grep 'syntax on'`" ] && echo 'syntax on' >> /etc/vim/vimrc +[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc sed -i 's@^# alias@alias@g' ~/.bashrc # /etc/sysctl.conf -[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF +[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 42889c67..7502046d 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* @@ -48,14 +48,15 @@ fi #[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail # PS1 -[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history size sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc -[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf +[ -z "`grep 'session required pam_limits.so' /etc/pam.d/common-session`" ] && echo 'session required pam_limits.so' >> /etc/pam.d/common-session sed -i '/^# End of file/,$d' /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/security/limits.conf <> /etc/rc.local # /etc/hosts [ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1\(.*\)@127.0.0.1 `hostname` \1@" /etc/hosts @@ -80,10 +84,11 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #EOF # alias vi -[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc +sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc # /etc/sysctl.conf -[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF +[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 diff --git a/include/ioncube.sh b/include/ioncube.sh index 93a869e2..9ca95369 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_ionCube() { diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index 60f2bb1d..a848959d 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install-JDK-1-6() { diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index 980af957..f0b57238 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install-JDK-1-7() { diff --git a/include/jdk-1.8.sh b/include/jdk-1.8.sh index a05a8ac5..6d958d34 100644 --- a/include/jdk-1.8.sh +++ b/include/jdk-1.8.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install-JDK-1-8() { diff --git a/include/jemalloc.sh b/include/jemalloc.sh index de1b4a6b..25fb7ebc 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_jemalloc() { diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 32b458b3..3f46ba9c 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MariaDB-10-0() { diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index f0dcb4fa..73507415 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MariaDB-10-1() { diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index bde7ac94..7dd46ff5 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MariaDB-5-5() { diff --git a/include/memcached.sh b/include/memcached.sh index 2d2e9b09..2be346b4 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_memcached() { diff --git a/include/memory.sh b/include/memory.sh index 62f17981..148a9bef 100644 --- a/include/memory.sh +++ b/include/memory.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Mem=`free -m | awk '/Mem:/{print $2}'` diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 8cb08536..401ed638 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MySQL-5-5() { diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 2d25f704..9d09184e 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MySQL-5-6() { diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index c0b99aca..c91bc484 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_MySQL-5-7() { diff --git a/include/nginx.sh b/include/nginx.sh index 86f729cb..eb054c65 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Nginx() { diff --git a/include/openresty.sh b/include/openresty.sh index f32e3a3b..09a07910 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_OpenResty() { diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 08c8644e..71c2bd0c 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Percona-5-5() { diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 41deca71..58845a7b 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Percona-5-6() { diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index d0a54cde..2b36415d 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Percona-5-7() { diff --git a/include/php-5.3.sh b/include/php-5.3.sh index febf291c..fdcff8c4 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PHP-5-3() { diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 3620ee17..7ba18f4b 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PHP-5-4() { diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 1ce75be8..824eb9cf 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PHP-5-5() { diff --git a/include/php-5.6.sh b/include/php-5.6.sh index e15adf85..bc690e27 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PHP-5-6() { diff --git a/include/php-7.sh b/include/php-7.sh index 69065fa5..9ae6e2c5 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PHP-7() { diff --git a/include/phpmyadmin.sh b/include/phpmyadmin.sh index fa01d909..e4e96467 100644 --- a/include/phpmyadmin.sh +++ b/include/phpmyadmin.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_phpMyAdmin() { diff --git a/include/pureftpd.sh b/include/pureftpd.sh index ef15cbf7..4b7a599c 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_PureFTPd() { diff --git a/include/redis.sh b/include/redis.sh index b49f85d7..a4f076b9 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_redis-server() { diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index 6777e3ff..471d45e5 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_tcmalloc() { diff --git a/include/tengine.sh b/include/tengine.sh index 60133412..b02bbbfa 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_Tengine() { diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 294f665e..262b647d 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_tomcat-6() { diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index a24758de..13765ce6 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_tomcat-7() { diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 21ca971e..88bb6c7e 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_tomcat-8() { diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index cb0af2d4..d7991714 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Upgrade_DB() { diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 1da58f88..33c64af5 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Upgrade_PHP() { diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 06fda89a..4995c96a 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Upgrade_phpMyAdmin() { diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index 3f5a6594..1e5fcfdc 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Upgrade_Redis() { diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 3e982e6d..e9e350c1 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Upgrade_Nginx() { diff --git a/include/xcache.sh b/include/xcache.sh index 69bb9d96..cbb49374 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_XCache() diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 92786d8e..0a816b52 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack Install_ZendOPcache() diff --git a/install.sh b/install.sh index d5594b5c..3c6783dc 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -13,7 +13,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/options.conf b/options.conf index b316993d..ca9f1449 100644 --- a/options.conf +++ b/options.conf @@ -1,5 +1,5 @@ # operating environment for the current working directory -oneinstack_dir= +oneinstack_dir=/root/git/repo/oneinstack # Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify run_user=www diff --git a/pureftpd_vhost.sh b/pureftpd_vhost.sh index a6bd030d..276b92a9 100755 --- a/pureftpd_vhost.sh +++ b/pureftpd_vhost.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # FTP virtual user account management # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index b4600c20..26255818 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Reset Database root password for OneinStack # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/shadowsocks.sh b/shadowsocks.sh index 262a044e..c452c41f 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -6,7 +6,7 @@ # Install Shadowsocks Server # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -15,7 +15,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+ # # Install Shadowsocks Server # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " @@ -137,7 +137,7 @@ if [ -f /usr/bin/pip ]; then [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks else echo - echo "${CQUESTION}Shadowsocks-python install failed! Please visit http://oneinstack.com${CEND}" + echo "${CQUESTION}Shadowsocks-python install failed! Please visit https://oneinstack.com${CEND}" exit 1 fi fi @@ -155,7 +155,7 @@ if [ -f /usr/local/bin/ss-server ];then [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } else echo - echo "${CQUESTION}Shadowsocks-libev install failed! Please visit http://oneinstack.com${CEND}" + echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}" exit 1 fi diff --git a/tools/db_bk.sh b/tools/db_bk.sh index 6a21cb6a..b5941ada 100755 --- a/tools/db_bk.sh +++ b/tools/db_bk.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack . ../options.conf diff --git a/tools/website_bk.sh b/tools/website_bk.sh index cee9022d..9fda7875 100755 --- a/tools/website_bk.sh +++ b/tools/website_bk.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack . ../options.conf diff --git a/uninstall.sh b/uninstall.sh index 017c7404..7eebc11a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Uninstall OneinStack # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/upgrade.sh b/upgrade.sh index a5162eb2..378c4fe0 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -14,7 +14,7 @@ printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # upgrade Web,Database,PHP,Redis,phpMyAdmin for OneinStack # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " # get pwd diff --git a/versions.txt b/versions.txt index 03778362..40ce2ce5 100644 --- a/versions.txt +++ b/versions.txt @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.4-8 +ImageMagick_version=6.9.4-9 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 @@ -56,7 +56,7 @@ mhash_version=0.9.9.9 pureftpd_version=1.0.42 # Redis -redis_version=3.2.0 +redis_version=3.2.1 redis_pecl_version=2.2.8 # Memcached diff --git a/vhost.sh b/vhost.sh index f3ff5639..fab3c2c8 100755 --- a/vhost.sh +++ b/vhost.sh @@ -5,7 +5,7 @@ # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: -# http://oneinstack.com +# https://oneinstack.com # https://github.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -13,13 +13,14 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " . ./options.conf . ./include/color.sh . ./include/check_dir.sh +. ./include/check_os.sh . ./include/get_char.sh # Check if user is root @@ -124,7 +125,7 @@ elif [ "$NGX_FLAG" == 'hhvm' ];then fi } -Create_SSL() { +Create_self_SSL() { printf " You are about to be asked to enter information that will be incorporated into your certificate request. @@ -154,23 +155,80 @@ echo read -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU [ -z "$SELFSIGNEDSSL_OU" ] && SELFSIGNEDSSL_OU='IT Dept.' -if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then - LISTENOPT='443 ssl http2' -else - LISTENOPT='443 ssl spdy' -fi - -[ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 /bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} /bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1 } +Create_SSL() { +if [ -e "/usr/local/bin/certbot-auto" ];then + while :; do echo + read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn + if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + if [ "$letsencrypt_yn" == 'y' ];then + PUBLIC_IPADDR=`./include/get_public_ipaddr.py` + for D in $domain $moredomainame + do + Domain_IPADDR=`ping $D -c1 | sed '1{s/[^(]*(//;s/).*//;q}'` + [ "$PUBLIC_IPADDR" != "$Domain_IPADDR" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for $D${CEND}"; echo; exit 1; } + done + + #add Email + while : + do + echo + read -p "Please enter Administrator Email(example: admin@linuxeye.com): " Admin_Email + if [ -z "`echo $Admin_Email | grep '.*@.*\..*'`" ]; then + echo "${CWARNING}input error! ${CEND}" + else + break + fi + done + [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`" + [ "$nginx_ssl_yn" == 'y' ] && S=nginx + [ "$apache_ssl_yn" == 'y' ] && S=httpd + [ ! -d "$wwwroot_dir/$domain/.well-known" ] && mkdir -p $wwwroot_dir/$domain/.well-known;chown -R $run_user.$run_user $wwwroot_dir/$domain/.well-known + certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start" + if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ];then + [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key} + ln -s /etc/letsencrypt/live/$domain/fullchain.pem $PATH_SSL/$domain.crt + ln -s /etc/letsencrypt/live/$domain/privkey.pem $PATH_SSL/$domain.key + if [ -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then + Cron_Command='/etc/init.d/nginx reload;/etc/init.d/httpd graceful' + elif [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then + Cron_Command='/etc/init.d/nginx reload' + elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then + Cron_Command='/etc/init.d/httpd graceful' + fi + [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root + [ -z "`grep "$domain $moredomainame_D" $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file + else + echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}" + exit 1 + fi + else + Create_self_SSL + fi +else + Create_self_SSL +fi +} + Print_ssl() { -echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}" -echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}" -echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}" +if [ "$letsencrypt_yn" == 'y' ];then + echo "`printf "%-30s" "Let's Encrypt SSL Certificate:"`${CMSG}/etc/letsencrypt/live/$domain/fullchain.pem${CEND}" + echo "`printf "%-30s" "SSL Private Key:"`${CMSG}/etc/letsencrypt/live/$domain/privkey.pem${CEND}" +else + echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}" + echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}" + echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}" +fi } @@ -195,8 +253,8 @@ elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachec done fi -[ "$apache_ssl_yn" == 'y' ] && PATH_SSL=$apache_install_dir/conf/ssl -[ "$nginx_ssl_yn" == 'y' ] && PATH_SSL=$web_install_dir/conf/ssl +[ "$apache_ssl_yn" == 'y' ] && { PATH_SSL=$apache_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } +[ "$nginx_ssl_yn" == 'y' ] && { PATH_SSL=$web_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } while :; do echo read -p "Please input domain(example: www.linuxeye.com): " domain @@ -249,12 +307,16 @@ if [ "$moredomainame_yn" == 'y' ]; then break fi done - [ "$nginx_ssl_yn" == 'y' ] && HTTP_flag=https || HTTP_flag=http [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") fi fi if [ "$nginx_ssl_yn" == 'y' ]; then + if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then + LISTENOPT='443 ssl http2' + else + LISTENOPT='443 ssl spdy' + fi Create_SSL Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") @@ -417,7 +479,7 @@ fi printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" @@ -444,7 +506,7 @@ echo printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" @@ -492,7 +554,7 @@ fi printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" @@ -577,7 +639,7 @@ fi printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" @@ -586,7 +648,7 @@ echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" } Create_nginx_apache_mod-php_conf() { -# Nginx/Tengine +# Nginx/Tengine/OpenResty [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost cat > $web_install_dir/conf/vhost/$domain.conf << EOF server { @@ -667,7 +729,7 @@ fi printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# For more information please visit http://oneinstack.com # +# For more information please visit https://oneinstack.com # ####################################################################### " echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" @@ -679,7 +741,7 @@ echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" } Add_Vhost() { - if [ -e "$web_install_dir/sbin/nginx" -a ! -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ];then + if [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then Choose_env Input_Add_domain Nginx_anti_hotlinking @@ -691,7 +753,7 @@ Add_Vhost() { Nginx_log Create_nginx_php-fpm_hhvm_conf fi - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ];then + elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then Choose_env Input_Add_domain Apache_log @@ -871,13 +933,11 @@ elif [ $# == 1 ];then add) Add_Vhost ;; - del) Del_NGX_Vhost Del_Apache_Vhost Del_Tomcat_Vhost ;; - *) Usage ;; From 33d8c8bfc3e381e46f9ea1bacad5be04eaa1f742 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 22 Jun 2016 13:12:08 +0800 Subject: [PATCH 581/617] fixed LeLet's Encrypt renew --- README.md | 16 ++++++++++++---- addons.sh | 2 +- versions.txt | 8 ++++---- vhost.sh | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a714e937..76735203 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~15 of 32 and 64. +[![PayPal donate button](https://img.shields.io/badge/paypal-donate-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=lj2007331@gmail.com&item_name=OneinStack%20Donate¤cy_code=USD) +[![支付宝捐助按钮](https://img.shields.io/badge/%E6%94%AF%E4%BB%98%E5%AE%9D-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/alipay.png) +[![微信捐助按钮](https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/weixin.png) + +This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~16 of 32 and 64. Script properties: - Continually updated @@ -18,6 +22,7 @@ Script properties: - Provided under HHVM install CentOS 6,7 ## How to use + If your server system: CentOS/Redhat (Do not enter "//" and "// subsequent sentence) ```bash yum -y install wget screen // For CentOS / Redhat @@ -37,11 +42,11 @@ screen -S lnmp // if network interruption, you can execute the command `scree ./install.sh // Do not sh install.sh or bash install.sh such execution ``` -## How to add PHP Extensions +## How to add Extensions + ```bash cd ~/oneinstack // Must enter the directory execution under oneinstack ./addons.sh // Do not sh addons.sh or bash addons.sh such execution - ``` ## How to add a virtual host @@ -76,7 +81,8 @@ crontab -l // Can be added to scheduled tasks, such as automatic backups ever ``` ## How to manage service -Nginx/Tengine: + +Nginx/Tengine/OpenResty: ```bash service nginx {start|stop|status|restart|reload|configtest} ``` @@ -110,6 +116,7 @@ service memcached {start|stop|status|restart|reload} ``` ## How to upgrade + ```bash ./upgrade.sh ``` @@ -121,6 +128,7 @@ service memcached {start|stop|status|restart|reload} ``` ## Installation + Follow the instructions in [Wiki Installation page](https://github.com/lj2007331/lnmp/wiki/Installation)
For feedback, questions, and to follow the progress of the project (Chinese):
diff --git a/addons.sh b/addons.sh index c0d150f5..a6082afa 100755 --- a/addons.sh +++ b/addons.sh @@ -121,7 +121,7 @@ cd $oneinstack_dir/src src_url=https://dl.eff.org/certbot-auto && Download_src /bin/mv certbot-auto /usr/local/bin/ chmod +x /usr/local/bin/certbot-auto -certbot-auto --help all +certbot-auto -n --help all certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client install successfully! ${CEND}" } diff --git a/versions.txt b/versions.txt index 40ce2ce5..48d29682 100644 --- a/versions.txt +++ b/versions.txt @@ -22,7 +22,7 @@ mysql_5_5_version=5.5.50 mariadb_10_1_version=10.1.14 mariadb_10_0_version=10.0.25 -mariadb_5_5_version=5.5.49 +mariadb_5_5_version=5.5.50 percona_5_7_version=5.7.12-5 percona_5_6_version=5.6.30-76.3 @@ -34,9 +34,9 @@ jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.7 -php_6_version=5.6.22 -php_5_version=5.5.36 +php_7_version=7.0.8 +php_6_version=5.6.23 +php_5_version=5.5.37 php_4_version=5.4.45 php_3_version=5.3.29 diff --git a/vhost.sh b/vhost.sh index fab3c2c8..17811634 100755 --- a/vhost.sh +++ b/vhost.sh @@ -162,7 +162,7 @@ openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH } Create_SSL() { -if [ -e "/usr/local/bin/certbot-auto" ];then +if [ -e "/usr/local/bin/certbot-auto" -a -e "~/.local/share/letsencrypt/bin/letsencrypt" ];then while :; do echo read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then From ba9b3f2ec440b696334f099d60fdd5cccbd9bdd5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 24 Jun 2016 09:48:06 +0800 Subject: [PATCH 582/617] Update redis.sh --- include/php-5.4.sh | 4 +- include/php-5.5.sh | 4 +- include/php-5.6.sh | 4 +- include/php-7.sh | 4 +- include/redis.sh | 14 ++- ...s-server-init-Ubuntu => Redis-server-init} | 2 +- init.d/Redis-server-init-CentOS | 102 ------------------ versions.txt | 2 +- 8 files changed, 22 insertions(+), 114 deletions(-) rename init.d/{Redis-server-init-Ubuntu => Redis-server-init} (90%) delete mode 100755 init.d/Redis-server-init-CentOS diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 7ba18f4b..a63507c2 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -71,7 +71,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +82,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 824eb9cf..c7d084cb 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -71,7 +71,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +82,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-5.6.sh b/include/php-5.6.sh index bc690e27..725704cb 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -70,7 +70,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -81,7 +81,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-7.sh b/include/php-7.sh index 9ae6e2c5..cb9efadb 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -71,7 +71,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +82,7 @@ else --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/redis.sh b/include/redis.sh index a4f076b9..49d8fac4 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -36,8 +36,18 @@ if [ -f "src/redis-server" ];then echo "${CSUCCESS}Redis-server install successfully! ${CEND}" cd .. rm -rf redis-$redis_version - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Redis-server-init-CentOS /etc/init.d/redis-server; chkconfig --add redis-server; chkconfig redis-server on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { useradd -M -s /sbin/nologin redis; chown -R redis:redis $redis_install_dir/var/; /bin/cp ../init.d/Redis-server-init-Ubuntu /etc/init.d/redis-server; update-rc.d redis-server defaults; } + id -u redis >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis + chown -R redis:redis $redis_install_dir/var + /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server + if [ "$OS" == 'CentOS' ];then + src_url=http://mirrors.linuxeye.com/oneinstack/src/start-stop-daemon.c && Download_src + cc start-stop-daemon.c -o /sbin/start-stop-daemon + chkconfig --add redis-server + chkconfig redis-server on + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + update-rc.d redis-server defaults + fi sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf #sysctl -p diff --git a/init.d/Redis-server-init-Ubuntu b/init.d/Redis-server-init similarity index 90% rename from init.d/Redis-server-init-Ubuntu rename to init.d/Redis-server-init index 90888e80..f67efe70 100755 --- a/init.d/Redis-server-init-Ubuntu +++ b/init.d/Redis-server-init @@ -29,7 +29,7 @@ case "$1" in echo -n "Starting $DESC: " touch $PIDFILE chown redis:redis $PIDFILE - if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS + if start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS then echo "$NAME." else diff --git a/init.d/Redis-server-init-CentOS b/init.d/Redis-server-init-CentOS deleted file mode 100755 index 044865eb..00000000 --- a/init.d/Redis-server-init-CentOS +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# -# redis - this script starts and stops the redis-server daemon -# -# chkconfig: - 85 15 -# description: Redis is a persistent key-value database -# processname: redis-server -# config: /usr/local/redis/etc/redis.conf -# config: /etc/sysconfig/redis -# pidfile: /var/run/redis.pid - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ "$NETWORKING" = "no" ] && exit 0 - -redis="/usr/local/redis/bin/redis-server" -prog=$(basename $redis) - -REDIS_CONF_FILE="/usr/local/redis/etc/redis.conf" - -[ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis - -lockfile=/var/lock/subsys/redis - -start() { - [ -x $redis ] || exit 5 - [ -f $REDIS_CONF_FILE ] || exit 6 - echo -n $"Starting $prog: " - daemon $redis $REDIS_CONF_FILE - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc $prog -QUIT - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - echo -n $"Reloading $prog: " - killproc $redis -HUP - RETVAL=$? - echo -} - -force_reload() { - restart -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart|configtest) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac diff --git a/versions.txt b/versions.txt index 48d29682..fab23705 100644 --- a/versions.txt +++ b/versions.txt @@ -66,7 +66,7 @@ memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 # phpMyadmin -phpMyAdmin_version=4.4.15.6 +phpMyAdmin_version=4.4.15.7 # jemalloc jemalloc_version=4.2.1 From d0329facb2bd519a595ec38ff3853b46f1710d6e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 26 Jun 2016 20:03:58 +0800 Subject: [PATCH 583/617] @kaneawk --- addons.sh | 16 ++++++++-------- config/index.html | 2 +- config/index_cn.html | 18 +++++++++--------- include/ZendGuardLoader.sh | 2 +- include/apache-2.2.sh | 2 +- include/apache-2.4.sh | 2 +- include/apcu.sh | 2 +- include/eaccelerator-0.9.sh | 2 +- include/eaccelerator-1.0-dev.sh | 2 +- include/jdk-1.6.sh | 2 +- include/jdk-1.7.sh | 2 +- include/jdk-1.8.sh | 2 +- include/jemalloc.sh | 2 +- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/memcached.sh | 6 +++--- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/php-5.3.sh | 2 +- include/php-5.4.sh | 2 +- include/php-5.5.sh | 2 +- include/php-5.6.sh | 2 +- include/php-7.sh | 2 +- include/pureftpd.sh | 2 +- include/redis.sh | 6 +++--- include/tcmalloc.sh | 2 +- include/tengine.sh | 2 +- include/tomcat-6.sh | 2 +- include/tomcat-7.sh | 2 +- include/tomcat-8.sh | 2 +- include/xcache.sh | 2 +- include/zendopcache.sh | 2 +- options.conf | 2 +- versions.txt | 2 +- vhost.sh | 2 +- 42 files changed, 61 insertions(+), 61 deletions(-) diff --git a/addons.sh b/addons.sh index a6082afa..5a6f05b1 100755 --- a/addons.sh +++ b/addons.sh @@ -66,7 +66,7 @@ Restart_PHP() { # Check succ Check_succ() { -[ -f "`$php_install_dir/bin/php-config --extension-dir`/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module install successfully! ${CEND}"; } +[ -f "`$php_install_dir/bin/php-config --extension-dir`/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } } # Uninstall succ @@ -121,14 +121,14 @@ cd $oneinstack_dir/src src_url=https://dl.eff.org/certbot-auto && Download_src /bin/mv certbot-auto /usr/local/bin/ chmod +x /usr/local/bin/certbot-auto -certbot-auto -n --help all -certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client install successfully! ${CEND}" +certbot-auto -n +certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" } Uninstall_letsencrypt() { rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root -sed -i '/certbot-auto/d' $Cron_file +sed -i '/certbot-auto/d' $Cron_file echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } @@ -154,7 +154,7 @@ What Are You Doing? \t${CMSG}1${CEND}. Install/Uninstall PHP opcode cache \t${CMSG}2${CEND}. Install/Uninstall ZendGuardLoader/ionCube PHP Extension \t${CMSG}3${CEND}. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension -\t${CMSG}4${CEND}. Install/Uninstall fileinfo PHP Extension +\t${CMSG}4${CEND}. Install/Uninstall fileinfo PHP Extension \t${CMSG}5${CEND}. Install/Uninstall memcached/memcache \t${CMSG}6${CEND}. Install/Uninstall Redis \t${CMSG}7${CEND}. Install/Uninstall Let's Encrypt client @@ -194,7 +194,7 @@ What Are You Doing? cd $oneinstack_dir/src if [[ $PHP_version =~ ^5.[3-4]$ ]];then Install_ZendOPcache - elif [ "$PHP_version" == '5.5' ];then + elif [ "$PHP_version" == '5.5' ];then src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src tar xzf php-$php_5_version.tar.gz cd php-$php_5_version/ext/opcache @@ -273,7 +273,7 @@ What Are You Doing? fi elif [ $Loader = 2 ];then Install_ionCube - Restart_PHP; echo "${CSUCCESS}PHP $PHP_extension module install successfully! ${CEND}"; + Restart_PHP; echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; fi else echo; echo "${CWARNING}Your php does not support $PHP_extension! ${CEND}"; @@ -367,7 +367,7 @@ What Are You Doing? Install_php-memcache PHP_extension=memcached && Check_PHP_Extension Install_php-memcached - [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" -a "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module install successfully! ${CEND}"; } + [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" -a "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } fi else PHP_extension=memcache && Uninstall_succ diff --git a/config/index.html b/config/index.html index 550a8757..f6694c97 100644 --- a/config/index.html +++ b/config/index.html @@ -21,7 +21,7 @@

-

Congratulations, OneinStack a successful installation!

+

Congratulations, OneinStack installed successfully!

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona
+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc.

Check environment:  Proberv phpinfo Opcache phpMyAdmin

Create Web virtual running script:  ./vhost.sh

diff --git a/config/index_cn.html b/config/index_cn.html index 68de0d04..62fd2125 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -21,19 +21,19 @@

-

Congratulations, OneinStack安装成功!

-

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc. 脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

-

查看本地环境:  探针 phpinfo Opcache phpMyAdmin(为了更安全,建议phpMyAdmin目录重命名!)

-

创建WEB虚拟主机执行脚本:  ./vhost.sh

-

创建FTP虚拟账号执行脚本:  ./pureftpd_vhost.sh

-

Github项目地址:  https://github.com/lj2007331/oneinstack

-

OneinStack官网:  https://oneinstack.com

-

QQ群:  558540514(付费千人群) 556824757(新) 213014293(满) 486321919(满) 438311066(满) 235258658(满)

+

恭喜您,OneinStack 安装成功!

+

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc 脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

+

查看本地环境:  探针 phpinfo Opcache phpMyAdmin(为了更安全,建议重命名 phpMyAdmin 目录!)

+

创建 WEB 虚拟主机执行脚本:  ./vhost.sh

+

创建 FTP 虚拟账号执行脚本:  ./pureftpd_vhost.sh

+

Github 项目地址:  https://github.com/lj2007331/oneinstack

+

OneinStack 官网:  https://oneinstack.com

+

QQ 群:  558540514(付费千人群) 556824757(新) 213014293(满) 486321919(满) 438311066(满) 235258658(满)

赞助我们:

          支付宝:  lj2007331@gmail.com

          PayPal:  lj2007331@gmail.com

- +
diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 4f9d1f50..af951f39 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -82,7 +82,7 @@ zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 EOF - echo "${CSUCCESS}PHP ZendGuardLoader module install successfully! ${CEND}" + echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}" [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart else echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 97b469a0..8ff9093f 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -22,7 +22,7 @@ cd httpd-$apache_2_version ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir make -j ${THREAD} && make install if [ -e "$apache_install_dir/conf/httpd.conf" ];then - echo "${CSUCCESS}Apache install successfully! ${CEND}" + echo "${CSUCCESS}Apache installed successfully! ${CEND}" cd .. rm -rf httpd-$apache_2_version else diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 2872e37f..48e7ac34 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -35,7 +35,7 @@ cd httpd-$apache_4_version ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir make -j ${THREAD} && make install if [ -e "$apache_install_dir/conf/httpd.conf" ];then - echo "${CSUCCESS}Apache install successfully! ${CEND}" + echo "${CSUCCESS}Apache installed successfully! ${CEND}" cd .. rm -rf httpd-$apache_4_version else diff --git a/include/apcu.sh b/include/apcu.sh index 42c0ffab..5c874ac2 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -29,7 +29,7 @@ apc.enable_cli=1 EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart /bin/cp apc.php $wwwroot_dir/default - echo "${CSUCCESS}APCU module install successfully! ${CEND}" + echo "${CSUCCESS}APCU module installed successfully! ${CEND}" cd .. rm -rf apcu-$apcu_version else diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index 416f9669..f4f165df 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -41,7 +41,7 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module install successfully! ${CEND}" + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" cd .. [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf sysctl -p diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index a8757a21..b9b880c8 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -41,7 +41,7 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module install successfully! ${CEND}" + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" cd .. [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf sysctl -p diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index a848959d..9c2482d3 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -30,7 +30,7 @@ if [ -d "$JDK_NAME" ];then [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep '$JAVA_HOME/bin' /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\$JAVA_HOME/bin:\1@" /etc/profile [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile - echo "${CSUCCESS}$JDK_NAME install successfully! ${CEND}" + echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index f0b57238..e6ad18fa 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -29,7 +29,7 @@ if [ -d "$JDK_NAME" ];then [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep '$JAVA_HOME/bin' /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\$JAVA_HOME/bin:\1@" /etc/profile [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile - echo "${CSUCCESS}$JDK_NAME install successfully! ${CEND}" + echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" diff --git a/include/jdk-1.8.sh b/include/jdk-1.8.sh index 6d958d34..72a39be1 100644 --- a/include/jdk-1.8.sh +++ b/include/jdk-1.8.sh @@ -29,7 +29,7 @@ if [ -d "$JDK_NAME" ];then [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep '$JAVA_HOME/bin' /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=\$JAVA_HOME/bin:\1@" /etc/profile [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile - echo "${CSUCCESS}$JDK_NAME install successfully! ${CEND}" + echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" diff --git a/include/jemalloc.sh b/include/jemalloc.sh index 25fb7ebc..924225d8 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -24,7 +24,7 @@ if [ -f "/usr/local/lib/libjemalloc.so" ];then fi echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig - echo "${CSUCCESS}jemalloc module install successfully! ${CEND}" + echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}" cd .. rm -rf jemalloc-$jemalloc_version else diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 3f46ba9c..27ef7a83 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -33,7 +33,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mariadb_install_dir/support-files" ];then - echo "${CSUCCESS}MariaDB install successfully! ${CEND}" + echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" else rm -rf $mariadb_install_dir echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 73507415..ad9368d6 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -33,7 +33,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mariadb_install_dir/support-files" ];then - echo "${CSUCCESS}MariaDB install successfully! ${CEND}" + echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" else rm -rf $mariadb_install_dir echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 7dd46ff5..8eb4f69e 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -33,7 +33,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mariadb_install_dir/support-files" ];then - echo "${CSUCCESS}MariaDB install successfully! ${CEND}" + echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" else rm -rf $mariadb_install_dir echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" diff --git a/include/memcached.sh b/include/memcached.sh index 2be346b4..11628afd 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -22,7 +22,7 @@ cd memcached-$memcached_version ./configure --prefix=$memcached_install_dir make -j ${THREAD} && make install if [ -d "$memcached_install_dir/include/memcached" ];then - echo "${CSUCCESS}memcached install successfully! ${CEND}" + echo "${CSUCCESS}memcached installed successfully! ${CEND}" cd .. rm -rf memcached-$memcached_version ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached @@ -64,7 +64,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then extension=memcache.so EOF [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - echo "${CSUCCESS}PHP memcache module install successfully! ${CEND}" + echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" cd .. rm -rf memcache-$memcache_pecl_version else @@ -108,7 +108,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then extension=memcached.so memcached.use_sasl=1 EOF - echo "${CSUCCESS}PHP memcached module install successfully! ${CEND}" + echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" cd .. rm -rf memcached-$memcached_pecl_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 401ed638..6a110872 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -34,7 +34,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mysql_install_dir/support-files" ];then - echo "${CSUCCESS}MySQL install successfully! ${CEND}" + echo "${CSUCCESS}MySQL installed successfully! ${CEND}" cd .. rm -rf mysql-$mysql_5_6_version else diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 9d09184e..2bae3c79 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -34,7 +34,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mysql_install_dir/support-files" ];then - echo "${CSUCCESS}MySQL install successfully! ${CEND}" + echo "${CSUCCESS}MySQL installed successfully! ${CEND}" cd .. rm -rf mysql-$mysql_5_6_version else diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index c91bc484..584dd861 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -34,7 +34,7 @@ elif [ "$je_tc_malloc" == '2' ];then fi if [ -d "$mysql_install_dir/support-files" ];then - echo "${CSUCCESS}MySQL install successfully! ${CEND}" + echo "${CSUCCESS}MySQL installed successfully! ${CEND}" cd .. rm -rf mysql-$mysql_5_7_version else diff --git a/include/nginx.sh b/include/nginx.sh index eb054c65..2751f4f4 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -43,7 +43,7 @@ make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ];then cd .. rm -rf nginx-$nginx_version - echo "${CSUCCESS}Nginx install successfully! ${CEND}" + echo "${CSUCCESS}Nginx installed successfully! ${CEND}" else rm -rf $nginx_install_dir echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" diff --git a/include/openresty.sh b/include/openresty.sh index 09a07910..9e52c87a 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -40,7 +40,7 @@ make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then cd .. rm -rf openresty-$openresty_version - echo "${CSUCCESS}OpenResty install successfully! ${CEND}" + echo "${CSUCCESS}OpenResty installed successfully! ${CEND}" else rm -rf $openresty_install_dir echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}" diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 71c2bd0c..a1e72f5d 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -44,7 +44,7 @@ make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then - echo "${CSUCCESS}Percona install successfully! ${CEND}" + echo "${CSUCCESS}Percona installed successfully! ${CEND}" cd .. rm -rf percona-server-$percona_5_5_version else diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 58845a7b..2b18a06c 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -43,7 +43,7 @@ make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then - echo "${CSUCCESS}Percona install successfully! ${CEND}" + echo "${CSUCCESS}Percona installed successfully! ${CEND}" cd .. rm -rf percona-server-$percona_5_6_version else diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 2b36415d..6870c689 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -58,7 +58,7 @@ make -j ${THREAD} make install if [ -d "$percona_install_dir/support-files" ];then - echo "${CSUCCESS}Percona install successfully! ${CEND}" + echo "${CSUCCESS}Percona installed successfully! ${CEND}" cd .. rm -rf percona-server-$percona_5_7_version else diff --git a/include/php-5.3.sh b/include/php-5.3.sh index fdcff8c4..e8e7cca4 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -129,7 +129,7 @@ make ZEND_EXTRA_LIBS='-liconv' make install if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" + echo "${CSUCCESS}PHP installed successfully! ${CEND}" else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" diff --git a/include/php-5.4.sh b/include/php-5.4.sh index a63507c2..3876a840 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -91,7 +91,7 @@ make ZEND_EXTRA_LIBS='-liconv' make install if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" + echo "${CSUCCESS}PHP installed successfully! ${CEND}" else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" diff --git a/include/php-5.5.sh b/include/php-5.5.sh index c7d084cb..0de6985b 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -91,7 +91,7 @@ make ZEND_EXTRA_LIBS='-liconv' make install if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" + echo "${CSUCCESS}PHP installed successfully! ${CEND}" else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 725704cb..9f24f2da 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -90,7 +90,7 @@ make ZEND_EXTRA_LIBS='-liconv' make install if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" + echo "${CSUCCESS}PHP installed successfully! ${CEND}" else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" diff --git a/include/php-7.sh b/include/php-7.sh index cb9efadb..ea774fd5 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -91,7 +91,7 @@ make ZEND_EXTRA_LIBS='-liconv' make install if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" + echo "${CSUCCESS}PHP installed successfully! ${CEND}" else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 4b7a599c..7a89c5c9 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -22,7 +22,7 @@ cd pure-ftpd-$pureftpd_version ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 make -j ${THREAD} && make install if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then - echo "${CSUCCESS}Pure-Ftp install successfully! ${CEND}" + echo "${CSUCCESS}Pure-Ftp installed successfully! ${CEND}" [ ! -e "$pureftpd_install_dir/etc" ] && mkdir $pureftpd_install_dir/etc cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@" $pureftpd_install_dir/sbin/pure-config.pl diff --git a/include/redis.sh b/include/redis.sh index 49d8fac4..61e16cb1 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -33,11 +33,11 @@ if [ -f "src/redis-server" ];then sed -i "s@^# bind 127.0.0.1@bind 127.0.0.1@" $redis_install_dir/etc/redis.conf redis_maxmemory=`expr $Mem / 8`000000 [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i "s@maxmemory @maxmemory \nmaxmemory `expr $Mem / 8`000000@" $redis_install_dir/etc/redis.conf - echo "${CSUCCESS}Redis-server install successfully! ${CEND}" + echo "${CSUCCESS}Redis-server installed successfully! ${CEND}" cd .. rm -rf redis-$redis_version id -u redis >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis + [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis chown -R redis:redis $redis_install_dir/var /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server if [ "$OS" == 'CentOS' ];then @@ -81,7 +81,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then [redis] extension=redis.so EOF - echo "${CSUCCESS}PHP Redis module install successfully! ${CEND}" + echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}" cd .. rm -rf redis-$redis_pecl_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index 471d45e5..e8a04942 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -20,7 +20,7 @@ make -j ${THREAD} && make install if [ -f "/usr/local/lib/libtcmalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig - echo "${CSUCCESS}tcmalloc module install successfully! ${CEND}" + echo "${CSUCCESS}tcmalloc module installed successfully! ${CEND}" cd .. rm -rf gperftools-$tcmalloc_version else diff --git a/include/tengine.sh b/include/tengine.sh index b02bbbfa..c476ad13 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -41,7 +41,7 @@ make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ];then cd .. rm -rf tengine-$tengine_version - echo "${CSUCCESS}Tengine install successfully! ${CEND}" + echo "${CSUCCESS}Tengine installed successfully! ${CEND}" else rm -rf $tengine_install_dir echo "${CFAILURE}Tengine install failed, Please Contact the author! ${CEND}" diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 262b647d..8da95009 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -111,7 +111,7 @@ EOF sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=$run_user@" /etc/init.d/tomcat [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat; chkconfig tomcat on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults - echo "${CSUCCESS}Tomcat install successfully! ${CEND}" + echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" fi else rm -rf $tomcat_install_dir diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 13765ce6..d30ae363 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -111,7 +111,7 @@ EOF sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=$run_user@" /etc/init.d/tomcat [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat; chkconfig tomcat on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults - echo "${CSUCCESS}Tomcat install successfully! ${CEND}" + echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" fi else rm -rf $tomcat_install_dir diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 88bb6c7e..0fc60dcf 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -111,7 +111,7 @@ EOF sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=$run_user@" /etc/init.d/tomcat [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat;chkconfig tomcat on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults - echo "${CSUCCESS}Tomcat install successfully! ${CEND}" + echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" fi else rm -rf $tomcat_install_dir diff --git a/include/xcache.sh b/include/xcache.sh index cbb49374..a222a366 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -61,7 +61,7 @@ xcache.coverager = Off xcache.coverager_autostart = On xcache.coveragedump_directory = "" EOF - echo "${CSUCCESS}Xcache module install successfully! ${CEND}" + echo "${CSUCCESS}Xcache module installed successfully! ${CEND}" cd .. rm -rf xcache-$xcache_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 0a816b52..4ef914b0 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -33,7 +33,7 @@ opcache.fast_shutdown=1 opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - echo "${CSUCCESS}PHP OPcache module install successfully! ${CEND}" + echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" cd .. rm -rf zendopcache-$zendopcache_version [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart diff --git a/options.conf b/options.conf index ca9f1449..b316993d 100644 --- a/options.conf +++ b/options.conf @@ -1,5 +1,5 @@ # operating environment for the current working directory -oneinstack_dir=/root/git/repo/oneinstack +oneinstack_dir= # Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify run_user=www diff --git a/versions.txt b/versions.txt index fab23705..43da6d9c 100644 --- a/versions.txt +++ b/versions.txt @@ -21,7 +21,7 @@ mysql_5_6_version=5.6.31 mysql_5_5_version=5.5.50 mariadb_10_1_version=10.1.14 -mariadb_10_0_version=10.0.25 +mariadb_10_0_version=10.0.26 mariadb_5_5_version=5.5.50 percona_5_7_version=5.7.12-5 diff --git a/vhost.sh b/vhost.sh index 17811634..afda4454 100755 --- a/vhost.sh +++ b/vhost.sh @@ -162,7 +162,7 @@ openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH } Create_SSL() { -if [ -e "/usr/local/bin/certbot-auto" -a -e "~/.local/share/letsencrypt/bin/letsencrypt" ];then +if [ -e "/usr/local/bin/certbot-auto" -a -e "/root/.local/share/letsencrypt/bin/letsencrypt" ];then while :; do echo read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then From 98d9059ad0569af3204a5310472483bef5d69bea Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sun, 3 Jul 2016 11:02:44 +0800 Subject: [PATCH 584/617] Update mysql/mariadb-*.sh --- include/check_os.sh | 4 ++++ include/mariadb-10.0.sh | 21 ++++++++++++++++----- include/mariadb-10.1.sh | 21 ++++++++++++++++----- include/mariadb-5.5.sh | 21 ++++++++++++++++----- include/mysql-5.5.sh | 10 +++++++++- include/mysql-5.6.sh | 10 +++++++++- include/mysql-5.7.sh | 10 +++++++++- include/upgrade_db.sh | 3 --- init.d/Tomcat-init | 2 +- versions.txt | 4 ++-- 10 files changed, 82 insertions(+), 24 deletions(-) diff --git a/include/check_os.sh b/include/check_os.sh index 5c7af585..c9b07088 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -40,4 +40,8 @@ else SYS_BIT_a=x86;SYS_BIT_b=i686; fi +LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` +LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` +[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 + THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 27ef7a83..d97eaa67 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -11,13 +11,24 @@ Install_MariaDB-10-0() { cd $oneinstack_dir/src -[ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f +FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +if [ "$IPADDR_STATE"x == "CN"x ];then + DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` + [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } +else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` +fi + +src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src -src_url=$DOWN_ADDR/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index ad9368d6..ae65eb6b 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -11,13 +11,24 @@ Install_MariaDB-10-1() { cd $oneinstack_dir/src -[ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f +FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +if [ "$IPADDR_STATE"x == "CN"x ];then + DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` + [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } +else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` +fi + +src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src -src_url=$DOWN_ADDR/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 8eb4f69e..c8ddb831 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -11,13 +11,24 @@ Install_MariaDB-5-5() { cd $oneinstack_dir/src -[ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f +FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +if [ "$IPADDR_STATE"x == "CN"x ];then + DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` + [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } +else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` +fi + +src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src -src_url=$DOWN_ADDR/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz && Download_src +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 6a110872..2edf04e1 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -17,7 +17,15 @@ else [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 fi -src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz && Download_src +FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src +MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 2bae3c79..92677d7d 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -17,7 +17,15 @@ else [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 fi -src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz && Download_src +FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src +MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 584dd861..7019e5bc 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -17,7 +17,15 @@ else [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 fi -src_url=$DOWN_ADDR_MYSQL/mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz && Download_src +FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src +MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` +while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; +do + wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue +done id -u mysql >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index d7991714..a99afc1a 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -15,9 +15,6 @@ OLD_DB_version_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{ DB_tmp=`echo $OLD_DB_version_tmp | awk -F'-' '{print $2}'` if [ "$DB_tmp" == 'MariaDB' ];then [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f - LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` - LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` - [ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 DB=MariaDB OLD_DB_version=`echo $OLD_DB_version_tmp | awk -F'-' '{print $1}'` elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then diff --git a/init.d/Tomcat-init b/init.d/Tomcat-init index 8ac3ccff..2e05d8f3 100755 --- a/init.d/Tomcat-init +++ b/init.d/Tomcat-init @@ -22,7 +22,7 @@ TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatu SHUTDOWN_WAIT=20 tomcat_pid() { - echo `ps -ef | grep $CATALINA_HOME | grep -v grep | tr -s " "|cut -d" " -f2` + echo `ps -ef | grep $CATALINA_HOME/ | grep -v grep | tr -s " "|cut -d" " -f2` } start() { diff --git a/versions.txt b/versions.txt index 43da6d9c..15c39974 100644 --- a/versions.txt +++ b/versions.txt @@ -20,7 +20,7 @@ mysql_5_7_version=5.7.13 mysql_5_6_version=5.6.31 mysql_5_5_version=5.5.50 -mariadb_10_1_version=10.1.14 +mariadb_10_1_version=10.1.15 mariadb_10_0_version=10.0.26 mariadb_5_5_version=5.5.50 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.4-9 +ImageMagick_version=6.9.5-0 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 From aa035d48a7da3596496e5059dc7d7aa9b817ed7b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 6 Jul 2016 10:25:05 +0800 Subject: [PATCH 585/617] Update check_os.sh --- include/check_os.sh | 5 ++--- install.sh | 6 ++++-- versions.txt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/check_os.sh b/include/check_os.sh index c9b07088..465d3b2e 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -40,8 +40,7 @@ else SYS_BIT_a=x86;SYS_BIT_b=i686; fi -LIBC_VERSION=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -LIBC_YN=`echo "$LIBC_VERSION < 2.14" | bc` -[ $LIBC_YN == '1' ] && GLIBC_FLAG=linux || GLIBC_FLAG=linux-glibc_214 +LIBC_YN=$(awk -v A=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') +[ $LIBC_YN == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) diff --git a/install.sh b/install.sh index 3c6783dc..c382fdeb 100755 --- a/install.sh +++ b/install.sh @@ -468,10 +468,12 @@ fi if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ];then . include/jemalloc.sh Install_jemalloc | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '4' -a ! -e "/usr/local/lib/libjemalloc.so" ];then +fi +if [ "$DB_version" == '4' -a ! -e "/usr/local/lib/libjemalloc.so" ];then . include/jemalloc.sh Install_jemalloc | tee -a $oneinstack_dir/install.log -elif [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ];then +fi +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ];then . include/tcmalloc.sh Install_tcmalloc | tee -a $oneinstack_dir/install.log fi diff --git a/versions.txt b/versions.txt index 15c39974..bc14fbd7 100644 --- a/versions.txt +++ b/versions.txt @@ -20,7 +20,7 @@ mysql_5_7_version=5.7.13 mysql_5_6_version=5.6.31 mysql_5_5_version=5.5.50 -mariadb_10_1_version=10.1.15 +mariadb_10_1_version=10.1.14 mariadb_10_0_version=10.0.26 mariadb_5_5_version=5.5.50 From 8a3b1854d4c48640bbe438f776a9877daba55cec Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 12 Jul 2016 11:55:29 +0800 Subject: [PATCH 586/617] Update versions.txt --- include/ZendGuardLoader.sh | 2 +- include/init_CentOS.sh | 4 +++- versions.txt | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index af951f39..edcc831f 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -75,7 +75,7 @@ else fi if [ -f "`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so" ];then - cat > $php_install_dir/etc/php.d/ext-zendGuardLoader.ini << EOF + cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF [Zend Guard Loader] zend_extension=`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so zend_loader.enable=1 diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index d4acc9bf..9f3c7a64 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -47,7 +47,9 @@ fi #[ "$sendmail_yn" == 'y' ] && yum -y install sendmail && service sendmail restart # closed Unnecessary services and remove obsolete rpm package -for Service in `chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis'`;do chkconfig --level 3 $Service off;done +[ "$CentOS_RHEL_version" == '7' ] && [ "`systemctl is-active NetworkManager.service`" == 'active' ] && NM_flag=1 +for Service in `chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis|NetworkManager'`;do chkconfig --level 3 $Service off;done +[ "$NM_flag" == '1' ] && systemctl enable NetworkManager.service for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done # Close SELINUX diff --git a/versions.txt b/versions.txt index bc14fbd7..05ce5a89 100644 --- a/versions.txt +++ b/versions.txt @@ -9,7 +9,7 @@ tomcat_8_version=8.0.30 tomcat_7_version=7.0.69 tomcat_6_version=6.0.45 -apache_4_version=2.4.20 +apache_4_version=2.4.23 apache_2_version=2.2.31 pcre_version=8.38 apr_version=1.5.2 @@ -24,9 +24,9 @@ mariadb_10_1_version=10.1.14 mariadb_10_0_version=10.0.26 mariadb_5_5_version=5.5.50 -percona_5_7_version=5.7.12-5 -percona_5_6_version=5.6.30-76.3 -percona_5_5_version=5.5.49-37.9 +percona_5_7_version=5.7.13-6 +percona_5_6_version=5.6.31-77.0 +percona_5_5_version=5.5.50-38.0 # JDK jdk_8_version=1.8.0_92 @@ -60,7 +60,7 @@ redis_version=3.2.1 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.25 +memcached_version=1.4.28 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 From b3e21b64af2fee857865fccb8167deb4ea0659ff Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 20 Jul 2016 09:41:54 +0800 Subject: [PATCH 587/617] Update versions.txt --- config/nginx.conf | 1 + config/nginx_apache.conf | 1 + config/nginx_tomcat.conf | 1 + config/server.xml | 1 + include/GraphicsMagick.sh | 6 +- include/check_os.sh | 3 +- include/init_Debian.sh | 2 +- include/init_Ubuntu.sh | 2 +- include/php-5.3.sh | 2 +- include/php-5.4.sh | 2 +- include/php-5.5.sh | 2 +- include/php-5.6.sh | 2 +- include/php-7.sh | 2 +- install.sh | 2 +- uninstall.sh | 2 +- versions.txt | 4 +- vhost.sh | 112 +++++++++++++++++++++++++++++++++++--- 17 files changed, 124 insertions(+), 23 deletions(-) diff --git a/config/nginx.conf b/config/nginx.conf index 386ca1bf..bf866959 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -18,6 +18,7 @@ http { client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; + client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index 862b4da6..98fe9944 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -18,6 +18,7 @@ http { client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; + client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index a6af8930..6fd1b628 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -18,6 +18,7 @@ http { client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; + client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; diff --git a/config/server.xml b/config/server.xml index 60dca227..64ec73a1 100644 --- a/config/server.xml +++ b/config/server.xml @@ -26,6 +26,7 @@ maxThreads="1000" minSpareThreads="20" acceptCount="1000" + maxHttpHeaderSize="65536" debug="0" disableUploadTimeout="true" useBodyEncodingForURI="true" diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 89f4b3c3..5a39c683 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -25,9 +25,9 @@ Install_php-gmagick() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - src_url=https://pecl.php.net/get/gmagick-2.0.2RC2.tgz && Download_src - tar xzf gmagick-2.0.2RC2.tgz - cd gmagick-2.0.2RC2 + src_url=https://pecl.php.net/get/gmagick-2.0.4RC1.tgz && Download_src + tar xzf gmagick-2.0.4RC1.tgz + cd gmagick-2.0.4RC1 else src_url=http://pecl.php.net/get/gmagick-$gmagick_version.tgz && Download_src tar xzf gmagick-$gmagick_version.tgz diff --git a/include/check_os.sh b/include/check_os.sh index 465d3b2e..229cf3c8 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -21,10 +21,11 @@ elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deep OS=Debian [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Debian_version=`lsb_release -sr | awk -F. '{print $1}'` -elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' ];then +elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' -o -n "`grep 'Linux Mint' /etc/issue`" ];then OS=Ubuntu [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Ubuntu_version=`lsb_release -sr | awk -F. '{print $1}'` + [ -n "`grep 'Linux Mint 18' /etc/issue`" ] && Ubuntu_version=16 else echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" kill -9 $$ diff --git a/include/init_Debian.sh b/include/init_Debian.sh index bff876e5..21a2f81d 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -20,7 +20,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc do apt-get -y install $Package done diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 7502046d..4a462e7c 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -20,7 +20,7 @@ apt-get -y update [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade # Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz ntpdate +for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate do apt-get -y install $Package done diff --git a/include/php-5.3.sh b/include/php-5.3.sh index e8e7cca4..c97d4ba5 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -125,7 +125,7 @@ else --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile -make ZEND_EXTRA_LIBS='-liconv' +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 3876a840..5e6498e4 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -87,7 +87,7 @@ else --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi -make ZEND_EXTRA_LIBS='-liconv' +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 0de6985b..8f1d1a7e 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -87,7 +87,7 @@ else --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi -make ZEND_EXTRA_LIBS='-liconv' +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 9f24f2da..b077f78b 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -86,7 +86,7 @@ else --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi -make ZEND_EXTRA_LIBS='-liconv' +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/include/php-7.sh b/include/php-7.sh index ea774fd5..69084572 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -87,7 +87,7 @@ else --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug fi -make ZEND_EXTRA_LIBS='-liconv' +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install if [ -e "$php_install_dir/bin/phpize" ];then diff --git a/install.sh b/install.sh index c382fdeb..62ee42a4 100755 --- a/install.sh +++ b/install.sh @@ -439,7 +439,7 @@ while :; do echo else if [ "$HHVM_yn" == 'y' ];then [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; HHVM_yn=Other; break; } - if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.5| 6\.6| 6\.7' /etc/redhat-release`" ];then + if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ];then break else echo diff --git a/uninstall.sh b/uninstall.sh index 7eebc11a..5980d532 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -81,7 +81,7 @@ Uninstall_Web() { [ -d "$tengine_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $tengine_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$tengine_install_dir/sbin:@@" /etc/profile; } [ -d "$openresty_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $openresty_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$openresty_install_dir/nginx/sbin:@@" /etc/profile; } [ -d "$apache_install_dir" ] && { service httpd stop > /dev/null 2>&1; rm -rf $apache_install_dir /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@$apache_install_dir/bin:@@" /etc/profile; } -[ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; rm -rf $tomcat_install_dir /etc/init.d/tomcat; /etc/logrotate.d/tomcat; } +[ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf $tomcat_install_dir /etc/init.d/tomcat; /etc/logrotate.d/tomcat; } [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } [ -e "$wwwroot_dir" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} sed -i 's@^website_name=.*@website_name=@' ./options.conf diff --git a/versions.txt b/versions.txt index 05ce5a89..1253fdf2 100644 --- a/versions.txt +++ b/versions.txt @@ -20,7 +20,7 @@ mysql_5_7_version=5.7.13 mysql_5_6_version=5.6.31 mysql_5_5_version=5.5.50 -mariadb_10_1_version=10.1.14 +mariadb_10_1_version=10.1.16 mariadb_10_0_version=10.0.26 mariadb_5_5_version=5.5.50 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.5-0 +ImageMagick_version=6.9.5-2 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 diff --git a/vhost.sh b/vhost.sh index afda4454..71858795 100755 --- a/vhost.sh +++ b/vhost.sh @@ -320,11 +320,6 @@ if [ "$nginx_ssl_yn" == 'y' ]; then Create_SSL Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") - if [ "$moredomainame_yn" == 'y' ]; then - Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain$moredomainame;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") - else - Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}") - fi elif [ "$apache_ssl_yn" == 'y' ]; then Create_SSL Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") @@ -451,9 +446,39 @@ location ~ .*\.(js|css)?$ { } $NGX_CONF } -$Nginx_http_to_https EOF +if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +rewrite ^/(.*) https://$domain/\$1 permanent; +} +EOF +elif [ "$nginx_ssl_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +$N_log +index index.html index.htm index.jsp; +root $vhostdir; +$Nginx_redirect +$anti_hotlinking +location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; + access_log off; + } +location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } +$NGX_CONF +} +EOF +fi + cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF $Tomcat_Domain_alias @@ -537,9 +562,40 @@ location ~ .*\.(js|css)?$ { access_log off; } } -$Nginx_http_to_https EOF +if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +rewrite ^/(.*) https://$domain/\$1 permanent; +} +EOF +elif [ "$nginx_ssl_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +$N_log +index index.html index.htm index.php; +include $web_install_dir/conf/rewrite/$rewrite.conf; +root $vhostdir; +$Nginx_redirect +$anti_hotlinking +$NGX_CONF +location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; + access_log off; + } +location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } +} +EOF +fi + echo $web_install_dir/sbin/nginx -t if [ $? == 0 ];then @@ -679,9 +735,49 @@ location ~ .*\.(js|css)?$ { access_log off; } } -$Nginx_http_to_https EOF +if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +rewrite ^/(.*) https://$domain/\$1 permanent; +} +EOF +elif [ "$nginx_ssl_yn" == 'y' ];then +cat >> $web_install_dir/conf/vhost/$domain.conf << EOF +server { +listen 80; +server_name $domain$moredomainame; +$N_log +index index.html index.htm index.php; +root $vhostdir; +$Nginx_redirect +$anti_hotlinking +location / { + try_files \$uri @apache; + } +location @apache { + proxy_pass http://127.0.0.1:88; + include proxy.conf; + } +location ~ .*\.(php|php5|cgi|pl)?$ { + proxy_pass http://127.0.0.1:88; + include proxy.conf; + } +location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; + access_log off; + } +location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } +} +EOF +fi + echo $web_install_dir/sbin/nginx -t if [ $? == 0 ];then From 35ff3205ad022934a557093c335d90577e2614b8 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 22 Jul 2016 13:59:19 +0800 Subject: [PATCH 588/617] Update get_ipaddr_state.py --- include/demo.sh | 4 ++-- include/get_ipaddr_state.py | 6 +++--- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/mysql-5.5.sh | 4 ++-- include/mysql-5.6.sh | 4 ++-- include/mysql-5.7.sh | 4 ++-- include/percona-5.7.sh | 2 +- include/upgrade_db.sh | 4 ++-- install.sh | 3 ++- upgrade.sh | 2 +- versions.txt | 6 +++--- 13 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/demo.sh b/include/demo.sh index 07e5dc15..e917f63e 100644 --- a/include/demo.sh +++ b/include/demo.sh @@ -11,10 +11,10 @@ DEMO() { cd $oneinstack_dir/src -[ "$IPADDR_STATE"x == "CN"x ] && /bin/cp ../config/index_cn.html $wwwroot_dir/default/index.html || /bin/cp ../config/index.html $wwwroot_dir/default +[ "$IPADDR_COUNTRY"x == "CN"x ] && /bin/cp ../config/index_cn.html $wwwroot_dir/default/index.html || /bin/cp ../config/index.html $wwwroot_dir/default if [ -e "$php_install_dir/bin/php" ];then - if [ "$IPADDR_STATE"x == "CN"x ];then + if [ "$IPADDR_COUNTRY"x == "CN"x ];then src_url=http://mirrors.linuxeye.com/oneinstack/src/tz.zip && Download_src unzip -q tz.zip -d $wwwroot_dir/default else diff --git a/include/get_ipaddr_state.py b/include/get_ipaddr_state.py index e30fd4cc..945152cd 100755 --- a/include/get_ipaddr_state.py +++ b/include/get_ipaddr_state.py @@ -3,13 +3,13 @@ try: import sys,urllib2,socket socket.setdefaulttimeout(10) - apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] + apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[2] content = urllib2.urlopen(apiurl).read() data = eval(content)['data'] code = eval(content)['code'] if code == 0: - print data['country'] + print data[sys.argv[1]] else: print data except: - print "Usage:%s IP" % sys.argv[0] + print "Usage:%s {country_id|isp} IP" % sys.argv[0] diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index d97eaa67..85eecd47 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -13,7 +13,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -if [ "$IPADDR_STATE"x == "CN"x ];then +if [ "$IPADDR_COUNTRY"x == "CN"x ];then DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index ae65eb6b..ff9b3a9c 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -13,7 +13,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -if [ "$IPADDR_STATE"x == "CN"x ];then +if [ "$IPADDR_COUNTRY"x == "CN"x ];then DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index c8ddb831..95f3ef77 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -13,7 +13,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -if [ "$IPADDR_STATE"x == "CN"x ];then +if [ "$IPADDR_COUNTRY"x == "CN"x ];then DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 2edf04e1..9b745dae 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -11,10 +11,10 @@ Install_MySQL-5-5() { cd $oneinstack_dir/src -if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then +if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 else - [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 fi FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 92677d7d..94b0a84d 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -11,10 +11,10 @@ Install_MySQL-5-6() { cd $oneinstack_dir/src -if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then +if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 else - [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 fi FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 7019e5bc..e79adcc3 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -11,10 +11,10 @@ Install_MySQL-5-7() { cd $oneinstack_dir/src -if [ "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then +if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 else - [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 fi FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 6870c689..4e052c95 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -10,7 +10,7 @@ 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 +[ "$IPADDR_COUNTRY"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 diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index a99afc1a..ff91a0be 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -14,14 +14,14 @@ cd $oneinstack_dir/src OLD_DB_version_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'` DB_tmp=`echo $OLD_DB_version_tmp | awk -F'-' '{print $2}'` if [ "$DB_tmp" == 'MariaDB' ];then - [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f DB=MariaDB OLD_DB_version=`echo $OLD_DB_version_tmp | awk -F'-' '{print $1}'` elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then DB=Percona OLD_DB_version=$OLD_DB_version_tmp else - [ "$IPADDR_STATE"x == "CN"x ] && DOWN_ADDR=http://mirrors.sohu.com/mysql || DOWN_ADDR=http://cdn.mysql.com/Downloads + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.sohu.com/mysql || DOWN_ADDR=http://cdn.mysql.com/Downloads DB=MySQL OLD_DB_version=$OLD_DB_version_tmp fi diff --git a/install.sh b/install.sh index 62ee42a4..ce9f3e91 100755 --- a/install.sh +++ b/install.sh @@ -34,7 +34,8 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # get the IP information IPADDR=`./include/get_ipaddr.py` PUBLIC_IPADDR=`./include/get_public_ipaddr.py` -[ "`./include/get_ipaddr_state.py $PUBLIC_IPADDR`" == '\u4e2d\u56fd' ] && IPADDR_STATE=CN +IPADDR_COUNTRY=`./include/get_ipaddr_state.py country_id $PUBLIC_IPADDR` +[ "`./include/get_ipaddr_state.py isp $PUBLIC_IPADDR`" == '\u963f\u91cc\u4e91' ] && IPADDR_ISP=aliyun mkdir -p $wwwroot_dir/default $wwwlogs_dir [ -d /data ] && chmod 755 /data diff --git a/upgrade.sh b/upgrade.sh index 378c4fe0..8937ce08 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -38,7 +38,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # get the IP information PUBLIC_IPADDR=`./include/get_public_ipaddr.py` -[ "`./include/get_ipaddr_state.py $PUBLIC_IPADDR`" == '\u4e2d\u56fd' ] && IPADDR_STATE=CN +IPADDR_COUNTRY=`./include/get_ipaddr_state.py country_id $PUBLIC_IPADDR` Usage(){ printf " diff --git a/versions.txt b/versions.txt index 1253fdf2..f7767128 100644 --- a/versions.txt +++ b/versions.txt @@ -34,9 +34,9 @@ jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.8 -php_6_version=5.6.23 -php_5_version=5.5.37 +php_7_version=7.0.9 +php_6_version=5.6.24 +php_5_version=5.5.38 php_4_version=5.4.45 php_3_version=5.3.29 From e19ca761a004b8f2f055ac0ba57cb522784ea08e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 22 Jul 2016 16:14:54 +0800 Subject: [PATCH 589/617] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76735203..e2e6e73b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Script properties: If your server system: CentOS/Redhat (Do not enter "//" and "// subsequent sentence) ```bash -yum -y install wget screen // For CentOS / Redhat +yum -y install wget screen python // For CentOS / Redhat wget http://mirrors.linuxeye.com/lnmp-full.tar.gz // Contains the source code tar xzf lnmp-full.tar.gz cd lnmp // If you need to modify the directory (installation, data storage, Nginx logs), modify options.conf file @@ -34,7 +34,7 @@ screen -S lnmp // if network interruption, you can execute the command `scree ``` If your server system: Debian/Ubuntu (Do not enter "//" and "// subsequent sentence) ```bash -apt-get -y install wget screen // For Debian / Ubuntu +apt-get -y install wget screen python // For Debian / Ubuntu wget http://mirrors.linuxeye.com/lnmp-full.tar.gz // Contains the source code tar xzf lnmp-full.tar.gz cd lnmp // If you need to modify the directory (installation, data storage, Nginx logs), modify options.conf file From d240d2d5268ea96088116211450147ea89761fef Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 29 Jul 2016 13:31:52 +0800 Subject: [PATCH 590/617] Update versions.txt --- addons.sh | 32 ++++++++++++++++---------------- include/get_ipaddr_state.py | 6 +++--- include/get_public_ipaddr.py | 4 ++-- include/ioncube.sh | 2 +- install.sh | 13 +++++++------ shadowsocks.sh | 10 +++++----- upgrade.sh | 2 +- versions.txt | 8 ++++---- 8 files changed, 39 insertions(+), 38 deletions(-) diff --git a/addons.sh b/addons.sh index 5a6f05b1..19a70af4 100755 --- a/addons.sh +++ b/addons.sh @@ -50,8 +50,8 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # Check PHP if [ -e "$php_install_dir/bin/phpize" ];then - PHP_version_detail=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` - PHP_version=`echo $PHP_version_detail | awk -F. '{print $1"."$2}'` + PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + PHP_main_version=${PHP_version%.*} fi # Check PHP Extensions @@ -192,19 +192,19 @@ What Are You Doing? else if [ $PHP_cache = 1 ];then cd $oneinstack_dir/src - if [[ $PHP_version =~ ^5.[3-4]$ ]];then + if [[ $PHP_main_version =~ ^5.[3-4]$ ]];then Install_ZendOPcache - elif [ "$PHP_version" == '5.5' ];then + elif [ "$PHP_main_version" == '5.5' ];then src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src tar xzf php-$php_5_version.tar.gz cd php-$php_5_version/ext/opcache Install_opcache - elif [ "$PHP_version" == '5.6' ];then + elif [ "$PHP_main_version" == '5.6' ];then src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src tar xzf php-$php_6_version.tar.gz cd php-$php_6_version/ext/opcache Install_opcache - elif [ "$PHP_version" == '7.0' ];then + elif [ "$PHP_main_version" == '7.0' ];then src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src tar xzf php-$php_7_version.tar.gz cd php-$php_7_version/ext/opcache @@ -212,7 +212,7 @@ What Are You Doing? fi Check_succ elif [ $PHP_cache = 2 ];then - if [[ $PHP_version =~ ^5.[3-6]$ ]];then + if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then while :; do read -p "Please input xcache admin password: " xcache_admin_pass (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" @@ -223,17 +223,17 @@ What Are You Doing? echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 fi elif [ $PHP_cache = 3 ];then - if [[ $PHP_version =~ ^5.[3-5]$ ]];then + if [[ $PHP_main_version =~ ^5.[3-5]$ ]];then Install_APCU Check_succ else echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1 fi elif [ $PHP_cache = 4 ];then - if [ "$PHP_version" == '5.3' ];then + if [ "$PHP_main_version" == '5.3' ];then Install_eAccelerator-0-9 Check_succ - elif [ "$PHP_version" == '5.4' ];then + elif [ "$PHP_main_version" == '5.4' ];then Install_eAccelerator-1-0-dev Check_succ else @@ -257,13 +257,13 @@ What Are You Doing? echo "${CWARNING}input error! Please only input number 1,2${CEND}" else [ $Loader = 1 ] && PHP_extension=ZendGuardLoader - [ $Loader = 2 ] && PHP_extension=ioncube + [ $Loader = 2 ] && PHP_extension=0ioncube break fi done if [ $ACTION = 1 ];then Check_PHP_Extension - if [[ $PHP_version =~ ^5.[3-6]$ ]];then + if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then if [ $Loader = 1 ];then if [ -e $php_install_dir/etc/php.d/ext-opcache.ini ];then echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 @@ -273,7 +273,7 @@ What Are You Doing? fi elif [ $Loader = 2 ];then Install_ionCube - Restart_PHP; echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; + Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; fi else echo; echo "${CWARNING}Your php does not support $PHP_extension! ${CEND}"; @@ -321,9 +321,9 @@ What Are You Doing? if [ $ACTION = 1 ];then Check_PHP_Extension cd $oneinstack_dir/src - src_url=http://www.php.net/distributions/php-$PHP_version_detail.tar.gz && Download_src - tar xzf php-$PHP_version_detail.tar.gz - cd php-$PHP_version_detail/ext/fileinfo + src_url=http://www.php.net/distributions/php-$PHP_version.tar.gz && Download_src + tar xzf php-$PHP_version.tar.gz + cd php-$PHP_version/ext/fileinfo $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make -j ${THREAD} && make install diff --git a/include/get_ipaddr_state.py b/include/get_ipaddr_state.py index 945152cd..6364f17c 100755 --- a/include/get_ipaddr_state.py +++ b/include/get_ipaddr_state.py @@ -3,13 +3,13 @@ try: import sys,urllib2,socket socket.setdefaulttimeout(10) - apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[2] + apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] content = urllib2.urlopen(apiurl).read() data = eval(content)['data'] code = eval(content)['code'] if code == 0: - print data[sys.argv[1]] + print data['country_id'],data['isp_id'] else: print data except: - print "Usage:%s {country_id|isp} IP" % sys.argv[0] + print "Usage:%s IP" % sys.argv[0] diff --git a/include/get_public_ipaddr.py b/include/get_public_ipaddr.py index 6c643752..78c40f9d 100755 --- a/include/get_public_ipaddr.py +++ b/include/get_public_ipaddr.py @@ -3,10 +3,10 @@ class Get_public_ip: def getip(self): try: - myip = self.visit("http://ipv4.icanhazip.com/") + myip = self.visit("http://ip.chinaz.com/getip.aspx") except: try: - myip = self.visit("http://www.whereismyip.com/") + myip = self.visit("http://ipv4.icanhazip.com/") except: myip = "So sorry!!!" return myip diff --git a/include/ioncube.sh b/include/ioncube.sh index 9ca95369..89c6c3bd 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -40,7 +40,7 @@ else fi rm -rf ioncube -cat > $php_install_dir/etc/php.d/ext-ioncube.ini << EOF +cat > $php_install_dir/etc/php.d/ext-0ioncube.ini << EOF [ionCube Loader] zend_extension=$zend_extension EOF diff --git a/install.sh b/install.sh index ce9f3e91..1072b2b1 100755 --- a/install.sh +++ b/install.sh @@ -31,12 +31,6 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # Check if user is root [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -# get the IP information -IPADDR=`./include/get_ipaddr.py` -PUBLIC_IPADDR=`./include/get_public_ipaddr.py` -IPADDR_COUNTRY=`./include/get_ipaddr_state.py country_id $PUBLIC_IPADDR` -[ "`./include/get_ipaddr_state.py isp $PUBLIC_IPADDR`" == '\u963f\u91cc\u4e91' ] && IPADDR_ISP=aliyun - mkdir -p $wwwroot_dir/default $wwwlogs_dir [ -d /data ] && chmod 755 /data @@ -454,6 +448,13 @@ while :; do echo fi done +# get the IP information +IPADDR=`./include/get_ipaddr.py` +PUBLIC_IPADDR=`./include/get_public_ipaddr.py` +IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR` +IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'` +[ "`echo $IPADDR_COUNTRY_ISP | awk '{print $2}'`"x == '1000323'x ] && IPADDR_ISP=aliyun + # init . ./include/memory.sh if [ "$OS" == 'CentOS' ];then diff --git a/shadowsocks.sh b/shadowsocks.sh index c452c41f..5e290f02 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -61,10 +61,10 @@ fi while :; do echo read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port - if [ $Shadowsocks_port -ge 9000 >/dev/null 2>&1 -a $Shadowsocks_port -le 10000 >/dev/null 2>&1 ];then - break + if [ $Shadowsocks_port -ge 1 >/dev/null 2>&1 -a $Shadowsocks_port -le 65535 >/dev/null 2>&1 ];then + [ -z "`netstat -an | grep :$Shadowsocks_port`" ] && break || echo "${CWARNING}This port is already used! ${CEND}" else - echo "${CWARNING}input error! Input range: 9001~9999${CEND}" + echo "${CWARNING}input error! Input range: 1~65535${CEND}" fi done @@ -81,7 +81,7 @@ elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then iptables-save > /etc/iptables.up.rules fi else - echo "${CWARNING}This port is already in iptables${CEND}" + echo "${CWARNING}This port is already in iptables! ${CEND}" fi } @@ -102,7 +102,7 @@ if [ "$OS" == 'CentOS' ]; then done AddUser_shadowsocks Iptables_set - for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git + for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto do yum -y install $Package done diff --git a/upgrade.sh b/upgrade.sh index 8937ce08..17550537 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -38,7 +38,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # get the IP information PUBLIC_IPADDR=`./include/get_public_ipaddr.py` -IPADDR_COUNTRY=`./include/get_ipaddr_state.py country_id $PUBLIC_IPADDR` +IPADDR_COUNTRY=`./include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}'` Usage(){ printf " diff --git a/versions.txt b/versions.txt index f7767128..5544edcc 100644 --- a/versions.txt +++ b/versions.txt @@ -11,7 +11,7 @@ tomcat_6_version=6.0.45 apache_4_version=2.4.23 apache_2_version=2.2.31 -pcre_version=8.38 +pcre_version=8.39 apr_version=1.5.2 apr_util_version=1.5.4 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.5-2 +ImageMagick_version=6.9.5-3 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 @@ -56,11 +56,11 @@ mhash_version=0.9.9.9 pureftpd_version=1.0.42 # Redis -redis_version=3.2.1 +redis_version=3.2.2 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.28 +memcached_version=1.4.29 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 From 880fd83c66ce2871ed4d4afb5c8a8a5484c90051 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 5 Aug 2016 10:45:22 +0800 Subject: [PATCH 591/617] Update include/mysql-5.*.sh --- include/download.sh | 2 +- include/mysql-5.5.sh | 18 ++++++++++++++++-- include/mysql-5.6.sh | 18 ++++++++++++++++-- include/mysql-5.7.sh | 18 ++++++++++++++++-- versions.txt | 10 +++++----- vhost.sh | 2 +- 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/include/download.sh b/include/download.sh index c46c6d4f..a89f4d2a 100644 --- a/include/download.sh +++ b/include/download.sh @@ -9,7 +9,7 @@ # https://github.com/lj2007331/oneinstack Download_src() { - [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget -c --no-check-certificate $src_url; sleep 1; } + [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget --tries=6 -c --no-check-certificate $src_url; sleep 1; } if [ ! -e "${src_url##*/}" ];then echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" kill -9 $$ diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 9b745dae..04e1536d 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -14,7 +14,21 @@ cd $oneinstack_dir/src if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 else - [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + if [ "$IPADDR_COUNTRY"x == "CN"x ];then + if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + else + if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + fi fi FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz @@ -23,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 94b0a84d..ed71edea 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -14,7 +14,21 @@ cd $oneinstack_dir/src if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 else - [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + if [ "$IPADDR_COUNTRY"x == "CN"x ];then + if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + else + if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + fi fi FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz @@ -23,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index e79adcc3..7d442ca9 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -14,7 +14,21 @@ cd $oneinstack_dir/src if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 else - [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 || DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + if [ "$IPADDR_COUNTRY"x == "CN"x ];then + if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + else + if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL + fi + fi fi FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz @@ -23,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME;sleep 1 + wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/versions.txt b/versions.txt index 5544edcc..b793c841 100644 --- a/versions.txt +++ b/versions.txt @@ -16,9 +16,9 @@ apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.13 -mysql_5_6_version=5.6.31 -mysql_5_5_version=5.5.50 +mysql_5_7_version=5.7.14 +mysql_5_6_version=5.6.32 +mysql_5_5_version=5.5.51 mariadb_10_1_version=10.1.16 mariadb_10_0_version=10.0.26 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.5-3 +ImageMagick_version=6.9.5-4 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 @@ -56,7 +56,7 @@ mhash_version=0.9.9.9 pureftpd_version=1.0.42 # Redis -redis_version=3.2.2 +redis_version=3.2.3 redis_pecl_version=2.2.8 # Memcached diff --git a/vhost.sh b/vhost.sh index 71858795..22e47307 100755 --- a/vhost.sh +++ b/vhost.sh @@ -318,7 +318,7 @@ if [ "$nginx_ssl_yn" == 'y' ]; then LISTENOPT='443 ssl spdy' fi Create_SSL - Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;") + Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\nssl_prefer_server_ciphers on;\nssl_session_timeout 10m;\nssl_session_cache builtin:1000 shared:SSL:10m;\nssl_buffer_size 1400;\nadd_header Strict-Transport-Security max-age=15768000;\nssl_stapling on;\nssl_stapling_verify on;\n") Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") elif [ "$apache_ssl_yn" == 'y' ]; then Create_SSL From 77dbd6c0ea0dbd06932ab97482d657b8e29eef22 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 9 Aug 2016 18:05:37 +0800 Subject: [PATCH 592/617] Update curl version --- include/php-5.3.sh | 63 ++++++++++++++++++++++------------------------ include/php-5.4.sh | 12 +++++++-- include/php-5.5.sh | 12 +++++++-- include/php-5.6.sh | 12 +++++++-- include/php-7.sh | 12 +++++++-- versions.txt | 1 + 6 files changed, 71 insertions(+), 41 deletions(-) diff --git a/include/php-5.3.sh b/include/php-5.3.sh index c97d4ba5..fb99a193 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -11,6 +11,7 @@ Install_PHP-5-3() { cd $oneinstack_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src @@ -28,6 +29,33 @@ make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version +# Problem building php-5.3 with openssl +if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then + if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ];then + src_url=http://mirrors.linuxeye.com/oneinstack/src/openssl-1.0.0s.tar.gz && Download_src + tar xzf openssl-1.0.0s.tar.gz + cd openssl-1.0.0s + ./config --prefix=/usr/local/openssl -fPIC shared zlib + make -j ${THREAD} && make install + cd .. + rm -rf openssl-1.0.0s + fi + OpenSSL_args='--with-openssl=/usr/local/openssl' +else + OpenSSL_args='--with-openssl' +fi + +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then + LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl +else + ./configure --prefix=/usr/local +fi +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure @@ -63,37 +91,6 @@ rm -rf mcrypt-$mcrypt_version id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user -# Problem building php-5.3 with openssl -if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then - if [ -e '/usr/local/openssl/lib/libcrypto.a' ];then - OpenSSL_args='--with-openssl=/usr/local/openssl' - else - src_url=http://mirrors.linuxeye.com/oneinstack/src/openssl-1.0.0s.tar.gz && Download_src - tar xzf openssl-1.0.0s.tar.gz - cd openssl-1.0.0s - ./config --prefix=/usr/local/openssl -fPIC shared zlib - make -j ${THREAD} && make install - cd .. - [ -e '/usr/local/openssl/lib/libcrypto.a' ] && { OpenSSL_args='--with-openssl=/usr/local/openssl'; rm -rf openssl-1.0.0s; } || OpenSSL_args='--with-openssl' - fi - if [ "$Ubuntu_version" == '16' ];then - if [ -e '/usr/local/curl/lib/libcurl.a' ];then - Curl_args='--with-curl=/usr/local/curl' - else - src_url=http://mirrors.linuxeye.com/oneinstack/src/curl-7.29.0.tar.gz && Download_src - tar xzf curl-7.29.0.tar.gz - cd curl-7.29.0 - LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl - make -j ${THREAD} && make install - cd .. - [ -e '/usr/local/curl/lib/libcurl.a' ] && { Curl_args='--with-curl=/usr/local/curl'; rm -rf curl-7.29.0; } || Curl_args='--with-curl' - fi - fi -else - OpenSSL_args='--with-openssl' - Curl_args='--with-curl' -fi - tar xzf php-$php_3_version.tar.gz patch -d php-$php_3_version -p0 < fpm-race-condition.patch cd php-$php_3_version @@ -108,7 +105,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization $Curl_args --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -119,7 +116,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization $Curl_args --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 5e6498e4..759b1e38 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -11,6 +11,7 @@ Install_PHP-5-4() { cd $oneinstack_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src @@ -26,6 +27,13 @@ make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure @@ -71,7 +79,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +90,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 8f1d1a7e..38c07170 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -11,6 +11,7 @@ Install_PHP-5-5() { cd $oneinstack_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src @@ -26,6 +27,13 @@ make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure @@ -71,7 +79,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +90,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-5.6.sh b/include/php-5.6.sh index b077f78b..1d8637e4 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -11,6 +11,7 @@ Install_PHP-5-6() { cd $oneinstack_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src @@ -25,6 +26,13 @@ make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure @@ -70,7 +78,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -81,7 +89,7 @@ else --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/include/php-7.sh b/include/php-7.sh index 69084572..4c32cfda 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -11,6 +11,7 @@ Install_PHP-7() { cd $oneinstack_dir/src src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src @@ -25,6 +26,13 @@ make -j ${THREAD} && make install cd .. rm -rf libiconv-$libiconv_version +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + tar xzf libmcrypt-$libmcrypt_version.tar.gz cd libmcrypt-$libmcrypt_version ./configure @@ -71,7 +79,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];the --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug @@ -82,7 +90,7 @@ else --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug diff --git a/versions.txt b/versions.txt index b793c841..bf99a146 100644 --- a/versions.txt +++ b/versions.txt @@ -48,6 +48,7 @@ imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 libiconv_version=1.14 +curl_version=7.35.0 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 From 0bbc5cf45b729f5d793b9a2c220dd055b4dcea50 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 15 Aug 2016 13:44:16 +0800 Subject: [PATCH 593/617] Update Pureftpd --- include/pureftpd.sh | 12 ++++---- init.d/Pureftpd-init | 71 ++++++++++++++++++++++++++++++++++++++++++++ versions.txt | 4 +-- 3 files changed, 78 insertions(+), 9 deletions(-) create mode 100755 init.d/Pureftpd-init diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 7a89c5c9..3c01234d 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -27,15 +27,13 @@ if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@" $pureftpd_install_dir/sbin/pure-config.pl chmod +x $pureftpd_install_dir/sbin/pure-config.pl - cp contrib/redhat.init /etc/init.d/pureftpd - sed -i "s@fullpath=.*@fullpath=$pureftpd_install_dir/sbin/\$prog@" /etc/init.d/pureftpd - sed -i "s@pureftpwho=.*@pureftpwho=$pureftpd_install_dir/sbin/pure-ftpwho@" /etc/init.d/pureftpd - sed -i "s@/etc/pure-ftpd.conf@$pureftpd_install_dir/etc/pure-ftpd.conf@" /etc/init.d/pureftpd + cd ../../ + /bin/cp init.d/Pureftpd-init /etc/init.d/pureftpd + sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@g" /etc/init.d/pureftpd chmod +x /etc/init.d/pureftpd [ "$OS" == 'CentOS' ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; [ -z "`grep ^'# Default-Start' /etc/init.d/pureftpd`" ] && sed -i "s@^# chkconfig.*@# chkconfig&\n# Default-Start: 2 3 4 5\n# Default-Stop: 0 1 6@" /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } [ "$Debian_version" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd - cd ../../ /bin/cp config/pure-ftpd.conf $pureftpd_install_dir/etc sed -i "s@^PureDB.*@PureDB $pureftpd_install_dir/etc/pureftpd.pdb@" $pureftpd_install_dir/etc/pure-ftpd.conf @@ -59,7 +57,7 @@ if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then fi else rm -rf $pureftpd_install_dir - echo "${CFAILURE}Pure-Ftp install failed, Please contact the author! ${CEND}" + echo "${CFAILURE}Pure-Ftpd install failed, Please contact the author! ${CEND}" kill -9 $$ fi } diff --git a/init.d/Pureftpd-init b/init.d/Pureftpd-init new file mode 100755 index 00000000..bbb1b1fb --- /dev/null +++ b/init.d/Pureftpd-init @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Startup script for the pure-ftpd FTP Server $Revision: 1.3 $ +# +# chkconfig: 2345 85 15 +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd +# processname: pure-ftpd +# pidfile: /var/run/pure-ftpd.pid +# config: /usr/local/pureftpd/etc/pure-ftpd.conf + +# Source function library. +. /etc/rc.d/init.d/functions + +RETVAL=0 + +# Path to the pure-ftp binaries. +prog=pure-config.pl +fullpath=/usr/local/pureftpd/sbin/$prog +pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho +pure_config=/usr/local/pureftpd/etc/pure-ftpd.conf + + +start() { + echo -n $"Starting $prog: " + $fullpath $pure_config --daemonize + RETVAL=$? + [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog + echo +} +stop() { + echo -n $"Stopping $prog: " + kill $(cat /var/run/pure-ftpd.pid) + RETVAL=$? + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog + echo +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart) + if [ -f /var/lock/subsys/$prog ] ; then + stop + # avoid race + sleep 3 + start + fi + ;; + status) + status $prog + RETVAL=$? + if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then + $pureftpwho + fi + ;; + *) + echo $"Usage: $prog {start|stop|restart|condrestart|status}" + RETVAL=1 +esac +exit $RETVAL diff --git a/versions.txt b/versions.txt index bf99a146..4f6c211b 100644 --- a/versions.txt +++ b/versions.txt @@ -22,7 +22,7 @@ mysql_5_5_version=5.5.51 mariadb_10_1_version=10.1.16 mariadb_10_0_version=10.0.26 -mariadb_5_5_version=5.5.50 +mariadb_5_5_version=5.5.51 percona_5_7_version=5.7.13-6 percona_5_6_version=5.6.31-77.0 @@ -54,7 +54,7 @@ mcrypt_version=2.6.8 mhash_version=0.9.9.9 # Ftp -pureftpd_version=1.0.42 +pureftpd_version=1.0.43 # Redis redis_version=3.2.3 From 169a4921a090706ccf2b37726d368da9ccd7660f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 30 Aug 2016 11:21:05 +0800 Subject: [PATCH 594/617] Debian/Ubuntu upgrade security packages only --- README.md | 4 +- include/init_CentOS.sh | 9 ++-- include/init_Debian.sh | 5 +- include/init_Ubuntu.sh | 5 +- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/mysql-5.5.sh | 8 +-- include/mysql-5.6.sh | 8 +-- include/mysql-5.7.sh | 8 +-- include/tomcat-6.sh | 2 +- include/tomcat-7.sh | 2 +- include/tomcat-8.sh | 2 +- include/upgrade_db.sh | 2 +- include/upgrade_web.sh | 10 ++-- install.sh | 2 +- versions.txt | 22 ++++---- vhost.sh | 115 +++++----------------------------------- 18 files changed, 59 insertions(+), 151 deletions(-) diff --git a/README.md b/README.md index e2e6e73b..53a5a502 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -[![PayPal donate button](https://img.shields.io/badge/paypal-donate-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=lj2007331@gmail.com&item_name=OneinStack%20Donate¤cy_code=USD) -[![支付宝捐助按钮](https://img.shields.io/badge/%E6%94%AF%E4%BB%98%E5%AE%9D-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/alipay.png) -[![微信捐助按钮](https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/weixin.png) +[![PayPal donate button](https://img.shields.io/badge/paypal-donate-green.svg)](https://paypal.me/yeho)[![支付宝捐助按钮](https://img.shields.io/badge/%E6%94%AF%E4%BB%98%E5%AE%9D-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/alipay.png)[![微信捐助按钮](https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/weixin.png) This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~16 of 32 and 64. diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 9f3c7a64..cc88d69e 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -26,9 +26,6 @@ fi yum check-update -# check upgrade OS -[ "$upgrade_yn" == 'y' ] && yum -y upgrade - # Install needed packages for Package in deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz do @@ -205,9 +202,9 @@ fi # install htop if [ ! -e "`which htop`" ];then cd src - 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 + src_url=http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz && Download_src + tar xzf htop-2.0.2.tar.gz + cd htop-2.0.2 ./configure make -j ${THREAD} && make install cd ../../ diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 21a2f81d..92281faa 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -16,8 +16,9 @@ dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update -# check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade +# critical security updates +grep security /etc/apt/sources.list > /tmp/security.sources.list +apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 4a462e7c..1f4614ee 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -16,8 +16,9 @@ dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P apt-get -y update -# check upgrade OS -[ "$upgrade_yn" == 'y' ] && apt-get -y upgrade +# critical security updates +grep security /etc/apt/sources.list > /tmp/security.sources.list +apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 85eecd47..823f8721 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -14,7 +14,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } else diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index ff9b3a9c..54e6e918 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -14,7 +14,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } else diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 95f3ef77..c818273f 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -14,7 +14,7 @@ cd $oneinstack_dir/src FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=http://mirrors.aliyun.com/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } else diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 04e1536d..3af0bfc3 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -15,10 +15,10 @@ if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/ch DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 else if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 else - DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL fi else @@ -37,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 + wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index ed71edea..68b34e24 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -15,10 +15,10 @@ if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/ch DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 else if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 else - DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL fi else @@ -37,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 + wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 7d442ca9..5229d53a 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -15,10 +15,10 @@ if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/ch DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 else if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.sohu.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 + if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 else - DOWN_ADDR_MYSQL=http://mirror.bit.edu.cn/mysql/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL fi else @@ -37,7 +37,7 @@ src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; do - wget -c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 + wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue done diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 8da95009..7952ed62 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -45,7 +45,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index d30ae363..d4d51f1f 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -45,7 +45,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 0fc60dcf..cc8bac66 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -45,7 +45,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then if [ -d "/usr/local/apr/lib" ];then [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m' +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index ff91a0be..c3ea84c3 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -14,7 +14,7 @@ cd $oneinstack_dir/src OLD_DB_version_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'` DB_tmp=`echo $OLD_DB_version_tmp | awk -F'-' '{print $2}'` if [ "$DB_tmp" == 'MariaDB' ];then - [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.aliyun.com/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f DB=MariaDB OLD_DB_version=`echo $OLD_DB_version_tmp | awk -F'-' '{print $1}'` elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index e9e350c1..7ad4ab4c 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -48,7 +48,7 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then ./configure $nginx_configure_arguments make -j ${THREAD} if [ -f "objs/nginx" ];then - /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d) + /bin/mv $nginx_install_dir/sbin/nginx{,`date +%m%d`} /bin/cp objs/nginx $nginx_install_dir/sbin/nginx kill -USR2 `cat /var/run/nginx.pid` sleep 1 @@ -102,9 +102,9 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then ./configure $tengine_configure_arguments make -j ${THREAD} if [ -f "objs/nginx" ];then - /bin/mv $tengine_install_dir/sbin/nginx $tengine_install_dir/sbin/nginx$(date +%m%d) - /bin/mv $tengine_install_dir/sbin/dso_tool $tengine_install_dir/sbin/dso_tool$(date +%m%d) - /bin/mv $tengine_install_dir/modules $tengine_install_dir/modules$(date +%m%d) + /bin/mv $tengine_install_dir/sbin/nginx{,`date +%m%d`} + /bin/mv $tengine_install_dir/sbin/dso_tool{,`date +%m%d`} + /bin/mv $tengine_install_dir/modules{,`date +%m%d`} /bin/cp objs/nginx $tengine_install_dir/sbin/nginx /bin/cp objs/dso_tool $tengine_install_dir/sbin/dso_tool chmod +x $tengine_install_dir/sbin/* @@ -164,7 +164,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then - /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d) + /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`} make install kill -USR2 `cat /var/run/nginx.pid` sleep 1 diff --git a/install.sh b/install.sh index 1072b2b1..c7000f11 100755 --- a/install.sh +++ b/install.sh @@ -75,7 +75,7 @@ while :; do echo else [ "$Nginx_version" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; Nginx_version=Other; } [ "$Nginx_version" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; Nginx_version=Other; } - [ "$Nginx_version" != '4' -a -e "$openresty_install_dir/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; Nginx_version=Other; } break fi done diff --git a/versions.txt b/versions.txt index 4f6c211b..f997ef9a 100644 --- a/versions.txt +++ b/versions.txt @@ -2,7 +2,7 @@ # Web nginx_version=1.10.1 tengine_version=2.1.1 -openresty_version=1.9.15.1 +openresty_version=1.11.2.1 openssl_version=1.0.2h tomcat_8_version=8.0.30 @@ -21,21 +21,21 @@ mysql_5_6_version=5.6.32 mysql_5_5_version=5.5.51 mariadb_10_1_version=10.1.16 -mariadb_10_0_version=10.0.26 +mariadb_10_0_version=10.0.27 mariadb_5_5_version=5.5.51 -percona_5_7_version=5.7.13-6 -percona_5_6_version=5.6.31-77.0 -percona_5_5_version=5.5.50-38.0 +percona_5_7_version=5.7.14-7 +percona_5_6_version=5.6.32-78.0 +percona_5_5_version=5.5.51-38.1 # JDK -jdk_8_version=1.8.0_92 +jdk_8_version=1.8.0_102 jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.9 -php_6_version=5.6.24 +php_7_version=7.0.10 +php_6_version=5.6.25 php_5_version=5.5.38 php_4_version=5.4.45 php_3_version=5.3.29 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.5-4 +ImageMagick_version=6.9.5-7 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 @@ -61,13 +61,13 @@ redis_version=3.2.3 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.29 +memcached_version=1.4.31 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 # phpMyadmin -phpMyAdmin_version=4.4.15.7 +phpMyAdmin_version=4.4.15.8 # jemalloc jemalloc_version=4.2.1 diff --git a/vhost.sh b/vhost.sh index 22e47307..fc6e02ca 100755 --- a/vhost.sh +++ b/vhost.sh @@ -312,13 +312,22 @@ if [ "$moredomainame_yn" == 'y' ]; then fi if [ "$nginx_ssl_yn" == 'y' ]; then + while :; do echo + read -p "Do you want to redirect all HTTP requests to HTTPS? [y/n]: " https_yn + if [[ ! $https_yn =~ ^[y,n]$ ]];then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then LISTENOPT='443 ssl http2' else LISTENOPT='443 ssl spdy' fi Create_SSL - Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\nssl_prefer_server_ciphers on;\nssl_session_timeout 10m;\nssl_session_cache builtin:1000 shared:SSL:10m;\nssl_buffer_size 1400;\nadd_header Strict-Transport-Security max-age=15768000;\nssl_stapling on;\nssl_stapling_verify on;\n") + Nginx_conf=$(echo -e "listen 80;\nlisten $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\nssl_prefer_server_ciphers on;\nssl_session_timeout 10m;\nssl_session_cache builtin:1000 shared:SSL:10m;\nssl_buffer_size 1400;\nadd_header Strict-Transport-Security max-age=15768000;\nssl_stapling on;\nssl_stapling_verify on;\n") Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") elif [ "$apache_ssl_yn" == 'y' ]; then Create_SSL @@ -448,36 +457,7 @@ $NGX_CONF } EOF -if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -rewrite ^/(.*) https://$domain/\$1 permanent; -} -EOF -elif [ "$nginx_ssl_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.jsp; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; - } -location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } -$NGX_CONF -} -EOF -fi +[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF $Tomcat_Domain_alias @@ -564,37 +544,7 @@ location ~ .*\.(js|css)?$ { } EOF -if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -rewrite ^/(.*) https://$domain/\$1 permanent; -} -EOF -elif [ "$nginx_ssl_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.php; -include $web_install_dir/conf/rewrite/$rewrite.conf; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -$NGX_CONF -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; - } -location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } -} -EOF -fi +[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf echo $web_install_dir/sbin/nginx -t @@ -737,46 +687,7 @@ location ~ .*\.(js|css)?$ { } EOF -if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -rewrite ^/(.*) https://$domain/\$1 permanent; -} -EOF -elif [ "$nginx_ssl_yn" == 'y' ];then -cat >> $web_install_dir/conf/vhost/$domain.conf << EOF -server { -listen 80; -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.php; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -location / { - try_files \$uri @apache; - } -location @apache { - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } -location ~ .*\.(php|php5|cgi|pl)?$ { - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; - } -location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } -} -EOF -fi +[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf echo $web_install_dir/sbin/nginx -t From 4136b5827407ef12feab1c948e2a23dc9aa65ee5 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 7 Sep 2016 10:02:15 +0800 Subject: [PATCH 595/617] Update include/mysql-5.*.sh --- include/apache-2.2.sh | 1 + include/apache-2.4.sh | 1 + include/init_CentOS.sh | 4 ---- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/upgrade_db.sh | 2 +- uninstall.sh | 3 ++- versions.txt | 10 +++++----- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 8ff9093f..f4c4caf3 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -129,6 +129,7 @@ RemoteIPInternalProxy 127.0.0.1 EOF sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf fi +ldconfig service httpd start cd .. } diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 48e7ac34..aec1f44d 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -144,6 +144,7 @@ EOF sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" $apache_install_dir/conf/httpd.conf fi +ldconfig service httpd start cd .. } diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index cc88d69e..469d827f 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -53,10 +53,6 @@ for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog setenforce 0 sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config -# initdefault -sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab -init q - # PS1 [ -z "`grep ^PS1 ~/.bashrc`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 3af0bfc3..5b223e44 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -32,7 +32,7 @@ else fi FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 68b34e24..9f509e35 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -32,7 +32,7 @@ else fi FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 5229d53a..ad249c60 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -32,7 +32,7 @@ else fi FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME && Download_src +wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index c3ea84c3..e07ebc42 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -21,7 +21,7 @@ elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then DB=Percona OLD_DB_version=$OLD_DB_version_tmp else - [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.sohu.com/mysql || DOWN_ADDR=http://cdn.mysql.com/Downloads + [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads DB=MySQL OLD_DB_version=$OLD_DB_version_tmp fi diff --git a/uninstall.sh b/uninstall.sh index 5980d532..3d0a8a64 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -74,6 +74,7 @@ Print_web() { [ -e "/etc/init.d/tomcat" ] && echo "/etc/init.d/tomcat" [ -e "/etc/logrotate.d/tomcat" ] && echo "/etc/logrotate.d/tomcat" [ -d "/usr/java" ] && echo '/usr/java' +[ -d "/usr/local/apr" ] && echo '/usr/local/apr' } Uninstall_Web() { @@ -81,7 +82,7 @@ Uninstall_Web() { [ -d "$tengine_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $tengine_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$tengine_install_dir/sbin:@@" /etc/profile; } [ -d "$openresty_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $openresty_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$openresty_install_dir/nginx/sbin:@@" /etc/profile; } [ -d "$apache_install_dir" ] && { service httpd stop > /dev/null 2>&1; rm -rf $apache_install_dir /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@$apache_install_dir/bin:@@" /etc/profile; } -[ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf $tomcat_install_dir /etc/init.d/tomcat; /etc/logrotate.d/tomcat; } +[ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf $tomcat_install_dir /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; } [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } [ -e "$wwwroot_dir" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} sed -i 's@^website_name=.*@website_name=@' ./options.conf diff --git a/versions.txt b/versions.txt index f997ef9a..a2855780 100644 --- a/versions.txt +++ b/versions.txt @@ -16,11 +16,11 @@ apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.14 -mysql_5_6_version=5.6.32 -mysql_5_5_version=5.5.51 +mysql_5_7_version=5.7.15 +mysql_5_6_version=5.6.33 +mysql_5_5_version=5.5.52 -mariadb_10_1_version=10.1.16 +mariadb_10_1_version=10.1.17 mariadb_10_0_version=10.0.27 mariadb_5_5_version=5.5.51 @@ -43,7 +43,7 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.10 -ImageMagick_version=6.9.5-7 +ImageMagick_version=6.9.5-9 imagick_version=3.4.1 GraphicsMagick_version=1.3.24 gmagick_version=1.1.7RC3 From af85907402c2298e08001145c7b61c977c8cd0f2 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 12 Sep 2016 08:43:16 +0800 Subject: [PATCH 596/617] Download sources code first and Support install databases by source code --- include/GraphicsMagick.sh | 4 - include/ImageMagick.sh | 8 +- include/ZendGuardLoader.sh | 13 +- include/apache-2.2.sh | 2 - include/apache-2.4.sh | 4 - include/apcu.sh | 2 - include/boost.sh | 33 ++ include/check_download.sh | 646 ++++++++++++++++++++++++++++++++ include/check_os.sh | 54 ++- include/color.sh | 2 +- include/eaccelerator-0.9.sh | 6 +- include/eaccelerator-1.0-dev.sh | 2 - include/init_CentOS.sh | 59 +-- include/init_Debian.sh | 31 +- include/init_Ubuntu.sh | 36 +- include/ioncube.sh | 4 +- include/jdk-1.6.sh | 6 - include/jdk-1.7.sh | 1 - include/jdk-1.8.sh | 1 - include/jemalloc.sh | 2 - include/mariadb-10.0.sh | 181 +++++---- include/mariadb-10.1.sh | 181 +++++---- include/mariadb-5.5.sh | 186 +++++---- include/memcached.sh | 6 - include/memory.sh | 2 +- include/mysql-5.5.sh | 198 +++++----- include/mysql-5.6.sh | 195 +++++----- include/mysql-5.7.sh | 187 ++++----- include/nginx.sh | 3 - include/openresty.sh | 3 - include/percona-5.5.sh | 187 +++++---- include/percona-5.6.sh | 182 +++++---- include/percona-5.7.sh | 192 +++++----- include/php-5.3.sh | 11 - include/php-5.4.sh | 8 - include/php-5.5.sh | 8 - include/php-5.6.sh | 7 - include/php-7.sh | 7 - include/phpmyadmin.sh | 2 - include/pureftpd.sh | 4 +- include/redis.sh | 9 +- include/tcmalloc.sh | 1 - include/tengine.sh | 3 - include/tomcat-6.sh | 3 - include/tomcat-7.sh | 3 - include/tomcat-8.sh | 3 - include/upgrade_db.sh | 2 +- include/upgrade_php.sh | 2 +- include/xcache.sh | 5 +- include/zendopcache.sh | 5 +- install.sh | 36 +- versions.txt | 12 + 52 files changed, 1762 insertions(+), 988 deletions(-) create mode 100644 include/boost.sh create mode 100644 include/check_download.sh diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 5a39c683..6f947a9b 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -10,8 +10,6 @@ Install_GraphicsMagick() { cd $oneinstack_dir/src -src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/$GraphicsMagick_version/GraphicsMagick-$GraphicsMagick_version.tar.gz && Download_src - tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz cd GraphicsMagick-$GraphicsMagick_version ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static @@ -25,11 +23,9 @@ Install_php-gmagick() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - src_url=https://pecl.php.net/get/gmagick-2.0.4RC1.tgz && Download_src tar xzf gmagick-2.0.4RC1.tgz cd gmagick-2.0.4RC1 else - src_url=http://pecl.php.net/get/gmagick-$gmagick_version.tgz && Download_src tar xzf gmagick-$gmagick_version.tgz cd gmagick-$gmagick_version fi diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 66771803..141dfe54 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -10,8 +10,6 @@ Install_ImageMagick() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/ImageMagick-$ImageMagick_version.tar.gz && Download_src - tar xzf ImageMagick-$ImageMagick_version.tar.gz cd ImageMagick-$ImageMagick_version ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static @@ -25,11 +23,9 @@ Install_php-imagick() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then - src_url=https://pecl.php.net/get/imagick-3.3.0.tgz && Download_src - tar xzf imagick-3.3.0.tgz - cd imagick-3.3.0 + tar xzf imagick-${imagick_for_php53_version}.tgz + cd imagick-${imagick_for_php53_version} else - src_url=http://pecl.php.net/get/imagick-$imagick_version.tgz && Download_src tar xzf imagick-$imagick_version.tgz cd imagick-$imagick_version fi diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index edcc831f..e1df8e33 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -8,66 +8,57 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_ZendGuardLoader() -{ +Install_ZendGuardLoader() { cd $oneinstack_dir/src PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` PHP_main_version=${PHP_version%.*} [ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` -if [ "$OS_BIT" == '64' ] ;then +if [ "$OS_BIT" == '64' ];then if [ "$PHP_main_version" == '5.6' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src tar xzf zend-loader-php5.6-linux-x86_64.tar.gz /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf zend-loader-php5.6-linux-x86_64 fi if [ "$PHP_main_version" == '5.5' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src tar xzf zend-loader-php5.5-linux-x86_64.tar.gz /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf zend-loader-php5.5-linux-x86_64 fi if [ "$PHP_main_version" == '5.4' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 fi if [ "$PHP_main_version" == '5.3' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 fi else if [ "$PHP_main_version" == '5.6' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.6-linux-i386.tar.gz && Download_src tar xzf zend-loader-php5.6-linux-i386.tar.gz /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf zend-loader-php5.6-linux-i386 fi if [ "$PHP_main_version" == '5.5' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/zend-loader-php5.5-linux-i386.tar.gz && Download_src tar xzf zend-loader-php5.5-linux-i386.tar.gz /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf zend-loader-php5.5-linux-x386 fi if [ "$PHP_main_version" == '5.4' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi if [ "$PHP_main_version" == '5.3' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index f4c4caf3..bfda7220 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -10,7 +10,6 @@ Install_Apache-2-2() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_2_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user @@ -120,7 +119,6 @@ Include conf/vhost/*.conf EOF if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/mod_remoteip.c && Download_src $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index aec1f44d..92e102ff 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -10,10 +10,6 @@ Install_Apache-2-4() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-$apr_version.tar.gz && Download_src -src_url=http://archive.apache.org/dist/apr/apr-util-$apr_util_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_4_version.tar.gz && Download_src tar xzf pcre-$pcre_version.tar.gz cd pcre-$pcre_version diff --git a/include/apcu.sh b/include/apcu.sh index 5c874ac2..eeeab459 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -10,8 +10,6 @@ Install_APCU() { cd $oneinstack_dir/src -src_url=http://pecl.php.net/get/apcu-$apcu_version.tgz && Download_src - tar xzf apcu-$apcu_version.tgz cd apcu-$apcu_version make clean diff --git a/include/boost.sh b/include/boost.sh new file mode 100644 index 00000000..d69a1a72 --- /dev/null +++ b/include/boost.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Author: Alpha Eva +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# https://oneinstack.com +# https://github.com/lj2007331/oneinstack + +installBoost() { + pushd $oneinstack_dir/src + + if [ ! -e "/usr/local/lib/libboost_system.so" ]; then + boostVersion2=$(echo $boost_version | awk -F. '{print $1}')_$(echo $boost_version | awk -F. '{print $2}')_$(echo $boost_version | awk -F. '{print $3}') + tar xvf boost_${boostVersion2}.tar.gz + pushd boost_${boostVersion2} + ./bootstrap.sh + ./bjam --prefix=/usr/local + ./b2 install + popd + fi + if [ -e "/usr/local/lib/libboost_system.so" ];then + echo "${CSUCCESS}Boost installed successfully! ${CEND}" + rm -rf boost_${boostVersion2} + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + else + rm -rf boost_${boostVersion2} + echo "${CFAILURE}Boost installed failed, Please contact the author! ${CEND}" + fi + + popd +} diff --git a/include/check_download.sh b/include/check_download.sh new file mode 100644 index 00000000..2f10a3f5 --- /dev/null +++ b/include/check_download.sh @@ -0,0 +1,646 @@ +#!/bin/bash +# Author: Alpha Eva +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# https://oneinstack.com +# https://github.com/lj2007331/oneinstack + +checkDownload() { + mirrorLink=http://mirrors.linuxeye.com/oneinstack/src + pushd ${oneinstack_dir}/src + + # Web + if [ "${Web_yn}" == 'y' ];then + echo "Download openSSL..." + src_url=https://www.openssl.org/source/openssl-${openssl_version}.tar.gz && Download_src + if [ "${Nginx_version}" == "1" ];then + echo "Download nginx..." + src_url=http://nginx.org/download/nginx-${nginx_version}.tar.gz && Download_src + fi + if [ "${Nginx_version}" == "2" ];then + echo "Download tengine..." + src_url=http://tengine.taobao.org/download/tengine-${tengine_version}.tar.gz && Download_src + fi + if [ "${Nginx_version}" == "3" ];then + echo "Download openresty..." + src_url=https://openresty.org/download/openresty-${openresty_version}.tar.gz && Download_src + fi + + if [[ "${Nginx_version}" =~ ^[1-3]$ || ${Apache_version} == "1" ]];then + echo "Download pcre..." + src_url=${mirrorLink}/pcre-${pcre_version}.tar.gz && Download_src + fi + + # apache + if [ "${Apache_version}" == "1" ];then + echo "Download apache 2.4..." + src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src + src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_4_version}.tar.gz && Download_src + fi + if [ "${Apache_version}" == "2" ];then + echo "Download apache 2.2..." + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_2_version}.tar.gz && Download_src + + echo "Download mod_remoteip.c for apache 2.2..." + src_url=${mirrorLink}/mod_remoteip.c && Download_src + fi + + # tomcat + if [ "${Tomcat_version}" == "1" ];then + echo "Download tomcat 8..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src + fi + if [ "${Tomcat_version}" == "2" ];then + echo "Download tomcat 7..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src + fi + if [ "${Tomcat_version}" == "3" ];then + echo "Download tomcat 6..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src + fi + + if [[ "${JDK_version}" =~ ^[1-3]$ ]];then + if [ "${JDK_version}" == "1" ];then + echo "Download jdk 1.8..." + JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + fi + if [ "${JDK_version}" == "2" ];then + echo "Download jdk 1.7..." + JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + fi + if [ "${JDK_version}" == "3" ];then + echo "Download jdk 1.6..." + JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" + fi + src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src + fi + fi + + if [ "${DB_yn}" == "y" ];then + if [[ "${DB_version}" =~ ^[1,4,7]$ ]] && [ "${dbInstallMethods}" == "2" ];then + echo "Download boost..." + [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_version} + boostVersion2=$(echo ${boost_version} | awk -F. '{print $1}')_$(echo ${boost_version} | awk -F. '{print $2}')_$(echo ${boost_version} | awk -F. '{print $3}') + src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src + fi + + if [ "${DB_version}" == "1" ];then + # mysql 5.7 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + else + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mysql 5.7 binary package..." + FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download mysql 5.7 source package..." + FILE_NAME=mysql-${mysql_5_7_version}.tar.gz + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done + fi + + if [ "${DB_version}" == "2" ];then + # mysql 5.6 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + else + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mysql 5.6 binary package..." + FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download MySQL 5.5 source package..." + FILE_NAME=mysql-${mysql_5_6_version}.tar.gz + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done + fi + + if [ "${DB_version}" == "3" ];then + # mysql 5.5 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ];then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + else + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mysql 5.5 binary package..." + FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download MySQL 5.5 source package..." + FILE_NAME=mysql-${mysql_5_5_version}.tar.gz + src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done + fi + + if [ "${DB_version}" == "4" ];then + # mariaDB 10.1 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mariaDB 10.1 binary package..." + FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download mariaDB 10.1 source package..." + FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "5" ];then + # mariaDB 10.0 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mariaDB 10.0 binary package..." + FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download mariaDB 10.0 source package..." + FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + if [ "${DB_version}" == "6" ];then + # mariaDB 5.5 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download mariaDB 5.5 binary package..." + FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download mariaDB 10.0 source package..." + FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "7" ];then + # precona 5.7 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download percona 5.7 binary package..." + FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download percona 5.7 source package..." + FILE_NAME=percona-server-${percona_5_7_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "8" ];then + # precona 5.6 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download percona 5.6 binary package..." + perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download percona 5.6 source package..." + FILE_NAME=percona-server-${percona_5_6_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "9" ];then + # precona 5.5 + if [ "${dbInstallMethods}" == "1" ];then + echo "Download percona 5.5 binary package..." + perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ];then + echo "Download percona 5.5 source package..." + FILE_NAME=percona-server-${percona_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ];then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + + if [ "${tryDlCount}" == "6" ];then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + fi + # PHP + if [ "${PHP_yn}" == "y" ];then + # php 5.3 5.4 5.5 5.6 5.7 + echo "PHP common..." + src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${libiconv_version}.tar.gz && Download_src + src_url=https://curl.haxx.se/download/curl-${curl_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${libmcrypt_version}/libmcrypt-${libmcrypt_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mhash/mhash/${mhash_version}/mhash-${mhash_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_version}/mcrypt-${mcrypt_version}.tar.gz && Download_src + src_url=${mirrorLink}/libiconv-glibc-2.16.patch && Download_src + + if [[ "${PHP_version}" =~ ^[1-3]$ ]];then + # php 5.3 5.4 5.5 + src_url=${mirrorLink}/fpm-race-condition.patch && Download_src + fi + + if [ "${PHP_version}" == "1" ];then + # php 5.3 + src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src + src_url=${mirrorLink}/php5.3patch && Download_src + if [[ "${Debian_version}" == "8" || "${Ubuntu_version}" == "16" ]];then + if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ];then + src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src + fi + fi + src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "2" ];then + src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "3" ];then + src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "4" ];then + src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "5" ];then + src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src + fi + + # PHP OPCache + if [ "${PHP_cache}" == "1" ] && [[ "$PHP_version" =~ ^[1,2]$ ]];then + # php 5.3 5.4 + echo "Download Zend OPCache..." + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src + fi + if [ "${PHP_cache}" == "2" ] && [[ "$PHP_version" =~ ^[1-4]$ ]];then + # php 5.3 5.4 5.5 5.6 + echo "Download xcache..." + src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src + fi + if [ "${PHP_cache}" == "3" ] && [[ "$PHP_version" =~ ^[1-3]$ ]];then + # php 5.3 5.4 5.5 + echo "Download apcu..." + src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src + fi + if [ "${PHP_cache}" == "4" -a "${PHP_version}" == "2" ];then + echo "Download eaccelerator 1.0 dev..." + src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src + elif [ "${PHP_cache}" == "4" -a "${PHP_version}" == "1" ];then + echo "Download eaccelerator 0.9..." + src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src + fi + + # Zend Guard Loader + if [ "${ZendGuardLoader_yn}" == "y" ];then + if [ "${PHP_version}" == "4" ];then + if [ "${OS_BIT}" == "64" ];then + # 64 bit + echo "Download zend loader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "3" ];then + if [ "${OS_BIT}" == "64" ];then + # 64 bit + echo "Download zend loader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "2" ];then + if [ "${OS_BIT}" == "64" ];then + # 64 bit + echo "Download zend loader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "1" ];then + if [ "${OS_BIT}" == "64" ];then + # 64 bit + echo "Download zend loader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + fi + fi + fi + + if [ "${ionCube_yn}" == "y" ];then + echo "Download ioncube..." + if [ "${OS_BIT}" == '64' ];then + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src + else + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src + fi + fi + + if [ "${Magick_yn}" == "y" ];then + if [ "${Magick}" == "1" ];then + echo "Download ImageMagick..." + src_url=${mirrorLink}/ImageMagick-${ImageMagick_version}.tar.gz && Download_src + if [ "${PHP_version}" == "1" ];then + echo "Download image for php 5.3..." + src_url=https://pecl.php.net/get/imagick-${imagick_for_php53_version}.tgz && Download_src + else + echo "Download imagick..." + src_url=http://pecl.php.net/get/imagick-${imagick_version}.tgz && Download_src + fi + else + echo "Download graphicsmagick..." + src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${GraphicsMagick_version}/GraphicsMagick-${GraphicsMagick_version}.tar.gz && Download_src + if [ "${PHP_version}" == "5" ];then + echo "Download gmagick for php7..." + src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src + else + echo "Download gmagick for php..." + src_url=http://pecl.php.net/get/gmagick-${gmagick_version}.tgz && Download_src + fi + fi + fi + + fi + + if [ "${FTP_yn}" == "y" ];then + echo "Download pureftpd..." + src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src + fi + + if [ "${phpMyAdmin_yn}" == "y" ];then + echo "Download phpMyAdmin..." + src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpMyAdmin_version}/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz && Download_src + fi + + if [ "${redis_yn}" == "y" ];then + echo "Download redis..." + src_url=http://download.redis.io/releases/redis-${redis_version}.tar.gz && Download_src + if [ "${OS}" == "CentOS" ];then + echo "Download start-stop-daemon.c for CentOS..." + src_url=${mirrorLink}/start-stop-daemon.c && Download_src + fi + # redis addon + if [ "${PHP_version}" == "5" ];then + echo "Download redis pecl for php7..." + src_url=http://pecl.php.net/get/redis-${redis_pecl_for_php7_version}.tgz && Download_src + else + echo "Download redis pecl..." + src_url=http://pecl.php.net/get/redis-${redis_pecl_version}.tgz && Download_src + fi + fi + + if [ "${memcached_yn}" == "y" ];then + echo "Download memcached..." + src_url=http://www.memcached.org/files/memcached-${memcached_version}.tar.gz && Download_src + if [ "${PHP_version}" == "5" ];then + echo "Download pecl memcache for php7..." + src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src + echo "Download php-memcached for php7..." + src_url=${mirrorLink}/php-memcached-php7.tgz && Download_src + else + echo "Download pecl memcache for php7..." + src_url=http://pecl.php.net/get/memcache-${memcache_pecl_version}.tgz && Download_src + echo "Download php-memcached for php7..." + src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src + fi + + echo "Download libmemcached..." + src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_version}/+download/libmemcached-${libmemcached_version}.tar.gz && Download_src + fi + + if [ "${je_tc_malloc_yn}" == "y" ];then + if [ "${je_tc_malloc}" == "1" ];then + echo "Download jemalloc..." + src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src + elif [ "${je_tc_malloc}" == "2" ];then + echo "Download tcmalloc..." + src_url=${mirrorLink}/gperftools-${tcmalloc_version}.tar.gz && Download_src + fi + fi + + # others + if [ "${OS}" == "CentOS" ];then + echo "Download tmux for CentOS..." + src_url=${mirrorLink}/libevent-${libevent_version}.tar.gz && Download_src + src_url=${mirrorLink}/tmux-${tmux_version}.tar.gz && Download_src + + echo "Download htop for CentOS..." + src_url=http://hisham.hm/htop/releases/${htop_version}/htop-${htop_version}.tar.gz && Download_src + fi + + if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]];then + echo "Download bison for Ubuntu..." + src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_version}.tar.gz && Download_src + fi + + popd +} diff --git a/include/check_os.sh b/include/check_os.sh index 229cf3c8..5c37913f 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -8,30 +8,33 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then +if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ];then OS=CentOS - [ -n "`grep ' 7\.' /etc/redhat-release`" ] && CentOS_RHEL_version=7 - [ -n "`grep ' 6\.' /etc/redhat-release`" -o -n "`grep 'Aliyun Linux release6 15' /etc/issue`" ] && CentOS_RHEL_version=6 - [ -n "`grep ' 5\.' /etc/redhat-release`" -o -n "`grep 'Aliyun Linux release5' /etc/issue`" ] && CentOS_RHEL_version=5 -elif [ -n "`grep bian /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Debian' ];then + [ -n "$(grep ' 7\.' /etc/redhat-release)" ] && CentOS_RHEL_version=7 + [ -n "$(grep ' 6\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6 + [ -n "$(grep ' 5\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5 +elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ];then + OS=CentOS + CentOS_RHEL_version=6 +elif [ -n "$(grep bian /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Debian' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Debian_version=`lsb_release -sr | awk -F. '{print $1}'` -elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deepin' ];then + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Debian_version=$(lsb_release -sr | awk -F. '{print $1}') +elif [ -n "$(grep Deepin /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Deepin' ];then OS=Debian - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Debian_version=`lsb_release -sr | awk -F. '{print $1}'` -elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' -o -n "`grep 'Linux Mint' /etc/issue`" ];then + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Debian_version=$(lsb_release -sr | awk -F. '{print $1}') +elif [ -n "$(grep Ubuntu /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Ubuntu' -o -n "$(grep 'Linux Mint' /etc/issue)" ];then OS=Ubuntu - [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Ubuntu_version=`lsb_release -sr | awk -F. '{print $1}'` - [ -n "`grep 'Linux Mint 18' /etc/issue`" ] && Ubuntu_version=16 + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}') + [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16 else echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" kill -9 $$ fi -if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then +if [ $(getconf WORD_BIT) == 32 ] && [ $(getconf LONG_BIT) == 64 ];then OS_BIT=64 SYS_BIG_FLAG=x64 #jdk SYS_BIT_a=x86_64;SYS_BIT_b=x86_64; #mariadb @@ -41,7 +44,26 @@ else SYS_BIT_a=x86;SYS_BIT_b=i686; fi -LIBC_YN=$(awk -v A=`getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}'` -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') +LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') [ $LIBC_YN == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux +if uname -m | grep -Eqi "arm";then + armTarget="y" +fi + THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) + +# Percona +if [ -f "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0" ];then + if [ "${Debian_version}" == "6" ];then + sslLibVer=ssl098 + else + sslLibVer=ssl100 + fi +elif [ -f "/usr/lib64/libssl.so.10" ];then + if [ "${CentOS_RHEL_version}" == "5" ];then + sslLibVer=ssl098e + else + sslLibVer=ssl101 + fi +fi diff --git a/include/color.sh b/include/color.sh index e2a214a4..c613fd28 100644 --- a/include/color.sh +++ b/include/color.sh @@ -11,7 +11,7 @@ echo=echo for cmd in echo /bin/echo; do $cmd >/dev/null 2>&1 || continue - if ! $cmd -e "" | grep -qE '^-e'; then + if ! $cmd -e "" | grep -qE '^-e';then echo=$cmd break fi diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index f4f165df..5c801cf8 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -10,10 +10,8 @@ Install_eAccelerator-0-9() { cd $oneinstack_dir/src -src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 && Download_src - -tar jxf eaccelerator-0.9.6.1.tar.bz2 -cd eaccelerator-0.9.6.1 +tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 +cd eaccelerator-${eaccelerator_version} make clean $php_install_dir/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index b9b880c8..d261bb9d 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -10,8 +10,6 @@ Install_eAccelerator-1-0-dev() { cd $oneinstack_dir/src -src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src - /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz tar xzf eaccelerator-eaccelerator-42067ac.tar.gz cd eaccelerator-eaccelerator-42067ac diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 469d827f..e76d7190 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -53,12 +53,22 @@ for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog setenforce 0 sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config -# PS1 -[ -z "`grep ^PS1 ~/.bashrc`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc - -# history size -sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile -[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +# Custom profile +cat > /etc/profile.d/oneinstack.sh << EOF +HISTSIZE=10000 +PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\\\$ " +HISTTIMEFORMAT="%F %T \`whoami\` " +PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }' + +alias l='ls -AFhlt' +alias lh='l | head' +alias vi=vim + +GREP_OPTIONS="--color=auto" +alias grep='grep --color' +alias egrep='egrep --color' +alias fgrep='fgrep --color' +EOF # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf @@ -84,9 +94,6 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #nameserver 8.8.8.8 #EOF -# alias vi -[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc - # /etc/sysctl.conf sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf [ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF @@ -117,14 +124,16 @@ elif [ "$CentOS_RHEL_version" == '6' ];then sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.netfilter.nf_conntrack_max = 1048576 -net.netfilter.nf_conntrack_tcp_timeout_established = 1200 +net.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_tcp_timeout_established = 180 EOF elif [ "$CentOS_RHEL_version" == '7' ];then sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.netfilter.nf_conntrack_max = 1048576 -net.netfilter.nf_conntrack_tcp_timeout_established = 1200 +net.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_tcp_timeout_established = 180 EOF fi init q @@ -132,10 +141,9 @@ init q # Update time ntpdate pool.ntp.org [ ! -e "/var/spool/cron/root" -o -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } -service crond restart # iptables -if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep ':INPUT DROP' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables`" ];then +if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep '^:INPUT DROP' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables`" ];then IPTABLES_STATUS=yes else IPTABLES_STATUS=no @@ -156,8 +164,8 @@ if [ "$IPTABLES_STATUS" == 'no' ];then -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/sec --limit-burst 10 -j ACCEPT +-A INPUT -f -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood -A INPUT -j REJECT --reject-with icmp-host-prohibited -A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN @@ -174,16 +182,14 @@ service sshd restart # install tmux if [ ! -e "`which tmux`" ];then cd src - src_url=http://mirrors.linuxeye.com/oneinstack/src/libevent-2.0.22-stable.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/tmux-2.2.tar.gz && Download_src - tar xzf libevent-2.0.22-stable.tar.gz - cd libevent-2.0.22-stable + tar xzf libevent-${libevent_version}.tar.gz + cd libevent-${libevent_version} ./configure make -j ${THREAD} && make install cd .. - tar xzf tmux-2.2.tar.gz - cd tmux-2.2 + tar xzf tmux-${tmux_version}.tar.gz + cd tmux-${tmux_version} CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure make -j ${THREAD} && make install cd ../../ @@ -198,12 +204,11 @@ fi # install htop if [ ! -e "`which htop`" ];then cd src - src_url=http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz && Download_src - tar xzf htop-2.0.2.tar.gz - cd htop-2.0.2 + tar xzf htop-${htop_version}.tar.gz + cd htop-${htop_version} ./configure make -j ${THREAD} && make install cd ../../ fi + . /etc/profile -. ~/.bashrc diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 92281faa..b0e18cf4 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -26,11 +26,24 @@ do apt-get -y install $Package done +# Custom profile +cat > /etc/profile.d/oneinstack.sh << EOF +HISTSIZE=10000 +HISTTIMEFORMAT="%F %T \`whoami\` " + +alias l='ls -AFhlt' +alias lh='l | head' +alias vi=vim + +GREP_OPTIONS="--color=auto" +alias grep='grep --color' +alias egrep='egrep --color' +alias fgrep='fgrep --color' +EOF + # PS1 [ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc -# history size -[ -z "`grep ^HISTSIZE ~/.bashrc`" ] && echo 'HISTSIZE=100' >> ~/.bashrc [ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf @@ -62,12 +75,6 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #nameserver 8.8.8.8 #EOF -# alias vi -[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc -sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc -sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc -sed -i 's@^# alias@alias@g' ~/.bashrc - # /etc/sysctl.conf [ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 @@ -96,10 +103,9 @@ init q # Update time ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } -service cron restart # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep ':INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then +if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then IPTABLES_STATUS=yes else IPTABLES_STATUS=no @@ -120,8 +126,8 @@ if [ "$IPTABLES_STATUS" == 'no' ];then -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/sec --limit-burst 10 -j ACCEPT +-A INPUT -f -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood -A INPUT -j REJECT --reject-with icmp-host-prohibited -A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN @@ -140,4 +146,5 @@ EOF chmod +x /etc/network/if-pre-up.d/iptables service ssh restart +. /etc/profile . ~/.bashrc diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 1f4614ee..af076c8f 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -30,13 +30,12 @@ if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then apt-get -y install libcloog-ppl1 apt-get -y remove bison cd src - src_url=http://ftp.gnu.org/gnu/bison/bison-2.7.1.tar.gz && Download_src - tar xzf bison-2.7.1.tar.gz - cd bison-2.7.1 + tar xzf bison-${bison_version}.tar.gz + cd bison-${bison_version} ./configure make -j ${THREAD} && make install cd .. - rm -rf bison-2.7.1 + rm -rf bison-${bison_version} cd .. ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype elif [ "$Ubuntu_version" == '13' ];then @@ -48,11 +47,24 @@ fi # check sendmail #[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail +# Custom profile +cat > /etc/profile.d/oneinstack.sh << EOF +HISTSIZE=10000 +HISTTIMEFORMAT="%F %T \`whoami\` " + +alias l='ls -AFhlt' +alias lh='l | head' +alias vi=vim + +GREP_OPTIONS="--color=auto" +alias grep='grep --color' +alias egrep='egrep --color' +alias fgrep='fgrep --color' +EOF + # PS1 [ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc -# history size -sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc [ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf @@ -84,10 +96,6 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #nameserver 8.8.8.8 #EOF -# alias vi -[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc -sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc - # /etc/sysctl.conf [ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 @@ -117,10 +125,9 @@ sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } -service cron restart # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep ':INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then +if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then IPTABLES_STATUS=yes else IPTABLES_STATUS=no @@ -141,8 +148,8 @@ if [ "$IPTABLES_STATUS" == 'no' ];then -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT --A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT --A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/sec --limit-burst 10 -j ACCEPT +-A INPUT -f -m limit --limit 100/sec --limit-burst 100 -j ACCEPT -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood -A INPUT -j REJECT --reject-with icmp-host-prohibited -A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN @@ -161,4 +168,5 @@ EOF chmod +x /etc/network/if-pre-up.d/iptables service ssh restart +. /etc/profile . ~/.bashrc diff --git a/include/ioncube.sh b/include/ioncube.sh index 89c6c3bd..1dc60f3c 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -14,11 +14,9 @@ cd $oneinstack_dir/src PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` PHP_main_version=${PHP_version%.*} -if [ "$OS_BIT" == '64' ] ;then - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src +if [ "$OS_BIT" == '64' ];then tar xzf ioncube_loaders_lin_x86-64.tar.gz else - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src tar xzf ioncube_loaders_lin_x86.tar.gz fi diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index 9c2482d3..7929f765 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -11,12 +11,6 @@ Install-JDK-1-6() { cd $oneinstack_dir/src -JDK_FILE="jdk-`echo $jdk_6_version | awk -F. '{print $2}'`u`echo $jdk_6_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" -JAVA_dir=/usr/java -JDK_NAME="jdk$jdk_6_version" -JDK_PATH=$JAVA_dir/$JDK_NAME -src_url=http://mirrors.linuxeye.com/jdk/$JDK_FILE && Download_src - [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` chmod +x $JDK_FILE diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index e6ad18fa..b84b1b1b 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -15,7 +15,6 @@ JDK_FILE="jdk-`echo $jdk_7_version | awk -F. '{print $2}'`u`echo $jdk_7_version JAVA_dir=/usr/java JDK_NAME="jdk$jdk_7_version" JDK_PATH=$JAVA_dir/$JDK_NAME -src_url=http://mirrors.linuxeye.com/jdk/$JDK_FILE && Download_src [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` diff --git a/include/jdk-1.8.sh b/include/jdk-1.8.sh index 72a39be1..5f51d181 100644 --- a/include/jdk-1.8.sh +++ b/include/jdk-1.8.sh @@ -15,7 +15,6 @@ JDK_FILE="jdk-`echo $jdk_8_version | awk -F. '{print $2}'`u`echo $jdk_8_version JAVA_dir=/usr/java JDK_NAME="jdk$jdk_8_version" JDK_PATH=$JAVA_dir/$JDK_NAME -src_url=http://mirrors.linuxeye.com/jdk/$JDK_FILE && Download_src [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` diff --git a/include/jemalloc.sh b/include/jemalloc.sh index 924225d8..c8c0df56 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -10,8 +10,6 @@ Install_jemalloc() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/jemalloc-$jemalloc_version.tar.bz2 && Download_src - tar xjf jemalloc-$jemalloc_version.tar.bz2 cd jemalloc-$jemalloc_version LDFLAGS="${LDFLAGS} -lrt" ./configure diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 823f8721..c4aff84b 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -9,59 +9,78 @@ # https://github.com/lj2007331/oneinstack Install_MariaDB-10-0() { -cd $oneinstack_dir/src - -FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - -if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` - [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } -else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` -fi - -src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src - -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; -do - wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -[ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* $mariadb_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe -fi - -if [ -d "$mariadb_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} + mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mariadb-${mariadb_10_0_version}.tar.gz + pushd mariadb-${mariadb_10_0_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 + + cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ + -DMYSQL_DATADIR=${mariadb_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 \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mariadb_install_dir}/support-files" ];then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" -else - rm -rf $mariadb_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mariadb-${mariadb_10_0_version} + fi + else + rm -rf ${mariadb_install_dir} + rm -rf mariadb-${mariadb_10_0_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mariadb_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mariadb_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mariadb_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mariadb_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 @@ -71,9 +90,9 @@ default-character-set = utf8mb4 port = 3306 socket = /tmp/mysql.sock -basedir = $mariadb_install_dir -datadir = $mariadb_data_dir -pid-file = $mariadb_data_dir/mysql.pid +basedir = ${mariadb_install_dir} +datadir = ${mariadb_data_dir} +pid-file = ${mariadb_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -112,10 +131,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $mariadb_data_dir/mysql-error.log +log_error = ${mariadb_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mariadb_data_dir/mysql-slow.log +slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log performance_schema = 0 @@ -157,8 +176,8 @@ 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@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 @@ -166,7 +185,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -174,7 +193,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -182,26 +201,26 @@ elif [ $Mem -gt 3500 ];then 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 - -$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir - -chown mysql.mysql -R $mariadb_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "reset master;" -rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf -echo "$mariadb_install_dir/lib" > /etc/ld.so.conf.d/mariadb.conf -ldconfig -service mysqld stop + fi + + ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} + + chown mysql.mysql -R ${mariadb_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "reset master;" + rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf + echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf + ldconfig + service mysqld stop } diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 54e6e918..720f0ecc 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -9,59 +9,78 @@ # https://github.com/lj2007331/oneinstack Install_MariaDB-10-1() { -cd $oneinstack_dir/src - -FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - -if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` - [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } -else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` -fi - -src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src - -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; -do - wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -[ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* $mariadb_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe -fi - -if [ -d "$mariadb_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} + mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mariadb-${mariadb_10_1_version}.tar.gz + pushd mariadb-${mariadb_10_1_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 + + cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ + -DMYSQL_DATADIR=${mariadb_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 \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mariadb_install_dir}/support-files" ];then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" -else - rm -rf $mariadb_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mariadb-${mariadb_10_1_version} + fi + else + rm -rf ${mariadb_install_dir} + rm -rf mariadb-${mariadb_10_1_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mariadb_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mariadb_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mariadb_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mariadb_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 @@ -71,9 +90,9 @@ default-character-set = utf8mb4 port = 3306 socket = /tmp/mysql.sock -basedir = $mariadb_install_dir -datadir = $mariadb_data_dir -pid-file = $mariadb_data_dir/mysql.pid +basedir = ${mariadb_install_dir} +datadir = ${mariadb_data_dir} +pid-file = ${mariadb_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -112,10 +131,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $mariadb_data_dir/mysql-error.log +log_error = ${mariadb_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mariadb_data_dir/mysql-slow.log +slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log performance_schema = 0 @@ -157,8 +176,8 @@ 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@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 @@ -166,7 +185,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -174,7 +193,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -182,26 +201,26 @@ elif [ $Mem -gt 3500 ];then 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 - -$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir - -chown mysql.mysql -R $mariadb_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "reset master;" -rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf -echo "$mariadb_install_dir/lib" > /etc/ld.so.conf.d/mariadb.conf -ldconfig -service mysqld stop + fi + + ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} + + chown mysql.mysql -R ${mariadb_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "reset master;" + rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf + echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf + ldconfig + service mysqld stop } diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index c818273f..7b862b55 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -9,59 +9,83 @@ # https://github.com/lj2007331/oneinstack Install_MariaDB-5-5() { -cd $oneinstack_dir/src - -FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - -if [ "$IPADDR_COUNTRY"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` - [ -z "$MARAIDB_TAR_MD5" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a; MARAIDB_TAR_MD5=`curl -Lk $DOWN_ADDR_MARIADB/md5sums.txt | grep $FILE_NAME | awk '{print $1}'`; } -else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a - MARAIDB_TAR_MD5=`curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/md5sums.txt | grep $FILE_NAME | awk '{print $1}'` -fi - -src_url=$DOWN_ADDR_MARIADB/$FILE_NAME && Download_src - -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MARAIDB_TAR_MD5" ]; -do - wget -c --no-check-certificate $DOWN_ADDR_MARIADB/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MARAIDB_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir -tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz -[ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir -mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* $mariadb_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe -fi - -if [ -d "$mariadb_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} + mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mariadb-${mariadb_5_5_version}.tar.gz + pushd mariadb-${mariadb_5_5_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 + + if [ "${armTarget}" == "y" ];then + patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch + fi + + cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ + -DMYSQL_DATADIR=${mariadb_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_READLINE=1 \ + -DWITH_EMBEDDED_SERVER=1 \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + -DEXTRA_CHARSETS=all \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mariadb_install_dir}/support-files" ];then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" -else - rm -rf $mariadb_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mariadb-${mariadb_5_5_version} + fi + else + rm -rf ${mariadb_install_dir} + rm -rf mariadb-${mariadb_5_5_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mariadb_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mariadb_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mariadb_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mariadb_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 @@ -71,9 +95,9 @@ default-character-set = utf8mb4 port = 3306 socket = /tmp/mysql.sock -basedir = $mariadb_install_dir -datadir = $mariadb_data_dir -pid-file = $mariadb_data_dir/mysql.pid +basedir = ${mariadb_install_dir} +datadir = ${mariadb_data_dir} +pid-file = ${mariadb_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -112,10 +136,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 30 -log_error = $mariadb_data_dir/mysql-error.log +log_error = ${mariadb_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mariadb_data_dir/mysql-slow.log +slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log performance_schema = 0 @@ -158,8 +182,8 @@ 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@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 @@ -167,7 +191,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -175,7 +199,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -183,26 +207,26 @@ elif [ $Mem -gt 3500 ];then 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 - -$mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir - -chown mysql.mysql -R $mariadb_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mariadb_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mariadb_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mariadb_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mariadb_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "reset master;" -rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf -echo "$mariadb_install_dir/lib" > /etc/ld.so.conf.d/mariadb.conf -ldconfig -service mysqld stop + fi + + ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} + + chown mysql.mysql -R ${mariadb_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';" + ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "reset master;" + rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf + echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/mariadb.conf + ldconfig + service mysqld stop } diff --git a/include/memcached.sh b/include/memcached.sh index 11628afd..2570f7af 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -10,7 +10,6 @@ Install_memcached() { cd $oneinstack_dir/src -src_url=http://www.memcached.org/files/memcached-$memcached_version.tar.gz && Download_src # memcached server id -u memcached >/dev/null 2>&1 @@ -47,11 +46,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then #git clone https://github.com/websupport-sk/pecl-memcache.git #cd pecl-memcache - src_url=http://mirrors.linuxeye.com/oneinstack/src/pecl-memcache-php7.tgz && Download_src tar xzf pecl-memcache-php7.tgz cd pecl-memcache-php7 else - src_url=http://pecl.php.net/get/memcache-$memcache_pecl_version.tgz && Download_src tar xzf memcache-$memcache_pecl_version.tgz cd memcache-$memcache_pecl_version fi @@ -77,7 +74,6 @@ cd .. Install_php-memcached() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then - src_url=https://launchpad.net/libmemcached/1.0/$libmemcached_version/+download/libmemcached-$libmemcached_version.tar.gz && Download_src # php memcached extension tar xzf libmemcached-$libmemcached_version.tar.gz cd libmemcached-$libmemcached_version @@ -91,11 +87,9 @@ if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git #cd php-memcached - src_url=http://mirrors.linuxeye.com/oneinstack/src/php-memcached-php7.tgz && Download_src tar xzf php-memcached-php7.tgz cd php-memcached-php7 else - src_url=http://pecl.php.net/get/memcached-$memcached_pecl_version.tgz && Download_src tar xzf memcached-$memcached_pecl_version.tgz cd memcached-$memcached_pecl_version fi diff --git a/include/memory.sh b/include/memory.sh index 148a9bef..a7f7bf1f 100644 --- a/include/memory.sh +++ b/include/memory.sh @@ -46,7 +46,7 @@ EOF } # add swapfile -if [ "$Swap" == '0' ] ;then +if [ "$Swap" == '0' ];then if [ $Mem -le 1024 ];then COUNT=1024 Make-swapfile diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 5b223e44..97580108 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -9,73 +9,81 @@ # https://github.com/lj2007331/oneinstack Install_MySQL-5-5() { -cd $oneinstack_dir/src - -if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 -else - if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi - else - if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} + mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar xvf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz + mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mysql-${mysql_5_5_version}.tar.gz + pushd mysql-${mysql_5_5_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 -fi - -FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz -wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src -MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; -do - wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir -mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - -tar xzf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz -mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* $mysql_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe -fi - -if [ -d "$mysql_install_dir/support-files" ];then + + [ "${armTarget}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch + + cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ + -DMYSQL_DATADIR=${mysql_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_READLINE=1 \ + -DWITH_EMBEDDED_SERVER=1 \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + -DEXTRA_CHARSETS=all \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mysql_install_dir}/support-files" ];then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - cd .. - rm -rf mysql-$mysql_5_6_version -else - rm -rf $mysql_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mysql-${mysql_5_5_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mysql-${mysql_5_5_version} + fi + else + rm -rf ${mysql_install_dir} + rm -rf mysql-${mysql_5_5_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mysql_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mysql_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 @@ -89,9 +97,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $mysql_install_dir -datadir = $mysql_data_dir -pid-file = $mysql_data_dir/mysql.pid +basedir = ${mysql_install_dir} +datadir = ${mysql_data_dir} +pid-file = ${mysql_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -130,10 +138,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $mysql_data_dir/mysql-error.log +log_error = ${mysql_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mysql_data_dir/mysql-slow.log +slow_query_log_file = ${mysql_data_dir}/mysql-slow.log performance_schema = 0 @@ -175,8 +183,8 @@ 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@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 @@ -184,7 +192,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -192,7 +200,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -200,27 +208,27 @@ elif [ $Mem -gt 3500 ];then 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 - -$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - -chown mysql.mysql -R $mysql_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "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 + fi + + ${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} + + chown mysql.mysql -R ${mysql_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';" + ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "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 } diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 9f509e35..44074032 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -9,73 +9,78 @@ # https://github.com/lj2007331/oneinstack Install_MySQL-5-6() { -cd $oneinstack_dir/src - -if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 -else - if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi - else - if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} + mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar xvf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe fi -fi - -FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src -MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; -do - wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir -mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - -tar zxf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* $mysql_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe -fi - -if [ -d "$mysql_install_dir/support-files" ];then + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mysql-${mysql_5_6_version}.tar.gz + pushd mysql-${mysql_5_6_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 + + cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ + -DMYSQL_DATADIR=${mysql_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 \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mysql_install_dir}/support-files" ];then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - cd .. - rm -rf mysql-$mysql_5_6_version -else - rm -rf $mysql_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mysql-${mysql_5_6_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mysql-${mysql_5_6_version} + fi + else + rm -rf ${mysql_install_dir} + rm -rf mysql-${mysql_5_6_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mysql_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mysql_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 @@ -89,9 +94,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $mysql_install_dir -datadir = $mysql_data_dir -pid-file = $mysql_data_dir/mysql.pid +basedir = ${mysql_install_dir} +datadir = ${mysql_data_dir} +pid-file = ${mysql_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -130,10 +135,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $mysql_data_dir/mysql-error.log +log_error = ${mysql_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mysql_data_dir/mysql-slow.log +slow_query_log_file = ${mysql_data_dir}/mysql-slow.log performance_schema = 0 explicit_defaults_for_timestamp @@ -176,8 +181,8 @@ 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@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 @@ -185,7 +190,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -193,7 +198,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -201,27 +206,27 @@ elif [ $Mem -gt 3500 ];then 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 - -$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - -chown mysql.mysql -R $mysql_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password='';" -$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "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 + fi + + ${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} + + chown mysql.mysql -R ${mysql_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='';" + ${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "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 } diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index ad249c60..e153b8bf 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -9,73 +9,78 @@ # https://github.com/lj2007331/oneinstack Install_MySQL-5-7() { -cd $oneinstack_dir/src - -if [ "$IPADDR_COUNTRY"x == "CN"x -a "$IPADDR_ISP" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 -else - if [ "$IPADDR_COUNTRY"x == "CN"x ];then - if [ "`../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443`" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi - else - if [ "`../include/check_port.py cdn.mysql.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=$DOWN_ADDR_MYSQL - fi + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} + mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar xvf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe fi -fi - -FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -wget --tries=6 -c --no-check-certificate $DOWN_ADDR_MYSQL/$FILE_NAME -src_url=$DOWN_ADDR_MYSQL/$FILE_NAME.md5 && Download_src -MYSQL_TAR_MD5=`awk '{print $1}' $FILE_NAME.md5` -while [ "`md5sum $FILE_NAME | awk '{print $1}'`" != "$MYSQL_TAR_MD5" ]; -do - wget -4c --no-check-certificate $DOWN_ADDR_MYSQL_BK/$FILE_NAME;sleep 1 - [ "`md5sum $FILE_NAME | awk '{print $1}'`" == "$MYSQL_TAR_MD5" ] && break || continue -done - -id -u mysql >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql - -[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir -mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - -tar zxf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz -mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* $mysql_install_dir -if [ "$je_tc_malloc" == '1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe -elif [ "$je_tc_malloc" == '2' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe -fi - -if [ -d "$mysql_install_dir/support-files" ];then + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf mysql-${mysql_5_7_version}.tar.gz + pushd mysql-${mysql_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 + + cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ + -DMYSQL_DATADIR=${mysql_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 \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${mysql_install_dir}/support-files" ];then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - cd .. - rm -rf mysql-$mysql_5_7_version -else - rm -rf $mysql_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf mysql-${mysql_5_7_version}-*-${SYS_BIT_b} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf mysql-${mysql_5_7_version} + fi + else + rm -rf ${mysql_install_dir} + rm -rf mysql-${mysql_5_7_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -/bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld -sed -i "s@^basedir=.*@basedir=$mysql_install_dir@" /etc/init.d/mysqld -sed -i "s@^datadir=.*@datadir=$mysql_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 -cd .. - -# my.cnf -[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -cat > /etc/my.cnf << EOF + fi + + /bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${mysql_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 @@ -89,9 +94,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $mysql_install_dir -datadir = $mysql_data_dir -pid-file = $mysql_data_dir/mysql.pid +basedir = ${mysql_install_dir} +datadir = ${mysql_data_dir} +pid-file = ${mysql_data_dir}/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 @@ -130,10 +135,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $mysql_data_dir/mysql-error.log +log_error = ${mysql_data_dir}/mysql-error.log slow_query_log = 1 long_query_time = 1 -slow_query_log_file = $mysql_data_dir/mysql-slow.log +slow_query_log_file = ${mysql_data_dir}/mysql-slow.log performance_schema = 0 explicit_defaults_for_timestamp @@ -177,8 +182,8 @@ 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@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 @@ -186,7 +191,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -194,7 +199,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -202,23 +207,23 @@ elif [ $Mem -gt 3500 ];then 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 - -$mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - -chown mysql.mysql -R $mysql_data_dir -[ -d '/etc/mysql' ] && mv /etc/mysql{,_bk} -service mysqld start -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\1@" /etc/profile -. /etc/profile - -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"$dbrootpwd\" with grant option;" -$mysql_install_dir/bin/mysql -uroot -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 + fi + + ${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} + + chown mysql.mysql -R ${mysql_data_dir} + [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + service mysqld start + [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile + . /etc/profile + + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;" + ${mysql_install_dir}/bin/mysql -uroot -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 } diff --git a/include/nginx.sh b/include/nginx.sh index 2751f4f4..61b5ad21 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -10,9 +10,6 @@ Install_Nginx() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src -src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user diff --git a/include/openresty.sh b/include/openresty.sh index 9e52c87a..46d51b54 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -10,9 +10,6 @@ Install_OpenResty() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src -src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src -src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index a1e72f5d..c29a8072 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -9,59 +9,84 @@ # https://github.com/lj2007331/oneinstack Install_Percona-5-5() { -cd $oneinstack_dir/src -src_url=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-$percona_5_5_version/source/tarball/percona-server-$percona_5_5_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_5_version.tar.gz -cd percona-server-$percona_5_5_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 \ --DWITH_READLINE=1 \ --DENABLE_DTRACE=0 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ -$EXE_LINKER -make -j ${THREAD} -make install - -if [ -d "$percona_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} + mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf percona-server-${percona_5_5_version}.tar.gz + pushd percona-server-${percona_5_5_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 + + if [ "${armTarget}" == "y" ];then + patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch + fi + + 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 \ + -DWITH_READLINE=1 \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + -DEXTRA_CHARSETS=all \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${percona_install_dir}/support-files" ];then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - cd .. - rm -rf percona-server-$percona_5_5_version -else - rm -rf $percona_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf percona-server-${percona_5_5_version} + fi + else + rm -rf ${percona_install_dir} + rm -rf percona-server-${percona_5_5_version} 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 + fi + + /bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${percona_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 @@ -75,9 +100,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $percona_install_dir -datadir = $percona_data_dir -pid-file = $percona_data_dir/mysql.pid +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 @@ -116,10 +141,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $percona_data_dir/mysql-error.log +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 +slow_query_log_file = ${percona_data_dir}/mysql-slow.log performance_schema = 0 @@ -161,8 +186,8 @@ 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@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 @@ -170,7 +195,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -178,7 +203,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -186,26 +211,26 @@ elif [ $Mem -gt 3500 ];then 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/scripts/mysql_install_db --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 "delete from mysql.user where Password='';" -$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "reset master;" -rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf -echo "$percona_install_dir/lib" > /etc/ld.so.conf.d/percona.conf -ldconfig -service mysqld stop + fi + + ${percona_install_dir}/scripts/mysql_install_db --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 "delete from mysql.user where Password='';" + ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "reset master;" + rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf + echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf + ldconfig + service mysqld stop } diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 2b18a06c..1468635d 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -9,58 +9,80 @@ # https://github.com/lj2007331/oneinstack Install_Percona-5-6() { -cd $oneinstack_dir/src -src_url=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-$percona_5_6_version/source/tarball/percona-server-$percona_5_6_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_6_version.tar.gz -cd percona-server-$percona_5_6_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 ${THREAD} -make install - -if [ -d "$percona_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} + mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf percona-server-${percona_5_6_version}.tar.gz + pushd percona-server-${percona_5_6_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 + + 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 \ + -DWITH_EMBEDDED_SERVER=1 \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + -DEXTRA_CHARSETS=all \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${percona_install_dir}/support-files" ];then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - cd .. - rm -rf percona-server-$percona_5_6_version -else - rm -rf $percona_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf percona-server-${percona_5_6_version} + fi + else + rm -rf ${percona_install_dir} + rm -rf percona-server-${percona_5_6_version} 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 + fi + + /bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${percona_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 @@ -74,9 +96,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $percona_install_dir -datadir = $percona_data_dir -pid-file = $percona_data_dir/mysql.pid +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 @@ -115,10 +137,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $percona_data_dir/mysql-error.log +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 +slow_query_log_file = ${percona_data_dir}/mysql-slow.log performance_schema = 0 explicit_defaults_for_timestamp @@ -161,8 +183,8 @@ 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@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 @@ -170,7 +192,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -178,7 +200,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -186,26 +208,26 @@ elif [ $Mem -gt 3500 ];then 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/scripts/mysql_install_db --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 "delete from mysql.user where Password='';" -$percona_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User='';" -$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 "reset master;" -rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf -echo "$percona_install_dir/lib" > /etc/ld.so.conf.d/percona.conf -ldconfig -service mysqld stop + fi + + ${percona_install_dir}/scripts/mysql_install_db --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 "delete from mysql.user where Password='';" + ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';" + ${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 "reset master;" + rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf + echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/percona.conf + ldconfig + service mysqld stop } diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 4e052c95..dea00c80 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -9,73 +9,80 @@ # https://github.com/lj2007331/oneinstack Install_Percona-5-7() { -cd $oneinstack_dir/src -[ "$IPADDR_COUNTRY"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 \ --DWITH_ZLIB=system \ --DENABLE_DTRACE=0 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ -$EXE_LINKER -make -j ${THREAD} -make install - -if [ -d "$percona_install_dir/support-files" ];then + pushd ${oneinstack_dir}/src + + id -u mysql >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql + + [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} + mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} + + if [ "${dbInstallMethods}" == "1" ];then + tar xvf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + mv Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} + + if [ "${je_tc_malloc}" == "1" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + elif [ "${je_tc_malloc}" == "2" ];then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe + fi + elif [ "${dbInstallMethods}" == "2" ];then + tar xvf percona-server-${percona_5_7_version}.tar.gz + pushd 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 + + 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_EMBEDDED_SERVER=1 \ + -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ + -DWITH_ZLIB=system \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + -DEXTRA_CHARSETS=all \ + ${EXE_LINKER} + make -j ${THREAD} + make install + popd + fi + + if [ -d "${percona_install_dir}/support-files" ];then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - cd .. - rm -rf percona-server-$percona_5_7_version -else - rm -rf $percona_install_dir + if [ "${dbInstallMethods}" == "1" ];then + rm -rf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer} + elif [ "${dbInstallMethods}" == "2" ];then + rm -rf percona-server-${percona_5_7_version} + fi + else + rm -rf ${percona_install_dir} + rm -rf percona-server-${percona_5_7_version} 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 + fi + + /bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld + sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld + sed -i "s@^datadir=.*@datadir=${percona_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 @@ -89,9 +96,9 @@ no-auto-rehash port = 3306 socket = /tmp/mysql.sock -basedir = $percona_install_dir -datadir = $percona_data_dir -pid-file = $percona_data_dir/mysql.pid +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 @@ -130,10 +137,10 @@ log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 -log_error = $percona_data_dir/mysql-error.log +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 +slow_query_log_file = ${percona_data_dir}/mysql-slow.log performance_schema = 0 explicit_defaults_for_timestamp @@ -176,8 +183,8 @@ 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@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 @@ -185,7 +192,7 @@ if [ $Mem -gt 1500 -a $Mem -le 2500 ];then 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 + 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 @@ -193,7 +200,7 @@ elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then 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 + 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 @@ -201,24 +208,23 @@ elif [ $Mem -gt 3500 ];then 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 + 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 } diff --git a/include/php-5.3.sh b/include/php-5.3.sh index fb99a193..fe987068 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -10,16 +10,6 @@ Install_PHP-5-3() { cd $oneinstack_dir/src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/php5.3patch && Download_src -src_url=http://www.php.net/distributions/php-$php_3_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch @@ -32,7 +22,6 @@ rm -rf libiconv-$libiconv_version # Problem building php-5.3 with openssl if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/openssl-1.0.0s.tar.gz && Download_src tar xzf openssl-1.0.0s.tar.gz cd openssl-1.0.0s ./config --prefix=/usr/local/openssl -fPIC shared zlib diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 759b1e38..1e55bc50 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -10,14 +10,6 @@ Install_PHP-5-4() { cd $oneinstack_dir/src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src -src_url=http://www.php.net/distributions/php-$php_4_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 38c07170..8de4648c 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -10,14 +10,6 @@ Install_PHP-5-5() { cd $oneinstack_dir/src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src -src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 1d8637e4..03b5a55b 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -10,13 +10,6 @@ Install_PHP-5-6() { cd $oneinstack_dir/src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src -src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch diff --git a/include/php-7.sh b/include/php-7.sh index 4c32cfda..96247aa4 100644 --- a/include/php-7.sh +++ b/include/php-7.sh @@ -10,13 +10,6 @@ Install_PHP-7() { cd $oneinstack_dir/src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=https://curl.haxx.se/download/curl-$curl_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/oneinstack/src/libiconv-glibc-2.16.patch && Download_src -src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src tar xzf libiconv-$libiconv_version.tar.gz patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch diff --git a/include/phpmyadmin.sh b/include/phpmyadmin.sh index e4e96467..dcc5de98 100644 --- a/include/phpmyadmin.sh +++ b/include/phpmyadmin.sh @@ -10,8 +10,6 @@ Install_phpMyAdmin() { cd $oneinstack_dir/src -src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpMyAdmin_version}/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz && Download_src - tar xzf phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz /bin/mv phpMyAdmin-${phpMyAdmin_version}-all-languages $wwwroot_dir/default/phpMyAdmin /bin/cp $wwwroot_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 3c01234d..47382af3 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -10,13 +10,11 @@ Install_PureFTPd() { cd $oneinstack_dir/src -src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-$pureftpd_version.tar.gz && Download_src - -tar xzf pure-ftpd-$pureftpd_version.tar.gz id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user +tar xzf pure-ftpd-$pureftpd_version.tar.gz cd pure-ftpd-$pureftpd_version [ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 diff --git a/include/redis.sh b/include/redis.sh index 61e16cb1..7331700f 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -10,8 +10,6 @@ Install_redis-server() { cd $oneinstack_dir/src -src_url=http://download.redis.io/releases/redis-$redis_version.tar.gz && Download_src - tar xzf redis-$redis_version.tar.gz cd redis-$redis_version if [ "$OS_BIT" == '32' ];then @@ -41,7 +39,6 @@ if [ -f "src/redis-server" ];then chown -R redis:redis $redis_install_dir/var /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server if [ "$OS" == 'CentOS' ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/start-stop-daemon.c && Download_src cc start-stop-daemon.c -o /sbin/start-stop-daemon chkconfig --add redis-server chkconfig redis-server on @@ -64,11 +61,9 @@ Install_php-redis() { cd $oneinstack_dir/src if [ -e "$php_install_dir/bin/phpize" ];then if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - src_url=http://pecl.php.net/get/redis-3.0.0.tgz && Download_src - tar xzf redis-3.0.0.tgz - cd redis-3.0.0 + tar xzf redis-${redis_pecl_for_php7_version}.tgz + cd redis-${redis_pecl_for_php7_version} else - src_url=http://pecl.php.net/get/redis-$redis_pecl_version.tgz && Download_src tar xzf redis-$redis_pecl_version.tgz cd redis-$redis_pecl_version fi diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index e8a04942..c881733c 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -10,7 +10,6 @@ Install_tcmalloc() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/gperftools-$tcmalloc_version.tar.gz && Download_src tar xzf gperftools-$tcmalloc_version.tar.gz cd gperftools-$tcmalloc_version diff --git a/include/tengine.sh b/include/tengine.sh index c476ad13..63e4d290 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -10,9 +10,6 @@ Install_Tengine() { cd $oneinstack_dir/src -src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src -src_url=http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz && Download_src -src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 7952ed62..007afe93 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -12,9 +12,6 @@ Install_tomcat-6() { cd $oneinstack_dir/src . /etc/profile -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/apache-tomcat-$tomcat_6_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/catalina-jmx-remote.jar && Download_src - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index d4d51f1f..b27b04e7 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -12,9 +12,6 @@ Install_tomcat-7() { cd $oneinstack_dir/src . /etc/profile -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_7_version/apache-tomcat-$tomcat_7_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_7_version/catalina-jmx-remote.jar && Download_src - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index cc8bac66..e37c3951 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -12,9 +12,6 @@ Install_tomcat-8() { cd $oneinstack_dir/src . /etc/profile -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_8_version/apache-tomcat-$tomcat_8_version.tar.gz && Download_src -src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_8_version/catalina-jmx-remote.jar && Download_src - id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index e07ebc42..e1cc140a 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -59,7 +59,7 @@ echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}" while :; do echo read -p "Please input upgrade $DB Version(example: $OLD_DB_version): " NEW_DB_version - if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ]; then + if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ];then if [ "$DB" == 'MariaDB' ];then DB_name=mariadb-${NEW_DB_version}-${GLIBC_FLAG}-${SYS_BIT_b} DB_URL=$DOWN_ADDR/mariadb-${NEW_DB_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/$DB_name.tar.gz diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 33c64af5..0ff88719 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -16,7 +16,7 @@ OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" while :; do echo read -p "Please input upgrade PHP Version: " NEW_PHP_version - if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ]; then + if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ];then [ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1 if [ -e "php-$NEW_PHP_version.tar.gz" ];then echo "Download [${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] successfully! " diff --git a/include/xcache.sh b/include/xcache.sh index a222a366..58233431 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -8,11 +8,8 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_XCache() -{ +Install_XCache() { cd $oneinstack_dir/src -src_url=http://xcache.lighttpd.net/pub/Releases/$xcache_version/xcache-$xcache_version.tar.gz && Download_src - tar xzf xcache-$xcache_version.tar.gz cd xcache-$xcache_version make clean diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 4ef914b0..1d9765f8 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -8,11 +8,8 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_ZendOPcache() -{ +Install_ZendOPcache() { cd $oneinstack_dir/src -src_url=https://pecl.php.net/get/zendopcache-$zendopcache_version.tgz && Download_src - tar xzf zendopcache-$zendopcache_version.tgz cd zendopcache-$zendopcache_version make clean diff --git a/install.sh b/install.sh index c7000f11..07f593e0 100755 --- a/install.sh +++ b/install.sh @@ -185,6 +185,20 @@ while :; do echo [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" done + # 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 + break fi done @@ -455,15 +469,19 @@ IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR` IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'` [ "`echo $IPADDR_COUNTRY_ISP | awk '{print $2}'`"x == '1000323'x ] && IPADDR_ISP=aliyun +# check download src +. ./include/check_download.sh +checkDownload 2>&1 | tee $oneinstack_dir/install.log + # init . ./include/memory.sh if [ "$OS" == 'CentOS' ];then - . include/init_CentOS.sh 2>&1 | tee $oneinstack_dir/install.log + . include/init_CentOS.sh 2>&1 | tee -a $oneinstack_dir/install.log [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ] && export CC="gcc44" CXX="g++44" elif [ "$OS" == 'Debian' ];then - . include/init_Debian.sh 2>&1 | tee $oneinstack_dir/install.log + . include/init_Debian.sh 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$OS" == 'Ubuntu' ];then - . include/init_Ubuntu.sh 2>&1 | tee $oneinstack_dir/install.log + . include/init_Ubuntu.sh 2>&1 | tee -a $oneinstack_dir/install.log fi # jemalloc or tcmalloc @@ -482,6 +500,10 @@ fi # Database if [ "$DB_version" == '1' ];then + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi . include/mysql-5.7.sh Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '2' ];then @@ -491,6 +513,10 @@ elif [ "$DB_version" == '3' ];then . include/mysql-5.5.sh Install_MySQL-5-5 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '4' ];then + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi . include/mariadb-10.1.sh Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '5' ];then @@ -500,6 +526,10 @@ 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 + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi . include/percona-5.7.sh Install_Percona-5-7 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$DB_version" == '8' ];then diff --git a/versions.txt b/versions.txt index a2855780..6b6655a5 100644 --- a/versions.txt +++ b/versions.txt @@ -45,19 +45,23 @@ xcache_version=3.2.0 apcu_version=4.0.10 ImageMagick_version=6.9.5-9 imagick_version=3.4.1 +imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.24 +gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 curl_version=7.35.0 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 +eaccelerator_version=0.9.6.1 # Ftp pureftpd_version=1.0.43 # Redis redis_version=3.2.3 +redis_pecl_for_php7_version=3.0.0 redis_pecl_version=2.2.8 # Memcached @@ -74,3 +78,11 @@ jemalloc_version=4.2.1 # tcmalloc tcmalloc_version=2.5 + +# boost +boost_version=1.60.0 + +# Others +libevent_version=2.0.22-stable +tmux_version=2.2 +htop_version=2.0.2 From 9b7dcc1efa8ef506431452ce66a7414cdd8a7e1f Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Mon, 19 Sep 2016 20:09:21 +0800 Subject: [PATCH 597/617] Update include/init_*.sh --- README.md | 2 +- include/check_download.sh | 2 +- include/check_port.py | 1 + include/get_ipaddr_state.py | 2 +- include/init_CentOS.sh | 66 +++++++++++++++++++++---------------- include/init_Debian.sh | 11 ++++--- include/init_Ubuntu.sh | 12 ++++--- versions.txt | 9 ++--- 8 files changed, 60 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 53a5a502..a5c1b1c8 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ screen -S lnmp // if network interruption, you can execute the command `scree ## How to add Extensions ```bash -cd ~/oneinstack // Must enter the directory execution under oneinstack +cd ~/lnmp // Must enter the directory execution under lnmp ./addons.sh // Do not sh addons.sh or bash addons.sh such execution ``` diff --git a/include/check_download.sh b/include/check_download.sh index 2f10a3f5..cae6a726 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -444,7 +444,7 @@ checkDownload() { # php 5.3 src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src src_url=${mirrorLink}/php5.3patch && Download_src - if [[ "${Debian_version}" == "8" || "${Ubuntu_version}" == "16" ]];then + if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ];then src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src fi diff --git a/include/check_port.py b/include/check_port.py index a5c8709e..c5b338ea 100755 --- a/include/check_port.py +++ b/include/check_port.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys,os,socket def IsOpen(ip,port): + socket.setdefaulttimeout(5) s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) try: s.connect((ip,int(port))) diff --git a/include/get_ipaddr_state.py b/include/get_ipaddr_state.py index 6364f17c..23593998 100755 --- a/include/get_ipaddr_state.py +++ b/include/get_ipaddr_state.py @@ -1,7 +1,7 @@ #!/usr/bin/env python #coding:utf-8 +import sys,urllib2,socket try: - 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() diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index e76d7190..d0e3b80b 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -40,14 +40,11 @@ if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then export CC="gcc44" CXX="g++44" fi -# check sendmail -#[ "$sendmail_yn" == 'y' ] && yum -y install sendmail && service sendmail restart - # closed Unnecessary services and remove obsolete rpm package [ "$CentOS_RHEL_version" == '7' ] && [ "`systemctl is-active NetworkManager.service`" == 'active' ] && NM_flag=1 for Service in `chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis|NetworkManager'`;do chkconfig --level 3 $Service off;done [ "$NM_flag" == '1' ] && systemctl enable NetworkManager.service -for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog sendmail;do chkconfig --level 3 $Service on;done +for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog;do chkconfig --level 3 $Service on;done # Close SELINUX setenforce 0 @@ -58,7 +55,6 @@ cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\\\$ " HISTTIMEFORMAT="%F %T \`whoami\` " -PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }' alias l='ls -AFhlt' alias lh='l | head' @@ -70,6 +66,10 @@ alias egrep='egrep --color' alias fgrep='fgrep --color' EOF +[ -z "`grep ^'PROMPT_COMMAND=' /etc/bashrc`" ] && cat >> /etc/bashrc << EOF +PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }' +EOF + # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf sed -i '/^# End of file/,$d' /etc/security/limits.conf @@ -94,24 +94,43 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #nameserver 8.8.8.8 #EOF +# ip_conntrack table full dropping packets +[ ! -e "/etc/sysconfig/modules/iptables.modules" ] && { echo modprobe ip_conntrack > /etc/sysconfig/modules/iptables.modules; chmod +x /etc/sysconfig/modules/iptables.modules; } +modprobe ip_conntrack +echo options nf_conntrack hashsize=131072 > /etc/modprobe.d/nf_conntrack.conf + # /etc/sysctl.conf -sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf -[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF +[ ! -e "/etc/sysctl.conf_bk" ] && /bin/mv /etc/sysctl.conf{,_bk} +cat > /etc/sysctl.conf << EOF fs.file-max=65535 -fs.inotify.max_user_instances = 8192 -net.ipv4.tcp_fin_timeout = 30 +net.ipv4.tcp_max_tw_buckets = 60000 +net.ipv4.tcp_sack = 1 +net.ipv4.tcp_window_scaling = 1 +net.ipv4.tcp_rmem = 4096 87380 4194304 +net.ipv4.tcp_wmem = 4096 16384 4194304 +net.ipv4.tcp_max_syn_backlog = 65536 +net.core.netdev_max_backlog = 32768 +net.core.somaxconn = 32768 +net.core.wmem_default = 8388608 +net.core.rmem_default = 8388608 +net.core.rmem_max = 16777216 +net.core.wmem_max = 16777216 +net.ipv4.tcp_timestamps = 0 +net.ipv4.tcp_synack_retries = 2 +net.ipv4.tcp_syn_retries = 2 +net.ipv4.tcp_tw_recycle = 1 +#net.ipv4.tcp_tw_len = 1 net.ipv4.tcp_tw_reuse = 1 +net.ipv4.tcp_mem = 94500000 915000000 927000000 +net.ipv4.tcp_max_orphans = 3276800 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 -net.ipv4.tcp_max_syn_backlog = 65536 -net.ipv4.tcp_max_tw_buckets = 6000 -net.ipv4.route.gc_timeout = 100 -net.ipv4.tcp_syn_retries = 1 -net.ipv4.tcp_synack_retries = 1 -net.core.somaxconn = 65535 -net.core.netdev_max_backlog = 262144 -net.ipv4.tcp_timestamps = 0 -net.ipv4.tcp_max_orphans = 262144 +net.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_max = 6553500 +net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60 +net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120 +net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120 +net.netfilter.nf_conntrack_tcp_timeout_established = 3600 EOF sysctl -p @@ -123,20 +142,9 @@ elif [ "$CentOS_RHEL_version" == '6' ];then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n - [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.nf_conntrack_max = 6553500 -net.netfilter.nf_conntrack_max = 6553500 -net.netfilter.nf_conntrack_tcp_timeout_established = 180 -EOF elif [ "$CentOS_RHEL_version" == '7' ];then sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf - [ -z "`grep net.netfilter.nf_conntrack_max /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF -net.nf_conntrack_max = 6553500 -net.netfilter.nf_conntrack_max = 6553500 -net.netfilter.nf_conntrack_tcp_timeout_established = 180 -EOF fi -init q # Update time ntpdate pool.ntp.org diff --git a/include/init_Debian.sh b/include/init_Debian.sh index b0e18cf4..47efd947 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -29,10 +29,13 @@ done # Custom profile cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 +PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ' HISTTIMEFORMAT="%F %T \`whoami\` " -alias l='ls -AFhlt' +alias l='ls -AFhlt --color=auto' alias lh='l | head' +alias ll='ls -l --color=auto' +alias ls='ls --color=auto' alias vi=vim GREP_OPTIONS="--color=auto" @@ -41,10 +44,10 @@ alias egrep='egrep --color' alias fgrep='fgrep --color' EOF -# PS1 -[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc -[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +# history +[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index af076c8f..6b0925f6 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -44,16 +44,15 @@ elif [ "$Ubuntu_version" == '12' ];then apt-get -y install bison libcloog-ppl0 fi -# check sendmail -#[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail - # Custom profile cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 HISTTIMEFORMAT="%F %T \`whoami\` " -alias l='ls -AFhlt' +alias l='ls -AFhlt --color=auto' alias lh='l | head' +alias ll='ls -l --color=auto' +alias ls='ls --color=auto' alias vi=vim GREP_OPTIONS="--color=auto" @@ -62,10 +61,13 @@ alias egrep='egrep --color' alias fgrep='fgrep --color' EOF +sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc + # PS1 [ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc -[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +# history +[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf diff --git a/versions.txt b/versions.txt index 6b6655a5..30d8dba9 100644 --- a/versions.txt +++ b/versions.txt @@ -22,7 +22,7 @@ mysql_5_5_version=5.5.52 mariadb_10_1_version=10.1.17 mariadb_10_0_version=10.0.27 -mariadb_5_5_version=5.5.51 +mariadb_5_5_version=5.5.52 percona_5_7_version=5.7.14-7 percona_5_6_version=5.6.32-78.0 @@ -34,8 +34,8 @@ jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.10 -php_6_version=5.6.25 +php_7_version=7.0.11 +php_6_version=5.6.26 php_5_version=5.5.38 php_4_version=5.4.45 php_3_version=5.3.29 @@ -80,9 +80,10 @@ jemalloc_version=4.2.1 tcmalloc_version=2.5 # boost -boost_version=1.60.0 +boost_version=1.59.0 # Others libevent_version=2.0.22-stable tmux_version=2.2 htop_version=2.0.2 +bison_version=2.7.1 From 018888a1951157ebfca7c4d8823b6f3d7eb2a02c Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 8 Oct 2016 18:08:11 +0800 Subject: [PATCH 598/617] Support apcu/ioncube for PHP 7.0 --- addons.sh | 79 ++++++---- config/nginx.conf | 1 + config/nginx_apache.conf | 1 + config/nginx_tomcat.conf | 1 + include/GraphicsMagick.sh | 65 ++++----- include/ImageMagick.sh | 65 ++++----- include/ZendGuardLoader.sh | 126 ++++++++-------- include/apcu.sh | 42 +++--- include/check_download.sh | 32 +++-- include/check_os.sh | 15 +- include/eaccelerator-0.9.sh | 43 +++--- include/eaccelerator-1.0-dev.sh | 43 +++--- include/ioncube.sh | 76 +++++----- include/jdk-1.6.sh | 5 + include/mariadb-5.5.sh | 2 +- include/memcached.sh | 180 +++++++++++------------ include/mysql-5.5.sh | 2 +- include/percona-5.5.sh | 2 +- include/php-7.0.sh | 245 ++++++++++++++++++++++++++++++++ include/phpmyadmin.sh | 20 +-- include/redis.sh | 137 +++++++++--------- include/xcache.sh | 43 +++--- include/zendopcache.sh | 37 ++--- install.sh | 21 +-- versions.txt | 19 +-- 25 files changed, 814 insertions(+), 488 deletions(-) create mode 100644 include/php-7.0.sh diff --git a/addons.sh b/addons.sh index 19a70af4..24066d87 100755 --- a/addons.sh +++ b/addons.sh @@ -26,6 +26,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./include/color.sh . ./include/memory.sh . ./include/check_os.sh +. ./include/check_download.sh . ./include/download.sh . ./include/get_char.sh @@ -50,8 +51,15 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf # Check PHP if [ -e "$php_install_dir/bin/phpize" ];then - PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` - PHP_main_version=${PHP_version%.*} + PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + PHP_main_version=${PHP_detail_version%.*} + PHP_yn=y + [ "$PHP_main_version" == '5.3' ] && PHP_version=1 + [ "$PHP_main_version" == '5.4' ] && PHP_version=2 + [ "$PHP_main_version" == '5.5' ] && PHP_version=3 + [ "$PHP_main_version" == '5.6' ] && PHP_version=4 + [ "$PHP_main_version" == '7.0' ] && PHP_version=5 fi # Check PHP Extensions @@ -66,7 +74,7 @@ Restart_PHP() { # Check succ Check_succ() { -[ -f "`$php_install_dir/bin/php-config --extension-dir`/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } +[ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } } # Uninstall succ @@ -193,6 +201,7 @@ What Are You Doing? if [ $PHP_cache = 1 ];then cd $oneinstack_dir/src if [[ $PHP_main_version =~ ^5.[3-4]$ ]];then + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src Install_ZendOPcache elif [ "$PHP_main_version" == '5.5' ];then src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src @@ -212,28 +221,39 @@ What Are You Doing? fi Check_succ elif [ $PHP_cache = 2 ];then + cd $oneinstack_dir/src if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then while :; do read -p "Please input xcache admin password: " xcache_admin_pass (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" done + src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src Install_XCache Check_succ else echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 fi - elif [ $PHP_cache = 3 ];then - if [[ $PHP_main_version =~ ^5.[3-5]$ ]];then + elif [ ${PHP_cache} = 3 ];then + cd $oneinstack_dir/src + if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]];then + src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src + Install_APCU + Check_succ + elif [[ ${PHP_main_version} =~ ^7.[0-1]$ ]];then + src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src Install_APCU Check_succ else echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1 fi elif [ $PHP_cache = 4 ];then + cd $oneinstack_dir/src if [ "$PHP_main_version" == '5.3' ];then + src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src Install_eAccelerator-0-9 Check_succ elif [ "$PHP_main_version" == '5.4' ];then + src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src Install_eAccelerator-1-0-dev Check_succ else @@ -261,25 +281,31 @@ What Are You Doing? break fi done - if [ $ACTION = 1 ];then - Check_PHP_Extension - if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then - if [ $Loader = 1 ];then - if [ -e $php_install_dir/etc/php.d/ext-opcache.ini ];then - echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 - else - Install_ZendGuardLoader - Check_succ - fi - elif [ $Loader = 2 ];then - Install_ionCube - Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; - fi + if [ ${ACTION} = "1" ];then + Check_PHP_Extension + if [ ${Loader} = "1" ]; then + if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]] || [ "${armPlatform}" != "y" ]; then + if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then + echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 + else + ZendGuardLoader_yn=y && checkDownload + Install_ZendGuardLoader + Check_succ + fi else - echo; echo "${CWARNING}Your php does not support $PHP_extension! ${CEND}"; + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; fi + elif [ ${Loader} = "2" ]; then + if [[ ${PHP_main_version} =~ ^5.[3-6]$|^7.0$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then + ionCube_yn=y && checkDownload + Install_ionCube + Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; + else + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; + fi + fi else - Uninstall_succ + Uninstall_succ fi ;; 3) @@ -300,6 +326,7 @@ What Are You Doing? done if [ $ACTION = 1 ];then Check_PHP_Extension + Magick_yn=y && checkDownload if [ $Magick = 1 ];then [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick Install_php-imagick @@ -321,9 +348,9 @@ What Are You Doing? if [ $ACTION = 1 ];then Check_PHP_Extension cd $oneinstack_dir/src - src_url=http://www.php.net/distributions/php-$PHP_version.tar.gz && Download_src - tar xzf php-$PHP_version.tar.gz - cd php-$PHP_version/ext/fileinfo + src_url=http://www.php.net/distributions/php-$PHP_detail_version.tar.gz && Download_src + tar xzf php-$PHP_detail_version.tar.gz + cd php-$PHP_detail_version/ext/fileinfo $php_install_dir/bin/phpize ./configure --with-php-config=$php_install_dir/bin/php-config make -j ${THREAD} && make install @@ -351,6 +378,7 @@ What Are You Doing? fi done if [ $ACTION = 1 ];then + memcached_yn=y && checkDownload if [ $Memcache = 1 ];then [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached Check_PHP_Extension @@ -367,7 +395,7 @@ What Are You Doing? Install_php-memcache PHP_extension=memcached && Check_PHP_Extension Install_php-memcached - [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" -a "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } + [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } fi else PHP_extension=memcache && Uninstall_succ @@ -378,6 +406,7 @@ What Are You Doing? 6) ACTION_FUN PHP_extension=redis + redis_yn=y && checkDownload if [ $ACTION = 1 ];then [ ! -d "$redis_install_dir" ] && Install_redis-server Check_PHP_Extension diff --git a/config/nginx.conf b/config/nginx.conf index bf866959..ccd8af7c 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -32,6 +32,7 @@ http { fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; #Gzip Compression gzip on; diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index 98fe9944..81b04935 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -32,6 +32,7 @@ http { fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; #Gzip Compression gzip on; diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index 6fd1b628..55f6f472 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -32,6 +32,7 @@ http { fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; #Gzip Compression gzip on; diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 6f947a9b..010d889e 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -9,43 +9,44 @@ # https://github.com/lj2007331/oneinstack Install_GraphicsMagick() { -cd $oneinstack_dir/src -tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz -cd GraphicsMagick-$GraphicsMagick_version -./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static -make -j ${THREAD} && make install -cd .. -rm -rf GraphicsMagick-$GraphicsMagick_version -cd .. + pushd $oneinstack_dir/src + tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz + pushd GraphicsMagick-$GraphicsMagick_version + ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static + make -j ${THREAD} && make install + popd + rm -rf GraphicsMagick-$GraphicsMagick_version + popd } Install_php-gmagick() { -cd $oneinstack_dir/src -if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - tar xzf gmagick-2.0.4RC1.tgz - cd gmagick-2.0.4RC1 - else - tar xzf gmagick-$gmagick_version.tgz - cd gmagick-$gmagick_version - fi - make clean - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick - make -j ${THREAD} && make install - cd .. - rm -rf gmagick-$gmagick_version - - if [ -f "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ];then - cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ -e "$php_install_dir/bin/phpize" ];then + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then + tar xzf gmagick-2.0.4RC1.tgz + pushd gmagick-2.0.4RC1 + else + tar xzf gmagick-$gmagick_version.tgz + pushd gmagick-$gmagick_version + fi + make clean + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick + make -j ${THREAD} && make install + popd + rm -rf gmagick-$gmagick_version + + if [ -f "${phpExtensionDir}/gmagick.so" ];then + cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF [gmagick] extension=gmagick.so EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" + fi fi -fi -cd .. + popd } diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 141dfe54..9293a1a2 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -9,43 +9,44 @@ # https://github.com/lj2007331/oneinstack Install_ImageMagick() { -cd $oneinstack_dir/src -tar xzf ImageMagick-$ImageMagick_version.tar.gz -cd ImageMagick-$ImageMagick_version -./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static -make -j ${THREAD} && make install -cd .. -rm -rf ImageMagick-$ImageMagick_version -cd .. + pushd $oneinstack_dir/src + tar xzf ImageMagick-$ImageMagick_version.tar.gz + pushd ImageMagick-$ImageMagick_version + ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static + make -j ${THREAD} && make install + popd + rm -rf ImageMagick-$ImageMagick_version + popd } Install_php-imagick() { -cd $oneinstack_dir/src -if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then - tar xzf imagick-${imagick_for_php53_version}.tgz - cd imagick-${imagick_for_php53_version} - else - tar xzf imagick-$imagick_version.tgz - cd imagick-$imagick_version - fi - make clean - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick - make -j ${THREAD} && make install - cd .. - rm -rf imagick-$imagick_version - - if [ -f "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ];then - cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ -e "$php_install_dir/bin/phpize" ];then + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then + tar xzf imagick-${imagick_for_php53_version}.tgz + pushd imagick-${imagick_for_php53_version} + else + tar xzf imagick-$imagick_version.tgz + pushd imagick-$imagick_version + fi + make clean + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick + make -j ${THREAD} && make install + popd + rm -rf imagick-$imagick_version + + if [ -f "${phpExtensionDir}/imagick.so" ];then + cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF [imagick] extension=imagick.so EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" + fi fi -fi -cd .. + popd } diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index e1df8e33..57f2b092 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -9,74 +9,74 @@ # https://github.com/lj2007331/oneinstack Install_ZendGuardLoader() { -cd $oneinstack_dir/src + pushd ${oneinstack_dir}/src + PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + PHP_main_version=${PHP_detail_version%.*} + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` -PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` -PHP_main_version=${PHP_version%.*} - -[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` -if [ "$OS_BIT" == '64' ];then - if [ "$PHP_main_version" == '5.6' ];then - tar xzf zend-loader-php5.6-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.6-linux-x86_64 - fi - - if [ "$PHP_main_version" == '5.5' ];then - tar xzf zend-loader-php5.5-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.5-linux-x86_64 - fi - - if [ "$PHP_main_version" == '5.4' ];then - tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 - fi - - if [ "$PHP_main_version" == '5.3' ];then - tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 - fi -else - if [ "$PHP_main_version" == '5.6' ];then - tar xzf zend-loader-php5.6-linux-i386.tar.gz - /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.6-linux-i386 + [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} + if [ "$OS_BIT" == '64' ];then + if [ "$PHP_main_version" == '5.6' ];then + tar xzf zend-loader-php5.6-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.6-linux-x86_64 + fi + + if [ "$PHP_main_version" == '5.5' ];then + tar xzf zend-loader-php5.5-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.5-linux-x86_64 + fi + + if [ "$PHP_main_version" == '5.4' ];then + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 + fi + + if [ "$PHP_main_version" == '5.3' ];then + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 + fi + else + if [ "$PHP_main_version" == '5.6' ];then + tar xzf zend-loader-php5.6-linux-i386.tar.gz + /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.6-linux-i386 + fi + + if [ "$PHP_main_version" == '5.5' ];then + tar xzf zend-loader-php5.5-linux-i386.tar.gz + /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.5-linux-x386 + fi + + if [ "$PHP_main_version" == '5.4' ];then + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 + fi + + if [ "$PHP_main_version" == '5.3' ];then + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 + fi fi - - if [ "$PHP_main_version" == '5.5' ];then - tar xzf zend-loader-php5.5-linux-i386.tar.gz - /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf zend-loader-php5.5-linux-x386 - fi - - if [ "$PHP_main_version" == '5.4' ];then - tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 - fi - - if [ "$PHP_main_version" == '5.3' ];then - tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so `$php_install_dir/bin/php-config --extension-dir` - rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 - fi -fi - -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so" ];then - cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF + + if [ -f "${phpExtensionDir}/ZendGuardLoader.so" ];then + cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF [Zend Guard Loader] -zend_extension=`$php_install_dir/bin/php-config --extension-dir`/ZendGuardLoader.so +zend_extension=${phpExtensionDir}/ZendGuardLoader.so zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 EOF - echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}" - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" -fi -cd .. + echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}" + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/apcu.sh b/include/apcu.sh index eeeab459..689a469f 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -9,15 +9,21 @@ # https://github.com/lj2007331/oneinstack Install_APCU() { -cd $oneinstack_dir/src -tar xzf apcu-$apcu_version.tgz -cd apcu-$apcu_version -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/apcu.so" ];then - cat > $php_install_dir/etc/php.d/ext-apcu.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then + tar xzf apcu-${apcu_for_php7_version}.tgz + pushd apcu-${apcu_for_php7_version} + else + tar xzf apcu-${apcu_version}.tgz + pushd apcu-${apcu_version} + fi + + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/apcu.so" ];then + cat > ${php_install_dir}/etc/php.d/ext-apcu.ini << EOF [apcu] extension=apcu.so apc.enabled=1 @@ -25,13 +31,13 @@ apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - /bin/cp apc.php $wwwroot_dir/default - echo "${CSUCCESS}APCU module installed successfully! ${CEND}" - cd .. - rm -rf apcu-$apcu_version -else - echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}" -fi -cd .. + [ "${Apache_version}" != '1' -a "${Apache_version}" != '2' ] && service php-fpm restart || service httpd restart + /bin/cp apc.php ${wwwroot_dir}/default + echo "${CSUCCESS}APCU module installed successfully! ${CEND}" + else + echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}" + fi + popd + rm -rf apcu-${apcu_version} + popd } diff --git a/include/check_download.sh b/include/check_download.sh index cae6a726..e94b8666 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -67,8 +67,8 @@ checkDownload() { if [[ "${JDK_version}" =~ ^[1-3]$ ]];then if [ "${JDK_version}" == "1" ];then - echo "Download jdk 1.8..." - JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + echo "Download jdk 1.8..." + JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" fi if [ "${JDK_version}" == "2" ];then echo "Download jdk 1.7..." @@ -234,7 +234,7 @@ checkDownload() { let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue done - if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + if [ "${tryDlCount}" == "6" ];then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ else @@ -273,7 +273,7 @@ checkDownload() { let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue done - if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + if [ "${tryDlCount}" == "6" ];then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ else @@ -311,7 +311,7 @@ checkDownload() { let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue done - if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + if [ "${tryDlCount}" == "6" ];then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ else @@ -345,7 +345,7 @@ checkDownload() { let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue done - if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + if [ "${tryDlCount}" == "6" ];then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ else @@ -380,7 +380,7 @@ checkDownload() { let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue done - if [ "${tryDlCount}" == "6" -o "${tryDlCount}" == "6" ];then + if [ "${tryDlCount}" == "6" ];then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ else @@ -475,10 +475,14 @@ checkDownload() { echo "Download xcache..." src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src fi - if [ "${PHP_cache}" == "3" ] && [[ "$PHP_version" =~ ^[1-3]$ ]];then - # php 5.3 5.4 5.5 + if [ "${PHP_cache}" == "3" ];then + # php 5.3 5.4 5.5 5.6 7.0 echo "Download apcu..." - src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src + if [ "${PHP_version}" != "5" ]; then + src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src + else + src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src + fi fi if [ "${PHP_cache}" == "4" -a "${PHP_version}" == "2" ];then echo "Download eaccelerator 1.0 dev..." @@ -489,7 +493,7 @@ checkDownload() { fi # Zend Guard Loader - if [ "${ZendGuardLoader_yn}" == "y" ];then + if [ "${ZendGuardLoader_yn}" == "y" -a "${armPlatform}" != "y" ];then if [ "${PHP_version}" == "4" ];then if [ "${OS_BIT}" == "64" ];then # 64 bit @@ -541,7 +545,11 @@ checkDownload() { if [ "${OS_BIT}" == '64' ];then src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src else - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src + if [ "${TARGET_ARCH}" == "armv7" ]; then + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz && Download_src + else + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src + fi fi fi diff --git a/include/check_os.sh b/include/check_os.sh index 5c37913f..6d9ab7c1 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -34,6 +34,17 @@ else kill -9 $$ fi +if uname -m | grep -Eqi "arm"; then + armPlatform="y" + if uname -m | grep -Eqi "armv7"; then + TARGET_ARCH="armv7" + elif uname -m | grep -Eqi "armv8"; then + TARGET_ARCH="arm64" + else + TARGET_ARCH="unknown" + fi +fi + if [ $(getconf WORD_BIT) == 32 ] && [ $(getconf LONG_BIT) == 64 ];then OS_BIT=64 SYS_BIG_FLAG=x64 #jdk @@ -47,10 +58,6 @@ fi LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') [ $LIBC_YN == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux -if uname -m | grep -Eqi "arm";then - armTarget="y" -fi - THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) # Percona diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index 5c801cf8..7327bf26 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -9,19 +9,20 @@ # https://github.com/lj2007331/oneinstack Install_eAccelerator-0-9() { -cd $oneinstack_dir/src -tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 -cd eaccelerator-${eaccelerator_version} -make clean -$php_install_dir/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install - -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then - mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 + pushd eaccelerator-${eaccelerator_version} + make clean + $php_install_dir/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + + if [ -f "${phpExtensionDir}/eaccelerator.so" ];then + mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache + cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] -zend_extension=`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so +zend_extension=${phpExtensionDir}/eaccelerator.so eaccelerator.shm_size=64 eaccelerator.cache_dir=/var/eaccelerator_cache eaccelerator.enable=1 @@ -39,13 +40,13 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - cd .. - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf - sysctl -p - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" -fi -cd .. + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" + popd + [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index d261bb9d..f6e86cd5 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -9,19 +9,20 @@ # https://github.com/lj2007331/oneinstack Install_eAccelerator-1-0-dev() { -cd $oneinstack_dir/src -/bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz -tar xzf eaccelerator-eaccelerator-42067ac.tar.gz -cd eaccelerator-eaccelerator-42067ac -make clean -$php_install_dir/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then - mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz + tar xzf eaccelerator-eaccelerator-42067ac.tar.gz + pushd eaccelerator-eaccelerator-42067ac + make clean + $php_install_dir/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/eaccelerator.so" ];then + mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache + cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] -zend_extension=`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so +zend_extension=${phpExtensionDir}/eaccelerator.so eaccelerator.shm_size=64 eaccelerator.cache_dir=/var/eaccelerator_cache eaccelerator.enable=1 @@ -39,13 +40,13 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - cd .. - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf - sysctl -p - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" -fi -cd .. + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" + popd + [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/ioncube.sh b/include/ioncube.sh index 1dc60f3c..125da40a 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -9,39 +9,49 @@ # https://github.com/lj2007331/oneinstack Install_ionCube() { -cd $oneinstack_dir/src - -PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` -PHP_main_version=${PHP_version%.*} - -if [ "$OS_BIT" == '64' ];then - tar xzf ioncube_loaders_lin_x86-64.tar.gz -else - tar xzf ioncube_loaders_lin_x86.tar.gz -fi - -[ ! -d "`$php_install_dir/bin/php-config --extension-dir`" ] && mkdir -p `$php_install_dir/bin/php-config --extension-dir` -if [ "$PHP_main_version" == '5.6' ];then - /bin/cp ioncube/ioncube_loader_lin_5.6.so `$php_install_dir/bin/php-config --extension-dir` - zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.6.so" -elif [ "$PHP_main_version" == '5.5' ];then - /bin/cp ioncube/ioncube_loader_lin_5.5.so `$php_install_dir/bin/php-config --extension-dir` - zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.5.so" -elif [ "$PHP_main_version" == '5.4' ];then - /bin/cp ioncube/ioncube_loader_lin_5.4.so `$php_install_dir/bin/php-config --extension-dir` - zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.4.so" -elif [ "$PHP_main_version" == '5.3' ];then - /bin/cp ioncube/ioncube_loader_lin_5.3.so `$php_install_dir/bin/php-config --extension-dir` - zend_extension="`$php_install_dir/bin/php-config --extension-dir`/ioncube_loader_lin_5.3.so" -else - exit 1 -fi - -rm -rf ioncube -cat > $php_install_dir/etc/php.d/ext-0ioncube.ini << EOF + pushd ${oneinstack_dir}/src + + PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') + PHP_main_version=${PHP_detail_version%.*} + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + + if [ "${OS_BIT}" == '64' ];then + tar xzf ioncube_loaders_lin_x86-64.tar.gz + else + if [ "${TARGET_ARCH}" == "armv7" ];then + tar xzf ioncube_loaders_lin_armv7l.tar.gz + else + tar xzf ioncube_loaders_lin_x86.tar.gz + fi + fi + + [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} + if [ "$PHP_main_version" == '7.0' ]; then + /bin/cp ioncube/ioncube_loader_lin_7.0.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_7.0.so" + elif [ "$PHP_main_version" == '5.6' ]; then + /bin/cp ioncube/ioncube_loader_lin_5.6.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.6.so" + elif [ "$PHP_main_version" == '5.5' ]; then + /bin/cp ioncube/ioncube_loader_lin_5.5.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.5.so" + elif [ "$PHP_main_version" == '5.4' ]; then + /bin/cp ioncube/ioncube_loader_lin_5.4.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.4.so" + elif [ "$PHP_main_version" == '5.3' ]; then + /bin/cp ioncube/ioncube_loader_lin_5.3.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.3.so" + else + echo "Error! Your PHP ${PHP_detail_version} does not support ionCube!" + rm -rf ioncube + exit 1 + fi + + rm -rf ioncube + cat > ${php_install_dir}/etc/php.d/ext-0ioncube.ini << EOF [ionCube Loader] -zend_extension=$zend_extension +zend_extension=${zend_extension} EOF -[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -cd .. + [ "${Apache_version}" != '1' -a "${Apache_version}" != '2' ] && service php-fpm restart || service httpd restart + popd } diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index 7929f765..9519f933 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -11,6 +11,11 @@ Install-JDK-1-6() { cd $oneinstack_dir/src +JDK_FILE="jdk-`echo $jdk_6_version | awk -F. '{print $2}'`u`echo $jdk_6_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" +JAVA_dir=/usr/java +JDK_NAME="jdk$jdk_6_version" +JDK_PATH=$JAVA_dir/$JDK_NAME + [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` chmod +x $JDK_FILE diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 7b862b55..7597578a 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -36,7 +36,7 @@ Install_MariaDB-5-5() { EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi - if [ "${armTarget}" == "y" ];then + if [ "${armPlatform}" == "y" ];then patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch fi diff --git a/include/memcached.sh b/include/memcached.sh index 2570f7af..51ea828e 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -9,106 +9,108 @@ # https://github.com/lj2007331/oneinstack Install_memcached() { -cd $oneinstack_dir/src - -# memcached server -id -u memcached >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached - -tar xzf memcached-$memcached_version.tar.gz -cd memcached-$memcached_version -[ ! -d "$memcached_install_dir" ] && mkdir -p $memcached_install_dir -./configure --prefix=$memcached_install_dir -make -j ${THREAD} && make install -if [ -d "$memcached_install_dir/include/memcached" ];then - echo "${CSUCCESS}memcached installed successfully! ${CEND}" - cd .. - rm -rf memcached-$memcached_version - ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } - sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached - [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached - [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached - service memcached start -else - rm -rf $memcached_install_dir - echo "${CFAILURE}memcached install failed, Please contact the author! ${CEND}" - kill -9 $$ -fi -cd .. + pushd $oneinstack_dir/src + + # memcached server + id -u memcached >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached + + tar xzf memcached-$memcached_version.tar.gz + pushd memcached-$memcached_version + [ ! -d "$memcached_install_dir" ] && mkdir -p $memcached_install_dir + ./configure --prefix=$memcached_install_dir + make -j ${THREAD} && make install + if [ -d "$memcached_install_dir/include/memcached" ];then + echo "${CSUCCESS}memcached installed successfully! ${CEND}" + popd + rm -rf memcached-$memcached_version + ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } + sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached + [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached + [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached + service memcached start + else + rm -rf $memcached_install_dir + echo "${CFAILURE}memcached install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + popd } Install_php-memcache() { -cd $oneinstack_dir/src -if [ -e "$php_install_dir/bin/phpize" ];then - # php memcache extension - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone https://github.com/websupport-sk/pecl-memcache.git - #cd pecl-memcache - tar xzf pecl-memcache-php7.tgz - cd pecl-memcache-php7 - else - tar xzf memcache-$memcache_pecl_version.tgz - cd memcache-$memcache_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ];then - cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ -e "$php_install_dir/bin/phpize" ];then + # php memcache extension + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then + #git clone https://github.com/websupport-sk/pecl-memcache.git + #cd pecl-memcache + tar xzf pecl-memcache-php7.tgz + pushd pecl-memcache-php7 + else + tar xzf memcache-$memcache_pecl_version.tgz + pushd memcache-$memcache_pecl_version + fi + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/memcache.so" ];then + cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF extension=memcache.so EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" - cd .. - rm -rf memcache-$memcache_pecl_version - else - echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" + popd + rm -rf memcache-$memcache_pecl_version + else + echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" + fi fi -fi -cd .. + popd } Install_php-memcached() { -cd $oneinstack_dir/src -if [ -e "$php_install_dir/bin/phpize" ];then - # php memcached extension - tar xzf libmemcached-$libmemcached_version.tar.gz - cd libmemcached-$libmemcached_version - [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure - ./configure --with-memcached=$memcached_install_dir - make -j ${THREAD} && make install - cd .. - rm -rf libmemcached-$libmemcached_version - - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git - #cd php-memcached - tar xzf php-memcached-php7.tgz - cd php-memcached-php7 - else - tar xzf memcached-$memcached_pecl_version.tgz - cd memcached-$memcached_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ];then - cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ -e "$php_install_dir/bin/phpize" ];then + # php memcached extension + tar xzf libmemcached-$libmemcached_version.tar.gz + pushd libmemcached-$libmemcached_version + [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure + ./configure --with-memcached=$memcached_install_dir + make -j ${THREAD} && make install + popd + rm -rf libmemcached-$libmemcached_version + + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then + #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git + #cd php-memcached + tar xzf php-memcached-php7.tgz + pushd php-memcached-php7 + else + tar xzf memcached-$memcached_pecl_version.tgz + pushd memcached-$memcached_pecl_version + fi + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/memcached.so" ];then + cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF extension=memcached.so memcached.use_sasl=1 EOF - echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" - cd .. - rm -rf memcached-$memcached_pecl_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" + echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" + popd + rm -rf memcached-$memcached_pecl_version + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" + fi fi -fi -cd .. + popd } diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 97580108..7be069cb 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -36,7 +36,7 @@ Install_MySQL-5-5() { EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi - [ "${armTarget}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch + [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index c29a8072..bc564762 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -37,7 +37,7 @@ Install_Percona-5-5() { EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi - if [ "${armTarget}" == "y" ];then + if [ "${armPlatform}" == "y" ];then patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch fi diff --git a/include/php-7.0.sh b/include/php-7.0.sh new file mode 100644 index 00000000..523b9f10 --- /dev/null +++ b/include/php-7.0.sh @@ -0,0 +1,245 @@ +#!/bin/bash +# Author: yeho +# 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_PHP-7-0() { +cd $oneinstack_dir/src + +tar xzf libiconv-$libiconv_version.tar.gz +patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch +cd libiconv-$libiconv_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf libiconv-$libiconv_version + +tar xzf curl-$curl_version.tar.gz +cd curl-$curl_version +./configure --prefix=/usr/local +make -j ${THREAD} && make install +cd .. +rm -rf curl-$curl_version + +tar xzf libmcrypt-$libmcrypt_version.tar.gz +cd libmcrypt-$libmcrypt_version +./configure +make -j ${THREAD} && make install +ldconfig +cd libltdl +./configure --enable-ltdl-install +make -j ${THREAD} && make install +cd ../../ +rm -rf libmcrypt-$libmcrypt_version + +tar xzf mhash-$mhash_version.tar.gz +cd mhash-$mhash_version +./configure +make -j ${THREAD} && make install +cd .. +rm -rf mhash-$mhash_version + +echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf +ldconfig +[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + +tar xzf mcrypt-$mcrypt_version.tar.gz +cd mcrypt-$mcrypt_version +ldconfig +./configure +make -j ${THREAD} && make install +cd .. +rm -rf mcrypt-$mcrypt_version + +id -u $run_user >/dev/null 2>&1 +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + +tar xzf php-$php_7_version.tar.gz +cd php-$php_7_version +make clean +./buildconf +[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir +[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' +if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ +--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ +--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +else + ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-config-file-scan-dir=$php_install_dir/etc/php.d \ +--with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ +--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug +fi +make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} +make install + +if [ -e "$php_install_dir/bin/phpize" ];then + echo "${CSUCCESS}PHP installed successfully! ${CEND}" +else + rm -rf $php_install_dir + echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" + kill -9 $$ +fi + +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile +. /etc/profile + +# wget -c http://pear.php.net/go-pear.phar +# $php_install_dir/bin/php go-pear.phar + +[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d +/bin/cp php.ini-production $php_install_dir/etc/php.ini + +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini +sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini +sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini +sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini +sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini +sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini +[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + +[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=100000 +opcache.max_wasted_percentage=5 +opcache.use_cwd=1 +opcache.validate_timestamps=1 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.consistency_checks=0 +;opcache.optimization_level=0 +EOF + +if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + # php-fpm Init Script + /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm + chmod +x /etc/init.d/php-fpm + [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults + + cat > $php_install_dir/etc/php-fpm.conf <@maxmemory \nmaxmemory `expr $Mem / 8`000000@" $redis_install_dir/etc/redis.conf - echo "${CSUCCESS}Redis-server installed successfully! ${CEND}" - cd .. - rm -rf redis-$redis_version - id -u redis >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis - chown -R redis:redis $redis_install_dir/var - /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server - if [ "$OS" == 'CentOS' ];then - cc start-stop-daemon.c -o /sbin/start-stop-daemon - chkconfig --add redis-server - chkconfig redis-server on - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - update-rc.d redis-server defaults + pushd $oneinstack_dir/src + tar xzf redis-$redis_version.tar.gz + pushd redis-$redis_version + if [ "$OS_BIT" == '32' ];then + sed -i '1i\CFLAGS= -march=i686' src/Makefile + sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings + fi + + make -j ${THREAD} + + if [ -f "src/redis-server" ];then + mkdir -p $redis_install_dir/{bin,etc,var} + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + /bin/cp redis.conf $redis_install_dir/etc/ + ln -s $redis_install_dir/bin/* /usr/local/bin/ + sed -i 's@pidfile.*@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf + sed -i "s@logfile.*@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf + sed -i "s@^dir.*@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf + sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf + sed -i "s@^# bind 127.0.0.1@bind 127.0.0.1@" $redis_install_dir/etc/redis.conf + redis_maxmemory=`expr $Mem / 8`000000 + [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i "s@maxmemory @maxmemory \nmaxmemory `expr $Mem / 8`000000@" $redis_install_dir/etc/redis.conf + echo "${CSUCCESS}Redis-server installed successfully! ${CEND}" + popd + rm -rf redis-$redis_version + id -u redis >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis + chown -R redis:redis $redis_install_dir/var + /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server + if [ "$OS" == 'CentOS' ];then + cc start-stop-daemon.c -o /sbin/start-stop-daemon + chkconfig --add redis-server + chkconfig redis-server on + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + update-rc.d redis-server defaults + fi + sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server + #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf + #sysctl -p + service redis-server start + else + rm -rf $redis_install_dir + echo "${CFAILURE}Redis-server install failed, Please contact the author! ${CEND}" + kill -9 $$ fi - sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server - #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf - #sysctl -p - service redis-server start -else - rm -rf $redis_install_dir - echo "${CFAILURE}Redis-server install failed, Please contact the author! ${CEND}" - kill -9 $$ -fi -cd .. + popd } Install_php-redis() { -cd $oneinstack_dir/src -if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - tar xzf redis-${redis_pecl_for_php7_version}.tgz - cd redis-${redis_pecl_for_php7_version} - else - tar xzf redis-$redis_pecl_version.tgz - cd redis-$redis_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ];then - cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + if [ -e "$php_install_dir/bin/phpize" ];then + if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then + tar xzf redis-${redis_pecl_for_php7_version}.tgz + popd redis-${redis_pecl_for_php7_version} + else + tar xzf redis-$redis_pecl_version.tgz + cd redis-$redis_pecl_version + fi + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/redis.so" ];then + cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF [redis] extension=redis.so EOF - echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}" - cd .. - rm -rf redis-$redis_pecl_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP Redis module install failed, Please contact the author! ${CEND}" + echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}" + popd + rm -rf redis-$redis_pecl_version + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP Redis module install failed, Please contact the author! ${CEND}" + fi fi -fi -cd .. + popd } diff --git a/include/xcache.sh b/include/xcache.sh index 58233431..32ee70f2 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -9,19 +9,20 @@ # https://github.com/lj2007331/oneinstack Install_XCache() { -cd $oneinstack_dir/src -tar xzf xcache-$xcache_version.tar.gz -cd xcache-$xcache_version -make clean -$php_install_dir/bin/phpize -./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/xcache.so" ];then - /bin/cp -R htdocs $wwwroot_dir/default/xcache - chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache - touch /tmp/xcache;chown ${run_user}.$run_user /tmp/xcache - - cat > $php_install_dir/etc/php.d/ext-xcache.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + tar xzf xcache-$xcache_version.tar.gz + pushd xcache-$xcache_version + make clean + $php_install_dir/bin/phpize + ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/xcache.so" ];then + /bin/cp -R htdocs $wwwroot_dir/default/xcache + chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache + touch /tmp/xcache;chown ${run_user}.$run_user /tmp/xcache + + cat > $php_install_dir/etc/php.d/ext-xcache.ini << EOF [xcache-common] extension=xcache.so [xcache.admin] @@ -58,12 +59,12 @@ xcache.coverager = Off xcache.coverager_autostart = On xcache.coveragedump_directory = "" EOF - echo "${CSUCCESS}Xcache module installed successfully! ${CEND}" - cd .. - rm -rf xcache-$xcache_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}" -fi -cd .. + echo "${CSUCCESS}Xcache module installed successfully! ${CEND}" + popd + rm -rf xcache-$xcache_version + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 1d9765f8..395a2b39 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -9,17 +9,18 @@ # https://github.com/lj2007331/oneinstack Install_ZendOPcache() { -cd $oneinstack_dir/src -tar xzf zendopcache-$zendopcache_version.tgz -cd zendopcache-$zendopcache_version -make clean -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install -if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then - cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + pushd $oneinstack_dir/src + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + tar xzf zendopcache-$zendopcache_version.tgz + pushd zendopcache-$zendopcache_version + make clean + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/opcache.so" ];then + cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] -zend_extension=`$php_install_dir/bin/php-config --extension-dir`/opcache.so +zend_extension=${phpExtensionDir}/opcache.so opcache.enable=1 opcache.memory_consumption=$Memory_limit opcache.interned_strings_buffer=8 @@ -30,12 +31,12 @@ opcache.fast_shutdown=1 opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" - cd .. - rm -rf zendopcache-$zendopcache_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart -else - echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" -fi -cd .. + echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" + popd + rm -rf zendopcache-$zendopcache_version + [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart + else + echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/install.sh b/install.sh index 07f593e0..bd7cccdb 100755 --- a/install.sh +++ b/install.sh @@ -221,7 +221,7 @@ while :; do echo echo -e "\t${CMSG}2${CEND}. Install php-5.4" echo -e "\t${CMSG}3${CEND}. Install php-5.5" echo -e "\t${CMSG}4${CEND}. Install php-5.6" - echo -e "\t${CMSG}5${CEND}. Install php-7" + echo -e "\t${CMSG}5${CEND}. Install php-7.0" read -p "Please input a number:(Default 3 press Enter) " PHP_version [ -z "$PHP_version" ] && PHP_version=3 if [[ ! $PHP_version =~ ^[1-5]$ ]];then @@ -285,10 +285,11 @@ while :; do echo echo 'Please select a opcode cache of the PHP:' echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" echo -e "\t${CMSG}2${CEND}. Install XCache" + echo -e "\t${CMSG}3${CEND}. Install APCU" read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" + if [[ ! $PHP_cache =~ ^[1-3]$ ]];then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" else break fi @@ -298,10 +299,11 @@ while :; do echo while :; do echo 'Please select a opcode cache of the PHP:' echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}3${CEND}. Install APCU" read -p "Please input a number:(Default 1 press Enter) " PHP_cache [ -z "$PHP_cache" ] && PHP_cache=1 - if [ $PHP_cache != 1 ];then - echo "${CWARNING}input error! Please only input number 1${CEND}" + if [[ ! $PHP_cache =~ ^[1,3]$ ]];then + echo "${CWARNING}input error! Please only input number 1,3${CEND}" else break fi @@ -317,7 +319,7 @@ while :; do echo (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" done fi - if [ "$PHP_version" != '5' -a "$PHP_cache" != '1' ];then + if [ "$PHP_version" != '5' -a "$PHP_cache" != '1' -a "${armPlatform}" != "y" ];then while :; do echo read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn if [[ ! $ZendGuardLoader_yn =~ ^[y,n]$ ]];then @@ -328,7 +330,8 @@ while :; do echo done fi - if [ "$PHP_version" != '5' ];then + # ionCube + if [ "${TARGET_ARCH}" != "arm64" ];then while :; do echo read -p "Do you want to install ionCube? [y/n]: " ionCube_yn if [[ ! $ionCube_yn =~ ^[y,n]$ ]];then @@ -563,8 +566,8 @@ elif [ "$PHP_version" == '4' ];then . include/php-5.6.sh Install_PHP-5-6 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$PHP_version" == '5' ];then - . include/php-7.sh - Install_PHP-7 2>&1 | tee -a $oneinstack_dir/install.log + . include/php-7.0.sh + Install_PHP-7-0 2>&1 | tee -a $oneinstack_dir/install.log fi # ImageMagick or GraphicsMagick diff --git a/versions.txt b/versions.txt index 30d8dba9..fe2c78f7 100644 --- a/versions.txt +++ b/versions.txt @@ -3,7 +3,7 @@ nginx_version=1.10.1 tengine_version=2.1.1 openresty_version=1.11.2.1 -openssl_version=1.0.2h +openssl_version=1.0.2j tomcat_8_version=8.0.30 tomcat_7_version=7.0.69 @@ -20,13 +20,13 @@ mysql_5_7_version=5.7.15 mysql_5_6_version=5.6.33 mysql_5_5_version=5.5.52 -mariadb_10_1_version=10.1.17 +mariadb_10_1_version=10.1.18 mariadb_10_0_version=10.0.27 mariadb_5_5_version=5.5.52 -percona_5_7_version=5.7.14-7 -percona_5_6_version=5.6.32-78.0 -percona_5_5_version=5.5.51-38.1 +percona_5_7_version=5.7.14-8 +percona_5_6_version=5.6.32-78.1 +percona_5_5_version=5.5.52-38.3 # JDK jdk_8_version=1.8.0_102 @@ -42,11 +42,12 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 -apcu_version=4.0.10 -ImageMagick_version=6.9.5-9 +apcu_version=4.0.11 +apcu_for_php7_version=5.1.6 +ImageMagick_version=6.9.6-0 imagick_version=3.4.1 imagick_for_php53_version=3.3.0 -GraphicsMagick_version=1.3.24 +GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 @@ -60,7 +61,7 @@ eaccelerator_version=0.9.6.1 pureftpd_version=1.0.43 # Redis -redis_version=3.2.3 +redis_version=3.2.4 redis_pecl_for_php7_version=3.0.0 redis_pecl_version=2.2.8 From d55527afba45676668aae68e3eb22c9bf2531298 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 8 Oct 2016 18:09:02 +0800 Subject: [PATCH 599/617] Support apcu/ioncube for PHP 7.0 --- include/php-7.sh | 245 ----------------------------------------------- 1 file changed, 245 deletions(-) delete mode 100644 include/php-7.sh diff --git a/include/php-7.sh b/include/php-7.sh deleted file mode 100644 index 96247aa4..00000000 --- a/include/php-7.sh +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/bash -# Author: yeho -# 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_PHP-7() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_7_version.tar.gz -cd php-$php_7_version -make clean -./buildconf -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then - ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ ---enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else - ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ ---enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else - rm -rf $php_install_dir - echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" - kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini -sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF -[opcache] -zend_extension=opcache.so -opcache.enable=1 -opcache.enable_cli=1 -opcache.memory_consumption=$Memory_limit -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=100000 -opcache.max_wasted_percentage=5 -opcache.use_cwd=1 -opcache.validate_timestamps=1 -opcache.revalidate_freq=60 -opcache.save_comments=0 -opcache.fast_shutdown=1 -opcache.consistency_checks=0 -;opcache.optimization_level=0 -EOF - -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then - # php-fpm Init Script - /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm - chmod +x /etc/init.d/php-fpm - [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults - - cat > $php_install_dir/etc/php-fpm.conf < Date: Thu, 13 Oct 2016 20:38:28 +0800 Subject: [PATCH 600/617] Format all script (Tab width:2 spaces) --- addons.sh | 572 +++++++------- backup.sh | 88 +-- backup_setup.sh | 184 ++--- config/index_cn.html | 2 +- include/GraphicsMagick.sh | 65 +- include/ImageMagick.sh | 65 +- include/ZendGuardLoader.sh | 122 ++- include/apache-2.2.sh | 94 ++- include/apache-2.4.sh | 119 ++- include/apcu.sh | 45 +- include/boost.sh | 13 +- include/check_download.sh | 1242 +++++++++++++++---------------- include/check_os.sh | 100 +-- include/check_port.py | 18 +- include/color.sh | 10 +- include/demo.sh | 58 +- include/download.sh | 10 +- include/eaccelerator-0.9.sh | 40 +- include/eaccelerator-1.0-dev.sh | 41 +- include/get_ipaddr.py | 34 +- include/get_ipaddr_state.py | 20 +- include/get_public_ipaddr.py | 32 +- include/hhvm_CentOS.sh | 66 +- include/init_CentOS.sh | 110 +-- include/init_Debian.sh | 16 +- include/init_Ubuntu.sh | 48 +- include/ioncube.sh | 86 +-- include/jdk-1.6.sh | 32 +- include/jdk-1.7.sh | 28 +- include/jdk-1.8.sh | 30 +- include/jemalloc.sh | 24 +- include/mariadb-10.0.sh | 24 +- include/mariadb-10.1.sh | 24 +- include/mariadb-5.5.sh | 26 +- include/memcached.sh | 175 +++-- include/memory.sh | 71 +- include/mysql-5.5.sh | 24 +- include/mysql-5.6.sh | 24 +- include/mysql-5.7.sh | 24 +- include/nginx.sh | 109 ++- include/openresty.sh | 105 ++- include/percona-5.5.sh | 26 +- include/percona-5.6.sh | 24 +- include/percona-5.7.sh | 24 +- include/php-5.3.sh | 312 ++++---- include/php-5.4.sh | 274 +++---- include/php-5.5.sh | 275 ++++--- include/php-5.6.sh | 276 +++---- include/php-7.0.sh | 280 +++---- include/phpmyadmin.sh | 20 +- include/pureftpd.sh | 59 +- include/redis.sh | 137 ++-- include/tcmalloc.sh | 22 +- include/tengine.sh | 115 ++- include/tomcat-6.sh | 106 +-- include/tomcat-7.sh | 104 +-- include/tomcat-8.sh | 104 +-- include/upgrade_db.sh | 310 ++++---- include/upgrade_php.sh | 42 +- include/upgrade_phpmyadmin.sh | 52 +- include/upgrade_redis.sh | 60 +- include/upgrade_web.sh | 217 +++--- include/xcache.sh | 42 +- include/zendopcache.sh | 34 +- init.d/Memcached-init-CentOS | 58 +- init.d/Memcached-init-Ubuntu | 98 +-- init.d/Nginx-init-CentOS | 138 ++-- init.d/Nginx-init-Ubuntu | 326 ++++---- init.d/Pureftpd-init | 76 +- init.d/Redis-server-init | 8 +- init.d/Shadowsocks-libev-init | 98 +-- init.d/Shadowsocks-python-init | 34 +- init.d/Supervisor-init-CentOS | 161 ++-- init.d/Tomcat-init | 50 +- install.sh | 1077 +++++++++++++-------------- pureftpd_vhost.sh | 204 ++--- reset_db_root_password.sh | 22 +- shadowsocks.sh | 291 ++++---- tools/ckssh.py | 6 +- tools/db_bk.sh | 18 +- tools/mabs.sh | 245 +++--- tools/mscp.exp | 140 ++-- tools/mssh.exp | 102 +-- tools/thread.sh | 48 +- tools/website_bk.sh | 30 +- uninstall.sh | 432 +++++------ upgrade.sh | 115 ++- versions.txt | 10 +- vhost.sh | 1011 +++++++++++++------------ 89 files changed, 5827 insertions(+), 5906 deletions(-) diff --git a/addons.sh b/addons.sh index 24066d87..c1bcf671 100755 --- a/addons.sh +++ b/addons.sh @@ -50,44 +50,43 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } # Check PHP -if [ -e "$php_install_dir/bin/phpize" ];then - PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - PHP_main_version=${PHP_detail_version%.*} - PHP_yn=y - [ "$PHP_main_version" == '5.3' ] && PHP_version=1 - [ "$PHP_main_version" == '5.4' ] && PHP_version=2 - [ "$PHP_main_version" == '5.5' ] && PHP_version=3 - [ "$PHP_main_version" == '5.6' ] && PHP_version=4 - [ "$PHP_main_version" == '7.0' ] && PHP_version=5 +if [ -e "$php_install_dir/bin/phpize" ]; then + PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + PHP_main_version=${PHP_detail_version%.*} + [ "$PHP_main_version" == '5.3' ] && PHP_version=1 + [ "$PHP_main_version" == '5.4' ] && PHP_version=2 + [ "$PHP_main_version" == '5.5' ] && PHP_version=3 + [ "$PHP_main_version" == '5.6' ] && PHP_version=4 + [ "$PHP_main_version" == '7.0' ] && PHP_version=5 fi # Check PHP Extensions Check_PHP_Extension() { -[ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP $PHP_extension module already installed! ${CEND}"; exit 1; } + [ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP $PHP_extension module already installed! ${CEND}"; exit 1; } } # restart PHP Restart_PHP() { -[ -e "$apache_install_dir/conf/httpd.conf" ] && /etc/init.d/httpd restart || /etc/init.d/php-fpm restart + [ -e "$apache_install_dir/conf/httpd.conf" ] && /etc/init.d/httpd restart || /etc/init.d/php-fpm restart } # Check succ Check_succ() { -[ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } + [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } } # Uninstall succ Uninstall_succ() { -[ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { rm -rf $php_install_dir/etc/php.d/ext-${PHP_extension}.ini; Restart_PHP; echo; echo "${CMSG}PHP $PHP_extension module uninstall completed${CEND}"; } || { echo; echo "${CWARNING}$PHP_extension module does not exist! ${CEND}"; } + [ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { rm -rf $php_install_dir/etc/php.d/ext-${PHP_extension}.ini; Restart_PHP; echo; echo "${CMSG}PHP $PHP_extension module uninstall completed${CEND}"; } || { echo; echo "${CWARNING}$PHP_extension module does not exist! ${CEND}"; } } # PHP 5.5,5,6,7.0 install opcache Install_opcache() { -$php_install_dir/bin/phpize -./configure --with-php-config=$php_install_dir/bin/php-config -make -j ${THREAD} && make install -cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=opcache.so opcache.enable=1 @@ -103,7 +102,7 @@ EOF } Install_letsencrypt() { -if [ "$CentOS_RHEL_version" == '7' ];then + if [ "$CentOS_RHEL_version" == '7' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch @@ -113,7 +112,7 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF -elif [ "$CentOS_RHEL_version" == '6' ];then + elif [ "$CentOS_RHEL_version" == '6' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch @@ -123,41 +122,41 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF -fi + fi -cd $oneinstack_dir/src -src_url=https://dl.eff.org/certbot-auto && Download_src -/bin/mv certbot-auto /usr/local/bin/ -chmod +x /usr/local/bin/certbot-auto -certbot-auto -n -certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" + pushd $oneinstack_dir/src + src_url=https://dl.eff.org/certbot-auto && Download_src + /bin/mv certbot-auto /usr/local/bin/ + chmod +x /usr/local/bin/certbot-auto + certbot-auto -n + certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" } Uninstall_letsencrypt() { -rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt -[ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root -sed -i '/certbot-auto/d' $Cron_file -echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; + rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt + [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root + sed -i '/certbot-auto/d' $Cron_file + echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } ACTION_FUN() { -while :; do + while :; do echo echo 'Please select an action:' echo -e "\t${CMSG}1${CEND}. install" echo -e "\t${CMSG}2${CEND}. uninstall" read -p "Please input a number:(Default 1 press Enter) " ACTION [ -z "$ACTION" ] && ACTION=1 - if [[ ! $ACTION =~ ^[1,2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" + if [[ ! $ACTION =~ ^[1,2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" else - break + break fi -done + done } while :;do - printf " + printf " What Are You Doing? \t${CMSG}1${CEND}. Install/Uninstall PHP opcode cache \t${CMSG}2${CEND}. Install/Uninstall ZendGuardLoader/ionCube PHP Extension @@ -168,265 +167,256 @@ What Are You Doing? \t${CMSG}7${CEND}. Install/Uninstall Let's Encrypt client \t${CMSG}q${CEND}. Exit " - read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-7,q]$ ]];then - echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}" - else - case "$Number" in - 1) - ACTION_FUN - while :; do echo - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Zend OPcache" - echo -e "\t${CMSG}2${CEND}. XCache" - echo -e "\t${CMSG}3${CEND}. APCU" - echo -e "\t${CMSG}4${CEND}. eAccelerator" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-4]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - else - [ $PHP_cache = 1 ] && PHP_extension=opcache - [ $PHP_cache = 2 ] && PHP_extension=xcache - [ $PHP_cache = 3 ] && PHP_extension=apcu - [ $PHP_cache = 4 ] && PHP_extension=eaccelerator - break - fi - done - if [ $ACTION = 1 ];then - Check_PHP_Extension - if [ -e $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini ];then - echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install $PHP_extension! ${CEND}"; echo; exit 1 - else - if [ $PHP_cache = 1 ];then - cd $oneinstack_dir/src - if [[ $PHP_main_version =~ ^5.[3-4]$ ]];then - src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src - Install_ZendOPcache - elif [ "$PHP_main_version" == '5.5' ];then - src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src - tar xzf php-$php_5_version.tar.gz - cd php-$php_5_version/ext/opcache - Install_opcache - elif [ "$PHP_main_version" == '5.6' ];then - src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src - tar xzf php-$php_6_version.tar.gz - cd php-$php_6_version/ext/opcache - Install_opcache - elif [ "$PHP_main_version" == '7.0' ];then - src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src - tar xzf php-$php_7_version.tar.gz - cd php-$php_7_version/ext/opcache - Install_opcache - fi - Check_succ - elif [ $PHP_cache = 2 ];then - cd $oneinstack_dir/src - if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then - while :; do - read -p "Please input xcache admin password: " xcache_admin_pass - (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" - done - src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src - Install_XCache - Check_succ - else - echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 - fi - elif [ ${PHP_cache} = 3 ];then - cd $oneinstack_dir/src - if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]];then - src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src - Install_APCU - Check_succ - elif [[ ${PHP_main_version} =~ ^7.[0-1]$ ]];then - src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src - Install_APCU - Check_succ - else - echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1 - fi - elif [ $PHP_cache = 4 ];then - cd $oneinstack_dir/src - if [ "$PHP_main_version" == '5.3' ];then - src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src - Install_eAccelerator-0-9 - Check_succ - elif [ "$PHP_main_version" == '5.4' ];then - src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src - Install_eAccelerator-1-0-dev - Check_succ - else - echo "${CWARNING}Your php does not support eAccelerator! ${CEND}"; exit 1 - fi - fi - fi - else - Uninstall_succ - fi - ;; - 2) - ACTION_FUN - while :; do echo - echo 'Please select ZendGuardLoader/ionCube:' - echo -e "\t${CMSG}1${CEND}. ZendGuardLoader" - echo -e "\t${CMSG}2${CEND}. ionCube Loader" - read -p "Please input a number:(Default 1 press Enter) " Loader - [ -z "$Loader" ] && Loader=1 - if [[ ! $Loader =~ ^[1,2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - [ $Loader = 1 ] && PHP_extension=ZendGuardLoader - [ $Loader = 2 ] && PHP_extension=0ioncube - break - fi - done - if [ ${ACTION} = "1" ];then - Check_PHP_Extension - if [ ${Loader} = "1" ]; then - if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]] || [ "${armPlatform}" != "y" ]; then - if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then - echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 - else - ZendGuardLoader_yn=y && checkDownload - Install_ZendGuardLoader - Check_succ - fi - else - echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; - fi - elif [ ${Loader} = "2" ]; then - if [[ ${PHP_main_version} =~ ^5.[3-6]$|^7.0$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then - ionCube_yn=y && checkDownload - Install_ionCube - Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; - else - echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; - fi - fi - else - Uninstall_succ + read -p "Please input the correct option: " Number + if [[ ! $Number =~ ^[1-7,q]$ ]]; then + echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}" + else + case "$Number" in + 1) + ACTION_FUN + while :; do echo + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Zend OPcache" + echo -e "\t${CMSG}2${CEND}. XCache" + echo -e "\t${CMSG}3${CEND}. APCU" + echo -e "\t${CMSG}4${CEND}. eAccelerator" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + [ $PHP_cache = 1 ] && PHP_extension=opcache + [ $PHP_cache = 2 ] && PHP_extension=xcache + [ $PHP_cache = 3 ] && PHP_extension=apcu + [ $PHP_cache = 4 ] && PHP_extension=eaccelerator + break + fi + done + if [ $ACTION = 1 ]; then + Check_PHP_Extension + if [ -e $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini ]; then + echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install $PHP_extension! ${CEND}"; echo; exit 1 + else + if [ $PHP_cache = 1 ]; then + pushd $oneinstack_dir/src + if [[ $PHP_main_version =~ ^5.[3-4]$ ]]; then + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src + Install_ZendOPcache + elif [ "$PHP_main_version" == '5.5' ]; then + src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src + tar xzf php-$php_5_version.tar.gz + pushd php-$php_5_version/ext/opcache + Install_opcache + elif [ "$PHP_main_version" == '5.6' ]; then + src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src + tar xzf php-$php_6_version.tar.gz + pushd php-$php_6_version/ext/opcache + Install_opcache + elif [ "$PHP_main_version" == '7.0' ]; then + src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src + tar xzf php-$php_7_version.tar.gz + pushd php-$php_7_version/ext/opcache + Install_opcache fi - ;; - 3) - ACTION_FUN - while :; do echo - echo 'Please select ImageMagick/GraphicsMagick:' - echo -e "\t${CMSG}1${CEND}. ImageMagick" - echo -e "\t${CMSG}2${CEND}. GraphicsMagick" - read -p "Please input a number:(Default 1 press Enter) " Magick - [ -z "$Magick" ] && Magick=1 - if [[ ! $Magick =~ ^[1,2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - [ $Magick = 1 ] && PHP_extension=imagick - [ $Magick = 2 ] && PHP_extension=gmagick - break - fi - done - if [ $ACTION = 1 ];then - Check_PHP_Extension - Magick_yn=y && checkDownload - if [ $Magick = 1 ];then - [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick - Install_php-imagick - Check_succ - elif [ $Magick = 2 ];then - [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick - Install_php-gmagick - Check_succ - fi + Check_succ + elif [ $PHP_cache = 2 ]; then + pushd $oneinstack_dir/src + if [[ $PHP_main_version =~ ^5.[3-6]$ ]]; then + while :; do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" + done + checkDownload + Install_XCache + Check_succ else - Uninstall_succ - [ -d "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick - [ -d "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick + echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 fi - ;; - 4) - ACTION_FUN - PHP_extension=fileinfo - if [ $ACTION = 1 ];then - Check_PHP_Extension - cd $oneinstack_dir/src - src_url=http://www.php.net/distributions/php-$PHP_detail_version.tar.gz && Download_src - tar xzf php-$PHP_detail_version.tar.gz - cd php-$PHP_detail_version/ext/fileinfo - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - echo 'extension=fileinfo.so' > $php_install_dir/etc/php.d/ext-fileinfo.ini - Check_succ + elif [ ${PHP_cache} = 3 ]; then + checkDownload + Install_APCU + Check_succ + elif [ $PHP_cache = 4 ]; then + if [ "$PHP_main_version" == '5.3' ]; then + checkDownload + Install_eAccelerator-0-9 + Check_succ + elif [ "$PHP_main_version" == '5.4' ]; then + checkDownload + Install_eAccelerator-1-0-dev + Check_succ else - Uninstall_succ + echo "${CWARNING}Your php does not support eAccelerator! ${CEND}"; exit 1 fi - ;; - 5) - ACTION_FUN - while :; do echo - echo 'Please select memcache/memcached PHP Extension:' - echo -e "\t${CMSG}1${CEND}. memcache PHP Extension" - echo -e "\t${CMSG}2${CEND}. memcached PHP Extension" - echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension" - read -p "Please input a number:(Default 1 press Enter) " Memcache - [ -z "$Memcache" ] && Memcache=1 - if [[ ! $Memcache =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - [ $Memcache = 1 ] && PHP_extension=memcache - [ $Memcache = 2 ] && PHP_extension=memcached - break - fi - done - if [ $ACTION = 1 ];then - memcached_yn=y && checkDownload - if [ $Memcache = 1 ];then - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - Check_PHP_Extension - Install_php-memcache - Check_succ - elif [ $Memcache = 2 ];then - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - Check_PHP_Extension - Install_php-memcached - Check_succ - elif [ $Memcache = 3 ];then - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - PHP_extension=memcache && Check_PHP_Extension - Install_php-memcache - PHP_extension=memcached && Check_PHP_Extension - Install_php-memcached - [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } - fi + fi + fi + else + Uninstall_succ + fi + ;; + 2) + ACTION_FUN + while :; do echo + echo 'Please select ZendGuardLoader/ionCube:' + echo -e "\t${CMSG}1${CEND}. ZendGuardLoader" + echo -e "\t${CMSG}2${CEND}. ionCube Loader" + read -p "Please input a number:(Default 1 press Enter) " Loader + [ -z "$Loader" ] && Loader=1 + if [[ ! $Loader =~ ^[1,2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + [ $Loader = 1 ] && PHP_extension=ZendGuardLoader + [ $Loader = 2 ] && PHP_extension=0ioncube + break + fi + done + if [ ${ACTION} = "1" ]; then + Check_PHP_Extension + if [ ${Loader} = "1" ]; then + if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]] && [ "${armPlatform}" != "y" ]; then + if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then + echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 else - PHP_extension=memcache && Uninstall_succ - PHP_extension=memcached && Uninstall_succ - [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } + ZendGuardLoader_yn=y && checkDownload + Install_ZendGuardLoader + Check_succ fi - ;; - 6) - ACTION_FUN - PHP_extension=redis - redis_yn=y && checkDownload - if [ $ACTION = 1 ];then - [ ! -d "$redis_install_dir" ] && Install_redis-server - Check_PHP_Extension - Install_php-redis - else - Uninstall_succ - [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } - fi - ;; - 7) - ACTION_FUN - if [ $ACTION = 1 ];then - Install_letsencrypt - else - Uninstall_letsencrypt - fi - ;; - q) - exit - ;; - esac - fi + else + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform arm does not support ${PHP_extension}! ${CEND}"; + fi + elif [ ${Loader} = "2" ]; then + if [[ ${PHP_main_version} =~ ^5.[3-6]$|^7.0$ ]] && [ "${TARGET_ARCH}" != "arm64" ]; then + ionCube_yn=y && checkDownload + Install_ionCube + Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; + else + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform arm64 does not support ${PHP_extension}! ${CEND}"; + fi + fi + else + Uninstall_succ + fi + ;; + 3) + ACTION_FUN + while :; do echo + echo 'Please select ImageMagick/GraphicsMagick:' + echo -e "\t${CMSG}1${CEND}. ImageMagick" + echo -e "\t${CMSG}2${CEND}. GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [[ ! $Magick =~ ^[1,2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + [ $Magick = 1 ] && PHP_extension=imagick + [ $Magick = 2 ] && PHP_extension=gmagick + break + fi + done + if [ $ACTION = 1 ]; then + Check_PHP_Extension + Magick_yn=y && checkDownload + if [ $Magick = 1 ]; then + [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick + Install_php-imagick + Check_succ + elif [ $Magick = 2 ]; then + [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick + Install_php-gmagick + Check_succ + fi + else + Uninstall_succ + [ -d "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick + [ -d "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick + fi + ;; + 4) + ACTION_FUN + PHP_extension=fileinfo + if [ $ACTION = 1 ]; then + Check_PHP_Extension + pushd $oneinstack_dir/src + src_url=http://www.php.net/distributions/php-$PHP_detail_version.tar.gz && Download_src + tar xzf php-$PHP_detail_version.tar.gz + pushd php-$PHP_detail_version/ext/fileinfo + $php_install_dir/bin/phpize + ./configure --with-php-config=$php_install_dir/bin/php-config + make -j ${THREAD} && make install + echo 'extension=fileinfo.so' > $php_install_dir/etc/php.d/ext-fileinfo.ini + Check_succ + else + Uninstall_succ + fi + ;; + 5) + ACTION_FUN + while :; do echo + echo 'Please select memcache/memcached PHP Extension:' + echo -e "\t${CMSG}1${CEND}. memcache PHP Extension" + echo -e "\t${CMSG}2${CEND}. memcached PHP Extension" + echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension" + read -p "Please input a number:(Default 1 press Enter) " Memcache + [ -z "$Memcache" ] && Memcache=1 + if [[ ! $Memcache =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + [ $Memcache = 1 ] && PHP_extension=memcache + [ $Memcache = 2 ] && PHP_extension=memcached + break + fi + done + if [ $ACTION = 1 ]; then + if [ $Memcache = 1 ]; then + Check_PHP_Extension + memcached_yn=y && checkDownload + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + Install_php-memcache + Check_succ + elif [ $Memcache = 2 ]; then + Check_PHP_Extension + memcached_yn=y && checkDownload + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + Install_php-memcached + Check_succ + elif [ $Memcache = 3 ]; then + PHP_extension=memcache && Check_PHP_Extension + PHP_extension=memcached && Check_PHP_Extension + memcached_yn=y && checkDownload + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached + Install_php-memcache + Install_php-memcached + [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } + fi + else + PHP_extension=memcache && Uninstall_succ + PHP_extension=memcached && Uninstall_succ + [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } + fi + ;; + 6) + ACTION_FUN + if [ $ACTION = 1 ]; then + PHP_extension=redis && Check_PHP_Extension + redis_yn=y && checkDownload + [ ! -d "$redis_install_dir" ] && Install_redis-server + Install_php-redis + else + Uninstall_succ + [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } + fi + ;; + 7) + ACTION_FUN + if [ $ACTION = 1 ]; then + Install_letsencrypt + else + Uninstall_letsencrypt + fi + ;; + q) + exit + ;; + esac + fi done diff --git a/backup.sh b/backup.sh index a989e444..ba5f34a9 100755 --- a/backup.sh +++ b/backup.sh @@ -8,62 +8,62 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -cd tools +pushd tools > /dev/null . ../options.conf DB_Local_BK() { - for D in `echo $db_name | tr ',' ' '` - do - ./db_bk.sh $D - done + for D in `echo $db_name | tr ',' ' '` + do + ./db_bk.sh $D + done } DB_Remote_BK() { - for D in `echo $db_name | tr ',' ' '` - do - ./db_bk.sh $D - DB_GREP="DB_${D}_`date +%Y`" - DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'` - echo "file:::$backup_dir/$DB_FILE $backup_dir push" >> config_bakcup.txt - echo "com:::[ -e "$backup_dir/$DB_FILE" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt - done + for D in `echo $db_name | tr ',' ' '` + do + ./db_bk.sh $D + DB_GREP="DB_${D}_`date +%Y`" + DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'` + echo "file:::$backup_dir/$DB_FILE $backup_dir push" >> config_bakcup.txt + echo "com:::[ -e "$backup_dir/$DB_FILE" ] && rm -rf $backup_dir/DB_${D}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt + done } WEB_Local_BK() { - for W in `echo $website_name | tr ',' ' '` - do - ./website_bk.sh $W - done + for W in `echo $website_name | tr ',' ' '` + do + ./website_bk.sh $W + done } WEB_Remote_BK() { - for W in `echo $website_name | tr ',' ' '` - do - if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ];then - ./website_bk.sh $W - Web_GREP="Web_${W}_`date +%Y`" - Web_FILE=`ls -lrt $backup_dir | grep ${Web_GREP} | tail -1 | awk '{print $NF}'` - echo "file:::$backup_dir/$Web_FILE $backup_dir push" >> config_bakcup.txt - echo "com:::[ -e "$backup_dir/$Web_FILE" ] && rm -rf $backup_dir/Web_${W}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt - else - echo "file:::$wwwroot_dir/$W $backup_dir push" >> config_bakcup.txt - fi - done + for W in `echo $website_name | tr ',' ' '` + do + if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then + ./website_bk.sh $W + Web_GREP="Web_${W}_`date +%Y`" + Web_FILE=`ls -lrt $backup_dir | grep ${Web_GREP} | tail -1 | awk '{print $NF}'` + echo "file:::$backup_dir/$Web_FILE $backup_dir push" >> config_bakcup.txt + echo "com:::[ -e "$backup_dir/$Web_FILE" ] && rm -rf $backup_dir/Web_${W}_$(date +%Y%m%d --date="$expired_days days ago")_*.tgz" >> config_bakcup.txt + else + echo "file:::$wwwroot_dir/$W $backup_dir push" >> config_bakcup.txt + fi + done } -if [ "$backup_destination" == 'local' ];then - [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK - [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK -elif [ "$backup_destination" == 'remote' ];then - echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt - [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK - [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK - ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log -elif [ "$backup_destination" == 'local,remote' ];then - echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt - [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK - [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK - [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK - [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK - ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log +if [ "$backup_destination" == 'local' ]; then + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK +elif [ "$backup_destination" == 'remote' ]; then + echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK + ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log +elif [ "$backup_destination" == 'local,remote' ]; then + echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK + ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log fi diff --git a/backup_setup.sh b/backup_setup.sh index 818a595b..25df68c6 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -26,17 +26,17 @@ printf " [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } while :; do echo - echo 'Please select your backup destination:' - echo -e "\t${CMSG}1${CEND}. Only Localhost" - echo -e "\t${CMSG}2${CEND}. Only Remote host" - echo -e "\t${CMSG}3${CEND}. Localhost and Remote host" - read -p "Please input a number:(Default 1 press Enter) " DESC_BK - [ -z "$DESC_BK" ] && DESC_BK=1 - if [[ ! $DESC_BK =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi + echo 'Please select your backup destination:' + echo -e "\t${CMSG}1${CEND}. Only Localhost" + echo -e "\t${CMSG}2${CEND}. Only Remote host" + echo -e "\t${CMSG}3${CEND}. Localhost and Remote host" + read -p "Please input a number:(Default 1 press Enter) " DESC_BK + [ -z "$DESC_BK" ] && DESC_BK=1 + if [[ ! $DESC_BK =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break + fi done [ "$DESC_BK" == '1' ] && sed -i 's@^backup_destination=.*@backup_destination=local@' ./options.conf @@ -44,17 +44,17 @@ done [ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf while :; do echo - echo 'Please select your backup content:' - echo -e "\t${CMSG}1${CEND}. Only Database" - echo -e "\t${CMSG}2${CEND}. Only Website" - echo -e "\t${CMSG}3${CEND}. Database and Website" - read -p "Please input a number:(Default 1 press Enter) " CONTENT_BK - [ -z "$CONTENT_BK" ] && CONTENT_BK=1 - if [[ ! $CONTENT_BK =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi + echo 'Please select your backup content:' + echo -e "\t${CMSG}1${CEND}. Only Database" + echo -e "\t${CMSG}2${CEND}. Only Website" + echo -e "\t${CMSG}3${CEND}. Database and Website" + read -p "Please input a number:(Default 1 press Enter) " CONTENT_BK + [ -z "$CONTENT_BK" ] && CONTENT_BK=1 + if [[ ! $CONTENT_BK =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break + fi done [ "$CONTENT_BK" == '1' ] && sed -i 's@^backup_content=.*@backup_content=db@' ./options.conf @@ -62,57 +62,57 @@ done [ "$CONTENT_BK" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf while :; do echo - echo "Please enter the directory for save the backup file: " - read -p "(Default directory: $backup_dir): " NEW_backup_dir - [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" - if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - break - fi + echo "Please enter the directory for save the backup file: " + read -p "(Default directory: $backup_dir): " NEW_backup_dir + [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" + if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then + echo "${CWARNING}input error! ${CEND}" + else + break + fi done sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf while :; do echo - echo "Pleas enter a valid backup number of days: " - read -p "(Default days: 5): " expired_days - [ -z "$expired_days" ] && expired_days=5 - [ -n "`echo $expired_days | sed -n "/^[0-9]\+$/p"`" ] && break || echo "${CWARNING}input error! Please only enter numbers! ${CEND}" + echo "Pleas enter a valid backup number of days: " + read -p "(Default days: 5): " expired_days + [ -z "$expired_days" ] && expired_days=5 + [ -n "`echo $expired_days | sed -n "/^[0-9]\+$/p"`" ] && break || echo "${CWARNING}input error! Please only enter numbers! ${CEND}" done sed -i "s@^expired_days=.*@expired_days=$expired_days@" ./options.conf -if [ "$CONTENT_BK" != '2' ];then - databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"` - while :; do echo - echo "Please enter one or more name for database, separate multiple database names with commas: " - read -p "(Default database: `echo $databases | tr ' ' ','`) " db_name - db_name=`echo $db_name | tr -d ' '` - [ -z "$db_name" ] && db_name="`echo $databases | tr ' ' ','`" - D_tmp=0 - for D in `echo $db_name | tr ',' ' '` - do - [ -z "`echo $databases | grep -w $D`" ] && { echo "${CWARNING}$D was not exist! ${CEND}" ; D_tmp=1; } - done - [ "$D_tmp" != '1' ] && break +if [ "$CONTENT_BK" != '2' ]; then + databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"` + while :; do echo + echo "Please enter one or more name for database, separate multiple database names with commas: " + read -p "(Default database: `echo $databases | tr ' ' ','`) " db_name + db_name=`echo $db_name | tr -d ' '` + [ -z "$db_name" ] && db_name="`echo $databases | tr ' ' ','`" + D_tmp=0 + for D in `echo $db_name | tr ',' ' '` + do + [ -z "`echo $databases | grep -w $D`" ] && { echo "${CWARNING}$D was not exist! ${CEND}" ; D_tmp=1; } done - sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf + [ "$D_tmp" != '1' ] && break + done + sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf fi -if [ "$CONTENT_BK" != '1' ];then - websites=`ls $wwwroot_dir | grep -vw default` - while :; do echo - echo "Please enter one or more name for website, separate multiple website names with commas: " - read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name - website_name=`echo $website_name | tr -d ' '` - [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`" - W_tmp=0 - for W in `echo $website_name | tr ',' ' '` - do - [ ! -e "$wwwroot_dir/$W" ] && { echo "${CWARNING}$wwwroot_dir/$W not exist! ${CEND}" ; W_tmp=1; } - done - [ "$W_tmp" != '1' ] && break +if [ "$CONTENT_BK" != '1' ]; then + websites=`ls $wwwroot_dir | grep -vw default` + while :; do echo + echo "Please enter one or more name for website, separate multiple website names with commas: " + read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name + website_name=`echo $website_name | tr -d ' '` + [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`" + W_tmp=0 + for W in `echo $website_name | tr ',' ' '` + do + [ ! -e "$wwwroot_dir/$W" ] && { echo "${CWARNING}$wwwroot_dir/$W not exist! ${CEND}" ; W_tmp=1; } done - sed -i "s@^website_name=.*@website_name=$website_name@" ./options.conf + [ "$W_tmp" != '1' ] && break + done + sed -i "s@^website_name=.*@website_name=$website_name@" ./options.conf fi echo @@ -120,35 +120,35 @@ echo "You have to backup the content:" [ "$CONTENT_BK" != '2' ] && echo "Database: ${CMSG}$db_name${CEND}" [ "$CONTENT_BK" != '1' ] && echo "Website: ${CMSG}$website_name${CEND}" -if [[ "$DESC_BK" =~ ^[2,3]$ ]];then - > tools/iplist.txt - while :; do echo - read -p "Please enter the remote host ip: " remote_ip - [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue - echo - read -p "Please enter the remote host port(Default: 22) : " remote_port - [ -z "$remote_port" ] && remote_port=22 - echo - read -p "Please enter the remote host user(Default: root) : " remote_user - [ -z "$remote_user" ] && remote_user=root - echo - read -p "Please enter the remote host password: " remote_password - IPcode=$(echo "ibase=16;$(echo "$remote_ip" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - Portcode=$(echo "ibase=16;$(echo "$remote_port" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - PWcode=$(echo "ibase=16;$(echo "$remote_password" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - [ -e "~/.ssh/known_hosts" ] && grep $remote_ip ~/.ssh/known_hosts | sed -i "/$remote_ip/d" ~/.ssh/known_hosts - ./tools/mssh.exp ${IPcode}P $remote_user ${PWcode}P ${Portcode}P true 10 - if [ $? -eq 0 ];then - [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}" - while :; do - read -p "Do you want to add more host ? [y/n]: " more_host_yn - if [[ ! "$more_host_yn" =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done - [ "$more_host_yn" == 'n' ] && break +if [[ "$DESC_BK" =~ ^[2,3]$ ]]; then + > tools/iplist.txt + while :; do echo + read -p "Please enter the remote host ip: " remote_ip + [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue + echo + read -p "Please enter the remote host port(Default: 22) : " remote_port + [ -z "$remote_port" ] && remote_port=22 + echo + read -p "Please enter the remote host user(Default: root) : " remote_user + [ -z "$remote_user" ] && remote_user=root + echo + read -p "Please enter the remote host password: " remote_password + IPcode=$(echo "ibase=16;$(echo "$remote_ip" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Portcode=$(echo "ibase=16;$(echo "$remote_port" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + PWcode=$(echo "ibase=16;$(echo "$remote_password" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + [ -e "~/.ssh/known_hosts" ] && grep $remote_ip ~/.ssh/known_hosts | sed -i "/$remote_ip/d" ~/.ssh/known_hosts + ./tools/mssh.exp ${IPcode}P $remote_user ${PWcode}P ${Portcode}P true 10 + if [ $? -eq 0 ]; then + [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}" + while :; do + read -p "Do you want to add more host ? [y/n]: " more_host_yn + if [[ ! "$more_host_yn" =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break fi - done + done + [ "$more_host_yn" == 'n' ] && break + fi + done fi diff --git a/config/index_cn.html b/config/index_cn.html index 62fd2125..26efdfac 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -28,7 +28,7 @@

OneinStack 创建 FTP 虚拟账号执行脚本:  ./pureftpd_vhost.sh

Github 项目地址:  https://github.com/lj2007331/oneinstack

OneinStack 官网:  https://oneinstack.com

-

QQ 群:  558540514(付费千人群) 556824757(新) 213014293(满) 486321919(满) 438311066(满) 235258658(满)

+

QQ 群:  558540514(付费千人群) 535783209(新)

赞助我们:

          支付宝:  lj2007331@gmail.com

          PayPal:  lj2007331@gmail.com

diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index 010d889e..f7a666b6 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -9,44 +9,39 @@ # https://github.com/lj2007331/oneinstack Install_GraphicsMagick() { - pushd $oneinstack_dir/src - tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz - pushd GraphicsMagick-$GraphicsMagick_version - ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static - make -j ${THREAD} && make install - popd - rm -rf GraphicsMagick-$GraphicsMagick_version - popd + pushd ${oneinstack_dir}/src + tar xzf GraphicsMagick-${GraphicsMagick_version}.tar.gz + pushd GraphicsMagick-${GraphicsMagick_version} + ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static + make -j ${THREAD} && make install + popd + rm -rf GraphicsMagick-${GraphicsMagick_version} + popd } Install_php-gmagick() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - tar xzf gmagick-2.0.4RC1.tgz - pushd gmagick-2.0.4RC1 - else - tar xzf gmagick-$gmagick_version.tgz - pushd gmagick-$gmagick_version - fi - make clean - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick - make -j ${THREAD} && make install - popd - rm -rf gmagick-$gmagick_version - - if [ -f "${phpExtensionDir}/gmagick.so" ];then - cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF -[gmagick] -extension=gmagick.so -EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" - fi + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ -e "${php_install_dir}/bin/phpize" ]; then + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + tar xzf gmagick-${gmagick_for_php7_version}.tgz + pushd gmagick-${gmagick_for_php7_version} + else + tar xzf gmagick-${gmagick_version}.tgz + pushd gmagick-${gmagick_version} fi + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config --with-gmagick=/usr/local/graphicsmagick + make -j ${THREAD} && make install popd + if [ -f "${phpExtensionDir}/gmagick.so" ]; then + echo 'extension=gmagick.so' > ${php_install_dir}/etc/php.d/ext-gmagick.ini + echo "${CSUCCESS}PHP gmagick module installed successfully! ${CEND}" + rm -rf gmagick-${gmagick_for_php7_version} gmagick-${gmagick_version} + else + echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" + fi + fi + popd } diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index 9293a1a2..c1b0894c 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -9,44 +9,39 @@ # https://github.com/lj2007331/oneinstack Install_ImageMagick() { - pushd $oneinstack_dir/src - tar xzf ImageMagick-$ImageMagick_version.tar.gz - pushd ImageMagick-$ImageMagick_version - ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static - make -j ${THREAD} && make install - popd - rm -rf ImageMagick-$ImageMagick_version - popd + pushd ${oneinstack_dir}/src + tar xzf ImageMagick-${ImageMagick_version}.tar.gz + pushd ImageMagick-${ImageMagick_version} + ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static + make -j ${THREAD} && make install + popd + rm -rf ImageMagick-${ImageMagick_version} + popd } Install_php-imagick() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then - tar xzf imagick-${imagick_for_php53_version}.tgz - pushd imagick-${imagick_for_php53_version} - else - tar xzf imagick-$imagick_version.tgz - pushd imagick-$imagick_version - fi - make clean - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick - make -j ${THREAD} && make install - popd - rm -rf imagick-$imagick_version - - if [ -f "${phpExtensionDir}/imagick.so" ];then - cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF -[imagick] -extension=imagick.so -EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" - fi + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ -e "${php_install_dir}/bin/phpize" ]; then + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ]; then + tar xzf imagick-${imagick_for_php53_version}.tgz + pushd imagick-${imagick_for_php53_version} + else + tar xzf imagick-${imagick_version}.tgz + pushd imagick-${imagick_version} fi + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config --with-imagick=/usr/local/imagemagick + make -j ${THREAD} && make install popd + if [ -f "${phpExtensionDir}/imagick.so" ]; then + echo 'extension=imagick.so' > ${php_install_dir}/etc/php.d/ext-imagick.ini + echo "${CSUCCESS}PHP imagick module installed successfully! ${CEND}" + rm -rf imagick-${imagick_for_php53_version} imagick-${imagick_version} + else + echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" + fi + fi + popd } diff --git a/include/ZendGuardLoader.sh b/include/ZendGuardLoader.sh index 57f2b092..03fd5ca7 100644 --- a/include/ZendGuardLoader.sh +++ b/include/ZendGuardLoader.sh @@ -9,74 +9,72 @@ # https://github.com/lj2007331/oneinstack Install_ZendGuardLoader() { - pushd ${oneinstack_dir}/src - PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` - PHP_main_version=${PHP_detail_version%.*} - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` + pushd ${oneinstack_dir}/src + PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') + PHP_main_version=${PHP_detail_version%.*} + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} + if [ "$OS_BIT" == '64' ]; then + if [ "$PHP_main_version" == '5.6' ]; then + tar xzf zend-loader-php5.6-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.6-linux-x86_64 + fi + + if [ "$PHP_main_version" == '5.5' ]; then + tar xzf zend-loader-php5.5-linux-x86_64.tar.gz + /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.5-linux-x86_64 + fi + + if [ "$PHP_main_version" == '5.4' ]; then + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 + fi + + if [ "$PHP_main_version" == '5.3' ]; then + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 + fi + else + if [ "$PHP_main_version" == '5.6' ]; then + tar xzf zend-loader-php5.6-linux-i386.tar.gz + /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.6-linux-i386 + fi + + if [ "$PHP_main_version" == '5.5' ]; then + tar xzf zend-loader-php5.5-linux-i386.tar.gz + /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so ${phpExtensionDir} + rm -rf zend-loader-php5.5-linux-x386 + fi - [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} - if [ "$OS_BIT" == '64' ];then - if [ "$PHP_main_version" == '5.6' ];then - tar xzf zend-loader-php5.6-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} - rm -rf zend-loader-php5.6-linux-x86_64 - fi - - if [ "$PHP_main_version" == '5.5' ];then - tar xzf zend-loader-php5.5-linux-x86_64.tar.gz - /bin/cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir} - rm -rf zend-loader-php5.5-linux-x86_64 - fi - - if [ "$PHP_main_version" == '5.4' ];then - tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} - rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 - fi - - if [ "$PHP_main_version" == '5.3' ];then - tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} - rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64 - fi - else - if [ "$PHP_main_version" == '5.6' ];then - tar xzf zend-loader-php5.6-linux-i386.tar.gz - /bin/cp zend-loader-php5.6-linux-i386/ZendGuardLoader.so ${phpExtensionDir} - rm -rf zend-loader-php5.6-linux-i386 - fi - - if [ "$PHP_main_version" == '5.5' ];then - tar xzf zend-loader-php5.5-linux-i386.tar.gz - /bin/cp zend-loader-php5.5-linux-i386/ZendGuardLoader.so ${phpExtensionDir} - rm -rf zend-loader-php5.5-linux-x386 - fi - - if [ "$PHP_main_version" == '5.4' ];then - tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} - rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 - fi - - if [ "$PHP_main_version" == '5.3' ];then - tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} - rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 - fi + if [ "$PHP_main_version" == '5.4' ]; then + tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 fi - - if [ -f "${phpExtensionDir}/ZendGuardLoader.so" ];then - cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF + + if [ "$PHP_main_version" == '5.3' ]; then + tar xzf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz + /bin/cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir} + rm -rf ZendGuardLoader-php-5.3-linux-glibc23-i386 + fi + fi + + if [ -f "${phpExtensionDir}/ZendGuardLoader.so" ]; then + cat > $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini << EOF [Zend Guard Loader] zend_extension=${phpExtensionDir}/ZendGuardLoader.so zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 EOF - echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}" - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" - fi - popd + echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}" + else + echo "${CFAILURE}PHP ZendGuardLoader module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index bfda7220..98472d60 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -9,59 +9,57 @@ # https://github.com/lj2007331/oneinstack Install_Apache-2-2() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf httpd-$apache_2_version.tar.gz -cd httpd-$apache_2_version -[ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir -[ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker -./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir -make -j ${THREAD} && make install -if [ -e "$apache_install_dir/conf/httpd.conf" ];then + pushd ${oneinstack_dir}/src + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + tar xzf httpd-$apache_2_version.tar.gz + pushd httpd-$apache_2_version + [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir + [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker + ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir + make -j ${THREAD} && make install + if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" - cd .. + popd rm -rf httpd-$apache_2_version -else + else rm -rf $apache_install_dir echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile -. /etc/profile + fi -/bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd -sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd -sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd -chmod +x /etc/init.d/httpd -[ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults - -sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf -sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf -if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile + . /etc/profile + + /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd + sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd + sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd + chmod +x /etc/init.d/httpd + [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults + + sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf + sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf + if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then + elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 TMP_IP=127.0.0.1 -fi -sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf -sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf -sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf -sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf -sed -i "s@^@@" $apache_install_dir/conf/httpd.conf -sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf - -#logrotate apache log -cat > /etc/logrotate.d/apache << EOF + fi + sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf + sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf + sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf + sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf + sed -i "s@^@@" $apache_install_dir/conf/httpd.conf + sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + + #logrotate apache log + cat > /etc/logrotate.d/apache << EOF $wwwlogs_dir/*apache.log { daily rotate 5 @@ -76,8 +74,8 @@ endscript } EOF -mkdir $apache_install_dir/conf/vhost -cat >> $apache_install_dir/conf/vhost/0.conf << EOF + mkdir $apache_install_dir/conf/vhost + cat >> $apache_install_dir/conf/vhost/0.conf << EOF NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com @@ -102,7 +100,7 @@ NameVirtualHost *:$TMP_PORT EOF -cat >> $apache_install_dir/conf/httpd.conf <> $apache_install_dir/conf/httpd.conf < AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript @@ -118,7 +116,7 @@ ServerSignature Off Include conf/vhost/*.conf EOF -if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ];then + if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so @@ -126,8 +124,8 @@ RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy 127.0.0.1 EOF sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf -fi -ldconfig -service httpd start -cd .. + fi + ldconfig + service httpd start + popd } diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 92e102ff..8bed32cf 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -9,72 +9,69 @@ # https://github.com/lj2007331/oneinstack Install_Apache-2-4() { -cd $oneinstack_dir/src - -tar xzf pcre-$pcre_version.tar.gz -cd pcre-$pcre_version -./configure -make -j ${THREAD} && make install -cd .. - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf httpd-$apache_4_version.tar.gz -tar xzf apr-$apr_version.tar.gz -tar xzf apr-util-$apr_util_version.tar.gz -cd httpd-$apache_4_version -[ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir -/bin/cp -R ../apr-$apr_version ./srclib/apr -/bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util -[ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker -./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir -make -j ${THREAD} && make install -if [ -e "$apache_install_dir/conf/httpd.conf" ];then + pushd ${oneinstack_dir}/src + tar xzf pcre-$pcre_version.tar.gz + pushd pcre-$pcre_version + ./configure + make -j ${THREAD} && make install + popd + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + tar xzf httpd-$apache_4_version.tar.gz + tar xzf apr-$apr_version.tar.gz + tar xzf apr-util-$apr_util_version.tar.gz + pushd httpd-$apache_4_version + [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir + /bin/cp -R ../apr-$apr_version ./srclib/apr + /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util + [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker + ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir + make -j ${THREAD} && make install + if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" - cd .. + popd rm -rf httpd-$apache_4_version -else + else rm -rf $apache_install_dir echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" kill -9 $$ -fi + fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile -. /etc/profile - -/bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd -sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd -sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd -chmod +x /etc/init.d/httpd -[ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults - -sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf -sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf -if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ];then + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile + . /etc/profile + + /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd + sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd + sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd + chmod +x /etc/init.d/httpd + [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults + + sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf + sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf + if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 TMP_IP=$IPADDR -elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];then + elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 TMP_IP=127.0.0.1 -fi -sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf -sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf -sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf -sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf -sed -i 's@^#LoadModule\(.*\)mod_ssl.so@LoadModule\1mod_ssl.so@' $apache_install_dir/conf/httpd.conf -sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf -sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf -sed -i "s@^@@" $apache_install_dir/conf/httpd.conf -sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf - -#logrotate apache log -cat > /etc/logrotate.d/apache << EOF + fi + sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf + sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf + sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf + sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf + sed -i 's@^#LoadModule\(.*\)mod_ssl.so@LoadModule\1mod_ssl.so@' $apache_install_dir/conf/httpd.conf + sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf + sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf + sed -i "s@^@@" $apache_install_dir/conf/httpd.conf + sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + + #logrotate apache log + cat > /etc/logrotate.d/apache << EOF $wwwlogs_dir/*apache.log { daily rotate 5 @@ -89,8 +86,8 @@ endscript } EOF -mkdir $apache_install_dir/conf/vhost -cat >> $apache_install_dir/conf/vhost/0.conf << EOF + mkdir $apache_install_dir/conf/vhost + cat >> $apache_install_dir/conf/vhost/0.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" @@ -115,7 +112,7 @@ cat >> $apache_install_dir/conf/vhost/0.conf << EOF EOF -cat >> $apache_install_dir/conf/httpd.conf <> $apache_install_dir/conf/httpd.conf < AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript @@ -131,7 +128,7 @@ ServerSignature Off Include conf/vhost/*.conf EOF -if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ];then + if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader X-Forwarded-For @@ -139,8 +136,8 @@ RemoteIPInternalProxy 127.0.0.1 EOF sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" $apache_install_dir/conf/httpd.conf -fi -ldconfig -service httpd start -cd .. + fi + ldconfig + service httpd start + popd } diff --git a/include/apcu.sh b/include/apcu.sh index 689a469f..b97db664 100644 --- a/include/apcu.sh +++ b/include/apcu.sh @@ -9,21 +9,21 @@ # https://github.com/lj2007331/oneinstack Install_APCU() { - pushd ${oneinstack_dir}/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - tar xzf apcu-${apcu_for_php7_version}.tgz - pushd apcu-${apcu_for_php7_version} - else - tar xzf apcu-${apcu_version}.tgz - pushd apcu-${apcu_version} - fi - - ${php_install_dir}/bin/phpize - ./configure --with-php-config=${php_install_dir}/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/apcu.so" ];then - cat > ${php_install_dir}/etc/php.d/ext-apcu.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + tar xzf apcu-${apcu_for_php7_version}.tgz + pushd apcu-${apcu_for_php7_version} + else + tar xzf apcu-${apcu_version}.tgz + pushd apcu-${apcu_version} + fi + + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/apcu.so" ]; then + cat > ${php_install_dir}/etc/php.d/ext-apcu.ini << EOF [apcu] extension=apcu.so apc.enabled=1 @@ -31,13 +31,12 @@ apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 EOF - [ "${Apache_version}" != '1' -a "${Apache_version}" != '2' ] && service php-fpm restart || service httpd restart - /bin/cp apc.php ${wwwroot_dir}/default - echo "${CSUCCESS}APCU module installed successfully! ${CEND}" - else - echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}" - fi - popd - rm -rf apcu-${apcu_version} + /bin/cp apc.php ${wwwroot_dir}/default + echo "${CSUCCESS}APCU module installed successfully! ${CEND}" popd + rm -rf apcu-${apcu_for_php7_version} apcu-${apcu_version} package.xml + else + echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/boost.sh b/include/boost.sh index d69a1a72..1cb15e2e 100644 --- a/include/boost.sh +++ b/include/boost.sh @@ -8,10 +8,9 @@ # https://github.com/lj2007331/oneinstack installBoost() { - pushd $oneinstack_dir/src - + pushd ${oneinstack_dir}/src if [ ! -e "/usr/local/lib/libboost_system.so" ]; then - boostVersion2=$(echo $boost_version | awk -F. '{print $1}')_$(echo $boost_version | awk -F. '{print $2}')_$(echo $boost_version | awk -F. '{print $3}') + boostVersion2=$(echo ${boost_version} | awk -F. '{print $1}')_$(echo ${boost_version} | awk -F. '{print $2}')_$(echo ${boost_version} | awk -F. '{print $3}') tar xvf boost_${boostVersion2}.tar.gz pushd boost_${boostVersion2} ./bootstrap.sh @@ -19,15 +18,13 @@ installBoost() { ./b2 install popd fi - if [ -e "/usr/local/lib/libboost_system.so" ];then - echo "${CSUCCESS}Boost installed successfully! ${CEND}" - rm -rf boost_${boostVersion2} + if [ -e "/usr/local/lib/libboost_system.so" ]; then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig - else + echo "${CSUCCESS}Boost installed successfully! ${CEND}" rm -rf boost_${boostVersion2} + else echo "${CFAILURE}Boost installed failed, Please contact the author! ${CEND}" fi - popd } diff --git a/include/check_download.sh b/include/check_download.sh index e94b8666..6ec9506d 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -8,647 +8,645 @@ # https://github.com/lj2007331/oneinstack checkDownload() { - mirrorLink=http://mirrors.linuxeye.com/oneinstack/src - pushd ${oneinstack_dir}/src + pushd ${oneinstack_dir}/src + mirrorLink=http://mirrors.linuxeye.com/oneinstack/src + + # Web + if [ "${Web_yn}" == 'y' ]; then + echo "Download openSSL..." + src_url=https://www.openssl.org/source/openssl-${openssl_version}.tar.gz && Download_src + if [ "${Nginx_version}" == "1" ]; then + echo "Download nginx..." + src_url=http://nginx.org/download/nginx-${nginx_version}.tar.gz && Download_src + fi + if [ "${Nginx_version}" == "2" ]; then + echo "Download tengine..." + src_url=http://tengine.taobao.org/download/tengine-${tengine_version}.tar.gz && Download_src + fi + if [ "${Nginx_version}" == "3" ]; then + echo "Download openresty..." + src_url=https://openresty.org/download/openresty-${openresty_version}.tar.gz && Download_src + fi - # Web - if [ "${Web_yn}" == 'y' ];then - echo "Download openSSL..." - src_url=https://www.openssl.org/source/openssl-${openssl_version}.tar.gz && Download_src - if [ "${Nginx_version}" == "1" ];then - echo "Download nginx..." - src_url=http://nginx.org/download/nginx-${nginx_version}.tar.gz && Download_src - fi - if [ "${Nginx_version}" == "2" ];then - echo "Download tengine..." - src_url=http://tengine.taobao.org/download/tengine-${tengine_version}.tar.gz && Download_src - fi - if [ "${Nginx_version}" == "3" ];then - echo "Download openresty..." - src_url=https://openresty.org/download/openresty-${openresty_version}.tar.gz && Download_src - fi - - if [[ "${Nginx_version}" =~ ^[1-3]$ || ${Apache_version} == "1" ]];then - echo "Download pcre..." - src_url=${mirrorLink}/pcre-${pcre_version}.tar.gz && Download_src - fi - - # apache - if [ "${Apache_version}" == "1" ];then - echo "Download apache 2.4..." - src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src - src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_4_version}.tar.gz && Download_src - fi - if [ "${Apache_version}" == "2" ];then - echo "Download apache 2.2..." - src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_2_version}.tar.gz && Download_src - - echo "Download mod_remoteip.c for apache 2.2..." - src_url=${mirrorLink}/mod_remoteip.c && Download_src - fi - - # tomcat - if [ "${Tomcat_version}" == "1" ];then - echo "Download tomcat 8..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src - fi - if [ "${Tomcat_version}" == "2" ];then - echo "Download tomcat 7..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src - fi - if [ "${Tomcat_version}" == "3" ];then - echo "Download tomcat 6..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src - fi - - if [[ "${JDK_version}" =~ ^[1-3]$ ]];then - if [ "${JDK_version}" == "1" ];then - echo "Download jdk 1.8..." - JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" - fi - if [ "${JDK_version}" == "2" ];then - echo "Download jdk 1.7..." - JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" - fi - if [ "${JDK_version}" == "3" ];then - echo "Download jdk 1.6..." - JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" - fi - src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src - fi + if [[ "${Nginx_version}" =~ ^[1-3]$ || ${Apache_version} == "1" ]]; then + echo "Download pcre..." + src_url=${mirrorLink}/pcre-${pcre_version}.tar.gz && Download_src fi - if [ "${DB_yn}" == "y" ];then - if [[ "${DB_version}" =~ ^[1,4,7]$ ]] && [ "${dbInstallMethods}" == "2" ];then - echo "Download boost..." - [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_version} - boostVersion2=$(echo ${boost_version} | awk -F. '{print $1}')_$(echo ${boost_version} | awk -F. '{print $2}')_$(echo ${boost_version} | awk -F. '{print $3}') - src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src - fi - - if [ "${DB_version}" == "1" ];then - # mysql 5.7 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - fi - fi - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mysql 5.7 binary package..." - FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download mysql 5.7 source package..." - FILE_NAME=mysql-${mysql_5_7_version}.tar.gz - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "2" ];then - # mysql 5.6 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - fi - fi - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mysql 5.6 binary package..." - FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download MySQL 5.5 source package..." - FILE_NAME=mysql-${mysql_5_6_version}.tar.gz - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "3" ];then - # mysql 5.5 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ];then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ];then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 - else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ];then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 - else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} - fi - fi - fi - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mysql 5.5 binary package..." - FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download MySQL 5.5 source package..." - FILE_NAME=mysql-${mysql_5_5_version}.tar.gz - src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "4" ];then - # mariaDB 10.1 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mariaDB 10.1 binary package..." - FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download mariaDB 10.1 source package..." - FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "5" ];then - # mariaDB 10.0 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mariaDB 10.0 binary package..." - FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download mariaDB 10.0 source package..." - FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - if [ "${DB_version}" == "6" ];then - # mariaDB 5.5 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download mariaDB 5.5 binary package..." - FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download mariaDB 10.0 source package..." - FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "7" ];then - # precona 5.7 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download percona 5.7 binary package..." - FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download percona 5.7 source package..." - FILE_NAME=percona-server-${percona_5_7_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "8" ];then - # precona 5.6 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download percona 5.6 binary package..." - perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") - FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download percona 5.6 source package..." - FILE_NAME=percona-server-${percona_5_6_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "9" ];then - # precona 5.5 - if [ "${dbInstallMethods}" == "1" ];then - echo "Download percona 5.5 binary package..." - perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") - FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ];then - echo "Download percona 5.5 source package..." - FILE_NAME=percona-server-${percona_5_5_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ];then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - - if [ "${tryDlCount}" == "6" ];then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi + # apache + if [ "${Apache_version}" == "1" ]; then + echo "Download apache 2.4..." + src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src + src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_4_version}.tar.gz && Download_src fi - # PHP - if [ "${PHP_yn}" == "y" ];then - # php 5.3 5.4 5.5 5.6 5.7 - echo "PHP common..." - src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${libiconv_version}.tar.gz && Download_src - src_url=https://curl.haxx.se/download/curl-${curl_version}.tar.gz && Download_src - src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${libmcrypt_version}/libmcrypt-${libmcrypt_version}.tar.gz && Download_src - src_url=http://downloads.sourceforge.net/project/mhash/mhash/${mhash_version}/mhash-${mhash_version}.tar.gz && Download_src - src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_version}/mcrypt-${mcrypt_version}.tar.gz && Download_src - src_url=${mirrorLink}/libiconv-glibc-2.16.patch && Download_src - - if [[ "${PHP_version}" =~ ^[1-3]$ ]];then - # php 5.3 5.4 5.5 - src_url=${mirrorLink}/fpm-race-condition.patch && Download_src - fi - - if [ "${PHP_version}" == "1" ];then - # php 5.3 - src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src - src_url=${mirrorLink}/php5.3patch && Download_src - if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then - if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ];then - src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src - fi - fi - src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "2" ];then - src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "3" ];then - src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "4" ];then - src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "5" ];then - src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src - fi - - # PHP OPCache - if [ "${PHP_cache}" == "1" ] && [[ "$PHP_version" =~ ^[1,2]$ ]];then - # php 5.3 5.4 - echo "Download Zend OPCache..." - src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src - fi - if [ "${PHP_cache}" == "2" ] && [[ "$PHP_version" =~ ^[1-4]$ ]];then - # php 5.3 5.4 5.5 5.6 - echo "Download xcache..." - src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src - fi - if [ "${PHP_cache}" == "3" ];then - # php 5.3 5.4 5.5 5.6 7.0 - echo "Download apcu..." - if [ "${PHP_version}" != "5" ]; then - src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src - else - src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src - fi - fi - if [ "${PHP_cache}" == "4" -a "${PHP_version}" == "2" ];then - echo "Download eaccelerator 1.0 dev..." - src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src - elif [ "${PHP_cache}" == "4" -a "${PHP_version}" == "1" ];then - echo "Download eaccelerator 0.9..." - src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src - fi - - # Zend Guard Loader - if [ "${ZendGuardLoader_yn}" == "y" -a "${armPlatform}" != "y" ];then - if [ "${PHP_version}" == "4" ];then - if [ "${OS_BIT}" == "64" ];then - # 64 bit - echo "Download zend loader for php 5.6..." - src_url=${mirrorLink}/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download zend loader for php 5.6..." - src_url=${mirrorLink}/zend-loader-php5.6-linux-i386.tar.gz && Download_src - fi - fi - if [ "${PHP_version}" == "3" ];then - if [ "${OS_BIT}" == "64" ];then - # 64 bit - echo "Download zend loader for php 5.5..." - src_url=${mirrorLink}/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download zend loader for php 5.5..." - src_url=${mirrorLink}/zend-loader-php5.5-linux-i386.tar.gz && Download_src - fi - fi - if [ "${PHP_version}" == "2" ];then - if [ "${OS_BIT}" == "64" ];then - # 64 bit - echo "Download zend loader for php 5.4..." - src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download zend loader for php 5.4..." - src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src - fi - fi - if [ "${PHP_version}" == "1" ];then - if [ "${OS_BIT}" == "64" ];then - # 64 bit - echo "Download zend loader for php 5.3..." - src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download zend loader for php 5.3..." - src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src - fi - fi - fi - - if [ "${ionCube_yn}" == "y" ];then - echo "Download ioncube..." - if [ "${OS_BIT}" == '64' ];then - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src - else - if [ "${TARGET_ARCH}" == "armv7" ]; then - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz && Download_src - else - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src - fi - fi - fi - - if [ "${Magick_yn}" == "y" ];then - if [ "${Magick}" == "1" ];then - echo "Download ImageMagick..." - src_url=${mirrorLink}/ImageMagick-${ImageMagick_version}.tar.gz && Download_src - if [ "${PHP_version}" == "1" ];then - echo "Download image for php 5.3..." - src_url=https://pecl.php.net/get/imagick-${imagick_for_php53_version}.tgz && Download_src - else - echo "Download imagick..." - src_url=http://pecl.php.net/get/imagick-${imagick_version}.tgz && Download_src - fi - else - echo "Download graphicsmagick..." - src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${GraphicsMagick_version}/GraphicsMagick-${GraphicsMagick_version}.tar.gz && Download_src - if [ "${PHP_version}" == "5" ];then - echo "Download gmagick for php7..." - src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src - else - echo "Download gmagick for php..." - src_url=http://pecl.php.net/get/gmagick-${gmagick_version}.tgz && Download_src - fi - fi - fi + if [ "${Apache_version}" == "2" ]; then + echo "Download apache 2.2..." + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_2_version}.tar.gz && Download_src + echo "Download mod_remoteip.c for apache 2.2..." + src_url=${mirrorLink}/mod_remoteip.c && Download_src fi - if [ "${FTP_yn}" == "y" ];then - echo "Download pureftpd..." - src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src + # tomcat + if [ "${Tomcat_version}" == "1" ]; then + echo "Download tomcat 8..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src fi - - if [ "${phpMyAdmin_yn}" == "y" ];then - echo "Download phpMyAdmin..." - src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpMyAdmin_version}/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz && Download_src + if [ "${Tomcat_version}" == "2" ]; then + echo "Download tomcat 7..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src + fi + if [ "${Tomcat_version}" == "3" ]; then + echo "Download tomcat 6..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src fi - if [ "${redis_yn}" == "y" ];then - echo "Download redis..." - src_url=http://download.redis.io/releases/redis-${redis_version}.tar.gz && Download_src - if [ "${OS}" == "CentOS" ];then - echo "Download start-stop-daemon.c for CentOS..." - src_url=${mirrorLink}/start-stop-daemon.c && Download_src - fi - # redis addon - if [ "${PHP_version}" == "5" ];then - echo "Download redis pecl for php7..." - src_url=http://pecl.php.net/get/redis-${redis_pecl_for_php7_version}.tgz && Download_src + if [[ "${JDK_version}" =~ ^[1-3]$ ]]; then + if [ "${JDK_version}" == "1" ]; then + echo "Download jdk 1.8..." + JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + fi + if [ "${JDK_version}" == "2" ]; then + echo "Download jdk 1.7..." + JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + fi + if [ "${JDK_version}" == "3" ]; then + echo "Download jdk 1.6..." + JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" + fi + src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src + fi + fi + + if [ "${DB_yn}" == "y" ]; then + if [[ "${DB_version}" =~ ^[1,4,7]$ ]] && [ "${dbInstallMethods}" == "2" ]; then + echo "Download boost..." + [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_version} + boostVersion2=$(echo ${boost_version} | awk -F. '{print $1}')_$(echo ${boost_version} | awk -F. '{print $2}')_$(echo ${boost_version} | awk -F. '{print $3}') + src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src + fi + + if [ "${DB_version}" == "1" ]; then + # mysql 5.7 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi else - echo "Download redis pecl..." - src_url=http://pecl.php.net/get/redis-${redis_pecl_version}.tgz && Download_src - fi + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MySQL 5.7 binary package..." + FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MySQL 5.7 source package..." + FILE_NAME=mysql-${mysql_5_7_version}.tar.gz + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done fi - - if [ "${memcached_yn}" == "y" ];then - echo "Download memcached..." - src_url=http://www.memcached.org/files/memcached-${memcached_version}.tar.gz && Download_src - if [ "${PHP_version}" == "5" ];then - echo "Download pecl memcache for php7..." - src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src - echo "Download php-memcached for php7..." - src_url=${mirrorLink}/php-memcached-php7.tgz && Download_src + + if [ "${DB_version}" == "2" ]; then + # mysql 5.6 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi else - echo "Download pecl memcache for php7..." - src_url=http://pecl.php.net/get/memcache-${memcache_pecl_version}.tgz && Download_src - echo "Download php-memcached for php7..." - src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src - fi - - echo "Download libmemcached..." - src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_version}/+download/libmemcached-${libmemcached_version}.tar.gz && Download_src + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MySQL 5.6 binary package..." + FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MySQL 5.5 source package..." + FILE_NAME=mysql-${mysql_5_6_version}.tar.gz + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done + fi + + if [ "${DB_version}" == "3" ]; then + # mysql 5.5 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + else + if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi + fi + fi + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MySQL 5.5 binary package..." + FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MySQL 5.5 source package..." + FILE_NAME=mysql-${mysql_5_5_version}.tar.gz + src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue + done + fi + + if [ "${DB_version}" == "4" ]; then + # mariaDB 10.1 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MariaDB 10.1 binary package..." + FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MariaDB 10.1 source package..." + FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "5" ]; then + # mariaDB 10.0 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MariaDB 10.0 binary package..." + FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MariaDB 10.0 source package..." + FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + if [ "${DB_version}" == "6" ]; then + # mariaDB 5.5 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download MariaDB 5.5 binary package..." + FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download MariaDB 5.5 source package..." + FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi fi + + if [ "${DB_version}" == "7" ]; then + # precona 5.7 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download Percona 5.7 binary package..." + FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download Percona 5.7 source package..." + FILE_NAME=percona-server-${percona_5_7_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "8" ]; then + # precona 5.6 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download Percona 5.6 binary package..." + perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download Percona 5.6 source package..." + FILE_NAME=percona-server-${percona_5_6_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + + if [ "${DB_version}" == "9" ]; then + # precona 5.5 + if [ "${dbInstallMethods}" == "1" ]; then + echo "Download Percona 5.5 binary package..." + perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == "2" ]; then + echo "Download Percona 5.5 source package..." + FILE_NAME=percona-server-${percona_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue + done + + if [ "${tryDlCount}" == "6" ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + fi + fi + # PHP + if [ "${PHP_yn}" == "y" ]; then + # php 5.3 5.4 5.5 5.6 5.7 + echo "PHP common..." + src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${libiconv_version}.tar.gz && Download_src + src_url=https://curl.haxx.se/download/curl-${curl_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${libmcrypt_version}/libmcrypt-${libmcrypt_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mhash/mhash/${mhash_version}/mhash-${mhash_version}.tar.gz && Download_src + src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_version}/mcrypt-${mcrypt_version}.tar.gz && Download_src + src_url=${mirrorLink}/libiconv-glibc-2.16.patch && Download_src - if [ "${je_tc_malloc_yn}" == "y" ];then - if [ "${je_tc_malloc}" == "1" ];then - echo "Download jemalloc..." - src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src - elif [ "${je_tc_malloc}" == "2" ];then - echo "Download tcmalloc..." - src_url=${mirrorLink}/gperftools-${tcmalloc_version}.tar.gz && Download_src - fi + if [[ "${PHP_version}" =~ ^[1-3]$ ]]; then + # php 5.3 5.4 5.5 + src_url=${mirrorLink}/fpm-race-condition.patch && Download_src fi - # others - if [ "${OS}" == "CentOS" ];then - echo "Download tmux for CentOS..." - src_url=${mirrorLink}/libevent-${libevent_version}.tar.gz && Download_src - src_url=${mirrorLink}/tmux-${tmux_version}.tar.gz && Download_src - - echo "Download htop for CentOS..." - src_url=http://hisham.hm/htop/releases/${htop_version}/htop-${htop_version}.tar.gz && Download_src + if [ "${PHP_version}" == "1" ]; then + # php 5.3 + src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src + src_url=${mirrorLink}/php5.3patch && Download_src + if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then + if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ]; then + src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src + fi + fi + src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "2" ]; then + src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "3" ]; then + src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "4" ]; then + src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src + fi + if [ "${PHP_version}" == "5" ]; then + src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src + fi + fi + + # PHP OPCache + if [ "${PHP_cache}" == "1" ] && [[ "$PHP_version" =~ ^[1,2]$ ]]; then + # php 5.3 5.4 + echo "Download Zend OPCache..." + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src + fi + if [ "${PHP_cache}" == "2" ] && [[ "$PHP_version" =~ ^[1-4]$ ]]; then + # php 5.3 5.4 5.5 5.6 + echo "Download xcache..." + src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src + fi + if [ "${PHP_cache}" == "3" ]; then + # php 5.3 5.4 5.5 5.6 7.0 + echo "Download apcu..." + if [ "${PHP_version}" != "5" ]; then + src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src + else + src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src + fi + fi + if [ "${PHP_cache}" == "4" -a "${PHP_version}" == "2" ]; then + echo "Download eaccelerator 1.0 dev..." + src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src + elif [ "${PHP_cache}" == "4" -a "${PHP_version}" == "1" ]; then + echo "Download eaccelerator 0.9..." + src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src + fi + + # Zend Guard Loader + if [ "${ZendGuardLoader_yn}" == "y" -a "${armPlatform}" != "y" ]; then + if [ "${PHP_version}" == "4" ]; then + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download ZendGuardLoader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download ZendGuardLoader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "3" ]; then + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download ZendGuardLoader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download ZendGuardLoader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "2" ]; then + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download ZendGuardLoader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download ZendGuardLoader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + fi + fi + if [ "${PHP_version}" == "1" ]; then + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download ZendGuardLoader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download ZendGuardLoader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + fi + fi + fi + + if [ "${ionCube_yn}" == "y" ]; then + echo "Download ioncube..." + if [ "${OS_BIT}" == '64' ]; then + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src + else + if [ "${TARGET_ARCH}" == "armv7" ]; then + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz && Download_src + else + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz && Download_src + fi + fi + fi + + if [ "${Magick_yn}" == "y" ]; then + if [ "${Magick}" == "1" ]; then + echo "Download ImageMagick..." + src_url=${mirrorLink}/ImageMagick-${ImageMagick_version}.tar.gz && Download_src + if [ "${PHP_version}" == "1" ]; then + echo "Download image for php 5.3..." + src_url=https://pecl.php.net/get/imagick-${imagick_for_php53_version}.tgz && Download_src + else + echo "Download imagick..." + src_url=http://pecl.php.net/get/imagick-${imagick_version}.tgz && Download_src + fi + else + echo "Download graphicsmagick..." + src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${GraphicsMagick_version}/GraphicsMagick-${GraphicsMagick_version}.tar.gz && Download_src + if [ "${PHP_version}" == "5" ]; then + echo "Download gmagick for php7..." + src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src + else + echo "Download gmagick for php..." + src_url=http://pecl.php.net/get/gmagick-${gmagick_version}.tgz && Download_src + fi + fi + fi + + if [ "${FTP_yn}" == "y" ]; then + echo "Download pureftpd..." + src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src + fi + + if [ "${phpMyAdmin_yn}" == "y" ]; then + echo "Download phpMyAdmin..." + src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpMyAdmin_version}/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz && Download_src + fi + + if [ "${redis_yn}" == "y" ]; then + echo "Download redis..." + src_url=http://download.redis.io/releases/redis-${redis_version}.tar.gz && Download_src + if [ "${OS}" == "CentOS" ]; then + echo "Download start-stop-daemon.c for CentOS..." + src_url=${mirrorLink}/start-stop-daemon.c && Download_src + fi + # redis addon + if [ "${PHP_version}" == "5" ]; then + echo "Download redis pecl for php7..." + src_url=http://pecl.php.net/get/redis-${redis_pecl_for_php7_version}.tgz && Download_src + else + echo "Download redis pecl..." + src_url=http://pecl.php.net/get/redis-${redis_pecl_version}.tgz && Download_src + fi + fi + + if [ "${memcached_yn}" == "y" ]; then + echo "Download memcached..." + src_url=http://www.memcached.org/files/memcached-${memcached_version}.tar.gz && Download_src + if [ "${PHP_version}" == "5" ]; then + echo "Download pecl memcache for php7..." + src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src + echo "Download php-memcached for php7..." + src_url=${mirrorLink}/php-memcached-php7.tgz && Download_src + else + echo "Download pecl memcache for php7..." + src_url=http://pecl.php.net/get/memcache-${memcache_pecl_version}.tgz && Download_src + echo "Download php-memcached for php7..." + src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src fi - if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]];then - echo "Download bison for Ubuntu..." - src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_version}.tar.gz && Download_src + echo "Download libmemcached..." + src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_version}/+download/libmemcached-${libmemcached_version}.tar.gz && Download_src + fi + + if [ "${je_tc_malloc_yn}" == "y" ]; then + if [ "${je_tc_malloc}" == "1" ]; then + echo "Download jemalloc..." + src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src + elif [ "${je_tc_malloc}" == "2" ]; then + echo "Download tcmalloc..." + src_url=${mirrorLink}/gperftools-${tcmalloc_version}.tar.gz && Download_src fi + fi + + # others + if [ "${OS}" == "CentOS" ]; then + echo "Download tmux for CentOS..." + src_url=${mirrorLink}/libevent-${libevent_version}.tar.gz && Download_src + src_url=${mirrorLink}/tmux-${tmux_version}.tar.gz && Download_src - popd + echo "Download htop for CentOS..." + src_url=http://hisham.hm/htop/releases/${htop_version}/htop-${htop_version}.tar.gz && Download_src + fi + + if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then + echo "Download bison for Ubuntu..." + src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_version}.tar.gz && Download_src + fi + popd } diff --git a/include/check_os.sh b/include/check_os.sh index 6d9ab7c1..0c283b06 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -8,51 +8,51 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ];then - OS=CentOS - [ -n "$(grep ' 7\.' /etc/redhat-release)" ] && CentOS_RHEL_version=7 - [ -n "$(grep ' 6\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6 - [ -n "$(grep ' 5\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5 -elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ];then - OS=CentOS - CentOS_RHEL_version=6 -elif [ -n "$(grep bian /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Debian' ];then - OS=Debian - [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Debian_version=$(lsb_release -sr | awk -F. '{print $1}') -elif [ -n "$(grep Deepin /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Deepin' ];then - OS=Debian - [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Debian_version=$(lsb_release -sr | awk -F. '{print $1}') -elif [ -n "$(grep Ubuntu /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Ubuntu' -o -n "$(grep 'Linux Mint' /etc/issue)" ];then - OS=Ubuntu - [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } - Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}') - [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16 +if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ]; then + OS=CentOS + [ -n "$(grep ' 7\.' /etc/redhat-release)" ] && CentOS_RHEL_version=7 + [ -n "$(grep ' 6\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6 + [ -n "$(grep ' 5\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5 +elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ]; then + OS=CentOS + CentOS_RHEL_version=6 +elif [ -n "$(grep bian /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Debian' ]; then + OS=Debian + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Debian_version=$(lsb_release -sr | awk -F. '{print $1}') +elif [ -n "$(grep Deepin /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Deepin' ]; then + OS=Debian + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Debian_version=$(lsb_release -sr | awk -F. '{print $1}') +elif [ -n "$(grep Ubuntu /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Ubuntu' -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then + OS=Ubuntu + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}') + [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16 else - echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" - kill -9 $$ + echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" + kill -9 $$ fi if uname -m | grep -Eqi "arm"; then - armPlatform="y" - if uname -m | grep -Eqi "armv7"; then - TARGET_ARCH="armv7" - elif uname -m | grep -Eqi "armv8"; then - TARGET_ARCH="arm64" - else - TARGET_ARCH="unknown" - fi + armPlatform="y" + if uname -m | grep -Eqi "armv7"; then + TARGET_ARCH="armv7" + elif uname -m | grep -Eqi "armv8"; then + TARGET_ARCH="arm64" + else + TARGET_ARCH="unknown" + fi fi -if [ $(getconf WORD_BIT) == 32 ] && [ $(getconf LONG_BIT) == 64 ];then - OS_BIT=64 - SYS_BIG_FLAG=x64 #jdk - SYS_BIT_a=x86_64;SYS_BIT_b=x86_64; #mariadb +if [ $(getconf WORD_BIT) == 32 ] && [ $(getconf LONG_BIT) == 64 ]; then + OS_BIT=64 + SYS_BIG_FLAG=x64 #jdk + SYS_BIT_a=x86_64;SYS_BIT_b=x86_64; #mariadb else - OS_BIT=32 - SYS_BIG_FLAG=i586 - SYS_BIT_a=x86;SYS_BIT_b=i686; + OS_BIT=32 + SYS_BIG_FLAG=i586 + SYS_BIT_a=x86;SYS_BIT_b=i686; fi LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') @@ -61,16 +61,16 @@ LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) # Percona -if [ -f "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0" ];then - if [ "${Debian_version}" == "6" ];then - sslLibVer=ssl098 - else - sslLibVer=ssl100 - fi -elif [ -f "/usr/lib64/libssl.so.10" ];then - if [ "${CentOS_RHEL_version}" == "5" ];then - sslLibVer=ssl098e - else - sslLibVer=ssl101 - fi +if [ -f "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0" ]; then + if [ "${Debian_version}" == "6" ]; then + sslLibVer=ssl098 + else + sslLibVer=ssl100 + fi +elif [ -f "/usr/lib64/libssl.so.10" ]; then + if [ "${CentOS_RHEL_version}" == "5" ]; then + sslLibVer=ssl098e + else + sslLibVer=ssl101 + fi fi diff --git a/include/check_port.py b/include/check_port.py index c5b338ea..4d57ce68 100755 --- a/include/check_port.py +++ b/include/check_port.py @@ -1,13 +1,13 @@ #!/usr/bin/env python import sys,os,socket def IsOpen(ip,port): - socket.setdefaulttimeout(5) - s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) - try: - s.connect((ip,int(port))) - s.shutdown(2) - print True - except: - print False + socket.setdefaulttimeout(5) + s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) + try: + s.connect((ip,int(port))) + s.shutdown(2) + print True + except: + print False if __name__ == '__main__': - IsOpen(sys.argv[1],int(sys.argv[2])) + IsOpen(sys.argv[1],int(sys.argv[2])) diff --git a/include/color.sh b/include/color.sh index c613fd28..16019004 100644 --- a/include/color.sh +++ b/include/color.sh @@ -10,11 +10,11 @@ echo=echo for cmd in echo /bin/echo; do - $cmd >/dev/null 2>&1 || continue - if ! $cmd -e "" | grep -qE '^-e';then - echo=$cmd - break - fi + $cmd >/dev/null 2>&1 || continue + if ! $cmd -e "" | grep -qE '^-e'; then + echo=$cmd + break + fi done CSI=$($echo -e "\033[") CEND="${CSI}0m" diff --git a/include/demo.sh b/include/demo.sh index e917f63e..8784ad87 100644 --- a/include/demo.sh +++ b/include/demo.sh @@ -9,36 +9,42 @@ # https://github.com/lj2007331/oneinstack DEMO() { -cd $oneinstack_dir/src + pushd ${oneinstack_dir}/src -[ "$IPADDR_COUNTRY"x == "CN"x ] && /bin/cp ../config/index_cn.html $wwwroot_dir/default/index.html || /bin/cp ../config/index.html $wwwroot_dir/default + [ "${IPADDR_COUNTRY}"x == "CN"x ] && /bin/cp ${oneinstack_dir}/config/index_cn.html ${wwwroot_dir}/default/index.html || /bin/cp ${oneinstack_dir}/config/index.html ${wwwroot_dir}/default -if [ -e "$php_install_dir/bin/php" ];then - if [ "$IPADDR_COUNTRY"x == "CN"x ];then - src_url=http://mirrors.linuxeye.com/oneinstack/src/tz.zip && Download_src - unzip -q tz.zip -d $wwwroot_dir/default + if [ -e "${php_install_dir}/bin/php" ]; then + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + src_url=http://mirrors.linuxeye.com/oneinstack/src/tz.zip && Download_src + unzip -q tz.zip -d ${wwwroot_dir}/default else - src_url=http://mirrors.linuxeye.com/oneinstack/src/tz_e.zip && Download_src - unzip -q tz_e.zip -d $wwwroot_dir/default;/bin/mv $wwwroot_dir/default/{tz_e.php,proberv.php} - sed -i 's@https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js@http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js@' $wwwroot_dir/default/proberv.php + src_url=http://mirrors.linuxeye.com/oneinstack/src/tz_e.zip && Download_src + unzip -q tz_e.zip -d ${wwwroot_dir}/default;/bin/mv ${wwwroot_dir}/default/{tz_e.php,proberv.php} + sed -i 's@https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js@http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js@' ${wwwroot_dir}/default/proberv.php fi - echo '' > $wwwroot_dir/default/phpinfo.php - if [ "$PHP_cache" == '1' ];then + echo '' > ${wwwroot_dir}/default/phpinfo.php + case "${PHP_cache}" in + 1) src_url=http://mirrors.linuxeye.com/oneinstack/src/ocp.php && Download_src - /bin/cp ocp.php $wwwroot_dir/default - elif [ "$PHP_cache" == '2' ];then - sed -i 's@Opcache@xcache@' $wwwroot_dir/default/index.html - elif [ "$PHP_cache" == '3' ];then - sed -i 's@Opcache@APC@' $wwwroot_dir/default/index.html - elif [ "$PHP_cache" == '4' ];then - /bin/cp eaccelerator-*/control.php $wwwroot_dir/default - sed -i 's@Opcache@eAccelerator@' $wwwroot_dir/default/index.html - else - sed -i 's@Opcache@@' $wwwroot_dir/default/index.html - fi -fi -chown -R ${run_user}.$run_user $wwwroot_dir/default -[ -e /usr/bin/systemctl ] && systemctl daemon-reload -cd .. + /bin/cp ocp.php ${wwwroot_dir}/default + ;; + 2) + sed -i 's@Opcache@xcache@' ${wwwroot_dir}/default/index.html + ;; + 3) + sed -i 's@Opcache@APC@' ${wwwroot_dir}/default/index.html + ;; + 4) + /bin/cp eaccelerator-*/control.php ${wwwroot_dir}/default + sed -i 's@Opcache@eAccelerator@' ${wwwroot_dir}/default/index.html + ;; + *) + sed -i 's@Opcache@@' ${wwwroot_dir}/default/index.html + ;; + esac + fi + chown -R ${run_user}.${run_user} ${wwwroot_dir}/default + [ -e /usr/bin/systemctl ] && systemctl daemon-reload + popd } diff --git a/include/download.sh b/include/download.sh index a89f4d2a..cc4e0f0a 100644 --- a/include/download.sh +++ b/include/download.sh @@ -9,9 +9,9 @@ # https://github.com/lj2007331/oneinstack Download_src() { - [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget --tries=6 -c --no-check-certificate $src_url; sleep 1; } - if [ ! -e "${src_url##*/}" ];then - echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" - kill -9 $$ - fi + [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget --tries=6 -c --no-check-certificate $src_url; sleep 1; } + if [ ! -e "${src_url##*/}" ]; then + echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" + kill -9 $$ + fi } diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator-0.9.sh index 7327bf26..7e662dde 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator-0.9.sh @@ -9,18 +9,17 @@ # https://github.com/lj2007331/oneinstack Install_eAccelerator-0-9() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 - pushd eaccelerator-${eaccelerator_version} - make clean - $php_install_dir/bin/phpize - ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - - if [ -f "${phpExtensionDir}/eaccelerator.so" ];then - mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 + pushd eaccelerator-${eaccelerator_version} + ${php_install_dir}/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd + if [ -f "${phpExtensionDir}/eaccelerator.so" ]; then + mkdir /var/eaccelerator_cache;chown -R ${run_user}.${run_user} /var/eaccelerator_cache + cat > ${php_install_dir}/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] zend_extension=${phpExtensionDir}/eaccelerator.so eaccelerator.shm_size=64 @@ -40,13 +39,12 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - popd - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf - sysctl -p - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" - fi - popd + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" + [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p + rm -rf eaccelerator-${eaccelerator_version} + else + echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh index f6e86cd5..a0aae6ec 100644 --- a/include/eaccelerator-1.0-dev.sh +++ b/include/eaccelerator-1.0-dev.sh @@ -9,18 +9,18 @@ # https://github.com/lj2007331/oneinstack Install_eAccelerator-1-0-dev() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz - tar xzf eaccelerator-eaccelerator-42067ac.tar.gz - pushd eaccelerator-eaccelerator-42067ac - make clean - $php_install_dir/bin/phpize - ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/eaccelerator.so" ];then - mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache - cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz + tar xzf eaccelerator-eaccelerator-42067ac.tar.gz + pushd eaccelerator-eaccelerator-42067ac + ${php_install_dir}/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd + if [ -f "${phpExtensionDir}/eaccelerator.so" ]; then + mkdir /var/eaccelerator_cache;chown -R ${run_user}.${run_user} /var/eaccelerator_cache + cat > ${php_install_dir}/etc/php.d/ext-eaccelerator.ini << EOF [eaccelerator] zend_extension=${phpExtensionDir}/eaccelerator.so eaccelerator.shm_size=64 @@ -40,13 +40,12 @@ eaccelerator.keys=disk_only eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF - echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - popd - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf - sysctl -p - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" - fi - popd + echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" + rm -rf eaccelerator-eaccelerator-42067ac + [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + sysctl -p + else + echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/get_ipaddr.py b/include/get_ipaddr.py index d2f121c5..c9d1d46f 100755 --- a/include/get_ipaddr.py +++ b/include/get_ipaddr.py @@ -1,22 +1,22 @@ #!/usr/bin/env python import socket def Get_local_ip(): - """ - Returns the actual ip of the local machine. - This code figures out what source address would be used if some traffic - were to be sent out to some well known address on the Internet. In this - case, a Google DNS server is used, but the specific address does not - matter much. No traffic is actually sent. - """ - try: - csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - csock.connect(('8.8.8.8', 80)) - (addr, port) = csock.getsockname() - csock.close() - return addr - except socket.error: - return "127.0.0.1" + """ + Returns the actual ip of the local machine. + This code figures out what source address would be used if some traffic + were to be sent out to some well known address on the Internet. In this + case, a Google DNS server is used, but the specific address does not + matter much. No traffic is actually sent. + """ + try: + csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + csock.connect(('8.8.8.8', 80)) + (addr, port) = csock.getsockname() + csock.close() + return addr + except socket.error: + return "127.0.0.1" if __name__ == "__main__": - IPADDR = Get_local_ip() - print IPADDR + IPADDR = Get_local_ip() + print IPADDR diff --git a/include/get_ipaddr_state.py b/include/get_ipaddr_state.py index 23593998..088872f2 100755 --- a/include/get_ipaddr_state.py +++ b/include/get_ipaddr_state.py @@ -2,14 +2,14 @@ #coding:utf-8 import sys,urllib2,socket try: - 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'] - code = eval(content)['code'] - if code == 0: - print data['country_id'],data['isp_id'] - else: - print data + 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'] + code = eval(content)['code'] + if code == 0: + print data['country_id'],data['isp_id'] + else: + print data except: - print "Usage:%s IP" % sys.argv[0] + print "Usage:%s IP" % sys.argv[0] diff --git a/include/get_public_ipaddr.py b/include/get_public_ipaddr.py index 78c40f9d..14254594 100755 --- a/include/get_public_ipaddr.py +++ b/include/get_public_ipaddr.py @@ -1,21 +1,21 @@ #!/usr/bin/env python import re,urllib2 class Get_public_ip: - def getip(self): - try: - myip = self.visit("http://ip.chinaz.com/getip.aspx") - except: - try: - myip = self.visit("http://ipv4.icanhazip.com/") - except: - myip = "So sorry!!!" - return myip - def visit(self,url): - opener = urllib2.urlopen(url) - if url == opener.geturl(): - str = opener.read() - return re.search('\d+\.\d+\.\d+\.\d+',str).group(0) + def getip(self): + try: + myip = self.visit("http://ip.chinaz.com/getip.aspx") + except: + try: + myip = self.visit("http://ipv4.icanhazip.com/") + except: + myip = "So sorry!!!" + return myip + def visit(self,url): + opener = urllib2.urlopen(url) + if url == opener.geturl(): + str = opener.read() + return re.search('\d+\.\d+\.\d+\.\d+',str).group(0) if __name__ == "__main__": - getmyip = Get_public_ip() - print getmyip.getip() + getmyip = Get_public_ip() + print getmyip.getip() diff --git a/include/hhvm_CentOS.sh b/include/hhvm_CentOS.sh index 09255cae..49cc4a58 100644 --- a/include/hhvm_CentOS.sh +++ b/include/hhvm_CentOS.sh @@ -9,12 +9,10 @@ # https://github.com/lj2007331/oneinstack Install_hhvm_CentOS() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -if [ "$CentOS_RHEL_version" == '7' ];then + pushd ${oneinstack_dir}/src + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + if [ "$CentOS_RHEL_version" == '7' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch @@ -33,9 +31,9 @@ gpgcheck=0 EOF yum -y install hhvm [ ! -e "/usr/bin/hhvm" -a "/usr/local/bin/hhvm" ] && ln -s /usr/local/bin/hhvm /usr/bin/hhvm -fi + fi -if [ "$CentOS_RHEL_version" == '6' ];then + if [ "$CentOS_RHEL_version" == '6' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch @@ -62,13 +60,13 @@ gpgcheck=0 EOF yum --disablerepo=epel -y install mysql mysql-devel mysql-libs yum --disablerepo=epel -y install hhvm -fi - -userdel -r nginx;userdel -r saslauth -rm -rf /var/log/hhvm -mkdir /var/log/hhvm -chown -R ${run_user}.${run_user} /var/log/hhvm -cat > /etc/hhvm/config.hdf << EOF + fi + + userdel -r nginx;userdel -r saslauth + rm -rf /var/log/hhvm + mkdir /var/log/hhvm + chown -R ${run_user}.${run_user} /var/log/hhvm + cat > /etc/hhvm/config.hdf << EOF ResourceLimit { CoreFileSize = 0 # in bytes MaxSocket = 10000 # must be not 0, otherwise HHVM will not start @@ -107,7 +105,7 @@ Mail { } EOF -cat > /etc/hhvm/server.ini << EOF + cat > /etc/hhvm/server.ini << EOF ; php options pid = /var/log/hhvm/pid @@ -121,29 +119,29 @@ hhvm.log.file = /var/log/hhvm/error.log hhvm.repo.central.path = /var/log/hhvm/hhvm.hhbc EOF -cat > /etc/hhvm/php.ini << EOF + cat > /etc/hhvm/php.ini << EOF hhvm.mysql.socket = /tmp/mysql.sock expose_php = 0 memory_limit = 400000000 post_max_size = 50000000 EOF -if [ -e "$web_install_dir/sbin/nginx" -a -e "/usr/bin/hhvm" -a ! -e "$php_install_dir" ];then + if [ -e "$web_install_dir/sbin/nginx" -a -e "/usr/bin/hhvm" -a ! -e "$php_install_dir" ]; then sed -i 's@/dev/shm/php-cgi.sock@/var/log/hhvm/sock@' $web_install_dir/conf/nginx.conf [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf service nginx reload -fi - -rm -rf /etc/ld.so.conf.d/*_64.conf -ldconfig -# Supervisor -yum -y install python-setuptools -ping pypi.python.org -c 4 >/dev/null 2>&1 -easy_install supervisor -echo_supervisord_conf > /etc/supervisord.conf -sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf -[ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF + fi + + rm -rf /etc/ld.so.conf.d/*_64.conf + ldconfig + # Supervisor + yum -y install python-setuptools + ping pypi.python.org -c 4 >/dev/null 2>&1 + easy_install supervisor + echo_supervisord_conf > /etc/supervisord.conf + sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf + [ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF [program:hhvm] command=/usr/bin/hhvm --mode server --user $run_user --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf numprocs=1 ; number of processes copies to start (def 1) @@ -152,9 +150,9 @@ autostart=true ; start at supervisord start (default: true) autorestart=unexpected ; whether/when to restart (default: unexpected) stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) EOF -/bin/cp ../init.d/Supervisor-init-CentOS /etc/init.d/supervisord -chmod +x /etc/init.d/supervisord -chkconfig supervisord on -service supervisord start -cd .. + /bin/cp ../init.d/Supervisor-init-CentOS /etc/init.d/supervisord + chmod +x /etc/init.d/supervisord + chkconfig supervisord on + service supervisord start + popd } diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index d0e3b80b..c7257370 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -13,15 +13,15 @@ yum clean all yum makecache -if [ "$CentOS_RHEL_version" == '7' ];then - yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server" - yum -y install iptables-services - systemctl mask firewalld.service - systemctl enable iptables.service -elif [ "$CentOS_RHEL_version" == '6' ];then - yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" -elif [ "$CentOS_RHEL_version" == '5' ];then - yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" +if [ "$CentOS_RHEL_version" == '7' ]; then + yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server" + yum -y install iptables-services + systemctl mask firewalld.service + systemctl enable iptables.service +elif [ "$CentOS_RHEL_version" == '6' ]; then + yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" +elif [ "$CentOS_RHEL_version" == '5' ]; then + yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" fi yum check-update @@ -29,15 +29,15 @@ yum check-update # Install needed packages for Package in deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz do - yum -y install $Package + yum -y install $Package done yum -y update bash openssl glibc # use gcc-4.4 -if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ];then - yum -y install gcc44 gcc44-c++ libstdc++44-devel - export CC="gcc44" CXX="g++44" +if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ]; then + yum -y install gcc44 gcc44-c++ libstdc++44-devel + export CC="gcc44" CXX="g++44" fi # closed Unnecessary services and remove obsolete rpm package @@ -134,16 +134,16 @@ net.netfilter.nf_conntrack_tcp_timeout_established = 3600 EOF sysctl -p -if [ "$CentOS_RHEL_version" == '5' ];then - sed -i 's@^[3-6]:2345:respawn@#&@g' /etc/inittab - sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab - sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n -elif [ "$CentOS_RHEL_version" == '6' ];then - sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init - sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf - sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n -elif [ "$CentOS_RHEL_version" == '7' ];then - sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf +if [ "$CentOS_RHEL_version" == '5' ]; then + sed -i 's@^[3-6]:2345:respawn@#&@g' /etc/inittab + sed -i 's@^ca::ctrlaltdel@#&@' /etc/inittab + sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n +elif [ "$CentOS_RHEL_version" == '6' ]; then + sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init + sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf + sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n +elif [ "$CentOS_RHEL_version" == '7' ]; then + sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf fi # Update time @@ -151,15 +151,15 @@ ntpdate pool.ntp.org [ ! -e "/var/spool/cron/root" -o -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } # iptables -if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep '^:INPUT DROP' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables`" ];then - IPTABLES_STATUS=yes +if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep '^:INPUT DROP' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables`" ]; then + IPTABLES_STATUS=yes else - IPTABLES_STATUS=no + IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/sysconfig/iptables' ] && /bin/mv /etc/sysconfig/iptables{,_bk} - cat > /etc/sysconfig/iptables << EOF +if [ "$IPTABLES_STATUS" == 'no' ]; then + [ -e '/etc/sysconfig/iptables' ] && /bin/mv /etc/sysconfig/iptables{,_bk} + cat > /etc/sysconfig/iptables << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter @@ -188,35 +188,35 @@ service iptables restart service sshd restart # install tmux -if [ ! -e "`which tmux`" ];then - cd src - tar xzf libevent-${libevent_version}.tar.gz - cd libevent-${libevent_version} - ./configure - make -j ${THREAD} && make install - cd .. - - tar xzf tmux-${tmux_version}.tar.gz - cd tmux-${tmux_version} - CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure - make -j ${THREAD} && make install - cd ../../ - - if [ "$OS_BIT" == '64' ];then - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 - else - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 - fi +if [ ! -e "`which tmux`" ]; then + pushd ${oneinstack_dir}/src + tar xzf libevent-${libevent_version}.tar.gz + pushd libevent-${libevent_version} + ./configure + make -j ${THREAD} && make install + popd + + tar xzf tmux-${tmux_version}.tar.gz + pushd tmux-${tmux_version} + CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure + make -j ${THREAD} && make install + popd + + if [ "$OS_BIT" == '64' ]; then + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 + else + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 + fi fi # install htop -if [ ! -e "`which htop`" ];then - cd src - tar xzf htop-${htop_version}.tar.gz - cd htop-${htop_version} - ./configure - make -j ${THREAD} && make install - cd ../../ +if [ ! -e "`which htop`" ]; then + tar xzf htop-${htop_version}.tar.gz + pushd htop-${htop_version} + ./configure + make -j ${THREAD} && make install + popd fi . /etc/profile +popd diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 47efd947..e0e20c32 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -10,7 +10,7 @@ for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do - apt-get -y remove --purge $Package + apt-get -y remove --purge $Package done dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P @@ -23,7 +23,7 @@ apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc do - apt-get -y install $Package + apt-get -y install $Package done # Custom profile @@ -108,15 +108,15 @@ ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then - IPTABLES_STATUS=yes +if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ]; then + IPTABLES_STATUS=yes else - IPTABLES_STATUS=no + IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} - cat > /etc/iptables.up.rules << EOF +if [ "$IPTABLES_STATUS" == 'no' ]; then + [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} + cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 6b0925f6..461e53ff 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -10,7 +10,7 @@ for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* do - apt-get -y remove --purge $Package + apt-get -y remove --purge $Package done dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P @@ -23,25 +23,24 @@ apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate do - apt-get -y install $Package + apt-get -y install $Package done -if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then - apt-get -y install libcloog-ppl1 - apt-get -y remove bison - cd src - tar xzf bison-${bison_version}.tar.gz - cd bison-${bison_version} - ./configure - make -j ${THREAD} && make install - cd .. - rm -rf bison-${bison_version} - cd .. - ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype -elif [ "$Ubuntu_version" == '13' ];then - apt-get -y install bison libcloog-ppl1 -elif [ "$Ubuntu_version" == '12' ];then - apt-get -y install bison libcloog-ppl0 +if [[ "$Ubuntu_version" =~ ^14$|^15$ ]]; then + apt-get -y install libcloog-ppl1 + apt-get -y remove bison + pushd ${oneinstack_dir}/src + tar xzf bison-${bison_version}.tar.gz + pushd bison-${bison_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf bison-${bison_version} + ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype +elif [ "$Ubuntu_version" == '13' ]; then + apt-get -y install bison libcloog-ppl1 +elif [ "$Ubuntu_version" == '12' ]; then + apt-get -y install bison libcloog-ppl0 fi # Custom profile @@ -129,15 +128,15 @@ ntpdate pool.ntp.org [ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ];then - IPTABLES_STATUS=yes +if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ]; then + IPTABLES_STATUS=yes else - IPTABLES_STATUS=no + IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ];then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} - cat > /etc/iptables.up.rules << EOF +if [ "$IPTABLES_STATUS" == 'no' ]; then + [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} + cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter @@ -172,3 +171,4 @@ service ssh restart . /etc/profile . ~/.bashrc +popd diff --git a/include/ioncube.sh b/include/ioncube.sh index 125da40a..3fb7ed4d 100644 --- a/include/ioncube.sh +++ b/include/ioncube.sh @@ -9,49 +9,49 @@ # https://github.com/lj2007331/oneinstack Install_ionCube() { - pushd ${oneinstack_dir}/src - - PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') - PHP_main_version=${PHP_detail_version%.*} - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - - if [ "${OS_BIT}" == '64' ];then - tar xzf ioncube_loaders_lin_x86-64.tar.gz + pushd ${oneinstack_dir}/src + PHP_detail_version=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'` + PHP_main_version=${PHP_detail_version%.*} + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ "${OS_BIT}" == '64' ]; then + tar xzf ioncube_loaders_lin_x86-64.tar.gz + else + if [ "${TARGET_ARCH}" == "armv7" ]; then + tar xzf ioncube_loaders_lin_armv7l.tar.gz else - if [ "${TARGET_ARCH}" == "armv7" ];then - tar xzf ioncube_loaders_lin_armv7l.tar.gz - else - tar xzf ioncube_loaders_lin_x86.tar.gz - fi + tar xzf ioncube_loaders_lin_x86.tar.gz fi - - [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} - if [ "$PHP_main_version" == '7.0' ]; then - /bin/cp ioncube/ioncube_loader_lin_7.0.so ${phpExtensionDir} - zend_extension="${phpExtensionDir}/ioncube_loader_lin_7.0.so" - elif [ "$PHP_main_version" == '5.6' ]; then - /bin/cp ioncube/ioncube_loader_lin_5.6.so ${phpExtensionDir} - zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.6.so" - elif [ "$PHP_main_version" == '5.5' ]; then - /bin/cp ioncube/ioncube_loader_lin_5.5.so ${phpExtensionDir} - zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.5.so" - elif [ "$PHP_main_version" == '5.4' ]; then - /bin/cp ioncube/ioncube_loader_lin_5.4.so ${phpExtensionDir} - zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.4.so" - elif [ "$PHP_main_version" == '5.3' ]; then - /bin/cp ioncube/ioncube_loader_lin_5.3.so ${phpExtensionDir} - zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.3.so" - else - echo "Error! Your PHP ${PHP_detail_version} does not support ionCube!" - rm -rf ioncube - exit 1 - fi - - rm -rf ioncube - cat > ${php_install_dir}/etc/php.d/ext-0ioncube.ini << EOF -[ionCube Loader] -zend_extension=${zend_extension} -EOF - [ "${Apache_version}" != '1' -a "${Apache_version}" != '2' ] && service php-fpm restart || service httpd restart - popd + fi + + [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir} + case "${PHP_main_version}" in + 7.0) + /bin/cp ioncube/ioncube_loader_lin_7.0.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_7.0.so" + ;; + 5.6) + /bin/cp ioncube/ioncube_loader_lin_5.6.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.6.so" + ;; + 5.5) + /bin/cp ioncube/ioncube_loader_lin_5.5.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.5.so" + ;; + 5.4) + /bin/cp ioncube/ioncube_loader_lin_5.4.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.4.so" + ;; + 5.3) + /bin/cp ioncube/ioncube_loader_lin_5.3.so ${phpExtensionDir} + zend_extension="${phpExtensionDir}/ioncube_loader_lin_5.3.so" + ;; + *) + echo "Error! Your PHP ${PHP_detail_version} does not support ionCube!" + exit 1 + ;; + esac + + echo "zend_extension=${zend_extension}" > ${php_install_dir}/etc/php.d/ext-0ioncube.ini + rm -rf ioncube + popd } diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index 9519f933..6e7f58d4 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -9,19 +9,19 @@ # https://github.com/lj2007331/oneinstack Install-JDK-1-6() { -cd $oneinstack_dir/src - -JDK_FILE="jdk-`echo $jdk_6_version | awk -F. '{print $2}'`u`echo $jdk_6_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" -JAVA_dir=/usr/java -JDK_NAME="jdk$jdk_6_version" -JDK_PATH=$JAVA_dir/$JDK_NAME - -[ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` - -chmod +x $JDK_FILE -./$JDK_FILE - -if [ -d "$JDK_NAME" ];then + pushd ${oneinstack_dir}/src + + JDK_FILE="jdk-`echo $jdk_6_version | awk -F. '{print $2}'`u`echo $jdk_6_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" + JAVA_dir=/usr/java + JDK_NAME="jdk$jdk_6_version" + JDK_PATH=$JAVA_dir/$JDK_NAME + + [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` + + chmod +x $JDK_FILE + ./$JDK_FILE + + if [ -d "$JDK_NAME" ]; then rm -rf $JAVA_dir; mkdir -p $JAVA_dir mv $JDK_NAME $JAVA_dir [ -z "`grep ^'export JAVA_HOME=' /etc/profile`" ] && { [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export JAVA_HOME=$JDK_PATH" >> /etc/profile || sed -i "s@^export PATH=@export JAVA_HOME=$JDK_PATH\nexport PATH=@" /etc/profile; } || sed -i "s@^export JAVA_HOME=.*@export JAVA_HOME=$JDK_PATH@" /etc/profile @@ -30,10 +30,10 @@ if [ -d "$JDK_NAME" ];then [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" -else + else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" kill -9 $$ -fi -cd .. + fi +popd } diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index b84b1b1b..543704c5 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -9,18 +9,18 @@ # https://github.com/lj2007331/oneinstack Install-JDK-1-7() { -cd $oneinstack_dir/src + pushd ${oneinstack_dir}/src -JDK_FILE="jdk-`echo $jdk_7_version | awk -F. '{print $2}'`u`echo $jdk_7_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" -JAVA_dir=/usr/java -JDK_NAME="jdk$jdk_7_version" -JDK_PATH=$JAVA_dir/$JDK_NAME - -[ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` - -tar xzf $JDK_FILE - -if [ -d "$JDK_NAME" ];then + JDK_FILE="jdk-`echo $jdk_7_version | awk -F. '{print $2}'`u`echo $jdk_7_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" + JAVA_dir=/usr/java + JDK_NAME="jdk$jdk_7_version" + JDK_PATH=$JAVA_dir/$JDK_NAME + + [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` + + tar xzf $JDK_FILE + + if [ -d "$JDK_NAME" ]; then rm -rf $JAVA_dir; mkdir -p $JAVA_dir mv $JDK_NAME $JAVA_dir [ -z "`grep ^'export JAVA_HOME=' /etc/profile`" ] && { [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export JAVA_HOME=$JDK_PATH" >> /etc/profile || sed -i "s@^export PATH=@export JAVA_HOME=$JDK_PATH\nexport PATH=@" /etc/profile; } || sed -i "s@^export JAVA_HOME=.*@export JAVA_HOME=$JDK_PATH@" /etc/profile @@ -29,10 +29,10 @@ if [ -d "$JDK_NAME" ];then [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" -else + else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" kill -9 $$ -fi -cd .. + fi + popd } diff --git a/include/jdk-1.8.sh b/include/jdk-1.8.sh index 5f51d181..52b4d8b7 100644 --- a/include/jdk-1.8.sh +++ b/include/jdk-1.8.sh @@ -9,18 +9,18 @@ # https://github.com/lj2007331/oneinstack Install-JDK-1-8() { -cd $oneinstack_dir/src - -JDK_FILE="jdk-`echo $jdk_8_version | awk -F. '{print $2}'`u`echo $jdk_8_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" -JAVA_dir=/usr/java -JDK_NAME="jdk$jdk_8_version" -JDK_PATH=$JAVA_dir/$JDK_NAME - -[ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` - -tar xzf $JDK_FILE - -if [ -d "$JDK_NAME" ];then + pushd ${oneinstack_dir}/src + + JDK_FILE="jdk-`echo $jdk_8_version | awk -F. '{print $2}'`u`echo $jdk_8_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" + JAVA_dir=/usr/java + JDK_NAME="jdk$jdk_8_version" + JDK_PATH=$JAVA_dir/$JDK_NAME + + [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` + + tar xzf $JDK_FILE + + if [ -d "$JDK_NAME" ]; then rm -rf $JAVA_dir; mkdir -p $JAVA_dir mv $JDK_NAME $JAVA_dir [ -z "`grep ^'export JAVA_HOME=' /etc/profile`" ] && { [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export JAVA_HOME=$JDK_PATH" >> /etc/profile || sed -i "s@^export PATH=@export JAVA_HOME=$JDK_PATH\nexport PATH=@" /etc/profile; } || sed -i "s@^export JAVA_HOME=.*@export JAVA_HOME=$JDK_PATH@" /etc/profile @@ -29,10 +29,10 @@ if [ -d "$JDK_NAME" ];then [ -z "`grep ^'export PATH=' /etc/profile | grep '$JAVA_HOME/bin'`" ] && echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile . /etc/profile echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}" -else + else rm -rf $JAVA_dir echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" kill -9 $$ -fi -cd .. + fi + popd } diff --git a/include/jemalloc.sh b/include/jemalloc.sh index c8c0df56..edd49d45 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -9,13 +9,14 @@ # https://github.com/lj2007331/oneinstack Install_jemalloc() { -cd $oneinstack_dir/src -tar xjf jemalloc-$jemalloc_version.tar.bz2 -cd jemalloc-$jemalloc_version -LDFLAGS="${LDFLAGS} -lrt" ./configure -make -j ${THREAD} && make install -if [ -f "/usr/local/lib/libjemalloc.so" ];then - if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ];then + pushd ${oneinstack_dir}/src + tar xjf jemalloc-$jemalloc_version.tar.bz2 + pushd jemalloc-$jemalloc_version + LDFLAGS="${LDFLAGS} -lrt" ./configure + make -j ${THREAD} && make install + popd + if [ -f "/usr/local/lib/libjemalloc.so" ]; then + if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ]; then ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 else ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1 @@ -23,11 +24,10 @@ if [ -f "/usr/local/lib/libjemalloc.so" ];then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}" - cd .. - rm -rf jemalloc-$jemalloc_version -else + rm -rf jemalloc-${jemalloc_version} + else echo "${CFAILURE}jemalloc install failed, Please contact the author! ${CEND}" kill -9 $$ -fi -cd .. + fi + popd } diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index c4aff84b..4ae34d28 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -17,22 +17,22 @@ Install_MariaDB-10-0() { [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_10_0_version}.tar.gz pushd mariadb-${mariadb_10_0_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -56,11 +56,11 @@ Install_MariaDB-10-0() { popd fi - if [ -d "${mariadb_install_dir}/support-files" ];then + if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mariadb-${mariadb_10_0_version} fi else @@ -177,7 +177,7 @@ 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 + 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 @@ -185,7 +185,7 @@ EOF 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 + 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 @@ -193,7 +193,7 @@ EOF 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 + 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 diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 720f0ecc..8ac71a20 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -17,22 +17,22 @@ Install_MariaDB-10-1() { [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_10_1_version}.tar.gz pushd mariadb-${mariadb_10_1_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -56,11 +56,11 @@ Install_MariaDB-10-1() { popd fi - if [ -d "${mariadb_install_dir}/support-files" ];then + if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mariadb-${mariadb_10_1_version} fi else @@ -177,7 +177,7 @@ 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 + 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 @@ -185,7 +185,7 @@ EOF 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 + 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 @@ -193,7 +193,7 @@ EOF 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 + 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 diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 7597578a..9c8c83ca 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -17,26 +17,26 @@ Install_MariaDB-5-5() { [ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir} mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_5_5_version}.tar.gz pushd mariadb-${mariadb_5_5_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi - if [ "${armPlatform}" == "y" ];then + if [ "${armPlatform}" == "y" ]; then patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch fi @@ -61,11 +61,11 @@ Install_MariaDB-5-5() { popd fi - if [ -d "${mariadb_install_dir}/support-files" ];then + if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mariadb-${mariadb_5_5_version} fi else @@ -183,7 +183,7 @@ 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 + 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 @@ -191,7 +191,7 @@ EOF 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 + 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 @@ -199,7 +199,7 @@ EOF 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 + 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 diff --git a/include/memcached.sh b/include/memcached.sh index 51ea828e..408cf69b 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -9,108 +9,99 @@ # https://github.com/lj2007331/oneinstack Install_memcached() { - pushd $oneinstack_dir/src - - # memcached server - id -u memcached >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached - - tar xzf memcached-$memcached_version.tar.gz - pushd memcached-$memcached_version - [ ! -d "$memcached_install_dir" ] && mkdir -p $memcached_install_dir - ./configure --prefix=$memcached_install_dir - make -j ${THREAD} && make install - if [ -d "$memcached_install_dir/include/memcached" ];then - echo "${CSUCCESS}memcached installed successfully! ${CEND}" - popd - rm -rf memcached-$memcached_version - ln -s $memcached_install_dir/bin/memcached /usr/bin/memcached - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } - sed -i "s@/usr/local/memcached@$memcached_install_dir@g" /etc/init.d/memcached - [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached - [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached - service memcached start - else - rm -rf $memcached_install_dir - echo "${CFAILURE}memcached install failed, Please contact the author! ${CEND}" - kill -9 $$ - fi - popd + pushd ${oneinstack_dir}/src + # memcached server + id -u memcached >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached + tar xzf memcached-${memcached_version}.tar.gz + pushd memcached-${memcached_version} + [ ! -d "${memcached_install_dir}" ] && mkdir -p ${memcached_install_dir} + ./configure --prefix=${memcached_install_dir} + make -j ${THREAD} && make install + popd + if [ -d "${memcached_install_dir}/include/memcached" ]; then + echo "${CSUCCESS}memcached installed successfully! ${CEND}" + rm -rf memcached-${memcached_version} + ln -s ${memcached_install_dir}/bin/memcached /usr/bin/memcached + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } + sed -i "s@/usr/local/memcached@${memcached_install_dir}@g" /etc/init.d/memcached + [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached + [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached + service memcached start + rm -rf memcached-${memcached_version} + else + rm -rf ${memcached_install_dir} + echo "${CFAILURE}memcached install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + popd } Install_php-memcache() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ -e "$php_install_dir/bin/phpize" ];then - # php memcache extension - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone https://github.com/websupport-sk/pecl-memcache.git - #cd pecl-memcache - tar xzf pecl-memcache-php7.tgz - pushd pecl-memcache-php7 - else - tar xzf memcache-$memcache_pecl_version.tgz - pushd memcache-$memcache_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/memcache.so" ];then - cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF -extension=memcache.so -EOF - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" - popd - rm -rf memcache-$memcache_pecl_version - else - echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" - fi + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ -e "${php_install_dir}/bin/phpize" ]; then + # php memcache extension + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + #git clone https://github.com/websupport-sk/pecl-memcache.git + tar xzf pecl-memcache-php7.tgz + pushd pecl-memcache-php7 + else + tar xzf memcache-${memcache_pecl_version}.tgz + pushd memcache-${memcache_pecl_version} fi + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install popd + if [ -f "${phpExtensionDir}/memcache.so" ]; then + echo 'extension=memcache.so' > ${php_install_dir}/etc/php.d/ext-memcache.ini + echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" + rm -rf pecl-memcache-php7 memcache-${memcache_pecl_version} + else + echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" + fi + fi + popd } Install_php-memcached() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ -e "$php_install_dir/bin/phpize" ];then - # php memcached extension - tar xzf libmemcached-$libmemcached_version.tar.gz - pushd libmemcached-$libmemcached_version - [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure - ./configure --with-memcached=$memcached_install_dir - make -j ${THREAD} && make install - popd - rm -rf libmemcached-$libmemcached_version - - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git - #cd php-memcached - tar xzf php-memcached-php7.tgz - pushd php-memcached-php7 - else - tar xzf memcached-$memcached_pecl_version.tgz - pushd memcached-$memcached_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/memcached.so" ];then - cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ -e "${php_install_dir}/bin/phpize" ]; then + # php memcached extension + tar xzf libmemcached-$libmemcached_version.tar.gz + pushd libmemcached-$libmemcached_version + [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure + ./configure --with-memcached=${memcached_install_dir} + make -j ${THREAD} && make install + popd + rm -rf libmemcached-$libmemcached_version + + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git + tar xzf php-memcached-php7.tgz + pushd php-memcached-php7 + else + tar xzf memcached-${memcached_pecl_version}.tgz + pushd memcached-${memcached_pecl_version} + fi + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd + if [ -f "${phpExtensionDir}/memcached.so" ]; then + cat > ${php_install_dir}/etc/php.d/ext-memcached.ini << EOF extension=memcached.so memcached.use_sasl=1 EOF - echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" - popd - rm -rf memcached-$memcached_pecl_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" - fi + echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" + rm -rf php-memcached-php7 memcached-${memcached_pecl_version} + else + echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" fi - popd + fi + popd } diff --git a/include/memory.sh b/include/memory.sh index a7f7bf1f..e195e06f 100644 --- a/include/memory.sh +++ b/include/memory.sh @@ -11,47 +11,44 @@ Mem=`free -m | awk '/Mem:/{print $2}'` Swap=`free -m | awk '/Swap:/{print $2}'` -if [ $Mem -le 640 ];then - Mem_level=512M - Memory_limit=64 -elif [ $Mem -gt 640 -a $Mem -le 1280 ];then - Mem_level=1G - Memory_limit=128 -elif [ $Mem -gt 1280 -a $Mem -le 2500 ];then - Mem_level=2G - Memory_limit=192 -elif [ $Mem -gt 2500 -a $Mem -le 3500 ];then - Mem_level=3G - Memory_limit=256 -elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then - Mem_level=4G - Memory_limit=320 -elif [ $Mem -gt 4500 -a $Mem -le 8000 ];then - Mem_level=6G - Memory_limit=384 -elif [ $Mem -gt 8000 ];then - Mem_level=8G - Memory_limit=448 +if [ $Mem -le 640 ]; then + Mem_level=512M + Memory_limit=64 +elif [ $Mem -gt 640 -a $Mem -le 1280 ]; then + Mem_level=1G + Memory_limit=128 +elif [ $Mem -gt 1280 -a $Mem -le 2500 ]; then + Mem_level=2G + Memory_limit=192 +elif [ $Mem -gt 2500 -a $Mem -le 3500 ]; then + Mem_level=3G + Memory_limit=256 +elif [ $Mem -gt 3500 -a $Mem -le 4500 ]; then + Mem_level=4G + Memory_limit=320 +elif [ $Mem -gt 4500 -a $Mem -le 8000 ]; then + Mem_level=6G + Memory_limit=384 +elif [ $Mem -gt 8000 ]; then + Mem_level=8G + Memory_limit=448 fi Make-swapfile() { - dd if=/dev/zero of=/swapfile count=$COUNT bs=1M - mkswap /swapfile - swapon /swapfile - chmod 600 /swapfile - [ -z "`grep swapfile /etc/fstab`" ] && cat >> /etc/fstab << EOF -/swapfile swap swap defaults 0 0 -EOF - + dd if=/dev/zero of=/swapfile count=$COUNT bs=1M + mkswap /swapfile + swapon /swapfile + chmod 600 /swapfile + [ -z "`grep swapfile /etc/fstab`" ] && echo '/swapfile swap swap defaults 0 0' >> /etc/fstab } # add swapfile -if [ "$Swap" == '0' ];then - if [ $Mem -le 1024 ];then - COUNT=1024 - Make-swapfile - elif [ $Mem -gt 1024 -a $Mem -le 2048 ];then - COUNT=2048 - Make-swapfile - fi +if [ "$Swap" == '0' ]; then + if [ $Mem -le 1024 ]; then + COUNT=1024 + Make-swapfile + elif [ $Mem -gt 1024 -a $Mem -le 2048 ]; then + COUNT=2048 + Make-swapfile + fi fi diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 7be069cb..40f79d5c 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -17,22 +17,22 @@ Install_MySQL-5-5() { [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_5_version}.tar.gz pushd mysql-${mysql_5_5_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -59,11 +59,11 @@ Install_MySQL-5-5() { popd fi - if [ -d "${mysql_install_dir}/support-files" ];then + if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mysql-${mysql_5_5_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mysql-${mysql_5_5_version} fi else @@ -184,7 +184,7 @@ 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 + 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 @@ -192,7 +192,7 @@ EOF 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 + 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 @@ -200,7 +200,7 @@ EOF 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 + 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 diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 44074032..86db9db9 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -17,22 +17,22 @@ Install_MySQL-5-6() { [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_6_version}.tar.gz pushd mysql-${mysql_5_6_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -56,11 +56,11 @@ Install_MySQL-5-6() { popd fi - if [ -d "${mysql_install_dir}/support-files" ];then + if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mysql-${mysql_5_6_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mysql-${mysql_5_6_version} fi else @@ -182,7 +182,7 @@ 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 + 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 @@ -190,7 +190,7 @@ EOF 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 + 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 @@ -198,7 +198,7 @@ EOF 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 + 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 diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index e153b8bf..87e1db5d 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -17,22 +17,22 @@ Install_MySQL-5-7() { [ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir} mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_7_version}.tar.gz pushd mysql-${mysql_5_7_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -56,11 +56,11 @@ Install_MySQL-5-7() { popd fi - if [ -d "${mysql_install_dir}/support-files" ];then + if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf mysql-${mysql_5_7_version}-*-${SYS_BIT_b} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf mysql-${mysql_5_7_version} fi else @@ -183,7 +183,7 @@ 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 + 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 @@ -191,7 +191,7 @@ EOF 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 + 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 @@ -199,7 +199,7 @@ EOF 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 + 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 diff --git a/include/nginx.sh b/include/nginx.sh index 61b5ad21..f48f9342 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -9,64 +9,63 @@ # https://github.com/lj2007331/oneinstack Install_Nginx() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf pcre-$pcre_version.tar.gz -tar xzf nginx-$nginx_version.tar.gz -tar xzf openssl-$openssl_version.tar.gz -cd nginx-$nginx_version -# Modify Nginx version -#sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h -#sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h -#sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c - -# close debug -sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc - -if [ "$je_tc_malloc" == '1' ];then + pushd ${oneinstack_dir}/src + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf pcre-$pcre_version.tar.gz + tar xzf nginx-$nginx_version.tar.gz + tar xzf openssl-$openssl_version.tar.gz + pushd nginx-$nginx_version + # Modify Nginx version + #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h + #sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h + #sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c + + # close debug + sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + + if [ "$je_tc_malloc" == '1' ]; then malloc_module="--with-ld-opt='-ljemalloc'" -elif [ "$je_tc_malloc" == '2' ];then + elif [ "$je_tc_malloc" == '2' ]; then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R ${run_user}.$run_user /tmp/tcmalloc -fi + fi -[ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir -./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make -j ${THREAD} && make install -if [ -e "$nginx_install_dir/conf/nginx.conf" ];then - cd .. + [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir + ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + make -j ${THREAD} && make install + if [ -e "$nginx_install_dir/conf/nginx.conf" ]; then + popd rm -rf nginx-$nginx_version echo "${CSUCCESS}Nginx installed successfully! ${CEND}" -else + else rm -rf $nginx_install_dir echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi + fi -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $nginx_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile -. /etc/profile + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $nginx_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile + . /etc/profile + + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } -[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } -cd .. - -sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx - -mv $nginx_install_dir/conf/nginx.conf{,_bk} -if [[ $Apache_version =~ ^[1-2]$ ]];then - /bin/cp config/nginx_apache.conf $nginx_install_dir/conf/nginx.conf -elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ];then - /bin/cp config/nginx_tomcat.conf $nginx_install_dir/conf/nginx.conf -else - /bin/cp config/nginx.conf $nginx_install_dir/conf/nginx.conf + sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx + + mv $nginx_install_dir/conf/nginx.conf{,_bk} + if [[ $Apache_version =~ ^[1-2]$ ]]; then + /bin/cp ../config/nginx_apache.conf $nginx_install_dir/conf/nginx.conf + elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then + /bin/cp ../config/nginx_tomcat.conf $nginx_install_dir/conf/nginx.conf + else + /bin/cp ../config/nginx.conf $nginx_install_dir/conf/nginx.conf [ "$PHP_yn" == 'y' ] && [ -z "`grep '/php-fpm_status' $nginx_install_dir/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $nginx_install_dir/conf/nginx.conf -fi -cat > $nginx_install_dir/conf/proxy.conf << EOF + fi + cat > $nginx_install_dir/conf/proxy.conf << EOF proxy_connect_timeout 300s; proxy_send_timeout 900; proxy_read_timeout 900; @@ -82,13 +81,13 @@ proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; EOF -sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $nginx_install_dir/conf/nginx.conf -sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf -sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf - -# logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF + sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $nginx_install_dir/conf/nginx.conf + sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf + sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf + [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf + + # logrotate nginx log + cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { daily rotate 5 @@ -102,7 +101,7 @@ postrotate endscript } EOF - -ldconfig -service nginx start + popd + ldconfig + service nginx start } diff --git a/include/openresty.sh b/include/openresty.sh index 46d51b54..b4fb4743 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -9,61 +9,60 @@ # https://github.com/lj2007331/oneinstack Install_OpenResty() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf pcre-$pcre_version.tar.gz -tar xzf openresty-$openresty_version.tar.gz -tar xzf openssl-$openssl_version.tar.gz -cd openresty-$openresty_version - -# close debug -openresty_version_tmp=${openresty_version%.*} -sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug - -if [ "$je_tc_malloc" == '1' ];then + pushd ${oneinstack_dir}/src + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf pcre-$pcre_version.tar.gz + tar xzf openresty-$openresty_version.tar.gz + tar xzf openssl-$openssl_version.tar.gz + pushd openresty-$openresty_version + + # close debug + openresty_version_tmp=${openresty_version%.*} + sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug + + if [ "$je_tc_malloc" == '1' ]; then malloc_module="--with-ld-opt='-ljemalloc'" -elif [ "$je_tc_malloc" == '2' ];then + elif [ "$je_tc_malloc" == '2' ]; then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R ${run_user}.$run_user /tmp/tcmalloc -fi + fi -[ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir -./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make -j ${THREAD} && make install -if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then - cd .. + [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + make -j ${THREAD} && make install + if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ]; then + popd rm -rf openresty-$openresty_version echo "${CSUCCESS}OpenResty installed successfully! ${CEND}" -else + else rm -rf $openresty_install_dir echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$openresty_install_dir/nginx/sbin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $openresty_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$openresty_install_dir/nginx/sbin:\1@" /etc/profile -. /etc/profile + fi -[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } -cd .. - -sed -i "s@/usr/local/nginx@$openresty_install_dir/nginx@g" /etc/init.d/nginx - -mv $openresty_install_dir/nginx/conf/nginx.conf{,_bk} -if [[ $Apache_version =~ ^[1-2]$ ]];then - /bin/cp config/nginx_apache.conf $openresty_install_dir/nginx/conf/nginx.conf -elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ];then - /bin/cp config/nginx_tomcat.conf $openresty_install_dir/nginx/conf/nginx.conf -else - /bin/cp config/nginx.conf $openresty_install_dir/nginx/conf/nginx.conf + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$openresty_install_dir/nginx/sbin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $openresty_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$openresty_install_dir/nginx/sbin:\1@" /etc/profile + . /etc/profile + + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } + + sed -i "s@/usr/local/nginx@$openresty_install_dir/nginx@g" /etc/init.d/nginx + + mv $openresty_install_dir/nginx/conf/nginx.conf{,_bk} + if [[ $Apache_version =~ ^[1-2]$ ]]; then + /bin/cp ../config/nginx_apache.conf $openresty_install_dir/nginx/conf/nginx.conf + elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then + /bin/cp ../config/nginx_tomcat.conf $openresty_install_dir/nginx/conf/nginx.conf + else + /bin/cp ../config/nginx.conf $openresty_install_dir/nginx/conf/nginx.conf [ "$PHP_yn" == 'y' ] && [ -z "`grep '/php-fpm_status' $openresty_install_dir/nginx/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $openresty_install_dir/nginx/conf/nginx.conf -fi -cat > $openresty_install_dir/nginx/conf/proxy.conf << EOF + fi + cat > $openresty_install_dir/nginx/conf/proxy.conf << EOF proxy_connect_timeout 300s; proxy_send_timeout 900; proxy_read_timeout 900; @@ -79,13 +78,13 @@ proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; EOF -sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf -sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf -sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf - -# logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF + sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf + sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf + sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf + [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf + + # logrotate nginx log + cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { daily rotate 5 @@ -99,7 +98,7 @@ postrotate endscript } EOF - -ldconfig -service nginx start + popd + ldconfig + service nginx start } diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index bc564762..5bf9b2da 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -17,27 +17,27 @@ Install_Percona-5-5() { [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_5_version}.tar.gz pushd percona-server-${percona_5_5_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi - if [ "${armPlatform}" == "y" ];then + if [ "${armPlatform}" == "y" ]; then patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch fi @@ -62,11 +62,11 @@ Install_Percona-5-5() { popd fi - if [ -d "${percona_install_dir}/support-files" ];then + if [ -d "${percona_install_dir}/support-files" ]; then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf percona-server-${percona_5_5_version} fi else @@ -187,7 +187,7 @@ 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 + 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 @@ -195,7 +195,7 @@ EOF 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 + 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 @@ -203,7 +203,7 @@ EOF 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 + 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 diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 1468635d..43a33123 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -17,23 +17,23 @@ Install_Percona-5-6() { [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_6_version}.tar.gz pushd percona-server-${percona_5_6_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -58,11 +58,11 @@ Install_Percona-5-6() { popd fi - if [ -d "${percona_install_dir}/support-files" ];then + if [ -d "${percona_install_dir}/support-files" ]; then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf percona-server-${percona_5_6_version} fi else @@ -184,7 +184,7 @@ 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 + 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 @@ -192,7 +192,7 @@ EOF 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 + 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 @@ -200,7 +200,7 @@ EOF 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 + 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 diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index dea00c80..846fe3cc 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -17,22 +17,22 @@ Install_Percona-5-7() { [ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir} mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then tar xvf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe fi - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_7_version}.tar.gz pushd percona-server-${percona_5_7_version} - if [ "${je_tc_malloc}" == "1" ];then + if [ "${je_tc_malloc}" == "1" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'" - elif [ "${je_tc_malloc}" == "2" ];then + elif [ "${je_tc_malloc}" == "2" ]; then EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc'" fi @@ -58,11 +58,11 @@ Install_Percona-5-7() { popd fi - if [ -d "${percona_install_dir}/support-files" ];then + if [ -d "${percona_install_dir}/support-files" ]; then echo "${CSUCCESS}Percona installed successfully! ${CEND}" - if [ "${dbInstallMethods}" == "1" ];then + if [ "${dbInstallMethods}" == "1" ]; then rm -rf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer} - elif [ "${dbInstallMethods}" == "2" ];then + elif [ "${dbInstallMethods}" == "2" ]; then rm -rf percona-server-${percona_5_7_version} fi else @@ -184,7 +184,7 @@ 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 + 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 @@ -192,7 +192,7 @@ EOF 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 + 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 @@ -200,7 +200,7 @@ EOF 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 + 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 diff --git a/include/php-5.3.sh b/include/php-5.3.sh index fe987068..d5c2fa24 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -9,143 +9,143 @@ # https://github.com/lj2007331/oneinstack Install_PHP-5-3() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -# Problem building php-5.3 with openssl -if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then - if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ];then - tar xzf openssl-1.0.0s.tar.gz - cd openssl-1.0.0s - ./config --prefix=/usr/local/openssl -fPIC shared zlib - make -j ${THREAD} && make install - cd .. - rm -rf openssl-1.0.0s + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + # Problem building php-5.3 with openssl + if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then + if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ]; then + tar xzf openssl-1.0.0s.tar.gz + pushd openssl-1.0.0s + ./config --prefix=/usr/local/openssl -fPIC shared zlib + make -j ${THREAD} && make install + popd + rm -rf openssl-1.0.0s fi OpenSSL_args='--with-openssl=/usr/local/openssl' -else + else OpenSSL_args='--with-openssl' -fi - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then + fi + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl -else + else ./configure --prefix=/usr/local -fi -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -[ ! -e '/usr/include/freetype2/freetype' ] && ln -s /usr/include/freetype2 /usr/include/freetype2/freetype - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_3_version.tar.gz -patch -d php-$php_3_version -p0 < fpm-race-condition.patch -cd php-$php_3_version -patch -p1 < ../php5.3patch -patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch -make clean -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + fi + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + [ ! -e '/usr/include/freetype2/freetype' ] && ln -s /usr/include/freetype2 /usr/include/freetype2/freetype + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf php-$php_3_version.tar.gz + patch -d php-$php_3_version -p0 < fpm-race-condition.patch + pushd php-$php_3_version + patch -p1 < ../php5.3patch + patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch + make clean + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else + else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -210,40 +210,40 @@ EOF [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf - if [ $Mem -le 3000 ];then - sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf + if [ $Mem -le 3000 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then service httpd restart -fi -cd .. -[ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_3_version -cd .. + fi + popd + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_3_version + popd } diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 1e55bc50..66bd1830 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -9,119 +9,119 @@ # https://github.com/lj2007331/oneinstack Install_PHP-5-4() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_4_version.tar.gz -patch -d php-$php_4_version -p0 < fpm-race-condition.patch -cd php-$php_4_version -make clean -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf php-$php_4_version.tar.gz + patch -d php-$php_4_version -p0 < fpm-race-condition.patch + pushd php-$php_4_version + make clean + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else + else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -186,40 +186,40 @@ EOF [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf - if [ $Mem -le 3000 ];then - sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf + if [ $Mem -le 3000 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then service httpd restart -fi -cd .. -[ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_4_version -cd .. + fi + popd + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_4_version + popd } diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 8de4648c..275967b9 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -9,119 +9,118 @@ # https://github.com/lj2007331/oneinstack Install_PHP-5-5() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user -tar xzf php-$php_5_version.tar.gz -patch -d php-$php_5_version -p0 < fpm-race-condition.patch -cd php-$php_5_version -make clean -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + tar xzf php-$php_5_version.tar.gz + patch -d php-$php_5_version -p0 < fpm-race-condition.patch + pushd php-$php_5_version + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else + else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + [ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=opcache.so opcache.enable=1 @@ -135,7 +134,7 @@ opcache.enable_cli=1 ;opcache.optimization_level=0 EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -200,40 +199,40 @@ EOF [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf - if [ $Mem -le 3000 ];then - sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf + if [ $Mem -le 3000 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then service httpd restart -fi -cd .. -[ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_5_version -cd .. + fi + popd + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_5_version + popd } diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 03b5a55b..adb5e743 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -9,119 +9,119 @@ # https://github.com/lj2007331/oneinstack Install_PHP-5-6() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_6_version.tar.gz -cd php-$php_6_version -make clean -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf php-$php_6_version.tar.gz + pushd php-$php_6_version + make clean + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ + --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else + else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 5@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + [ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=opcache.so opcache.enable=1 @@ -135,7 +135,7 @@ opcache.enable_cli=1 ;opcache.optimization_level=0 EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -200,40 +200,40 @@ EOF [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf - if [ $Mem -le 3000 ];then - sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf + if [ $Mem -le 3000 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then service httpd restart -fi -cd .. -[ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_6_version -cd .. + fi + popd + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_6_version + popd } diff --git a/include/php-7.0.sh b/include/php-7.0.sh index 523b9f10..8a3ee35d 100644 --- a/include/php-7.0.sh +++ b/include/php-7.0.sh @@ -9,121 +9,121 @@ # https://github.com/lj2007331/oneinstack Install_PHP-7-0() { -cd $oneinstack_dir/src - -tar xzf libiconv-$libiconv_version.tar.gz -patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf curl-$curl_version.tar.gz -cd curl-$curl_version -./configure --prefix=/usr/local -make -j ${THREAD} && make install -cd .. -rm -rf curl-$curl_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make -j ${THREAD} && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make -j ${THREAD} && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -[ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make -j ${THREAD} && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_7_version.tar.gz -cd php-$php_7_version -make clean -./buildconf -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir -[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' -if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf php-$php_7_version.tar.gz + pushd php-$php_7_version + make clean + ./buildconf + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ ---enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -else + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ + --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-config-file-scan-dir=$php_install_dir/etc/php.d \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ ---enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug -fi -make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} -make install - -if [ -e "$php_install_dir/bin/phpize" ];then + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ + --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then echo "${CSUCCESS}PHP installed successfully! ${CEND}" -else + else rm -rf $php_install_dir echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini -sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - -[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini + sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + [ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=opcache.so opcache.enable=1 @@ -141,7 +141,7 @@ opcache.consistency_checks=0 ;opcache.optimization_level=0 EOF -if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm @@ -206,40 +206,40 @@ EOF [ -d "/run/shm" -a ! -e "/dev/shm" ] && sed -i 's@/dev/shm@/run/shm@' $php_install_dir/etc/php-fpm.conf $oneinstack_dir/vhost.sh $oneinstack_dir/config/nginx.conf - if [ $Mem -le 3000 ];then - sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 3000 -a $Mem -le 4500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 4500 -a $Mem -le 6500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 6500 -a $Mem -le 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf - elif [ $Mem -gt 8500 ];then - sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf - sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf + if [ $Mem -le 3000 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 70@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" $php_install_dir/etc/php-fpm.conf + elif [ $Mem -gt 8500 ]; then + sed -i "s@^pm.max_children.*@pm.max_children = 80@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" $php_install_dir/etc/php-fpm.conf + sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" $php_install_dir/etc/php-fpm.conf fi #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf service php-fpm start -elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then + elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then service httpd restart -fi -cd .. -[ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_7_version -cd .. + fi + popd + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_7_version + popd } diff --git a/include/phpmyadmin.sh b/include/phpmyadmin.sh index 5f1b56ce..8b1219f5 100644 --- a/include/phpmyadmin.sh +++ b/include/phpmyadmin.sh @@ -9,14 +9,14 @@ # https://github.com/lj2007331/oneinstack Install_phpMyAdmin() { - pushd $oneinstack_dir/src - tar xzf phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz - /bin/mv phpMyAdmin-${phpMyAdmin_version}-all-languages $wwwroot_dir/default/phpMyAdmin - /bin/cp $wwwroot_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} - mkdir $wwwroot_dir/default/phpMyAdmin/{upload,save} - sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'`cat /dev/urandom | head -1 | md5sum | head -c 10`\';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - chown -R ${run_user}.$run_user $wwwroot_dir/default/phpMyAdmin - popd + pushd ${oneinstack_dir}/src + tar xzf phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz + /bin/mv phpMyAdmin-${phpMyAdmin_version}-all-languages ${wwwroot_dir}/default/phpMyAdmin + /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} + mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save} + sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + chown -R ${run_user}.$run_user ${wwwroot_dir}/default/phpMyAdmin + popd } diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 47382af3..cd63a396 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -9,53 +9,56 @@ # https://github.com/lj2007331/oneinstack Install_PureFTPd() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf pure-ftpd-$pureftpd_version.tar.gz -cd pure-ftpd-$pureftpd_version -[ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir -./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 -make -j ${THREAD} && make install -if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then + pushd ${oneinstack_dir}/src + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf pure-ftpd-$pureftpd_version.tar.gz + pushd pure-ftpd-$pureftpd_version + [ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir + ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 + make -j ${THREAD} && make install + if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ]; then echo "${CSUCCESS}Pure-Ftp installed successfully! ${CEND}" [ ! -e "$pureftpd_install_dir/etc" ] && mkdir $pureftpd_install_dir/etc cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@" $pureftpd_install_dir/sbin/pure-config.pl chmod +x $pureftpd_install_dir/sbin/pure-config.pl - cd ../../ - /bin/cp init.d/Pureftpd-init /etc/init.d/pureftpd + popd + /bin/cp ../init.d/Pureftpd-init /etc/init.d/pureftpd sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@g" /etc/init.d/pureftpd chmod +x /etc/init.d/pureftpd [ "$OS" == 'CentOS' ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } [ "$Debian_version" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd - /bin/cp config/pure-ftpd.conf $pureftpd_install_dir/etc + /bin/cp ../config/pure-ftpd.conf $pureftpd_install_dir/etc sed -i "s@^PureDB.*@PureDB $pureftpd_install_dir/etc/pureftpd.pdb@" $pureftpd_install_dir/etc/pure-ftpd.conf sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" $pureftpd_install_dir/etc/pure-ftpd.conf ulimit -s unlimited service pureftpd start + echo "${CSUCCESS}Pureftpd installed successfully! ${CEND}" + rm -rf pure-ftpd-$pureftpd_version # iptables Ftp - if [ "$OS" == 'CentOS' ];then - if [ -z "`grep '20000:30000' /etc/sysconfig/iptables`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT - iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep '20000:30000' /etc/iptables.up.rules`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT - iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi + if [ "$OS" == 'CentOS' ]; then + if [ -z "`grep '20000:30000' /etc/sysconfig/iptables`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT + iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT + service iptables save + fi + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "`grep '20000:30000' /etc/iptables.up.rules`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT + iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi fi -else + else rm -rf $pureftpd_install_dir echo "${CFAILURE}Pure-Ftpd install failed, Please contact the author! ${CEND}" kill -9 $$ -fi + fi + popd } diff --git a/include/redis.sh b/include/redis.sh index 1ea04ca6..c557a923 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -9,81 +9,74 @@ # https://github.com/lj2007331/oneinstack Install_redis-server() { - pushd $oneinstack_dir/src - tar xzf redis-$redis_version.tar.gz - pushd redis-$redis_version - if [ "$OS_BIT" == '32' ];then - sed -i '1i\CFLAGS= -march=i686' src/Makefile - sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings - fi - - make -j ${THREAD} - - if [ -f "src/redis-server" ];then - mkdir -p $redis_install_dir/{bin,etc,var} - /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ - /bin/cp redis.conf $redis_install_dir/etc/ - ln -s $redis_install_dir/bin/* /usr/local/bin/ - sed -i 's@pidfile.*@pidfile /var/run/redis.pid@' $redis_install_dir/etc/redis.conf - sed -i "s@logfile.*@logfile $redis_install_dir/var/redis.log@" $redis_install_dir/etc/redis.conf - sed -i "s@^dir.*@dir $redis_install_dir/var@" $redis_install_dir/etc/redis.conf - sed -i 's@daemonize no@daemonize yes@' $redis_install_dir/etc/redis.conf - sed -i "s@^# bind 127.0.0.1@bind 127.0.0.1@" $redis_install_dir/etc/redis.conf - redis_maxmemory=`expr $Mem / 8`000000 - [ -z "`grep ^maxmemory $redis_install_dir/etc/redis.conf`" ] && sed -i "s@maxmemory @maxmemory \nmaxmemory `expr $Mem / 8`000000@" $redis_install_dir/etc/redis.conf - echo "${CSUCCESS}Redis-server installed successfully! ${CEND}" - popd - rm -rf redis-$redis_version - id -u redis >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis - chown -R redis:redis $redis_install_dir/var - /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server - if [ "$OS" == 'CentOS' ];then - cc start-stop-daemon.c -o /sbin/start-stop-daemon - chkconfig --add redis-server - chkconfig redis-server on - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - update-rc.d redis-server defaults - fi - sed -i "s@/usr/local/redis@$redis_install_dir@g" /etc/init.d/redis-server - #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf - #sysctl -p - service redis-server start - else - rm -rf $redis_install_dir - echo "${CFAILURE}Redis-server install failed, Please contact the author! ${CEND}" - kill -9 $$ - fi + pushd ${oneinstack_dir}/src + tar xzf redis-${redis_version}.tar.gz + pushd redis-${redis_version} + if [ "$OS_BIT" == '32' ]; then + sed -i '1i\CFLAGS= -march=i686' src/Makefile + sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings + fi + make -j ${THREAD} + if [ -f "src/redis-server" ]; then + mkdir -p ${redis_install_dir}/{bin,etc,var} + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} ${redis_install_dir}/bin/ + /bin/cp redis.conf ${redis_install_dir}/etc/ + ln -s ${redis_install_dir}/bin/* /usr/local/bin/ + sed -i 's@pidfile.*@pidfile /var/run/redis.pid@' ${redis_install_dir}/etc/redis.conf + sed -i "s@logfile.*@logfile ${redis_install_dir}/var/redis.log@" ${redis_install_dir}/etc/redis.conf + sed -i "s@^dir.*@dir ${redis_install_dir}/var@" ${redis_install_dir}/etc/redis.conf + sed -i 's@daemonize no@daemonize yes@' ${redis_install_dir}/etc/redis.conf + sed -i "s@^# bind 127.0.0.1@bind 127.0.0.1@" ${redis_install_dir}/etc/redis.conf + redis_maxmemory=`expr $Mem / 8`000000 + [ -z "`grep ^maxmemory ${redis_install_dir}/etc/redis.conf`" ] && sed -i "s@maxmemory @maxmemory \nmaxmemory `expr $Mem / 8`000000@" ${redis_install_dir}/etc/redis.conf + echo "${CSUCCESS}Redis-server installed successfully! ${CEND}" popd + rm -rf redis-${redis_version} + id -u redis >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis + chown -R redis:redis ${redis_install_dir}/var + /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server + if [ "$OS" == 'CentOS' ]; then + cc start-stop-daemon.c -o /sbin/start-stop-daemon + chkconfig --add redis-server + chkconfig redis-server on + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + update-rc.d redis-server defaults + fi + sed -i "s@/usr/local/redis@${redis_install_dir}@g" /etc/init.d/redis-server + #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf + #sysctl -p + service redis-server start + else + rm -rf ${redis_install_dir} + echo "${CFAILURE}Redis-server install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + popd } Install_php-redis() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - if [ -e "$php_install_dir/bin/phpize" ];then - if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then - tar xzf redis-${redis_pecl_for_php7_version}.tgz - popd redis-${redis_pecl_for_php7_version} - else - tar xzf redis-$redis_pecl_version.tgz - cd redis-$redis_pecl_version - fi - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/redis.so" ];then - cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF -[redis] -extension=redis.so -EOF - echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}" - popd - rm -rf redis-$redis_pecl_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP Redis module install failed, Please contact the author! ${CEND}" - fi + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + if [ -e "${php_install_dir}/bin/phpize" ]; then + if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + tar xzf redis-${redis_pecl_for_php7_version}.tgz + pushd redis-${redis_pecl_for_php7_version} + else + tar xzf redis-$redis_pecl_version.tgz + pushd redis-$redis_pecl_version fi - popd + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + if [ -f "${phpExtensionDir}/redis.so" ]; then + echo 'extension=redis.so' > ${php_install_dir}/etc/php.d/ext-redis.ini + echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}" + popd + rm -rf redis-${redis_pecl_for_php7_version} redis-$redis_pecl_version + else + echo "${CFAILURE}PHP Redis module install failed, Please contact the author! ${CEND}" + fi + fi + popd } diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh index c881733c..bb2bc036 100644 --- a/include/tcmalloc.sh +++ b/include/tcmalloc.sh @@ -9,22 +9,20 @@ # https://github.com/lj2007331/oneinstack Install_tcmalloc() { -cd $oneinstack_dir/src - -tar xzf gperftools-$tcmalloc_version.tar.gz -cd gperftools-$tcmalloc_version -./configure --enable-frame-pointers -make -j ${THREAD} && make install - -if [ -f "/usr/local/lib/libtcmalloc.so" ];then + pushd ${oneinstack_dir}/src + tar xzf gperftools-$tcmalloc_version.tar.gz + pushd gperftools-$tcmalloc_version + ./configure --enable-frame-pointers + make -j ${THREAD} && make install + popd + if [ -f "/usr/local/lib/libtcmalloc.so" ]; then echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig echo "${CSUCCESS}tcmalloc module installed successfully! ${CEND}" - cd .. rm -rf gperftools-$tcmalloc_version -else + else echo "${CFAILURE}tcmalloc module install failed, Please contact the author! ${CEND}" kill -9 $$ -fi -cd .. + fi + popd } diff --git a/include/tengine.sh b/include/tengine.sh index 63e4d290..99d343ee 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -9,62 +9,61 @@ # https://github.com/lj2007331/oneinstack Install_Tengine() { -cd $oneinstack_dir/src - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf pcre-$pcre_version.tar.gz -tar xzf tengine-$tengine_version.tar.gz -tar xzf openssl-$openssl_version.tar.gz -cd tengine-$tengine_version -# Modify Tengine version -#sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h - -# close debug -sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc - -if [ "$je_tc_malloc" == '1' ];then + pushd ${oneinstack_dir}/src + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf pcre-$pcre_version.tar.gz + tar xzf tengine-$tengine_version.tar.gz + tar xzf openssl-$openssl_version.tar.gz + pushd tengine-$tengine_version + # Modify Tengine version + #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h + + # close debug + sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + + if [ "$je_tc_malloc" == '1' ]; then malloc_module='--with-jemalloc' -elif [ "$je_tc_malloc" == '2' ];then + elif [ "$je_tc_malloc" == '2' ]; then malloc_module='--with-google_perftools_module' mkdir /tmp/tcmalloc chown -R ${run_user}.$run_user /tmp/tcmalloc -fi + fi -[ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir -./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module -make -j ${THREAD} && make install -if [ -e "$tengine_install_dir/conf/nginx.conf" ];then - cd .. + [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir + ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + make -j ${THREAD} && make install + if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then + popd rm -rf tengine-$tengine_version echo "${CSUCCESS}Tengine installed successfully! ${CEND}" -else + else rm -rf $tengine_install_dir echo "${CFAILURE}Tengine install failed, Please Contact the author! ${CEND}" kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$tengine_install_dir/sbin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $tengine_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/sbin:\1@" /etc/profile -. /etc/profile + fi -[ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } -[[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } -cd .. - -sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx - -mv $tengine_install_dir/conf/nginx.conf{,_bk} -if [[ $Apache_version =~ ^[1-2]$ ]];then - /bin/cp config/nginx_apache.conf $tengine_install_dir/conf/nginx.conf -elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ];then - /bin/cp config/nginx_tomcat.conf $tengine_install_dir/conf/nginx.conf -else - /bin/cp config/nginx.conf $tengine_install_dir/conf/nginx.conf + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$tengine_install_dir/sbin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $tengine_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$tengine_install_dir/sbin:\1@" /etc/profile + . /etc/profile + + [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; update-rc.d nginx defaults; } + + sed -i "s@/usr/local/nginx@$tengine_install_dir@g" /etc/init.d/nginx + + mv $tengine_install_dir/conf/nginx.conf{,_bk} + if [[ $Apache_version =~ ^[1-2]$ ]]; then + /bin/cp ../config/nginx_apache.conf $tengine_install_dir/conf/nginx.conf + elif [[ $Tomcat_version =~ ^[1-2]$ ]] && [ ! -e "$php_install_dir/bin/php" ]; then + /bin/cp ../config/nginx_tomcat.conf $tengine_install_dir/conf/nginx.conf + else + /bin/cp ../config/nginx.conf $tengine_install_dir/conf/nginx.conf [ "$PHP_yn" == 'y' ] && [ -z "`grep '/php-fpm_status' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $tengine_install_dir/conf/nginx.conf -fi -cat > $tengine_install_dir/conf/proxy.conf << EOF + fi + cat > $tengine_install_dir/conf/proxy.conf << EOF proxy_connect_timeout 300s; proxy_send_timeout 900; proxy_read_timeout 900; @@ -80,17 +79,17 @@ proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; EOF -sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $tengine_install_dir/conf/nginx.conf -sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf -sed -i "s@^user www www@user $run_user $run_user@" $tengine_install_dir/conf/nginx.conf -[ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf -uname -r | awk -F'.' '{if ($1$2>=39)S=0;else S=1}{exit S}' && [ -z "`grep 'reuse_port on;' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@worker_connections 51200;@worker_connections 51200;\n reuse_port on;@" $tengine_install_dir/conf/nginx.conf - -# worker_cpu_affinity -sed -i "s@^worker_processes.*@worker_processes auto;\nworker_cpu_affinity auto;\ndso {\n\tload ngx_http_concat_module.so;\n\tload ngx_http_sysguard_module.so;\n}@" $tengine_install_dir/conf/nginx.conf - -# logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF + sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $tengine_install_dir/conf/nginx.conf + sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf + sed -i "s@^user www www@user $run_user $run_user@" $tengine_install_dir/conf/nginx.conf + [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf + uname -r | awk -F'.' '{if ($1$2>=39)S=0;else S=1}{exit S}' && [ -z "`grep 'reuse_port on;' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@worker_connections 51200;@worker_connections 51200;\n reuse_port on;@" $tengine_install_dir/conf/nginx.conf + + # worker_cpu_affinity + sed -i "s@^worker_processes.*@worker_processes auto;\nworker_cpu_affinity auto;\ndso {\n\tload ngx_http_concat_module.so;\n\tload ngx_http_sysguard_module.so;\n}@" $tengine_install_dir/conf/nginx.conf + + # logrotate nginx log + cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { daily rotate 5 @@ -104,7 +103,7 @@ postrotate endscript } EOF - -ldconfig -service nginx start + popd + ldconfig + service nginx start } diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 007afe93..83f3e040 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -9,18 +9,18 @@ # https://github.com/lj2007331/oneinstack Install_tomcat-6() { -cd $oneinstack_dir/src -. /etc/profile - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - -tar xzf apache-tomcat-$tomcat_6_version.tar.gz -[ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir -/bin/cp -R apache-tomcat-$tomcat_6_version/* $tomcat_install_dir -rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - -if [ -e "$tomcat_install_dir/conf/server.xml" ];then + cd ${oneinstack_dir}/src + . /etc/profile + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } + + tar xzf apache-tomcat-$tomcat_6_version.tar.gz + [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir + /bin/cp -R apache-tomcat-$tomcat_6_version/* $tomcat_install_dir + rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ -e "$tomcat_install_dir/conf/server.xml" ]; then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib cd $tomcat_install_dir/lib [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina @@ -39,9 +39,9 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ];then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF + if [ -d "/usr/local/apr/lib" ]; then + [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 + cat > $tomcat_install_dir/bin/setenv.sh << EOF JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR @@ -49,37 +49,37 @@ CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd $oneinstack_dir/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml - sed -i /ThreadLocalLeakPreventionListener/d $tomcat_install_dir/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then - if [ "$OS" == 'CentOS' ];then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi - fi + cd ../../../;rm -rf tomcat-native-* + chmod +x $tomcat_install_dir/bin/*.sh + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + cd ${oneinstack_dir}/src + /bin/cp ../config/server.xml $tomcat_install_dir/conf + sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + sed -i /ThreadLocalLeakPreventionListener/d $tomcat_install_dir/conf/server.xml + if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ "$OS" == 'CentOS' ]; then + if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost + cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF $tomcat_install_dir/logs/catalina.out { daily rotate 5 @@ -90,31 +90,31 @@ notifempty copytruncate } EOF - [ -z "`grep '/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - -tar xzf apache-tomcat-$tomcat_7_version.tar.gz -[ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir -/bin/cp -R apache-tomcat-$tomcat_7_version/* $tomcat_install_dir -rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - -if [ -e "$tomcat_install_dir/conf/server.xml" ];then + cd ${oneinstack_dir}/src + . /etc/profile + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } + + tar xzf apache-tomcat-$tomcat_7_version.tar.gz + [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir + /bin/cp -R apache-tomcat-$tomcat_7_version/* $tomcat_install_dir + rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ -e "$tomcat_install_dir/conf/server.xml" ]; then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib cd $tomcat_install_dir/lib [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina @@ -39,9 +39,9 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ];then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF + if [ -d "/usr/local/apr/lib" ]; then + [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 + cat > $tomcat_install_dir/bin/setenv.sh << EOF JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR @@ -49,37 +49,37 @@ CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd $oneinstack_dir/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + cd ../../../;rm -rf tomcat-native-* + chmod +x $tomcat_install_dir/bin/*.sh + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + cd ${oneinstack_dir}/src + /bin/cp ../config/server.xml $tomcat_install_dir/conf + sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then - if [ "$OS" == 'CentOS' ];then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi - fi + if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ "$OS" == 'CentOS' ]; then + if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost + cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF $tomcat_install_dir/logs/catalina.out { daily rotate 5 @@ -90,31 +90,31 @@ notifempty copytruncate } EOF - [ -z "`grep '/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - -tar xzf apache-tomcat-$tomcat_8_version.tar.gz -[ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir -/bin/cp -R apache-tomcat-$tomcat_8_version/* $tomcat_install_dir -rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - -if [ -e "$tomcat_install_dir/conf/server.xml" ];then + cd ${oneinstack_dir}/src + . /etc/profile + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } + + tar xzf apache-tomcat-$tomcat_8_version.tar.gz + [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir + /bin/cp -R apache-tomcat-$tomcat_8_version/* $tomcat_install_dir + rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ -e "$tomcat_install_dir/conf/server.xml" ]; then /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib cd $tomcat_install_dir/lib [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina @@ -39,9 +39,9 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ];then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF + if [ -d "/usr/local/apr/lib" ]; then + [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 + cat > $tomcat_install_dir/bin/setenv.sh << EOF JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR @@ -49,37 +49,37 @@ CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd $oneinstack_dir/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + cd ../../../;rm -rf tomcat-native-* + chmod +x $tomcat_install_dir/bin/*.sh + /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} + cd ${oneinstack_dir}/src + /bin/cp ../config/server.xml $tomcat_install_dir/conf + sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then - if [ "$OS" == 'CentOS' ];then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ];then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi - fi + if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ "$OS" == 'CentOS' ]; then + if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost + cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF $tomcat_install_dir/logs/catalina.out { daily rotate 5 @@ -90,31 +90,31 @@ notifempty copytruncate } EOF - [ -z "`grep ' /dev/null + [ ! -e "$db_install_dir/bin/mysql" ] && echo "${CWARNING}MySQL/MariaDB/Percona is not installed on your system! ${CEND}" && exit 1 + OLD_DB_version_tmp=`$db_install_dir/bin/mysql -V | awk '{print $5}' | awk -F, '{print $1}'` + DB_tmp=`echo $OLD_DB_version_tmp | awk -F'-' '{print $2}'` + if [ "$DB_tmp" == 'MariaDB' ]; then [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mariadb || DOWN_ADDR=https://downloads.mariadb.org/f DB=MariaDB OLD_DB_version=`echo $OLD_DB_version_tmp | awk -F'-' '{print $1}'` -elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ];then + elif [ -n "$DB_tmp" -a "$DB_tmp" != 'MariaDB' ]; then DB=Percona OLD_DB_version=$OLD_DB_version_tmp -else + else [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads DB=MySQL OLD_DB_version=$OLD_DB_version_tmp -fi + fi -#backup -while :; do + #backup + while :; do $db_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "quit" >/dev/null 2>&1 - if [ $? -eq 0 ];then - break + if [ $? -eq 0 ]; then + break else - echo - read -p "Please input the root password of database: " NEW_dbrootpwd - $db_install_dir/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1 - if [ $? -eq 0 ];then - dbrootpwd=$NEW_dbrootpwd - sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf - break - else - echo "${CFAILURE}$DB root password incorrect,Please enter again! ${CEND}" - fi + echo + read -p "Please input the root password of database: " NEW_dbrootpwd + $db_install_dir/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1 + if [ $? -eq 0 ]; then + dbrootpwd=$NEW_dbrootpwd + sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf + break + else + echo "${CFAILURE}$DB root password incorrect,Please enter again! ${CEND}" + fi fi -done + done -echo -echo "${CSUCCESS}Starting $DB backup${CEND}......" -$db_install_dir/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql -[ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "$DB backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}" - -#upgrade -echo -echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}" -[ -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'"; } -[ -e /usr/local/lib/libjemalloc.so -a -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; } - -while :; do echo + echo + echo "${CSUCCESS}Starting $DB backup${CEND}......" + $db_install_dir/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql + [ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "$DB backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}" + + #upgrade + echo + echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}" + [ -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'"; } + [ -e /usr/local/lib/libjemalloc.so -a -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; } + + while :; do echo read -p "Please input upgrade $DB Version(example: $OLD_DB_version): " NEW_DB_version - if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ];then - if [ "$DB" == 'MariaDB' ];then - DB_name=mariadb-${NEW_DB_version}-${GLIBC_FLAG}-${SYS_BIT_b} - DB_URL=$DOWN_ADDR/mariadb-${NEW_DB_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/$DB_name.tar.gz - elif [ "$DB" == 'Percona' ];then - DB_name=percona-server-$NEW_DB_version - DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz - elif [ "$DB" == 'MySQL' ];then - [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-${NEW_DB_version}-linux2.6-${SYS_BIT_b} - DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz - fi - [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 + if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ]; then + if [ "$DB" == 'MariaDB' ]; then + DB_name=mariadb-${NEW_DB_version}-${GLIBC_FLAG}-${SYS_BIT_b} + DB_URL=$DOWN_ADDR/mariadb-${NEW_DB_version}/bintar-${GLIBC_FLAG}-$SYS_BIT_a/$DB_name.tar.gz + elif [ "$DB" == 'Percona' ]; then + DB_name=percona-server-$NEW_DB_version + DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz + elif [ "$DB" == 'MySQL' ]; then + [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-${NEW_DB_version}-linux2.6-${SYS_BIT_b} + DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz + fi + [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 - if [ -e "$DB_name.tar.gz" ];then - echo "Download [${CMSG}$DB_name.tar.gz${CEND}] successfully! " - else - echo "${CWARNING}$DB version does not exist! ${CEND}" - fi - break + if [ -e "$DB_name.tar.gz" ]; then + echo "Download [${CMSG}$DB_name.tar.gz${CEND}] successfully! " + else + echo "${CWARNING}$DB version does not exist! ${CEND}" + fi + break else - echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_DB_version%.*}.xx${CEND}'" + echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_DB_version%.*}.xx${CEND}'" fi -done + done -if [ -e "$DB_name.tar.gz" ];then + if [ -e "$DB_name.tar.gz" ]; then echo "[${CMSG}$DB_name.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` - if [ "$DB" == 'MariaDB' ];then - service mysqld stop - mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir - tar xzf $DB_name.tar.gz - [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir - mv mariadb-${NEW_DB_version}-*-${SYS_BIT_b}/* $mariadb_install_dir - if [ "$je_tc_malloc" == '1' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe - elif [ "$je_tc_malloc" == '2' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ];then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe - fi - $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir - chown mysql.mysql -R $mariadb_data_dir - service mysqld start - $mariadb_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql - service mysqld restart - $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 - $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 - [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" - elif [ "$DB" == 'Percona' ];then - tar zxf $DB_name.tar.gz - cd $DB_name - make clean - if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ];then - 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 \ --DWITH_READLINE=1 \ --DENABLE_DTRACE=0 \ --DENABLED_LOCAL_INFILE=1 \ --DDEFAULT_CHARSET=utf8mb4 \ --DDEFAULT_COLLATION=utf8mb4_general_ci \ -$EXE_LINKER - else - 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 - fi - make -j ${THREAD} - service mysqld stop - mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - [ ! -d "$percona_install_dir" ] && mkdir -p $percona_install_dir - mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir - make install - cd .. - 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 - service mysqld restart - $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 - $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 - [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" - elif [ "$DB" == 'MySQL' ];then - tar zxf $DB_name.tar.gz - service mysqld stop - mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} - [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir - mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir - mv $DB_name/* $mysql_install_dir/ - [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe - [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe - [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + if [ "$DB" == 'MariaDB' ]; then + service mysqld stop + mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mkdir -p $mariadb_data_dir;chown mysql.mysql -R $mariadb_data_dir + tar xzf $DB_name.tar.gz + [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir + mv mariadb-${NEW_DB_version}-*-${SYS_BIT_b}/* $mariadb_install_dir + if [ "$je_tc_malloc" == '1' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ]; then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe + elif [ "$je_tc_malloc" == '2' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ]; then + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe + fi + $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir + chown mysql.mysql -R $mariadb_data_dir + service mysqld start + $mariadb_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql + service mysqld restart + $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 + $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 + [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" + elif [ "$DB" == 'Percona' ]; then + tar zxf $DB_name.tar.gz + pushd $DB_name + make clean + if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ]; then + 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 \ + -DWITH_READLINE=1 \ + -DENABLE_DTRACE=0 \ + -DENABLED_LOCAL_INFILE=1 \ + -DDEFAULT_CHARSET=utf8mb4 \ + -DDEFAULT_COLLATION=utf8mb4_general_ci \ + $EXE_LINKER + else + 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 + fi + make -j ${THREAD} + service mysqld stop + mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + [ ! -d "$percona_install_dir" ] && mkdir -p $percona_install_dir + mkdir -p $percona_data_dir;chown mysql.mysql -R $percona_data_dir + make install + popd + 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 + service mysqld restart + $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 + $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 + [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" + elif [ "$DB" == 'MySQL' ]; then + tar zxf $DB_name.tar.gz + service mysqld stop + mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`} + [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir + mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir + mv $DB_name/* $mysql_install_dir/ + [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir + [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir - chown mysql.mysql -R $mysql_data_dir - [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf - service mysqld start - $mysql_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql - service mysqld restart - $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 - $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 - [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" + chown mysql.mysql -R $mysql_data_dir + [ -e "$mysql_install_dir/my.cnf" ] && rm -rf $mysql_install_dir/my.cnf + service mysqld start + $mysql_install_dir/bin/mysql < DB_all_backup_$(date +"%Y%m%d").sql + service mysqld restart + $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1 + $mysql_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1 + [ $? -eq 0 ] && echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}" fi -fi + fi } diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 0ff88719..53c2c251 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -9,44 +9,44 @@ # https://github.com/lj2007331/oneinstack Upgrade_PHP() { -cd $oneinstack_dir/src -[ ! -e "$php_install_dir" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1 -echo -OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` -echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" -while :; do echo + pushd ${oneinstack_dir}/src > /dev/null + [ ! -e "$php_install_dir" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1 + echo + OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" + while :; do echo read -p "Please input upgrade PHP Version: " NEW_PHP_version - if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ];then - [ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1 - if [ -e "php-$NEW_PHP_version.tar.gz" ];then - echo "Download [${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] successfully! " - else - echo "${CWARNING}PHP version does not exist! ${CEND}" - fi - break + if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ]; then + [ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1 + if [ -e "php-$NEW_PHP_version.tar.gz" ]; then + echo "Download [${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] successfully! " + else + echo "${CWARNING}PHP version does not exist! ${CEND}" + fi + break else - echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_PHP_version%.*}.xx${CEND}'" + echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_PHP_version%.*}.xx${CEND}'" fi -done + done -if [ -e "php-$NEW_PHP_version.tar.gz" ];then + if [ -e "php-$NEW_PHP_version.tar.gz" ]; then echo "[${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf php-$NEW_PHP_version.tar.gz src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src patch -d php-$NEW_PHP_version -p0 < fpm-race-condition.patch - cd php-$NEW_PHP_version + pushd php-$NEW_PHP_version make clean $php_install_dir/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash make ZEND_EXTRA_LIBS='-liconv' echo "Stoping php-fpm..." service php-fpm stop make install - cd .. + popd > /dev/null echo "Starting php-fpm..." service php-fpm start echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_PHP_version${CEND} to ${CWARNING}$NEW_PHP_version${CEND}" -fi -cd .. + fi + popd > /dev/null } diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 4995c96a..0826cf2f 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -9,40 +9,40 @@ # https://github.com/lj2007331/oneinstack Upgrade_phpMyAdmin() { -cd $oneinstack_dir/src -[ ! -e "$wwwroot_dir/default/phpMyAdmin" ] && echo "${CWARNING}phpMyAdmin is not installed on your system! ${CEND}" && exit 1 -OLD_phpMyAdmin_version=`grep Version $wwwroot_dir/default/phpMyAdmin/README | awk '{print $2}'` -echo "Current phpMyAdmin Version: ${CMSG}$OLD_phpMyAdmin_version${CEND}" + pushd ${oneinstack_dir}/src > /dev/null + [ ! -e "${wwwroot_dir}/default/phpMyAdmin" ] && echo "${CWARNING}phpMyAdmin is not installed on your system! ${CEND}" && exit 1 + OLD_phpMyAdmin_version=`grep Version ${wwwroot_dir}/default/phpMyAdmin/README | awk '{print $2}'` + echo "Current phpMyAdmin Version: ${CMSG}${OLD_phpMyAdmin_version}${CEND}" -while :; do echo + while :; do echo read -p "Please input upgrade phpMyAdmin Version(example: 4.4.15): " NEW_phpMyAdmin_version - if [ "$NEW_phpMyAdmin_version" != "$OLD_phpMyAdmin_version" ];then - [ ! -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/$NEW_phpMyAdmin_version/phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz > /dev/null 2>&1 - if [ -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ];then - echo "Download [${CMSG}phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz${CEND}] successfully! " - break - else - echo "${CWARNING}phpMyAdmin version does not exist! ${CEND}" - fi + if [ "${NEW_phpMyAdmin_version}" != "${OLD_phpMyAdmin_version}" ]; then + [ ! -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/${NEW_phpMyAdmin_version}/phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz > /dev/null 2>&1 + if [ -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ]; then + echo "Download [${CMSG}phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}phpMyAdmin version does not exist! ${CEND}" + fi else - echo "${CWARNING}input error! Upgrade phpMyAdmin version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade phpMyAdmin version is the same as the old version${CEND}" fi -done + done -if [ -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ];then + if [ -e "phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz" ]; then echo "[${CMSG}phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages.tar.gz - rm -rf $wwwroot_dir/default/phpMyAdmin - /bin/mv phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages $wwwroot_dir/default/phpMyAdmin - /bin/cp $wwwroot_dir/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} - mkdir $wwwroot_dir/default/phpMyAdmin/{upload,save} - sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'`cat /dev/urandom | head -1 | md5sum | head -c 10`\';@" $wwwroot_dir/default/phpMyAdmin/config.inc.php - chown -R ${run_user}.$run_user $wwwroot_dir/default/phpMyAdmin + rm -rf ${wwwroot_dir}/default/phpMyAdmin + /bin/mv phpMyAdmin-${NEW_phpMyAdmin_version}-all-languages ${wwwroot_dir}/default/phpMyAdmin + /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php} + mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save} + sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php + chown -R ${run_user}.$run_user ${wwwroot_dir}/default/phpMyAdmin echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_phpMyAdmin_version${CEND} to ${CWARNING}$NEW_phpMyAdmin_version${CEND}" -fi -cd .. + fi + popd } diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index 1e5fcfdc..bcb7a527 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -9,49 +9,49 @@ # https://github.com/lj2007331/oneinstack Upgrade_Redis() { -cd $oneinstack_dir/src -[ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1 -OLD_Redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'` -echo "Current Redis Version: ${CMSG}$OLD_Redis_version${CEND}" -while :; do echo + pushd ${oneinstack_dir}/src > /dev/null + [ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1 + OLD_Redis_version=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'` + echo "Current Redis Version: ${CMSG}$OLD_Redis_version${CEND}" + while :; do echo read -p "Please input upgrade Redis Version(example: 3.0.5): " NEW_Redis_version - if [ "$NEW_Redis_version" != "$OLD_Redis_version" ];then - [ ! -e "redis-$NEW_Redis_version.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_Redis_version.tar.gz > /dev/null 2>&1 - if [ -e "redis-$NEW_Redis_version.tar.gz" ];then - echo "Download [${CMSG}redis-$NEW_Redis_version.tar.gz${CEND}] successfully! " - break - else - echo "${CWARNING}Redis version does not exist! ${CEND}" - fi + if [ "$NEW_Redis_version" != "$OLD_Redis_version" ]; then + [ ! -e "redis-$NEW_Redis_version.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_Redis_version.tar.gz > /dev/null 2>&1 + if [ -e "redis-$NEW_Redis_version.tar.gz" ]; then + echo "Download [${CMSG}redis-$NEW_Redis_version.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}Redis version does not exist! ${CEND}" + fi else - echo "${CWARNING}input error! Upgrade Redis version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Redis version is the same as the old version${CEND}" fi -done + done -if [ -e "redis-$NEW_Redis_version.tar.gz" ];then + if [ -e "redis-$NEW_Redis_version.tar.gz" ]; then echo "[${CMSG}redis-$NEW_Redis_version.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf redis-$NEW_Redis_version.tar.gz - cd redis-$NEW_Redis_version + pushd redis-$NEW_Redis_version make clean - if [ "$OS_BIT" == '32' ];then - sed -i '1i\CFLAGS= -march=i686' src/Makefile - sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings + if [ "$OS_BIT" == '32' ]; then + sed -i '1i\CFLAGS= -march=i686' src/Makefile + sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings fi make -j ${THREAD} - if [ -f "src/redis-server" ];then - echo "Restarting Redis..." - service redis-server stop - /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ - service redis-server start - echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}" + if [ -f "src/redis-server" ]; then + echo "Restarting Redis..." + service redis-server stop + /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ + service redis-server start + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}" else - echo "${CFAILURE}Upgrade Redis failed! ${CEND}" + echo "${CFAILURE}Upgrade Redis failed! ${CEND}" fi - cd .. -fi -cd .. + popd > /dev/null + fi + popd > /dev/null } diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 7ad4ab4c..698abf06 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -9,37 +9,37 @@ # https://github.com/lj2007331/oneinstack Upgrade_Nginx() { -cd $oneinstack_dir/src -[ ! -e "$nginx_install_dir/sbin/nginx" ] && echo "${CWARNING}Nginx is not installed on your system! ${CEND}" && exit 1 -OLD_Nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` -OLD_Nginx_version=${OLD_Nginx_version_tmp##*/} -echo -echo "Current Nginx Version: ${CMSG}$OLD_Nginx_version${CEND}" -while :; do echo + pushd ${oneinstack_dir}/src > /dev/null + [ ! -e "$nginx_install_dir/sbin/nginx" ] && echo "${CWARNING}Nginx is not installed on your system! ${CEND}" && exit 1 + OLD_Nginx_version_tmp=`$nginx_install_dir/sbin/nginx -v 2>&1` + OLD_Nginx_version=${OLD_Nginx_version_tmp##*/} + echo + echo "Current Nginx Version: ${CMSG}$OLD_Nginx_version${CEND}" + while :; do echo read -p "Please input upgrade Nginx Version(example: 1.9.15): " NEW_Nginx_version - if [ "$NEW_Nginx_version" != "$OLD_Nginx_version" ];then - [ ! -e "nginx-$NEW_Nginx_version.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-$NEW_Nginx_version.tar.gz > /dev/null 2>&1 - if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then - src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src - tar xzf openssl-$openssl_version.tar.gz - tar xzf pcre-$pcre_version.tar.gz - echo "Download [${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] successfully! " - break - else - echo "${CWARNING}Nginx version does not exist! ${CEND}" - fi + if [ "$NEW_Nginx_version" != "$OLD_Nginx_version" ]; then + [ ! -e "nginx-$NEW_Nginx_version.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-$NEW_Nginx_version.tar.gz > /dev/null 2>&1 + if [ -e "nginx-$NEW_Nginx_version.tar.gz" ]; then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz + tar xzf pcre-$pcre_version.tar.gz + echo "Download [${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}Nginx version does not exist! ${CEND}" + fi else - echo "${CWARNING}input error! Upgrade Nginx version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Nginx version is the same as the old version${CEND}" fi -done + done -if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then + if [ -e "nginx-$NEW_Nginx_version.tar.gz" ]; then echo "[${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf nginx-$NEW_Nginx_version.tar.gz - cd nginx-$NEW_Nginx_version + pushd nginx-$NEW_Nginx_version make clean sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc # close debug $nginx_install_dir/sbin/nginx -V &> $$ @@ -47,53 +47,54 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then rm -rf $$ ./configure $nginx_configure_arguments make -j ${THREAD} - if [ -f "objs/nginx" ];then - /bin/mv $nginx_install_dir/sbin/nginx{,`date +%m%d`} - /bin/cp objs/nginx $nginx_install_dir/sbin/nginx - kill -USR2 `cat /var/run/nginx.pid` - sleep 1 - kill -QUIT `cat /var/run/nginx.pid.oldbin` - echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Nginx_version${CEND} to ${CWARNING}$NEW_Nginx_version${CEND}" + if [ -f "objs/nginx" ]; then + /bin/mv $nginx_install_dir/sbin/nginx{,`date +%m%d`} + /bin/cp objs/nginx $nginx_install_dir/sbin/nginx + kill -USR2 `cat /var/run/nginx.pid` + sleep 1 + kill -QUIT `cat /var/run/nginx.pid.oldbin` + popd > /dev/null + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Nginx_version${CEND} to ${CWARNING}$NEW_Nginx_version${CEND}" + rm -rf nginx-$NEW_Nginx_version else - echo "${CFAILURE}Upgrade Nginx failed! ${CEND}" + echo "${CFAILURE}Upgrade Nginx failed! ${CEND}" fi - cd .. -fi -cd .. + fi + popd > /dev/null } Upgrade_Tengine() { -cd $oneinstack_dir/src -[ ! -e "$tengine_install_dir/sbin/nginx" ] && echo "${CWARNING}Tengine is not installed on your system! ${CEND}" && exit 1 -OLD_Tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` -OLD_Tengine_version="`echo ${OLD_Tengine_version_tmp#*/} | awk '{print $1}'`" -echo -echo "Current Tengine Version: ${CMSG}$OLD_Tengine_version${CEND}" -while :; do echo + pushd ${oneinstack_dir}/src + [ ! -e "$tengine_install_dir/sbin/nginx" ] && echo "${CWARNING}Tengine is not installed on your system! ${CEND}" && exit 1 + OLD_Tengine_version_tmp=`$tengine_install_dir/sbin/nginx -v 2>&1` + OLD_Tengine_version="`echo ${OLD_Tengine_version_tmp#*/} | awk '{print $1}'`" + echo + echo "Current Tengine Version: ${CMSG}$OLD_Tengine_version${CEND}" + while :; do echo read -p "Please input upgrade Tengine Version(example: 2.1.15): " NEW_Tengine_version - if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ];then - [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1 - if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then - src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src - tar xzf openssl-$openssl_version.tar.gz - tar xzf pcre-$pcre_version.tar.gz - echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! " - break - else - echo "${CWARNING}Tengine version does not exist! ${CEND}" - fi + if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ]; then + [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1 + if [ -e "tengine-$NEW_Tengine_version.tar.gz" ]; then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz + tar xzf pcre-$pcre_version.tar.gz + echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}Tengine version does not exist! ${CEND}" + fi else - echo "${CWARNING}input error! Upgrade Tengine version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade Tengine version is the same as the old version${CEND}" fi -done + done -if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then + if [ -e "tengine-$NEW_Tengine_version.tar.gz" ]; then echo "[${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf tengine-$NEW_Tengine_version.tar.gz - cd tengine-$NEW_Tengine_version + pushd tengine-$NEW_Tengine_version make clean sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc # close debug $tengine_install_dir/sbin/nginx -V &> $$ @@ -101,58 +102,59 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then rm -rf $$ ./configure $tengine_configure_arguments make -j ${THREAD} - if [ -f "objs/nginx" ];then - /bin/mv $tengine_install_dir/sbin/nginx{,`date +%m%d`} - /bin/mv $tengine_install_dir/sbin/dso_tool{,`date +%m%d`} - /bin/mv $tengine_install_dir/modules{,`date +%m%d`} - /bin/cp objs/nginx $tengine_install_dir/sbin/nginx - /bin/cp objs/dso_tool $tengine_install_dir/sbin/dso_tool - chmod +x $tengine_install_dir/sbin/* - make install - kill -USR2 `cat /var/run/nginx.pid` - sleep 1 - kill -QUIT `cat /var/run/nginx.pid.oldbin` - echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Tengine_version${CEND} to ${CWARNING}$NEW_Tengine_version${CEND}" + if [ -f "objs/nginx" ]; then + /bin/mv $tengine_install_dir/sbin/nginx{,`date +%m%d`} + /bin/mv $tengine_install_dir/sbin/dso_tool{,`date +%m%d`} + /bin/mv $tengine_install_dir/modules{,`date +%m%d`} + /bin/cp objs/nginx $tengine_install_dir/sbin/nginx + /bin/cp objs/dso_tool $tengine_install_dir/sbin/dso_tool + chmod +x $tengine_install_dir/sbin/* + make install + kill -USR2 `cat /var/run/nginx.pid` + sleep 1 + kill -QUIT `cat /var/run/nginx.pid.oldbin` + popd > /dev/null + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Tengine_version${CEND} to ${CWARNING}$NEW_Tengine_version${CEND}" + rm -rf tengine-$NEW_Tengine_version else - echo "${CFAILURE}Upgrade Tengine failed! ${CEND}" + echo "${CFAILURE}Upgrade Tengine failed! ${CEND}" fi - cd .. -fi -cd .. + fi + popd > /dev/null } Upgrade_OpenResty() { -cd $oneinstack_dir/src -[ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}OpenResty is not installed on your system! ${CEND}" && exit 1 -OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1` -OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`" -echo -echo "Current OpenResty Version: ${CMSG}$OLD_OpenResty_version${CEND}" -while :; do echo + pushd ${oneinstack_dir}/src + [ ! -e "$openresty_install_dir/nginx/sbin/nginx" ] && echo "${CWARNING}OpenResty is not installed on your system! ${CEND}" && exit 1 + OLD_OpenResty_version_tmp=`$openresty_install_dir/nginx/sbin/nginx -v 2>&1` + OLD_OpenResty_version="`echo ${OLD_OpenResty_version_tmp#*/} | awk '{print $1}'`" + echo + echo "Current OpenResty Version: ${CMSG}$OLD_OpenResty_version${CEND}" + while :; do echo read -p "Please input upgrade OpenResty Version(example: 1.9.7.19): " NEW_OpenResty_version - if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then - [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 - if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then - src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src - tar xzf openssl-$openssl_version.tar.gz - tar xzf pcre-$pcre_version.tar.gz - echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! " - break - else - echo "${CWARNING}OpenResty version does not exist! ${CEND}" - fi + if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ]; then + [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1 + if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ]; then + src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src + tar xzf openssl-$openssl_version.tar.gz + tar xzf pcre-$pcre_version.tar.gz + echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}OpenResty version does not exist! ${CEND}" + fi else - echo "${CWARNING}input error! Upgrade OpenResty version is the same as the old version${CEND}" + echo "${CWARNING}input error! Upgrade OpenResty version is the same as the old version${CEND}" fi -done + done -if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then + if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ]; then echo "[${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` tar xzf openresty-$NEW_OpenResty_version.tar.gz - cd openresty-$NEW_OpenResty_version + pushd openresty-$NEW_OpenResty_version make clean openresty_version_tmp=${NEW_OpenResty_version%.*} sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug @@ -163,17 +165,18 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} - if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then - /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`} - make install - kill -USR2 `cat /var/run/nginx.pid` - sleep 1 - kill -QUIT `cat /var/run/nginx.pid.oldbin` - echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_OpenResty_version${CEND} to ${CWARNING}$NEW_OpenResty_version${CEND}" + if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ]; then + /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`} + make install + kill -USR2 `cat /var/run/nginx.pid` + sleep 1 + kill -QUIT `cat /var/run/nginx.pid.oldbin` + popd > /dev/null + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_OpenResty_version${CEND} to ${CWARNING}$NEW_OpenResty_version${CEND}" + rm -rf openresty-$NEW_OpenResty_version else - echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}" + echo "${CFAILURE}Upgrade OpenResty failed! ${CEND}" fi - cd .. -fi -cd .. + fi + popd > /dev/null } diff --git a/include/xcache.sh b/include/xcache.sh index 32ee70f2..47149f50 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -9,20 +9,20 @@ # https://github.com/lj2007331/oneinstack Install_XCache() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - tar xzf xcache-$xcache_version.tar.gz - pushd xcache-$xcache_version - make clean - $php_install_dir/bin/phpize - ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/xcache.so" ];then - /bin/cp -R htdocs $wwwroot_dir/default/xcache - chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache - touch /tmp/xcache;chown ${run_user}.$run_user /tmp/xcache - - cat > $php_install_dir/etc/php.d/ext-xcache.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + tar xzf xcache-${xcache_version}.tar.gz + pushd xcache-${xcache_version} + ${php_install_dir}/bin/phpize + ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd + if [ -f "${phpExtensionDir}/xcache.so" ]; then + /bin/cp -R htdocs ${wwwroot_dir}/default/xcache + chown -R ${run_user}.$run_user ${wwwroot_dir}/default/xcache + touch /tmp/xcache;chown ${run_user}.${run_user} /tmp/xcache + + cat > ${php_install_dir}/etc/php.d/ext-xcache.ini << EOF [xcache-common] extension=xcache.so [xcache.admin] @@ -59,12 +59,10 @@ xcache.coverager = Off xcache.coverager_autostart = On xcache.coveragedump_directory = "" EOF - echo "${CSUCCESS}Xcache module installed successfully! ${CEND}" - popd - rm -rf xcache-$xcache_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}" - fi - popd + echo "${CSUCCESS}Xcache module installed successfully! ${CEND}" + rm -rf xcache-${xcache_version} + else + echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 395a2b39..0c3d7cc1 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -9,16 +9,16 @@ # https://github.com/lj2007331/oneinstack Install_ZendOPcache() { - pushd $oneinstack_dir/src - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` - tar xzf zendopcache-$zendopcache_version.tgz - pushd zendopcache-$zendopcache_version - make clean - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - if [ -f "${phpExtensionDir}/opcache.so" ];then - cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF + pushd ${oneinstack_dir}/src + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + tar xzf zendopcache-$zendopcache_version.tgz + pushd zendopcache-$zendopcache_version + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd + if [ -f "${phpExtensionDir}/opcache.so" ]; then + cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=${phpExtensionDir}/opcache.so opcache.enable=1 @@ -31,12 +31,10 @@ opcache.fast_shutdown=1 opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" - popd - rm -rf zendopcache-$zendopcache_version - [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart - else - echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" - fi - popd + echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" + rm -rf zendopcache-${zendopcache_version} + else + echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" + fi + popd } diff --git a/init.d/Memcached-init-CentOS b/init.d/Memcached-init-CentOS index 17c50a40..f967724a 100755 --- a/init.d/Memcached-init-CentOS +++ b/init.d/Memcached-init-CentOS @@ -17,59 +17,59 @@ DAEMON=/usr/local/memcached/bin/memcached if [ "$NETWORKING" = "no" ] then - exit 0 + exit 0 fi RETVAL=0 prog="memcached" start () { - echo -n $"Starting $prog: " - # insure that /var/run/memcached has proper permissions - mkdir -p /var/run/memcached - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then - chown $USER /var/run/memcached - fi - $DAEMON -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached + echo -n $"Starting $prog: " + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + $DAEMON -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached } stop () { - echo -n $"Stopping $prog: " - killproc memcached - RETVAL=$? - echo - if [ $RETVAL -eq 0 ] ; then - rm -f /var/lock/subsys/memcached - rm -f /var/run/memcached/memcached.pid - fi + echo -n $"Stopping $prog: " + killproc memcached + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/subsys/memcached + rm -f /var/run/memcached/memcached.pid + fi } restart () { - stop - start + stop + start } # See how we were called. case "$1" in - start) - start - ;; - stop) + start) + start + ;; + stop) stop ;; - status) + status) status memcached ;; - restart|reload) + restart|reload) restart ;; - condrestart) + condrestart) [ -f /var/lock/subsys/memcached ] && restart || : ;; - *) + *) echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" exit 1 esac diff --git a/init.d/Memcached-init-Ubuntu b/init.d/Memcached-init-Ubuntu index edeb534f..d8ef3c10 100755 --- a/init.d/Memcached-init-Ubuntu +++ b/init.d/Memcached-init-Ubuntu @@ -11,75 +11,75 @@ RETVAL=0 prog="/usr/local/memcached/bin/memcached" start_instance() { - echo -n $"Starting $prog ($1): " - start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 - PORT=`expr $PORT + 1` + echo -n $"Starting $prog ($1): " + start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 + PORT=`expr $PORT + 1` } stop_instance() { - echo -n $"Stopping $prog ($1): " - start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON - RETVAL=$? - echo - if [ $RETVAL -eq 0 ] ; then - rm -f /var/lock/memcached.$1 - rm -f /var/run/memcached/memcached.$1.pid - fi + echo -n $"Stopping $prog ($1): " + start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/memcached.$1 + rm -f /var/run/memcached/memcached.$1.pid + fi } start () { - # insure that /var/run/memcached has proper permissions - mkdir -p /var/run/memcached - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then - chown $USER /var/run/memcached - fi + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi - start_instance default 256; - #start_instance block 16; - #start_instance content 128; - #start_instance filter 128; - #start_instance form 32; - #start_instance menu 16; - #start_instance page 8; - #start_instance update 8; - #start_instance views 8; + start_instance default 256; + #start_instance block 16; + #start_instance content 128; + #start_instance filter 128; + #start_instance form 32; + #start_instance menu 16; + #start_instance page 8; + #start_instance update 8; + #start_instance views 8; } stop () { - stop_instance default; - #stop_instance block; - #stop_instance content; - #stop_instance filter; - #stop_instance form; - #stop_instance menu; - #stop_instance page; - #stop_instance update; - #stop_instance views; + stop_instance default; + #stop_instance block; + #stop_instance content; + #stop_instance filter; + #stop_instance form; + #stop_instance menu; + #stop_instance page; + #stop_instance update; + #stop_instance views; } restart () { - stop - start + stop + start } # See how we were called. case "$1" in start) - start - ;; + start + ;; stop) - stop - ;; + stop + ;; status) - status memcached - ;; + status memcached + ;; restart|reload|force-reload) - restart - ;; + restart + ;; *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 esac exit $? diff --git a/init.d/Nginx-init-CentOS b/init.d/Nginx-init-CentOS index bd58a9fd..e95c4bc9 100755 --- a/init.d/Nginx-init-CentOS +++ b/init.d/Nginx-init-CentOS @@ -28,61 +28,61 @@ NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" lockfile=/var/lock/subsys/nginx make_dirs() { - # make required directories - user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` - if [ -z "`grep $user /etc/passwd`" ]; then - useradd -M -s /bin/nologin $user - fi - options=`$nginx -V 2>&1 | grep 'configure arguments:'` - for opt in $options; do - if [ `echo $opt | grep '.*-temp-path'` ]; then - value=`echo $opt | cut -d "=" -f 2` - if [ ! -d "$value" ]; then - # echo "creating" $value - mkdir -p $value && chown -R $user $value - fi - fi - done + # make required directories + user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` + if [ -z "`grep $user /etc/passwd`" ]; then + useradd -M -s /bin/nologin $user + fi + options=`$nginx -V 2>&1 | grep 'configure arguments:'` + for opt in $options; do + if [ `echo $opt | grep '.*-temp-path'` ]; then + value=`echo $opt | cut -d "=" -f 2` + if [ ! -d "$value" ]; then + # echo "creating" $value + mkdir -p $value && chown -R $user $value + fi + fi + done } start() { - [ -x $nginx ] || exit 5 - [ -f $NGINX_CONF_FILE ] || exit 6 - make_dirs - echo -n $"Starting $prog: " - daemon $nginx -c $NGINX_CONF_FILE - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + make_dirs + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval } stop() { - echo -n $"Stopping $prog: " - killproc $prog -QUIT - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval } restart() { - configtest || return $? - stop - sleep 3 - start + configtest || return $? + stop + sleep 3 + start } reload() { - configtest || return $? - echo -n $"Reloading $prog: " - killproc $nginx -HUP - RETVAL=$? - echo + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo } force_reload() { - restart + restart } configtest() { @@ -90,39 +90,39 @@ configtest() { } rh_status() { - status $prog + status $prog } rh_status_q() { - rh_status >/dev/null 2>&1 + rh_status >/dev/null 2>&1 } case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart|configtest) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" - exit 2 + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 esac diff --git a/init.d/Nginx-init-Ubuntu b/init.d/Nginx-init-Ubuntu index 841a5d38..f411c880 100755 --- a/init.d/Nginx-init-Ubuntu +++ b/init.d/Nginx-init-Ubuntu @@ -68,7 +68,7 @@ test -x $DAEMON || exit 0 # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then - . /etc/default/nginx + . /etc/default/nginx fi #set exit condition @@ -80,233 +80,231 @@ fi setFilePerms(){ - if [ -f $PIDSPATH/$PIDFILE ]; then - chmod 400 $PIDSPATH/$PIDFILE - fi + if [ -f $PIDSPATH/$PIDFILE ]; then + chmod 400 $PIDSPATH/$PIDFILE + fi } configtest() { - $DAEMON -t -c $NGINX_CONF_FILE + $DAEMON -t -c $NGINX_CONF_FILE } getPSCount() { - return `pgrep -f $PS | wc -l` + return `pgrep -f $PS | wc -l` } isRunning() { - if [ $1 ]; then - pidof_daemon $1 - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - else - pidof_daemon - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - fi + if [ $1 ]; then + pidof_daemon $1 + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + else + pidof_daemon + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + fi } #courtesy of php-fpm wait_for_pid () { - try=0 - - while test $try -lt 35 ; do - - case "$1" in - 'created') - if [ -f "$2" ] ; then - try='' - break - fi - ;; - - 'removed') - if [ ! -f "$2" ] ; then - try='' - break - fi - ;; - esac - - #echo -n . - try=`expr $try + 1` - sleep 1 - done + try=0 + + while test $try -lt 35 ; do + + case "$1" in + 'created') + if [ -f "$2" ] ; then + try='' + break + fi + ;; + + 'removed') + if [ ! -f "$2" ] ; then + try='' + break + fi + ;; + esac + + #echo -n . + try=`expr $try + 1` + sleep 1 + done } status(){ - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then - echo "$PIDNAME found running with processes: `pidof $PS`" - else - echo "$PIDNAME is NOT running." - fi - - + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then + echo "$PIDNAME found running with processes: `pidof $PS`" + else + echo "$PIDNAME is NOT running." + fi } removePIDFile(){ - if [ $1 ]; then - if [ -f $1 ]; then - rm -f $1 - fi - else - #Do default removal - if [ -f $PIDSPATH/$PIDFILE ]; then - rm -f $PIDSPATH/$PIDFILE - fi - fi + if [ $1 ]; then + if [ -f $1 ]; then + rm -f $1 + fi + else + #Do default removal + if [ -f $PIDSPATH/$PIDFILE ]; then + rm -f $PIDSPATH/$PIDFILE + fi + fi } start() { - log_daemon_msg "Starting $DESCRIPTION" + log_daemon_msg "Starting $DESCRIPTION" - isRunning - isAlive=$? + isRunning + isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - log_end_msg $SCRIPT_ERROR - else - start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ - -- -c $NGINX_CONF_FILE - setFilePerms - log_end_msg $SCRIPT_OK - fi + if [ "${isAlive}" -eq $TRUE ]; then + log_end_msg $SCRIPT_ERROR + else + start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ + -- -c $NGINX_CONF_FILE + setFilePerms + log_end_msg $SCRIPT_OK + fi } stop() { - log_daemon_msg "Stopping $DESCRIPTION" + log_daemon_msg "Stopping $DESCRIPTION" - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE - wait_for_pid 'removed' $PIDSPATH/$PIDFILE + wait_for_pid 'removed' $PIDSPATH/$PIDFILE - if [ -n "$try" ] ; then - log_end_msg $SCRIPT_ERROR - else - removePIDFile - log_end_msg $SCRIPT_OK - fi + if [ -n "$try" ] ; then + log_end_msg $SCRIPT_ERROR + else + removePIDFile + log_end_msg $SCRIPT_OK + fi - else - log_end_msg $SCRIPT_ERROR - fi + else + log_end_msg $SCRIPT_ERROR + fi } reload() { - configtest || return $? + configtest || return $? - log_daemon_msg "Reloading (via HUP) $DESCRIPTION" + log_daemon_msg "Reloading (via HUP) $DESCRIPTION" - isRunning - if [ $? -eq $TRUE ]; then - `killall -HUP $PS` #to be safe + isRunning + if [ $? -eq $TRUE ]; then + `killall -HUP $PS` #to be safe - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - fi + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi } quietupgrade() { - log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -USR2 `cat $PIDSPATH/$PIDFILE` - kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - - log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" - - kill -HUP `cat $PIDSPATH/$PIDFILE` - kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_ok - fi - else - log_end_msg $SCRIPT_ERROR - fi + log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -USR2 `cat $PIDSPATH/$PIDFILE` + kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + + log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" + + kill -HUP `cat $PIDSPATH/$PIDFILE` + kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_ok + fi + else + log_end_msg $SCRIPT_ERROR + fi } terminate() { - log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" + log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" - PIDS=`pidof $PS` || true + PIDS=`pidof $PS` || true - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - kill $i - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - removePIDFile - fi - done + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + kill $i + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + removePIDFile + fi + done - log_end_msg $SCRIPT_OK + log_end_msg $SCRIPT_OK } destroy() { - log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" - killall $PS -q >> /dev/null 2>&1 - log_end_msg $SCRIPT_OK + log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" + killall $PS -q >> /dev/null 2>&1 + log_end_msg $SCRIPT_OK } pidof_daemon() { - PIDS=`pidof $PS` || true + PIDS=`pidof $PS` || true - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - return 1 - fi - done - return 0 + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + return 1 + fi + done + return 0 } case "$1" in start) start - ;; + ;; stop) stop - ;; + ;; restart|force-reload) stop sleep 3 start - ;; + ;; reload) $1 ;; @@ -314,8 +312,8 @@ case "$1" in status ;; configtest) - $1 - ;; + $1 + ;; quietupgrade) $1 ;; diff --git a/init.d/Pureftpd-init b/init.d/Pureftpd-init index bbb1b1fb..c72344e5 100755 --- a/init.d/Pureftpd-init +++ b/init.d/Pureftpd-init @@ -23,49 +23,49 @@ pure_config=/usr/local/pureftpd/etc/pure-ftpd.conf start() { - echo -n $"Starting $prog: " - $fullpath $pure_config --daemonize - RETVAL=$? - [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog - echo + echo -n $"Starting $prog: " + $fullpath $pure_config --daemonize + RETVAL=$? + [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog + echo } stop() { - echo -n $"Stopping $prog: " - kill $(cat /var/run/pure-ftpd.pid) - RETVAL=$? - [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog - echo + echo -n $"Stopping $prog: " + kill $(cat /var/run/pure-ftpd.pid) + RETVAL=$? + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog + echo } # See how we were called. case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - condrestart) - if [ -f /var/lock/subsys/$prog ] ; then - stop - # avoid race - sleep 3 - start - fi - ;; - status) - status $prog - RETVAL=$? - if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then - $pureftpwho - fi - ;; - *) - echo $"Usage: $prog {start|stop|restart|condrestart|status}" - RETVAL=1 + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart) + if [ -f /var/lock/subsys/$prog ] ; then + stop + # avoid race + sleep 3 + start + fi + ;; + status) + status $prog + RETVAL=$? + if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then + $pureftpwho + fi + ;; + *) + echo $"Usage: $prog {start|stop|restart|condrestart|status}" + RETVAL=1 esac exit $RETVAL diff --git a/init.d/Redis-server-init b/init.d/Redis-server-init index f67efe70..53be3f81 100755 --- a/init.d/Redis-server-init +++ b/init.d/Redis-server-init @@ -31,18 +31,18 @@ case "$1" in chown redis:redis $PIDFILE if start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS then - echo "$NAME." + echo "$NAME." else - echo "failed" + echo "failed" fi ;; stop) echo -n "Stopping $DESC: " if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON then - echo "$NAME." + echo "$NAME." else - echo "failed" + echo "failed" fi rm -f $PIDFILE ;; diff --git a/init.d/Shadowsocks-libev-init b/init.d/Shadowsocks-libev-init index 5741680d..671bdfba 100755 --- a/init.d/Shadowsocks-libev-init +++ b/init.d/Shadowsocks-libev-init @@ -39,9 +39,9 @@ mkdir /var/run/$NAME 2>/dev/null || true # Check the configuration file exists. # -if [ ! -f $CONF ] ; then -echo "The configuration file cannot be found!" -exit 0 +if [ ! -f $CONF ]; then + echo "The configuration file cannot be found!" + exit 0 fi # Path to the lock file. @@ -63,62 +63,62 @@ RETVAL=0 # Start shadowsocks as daemon. # start() { -if [ -f $LOCK_FILE ]; then -echo "$NAME is already running!" -exit 0 -else -echo -n $"Starting ${NAME}: " -#daemon --check $DAEMON --user $USER "$DAEMON -f $PID -c $CONF > /dev/null" -daemon $DAEMON -u -c $CONF -f $PID -fi - -RETVAL=$? -[ $RETVAL -eq 0 ] && success -echo -[ $RETVAL -eq 0 ] && touch $LOCK_FILE -return $RETVAL + if [ -f $LOCK_FILE ]; then + echo "$NAME is already running!" + exit 0 + else + echo -n $"Starting ${NAME}: " + #daemon --check $DAEMON --user $USER "$DAEMON -f $PID -c $CONF > /dev/null" + daemon $DAEMON -u -c $CONF -f $PID + fi + + RETVAL=$? + [ $RETVAL -eq 0 ] && success + echo + [ $RETVAL -eq 0 ] && touch $LOCK_FILE + return $RETVAL } # Stop shadowsocks. # stop() { -echo -n $"Shutting down ${NAME}: " -killproc -p ${PID} -RETVAL=$? -[ $RETVAL -eq 0 ] -rm -f $LOCK_FILE -rm -f ${PID} -echo -return $RETVAL + echo -n $"Shutting down ${NAME}: " + killproc -p ${PID} + RETVAL=$? + [ $RETVAL -eq 0 ] + rm -f $LOCK_FILE + rm -f ${PID} + echo + return $RETVAL } # See how we were called. case "$1" in -start) -start -;; -stop) -stop -;; -restart) -stop -start -;; -condrestart) -if [ -f $LOCK_FILE ]; then -stop -start -RETVAL=$? -fi -;; -status) -status $DAEMON -RETVAL=$? -;; -*) -echo $"Usage: $0 {start|stop|restart|condrestart|status}" -RETVAL=1 + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart) + if [ -f $LOCK_FILE ]; then + stop + start + RETVAL=$? + fi + ;; + status) + status $DAEMON + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|condrestart|status}" + RETVAL=1 esac exit $RETVAL diff --git a/init.d/Shadowsocks-python-init b/init.d/Shadowsocks-python-init index 569c452a..753295e1 100755 --- a/init.d/Shadowsocks-python-init +++ b/init.d/Shadowsocks-python-init @@ -20,7 +20,7 @@ Shadowsocks_pid(){ start() { pid=$(Shadowsocks_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;31mShadowsocks is already running (pid: $pid)\e[00m" else $Shadowsocks_bin -c $Shadowsocks_conf -d start @@ -37,7 +37,7 @@ start() { status(){ pid=$(Shadowsocks_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;32mShadowsocks is running with pid: $pid\e[00m" else echo -e "\e[00;31mShadowsocks is not running\e[00m" @@ -46,7 +46,7 @@ status(){ stop(){ pid=$(Shadowsocks_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;31mStoping Shadowsocks\e[00m" $Shadowsocks_bin -c $Shadowsocks_conf -d stop let kwait=$SHUTDOWN_WAIT @@ -58,7 +58,7 @@ stop(){ let count=$count+1; done - if [ $count -gt $kwait ];then + if [ $count -gt $kwait ]; then echo -n -e "\n\e[00;31mkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\e[00m" kill -9 $pid fi @@ -71,20 +71,20 @@ stop(){ case $1 in start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) status - ;; - *) + ;; + *) echo -e $Shadowsocks_USAGE - ;; + ;; esac exit 0 diff --git a/init.d/Supervisor-init-CentOS b/init.d/Supervisor-init-CentOS index d3c6e0d5..d90a53e4 100755 --- a/init.d/Supervisor-init-CentOS +++ b/init.d/Supervisor-init-CentOS @@ -43,111 +43,108 @@ ulimit -n 96000 RETVAL=0 -running_pid() -{ - # Check if a given process pid's cmdline matches a given name - pid=$1 - name=$2 - [ -z "$pid" ] && return 1 - [ ! -d /proc/$pid ] && return 1 - (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 - return 0 +running_pid() { + # Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 + return 0 } -running() -{ +running() { # Check if the process is running looking at /proc # (works for all users) - # No pidfile, probably no daemon present - [ ! -f "$PIDFILE" ] && return 1 - # Obtain the pid and check it against the binary name - pid=`cat $PIDFILE` - running_pid $pid $SUPERVISORD || return 1 - return 0 + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + # Obtain the pid and check it against the binary name + pid=`cat $PIDFILE` + running_pid $pid $SUPERVISORD || return 1 + return 0 } start() { - echo "Starting supervisord: " + echo "Starting supervisord: " - if [ -e $PIDFILE ]; then - echo "ALREADY STARTED" - return 1 - fi + if [ -e $PIDFILE ]; then + echo "ALREADY STARTED" + return 1 + fi - # start supervisord with options from sysconfig (stuff like -c) - $SUPERVISORD $OPTIONS + # start supervisord with options from sysconfig (stuff like -c) + $SUPERVISORD $OPTIONS - # show initial startup status - $SUPERVISORCTL $OPTIONS status + # show initial startup status + $SUPERVISORCTL $OPTIONS status - # only create the subsyslock if we created the PIDFILE - [ -e $PIDFILE ] && touch $LOCKFILE + # only create the subsyslock if we created the PIDFILE + [ -e $PIDFILE ] && touch $LOCKFILE } stop() { - echo -n "Stopping supervisord: " - $SUPERVISORCTL $OPTIONS shutdown - if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then - echo "Waiting roughly 60 seconds for $PIDFILE to be removed after child processes exit" - for sleep in 2 2 2 2 4 4 4 4 8 8 8 8 last; do - if [ ! -e $PIDFILE ] ; then - echo "Supervisord exited as expected in under $total_sleep seconds" - break - else - if [[ $sleep -eq "last" ]] ; then - echo "Supervisord still working on shutting down. We've waited roughly 60 seconds, we'll let it do its thing from here" - return 1 - else - sleep $sleep - total_sleep=$(( $total_sleep + $sleep )) - fi - - fi - done + echo -n "Stopping supervisord: " + $SUPERVISORCTL $OPTIONS shutdown + if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then + echo "Waiting roughly 60 seconds for $PIDFILE to be removed after child processes exit" + for sleep in 2 2 2 2 4 4 4 4 8 8 8 8 last; do + if [ ! -e $PIDFILE ] ; then + echo "Supervisord exited as expected in under $total_sleep seconds" + break + else + if [[ $sleep -eq "last" ]] ; then + echo "Supervisord still working on shutting down. We've waited roughly 60 seconds, we'll let it do its thing from here" + return 1 + else + sleep $sleep + total_sleep=$(( $total_sleep + $sleep )) fi + fi + done + fi - # always remove the subsys. We might have waited a while, but just remove it at this point. - rm -f $LOCKFILE + # always remove the subsys. We might have waited a while, but just remove it at this point. + rm -f $LOCKFILE } restart() { - stop - start + stop + start } case "$1" in - start) - start - RETVAL=$? - ;; - stop) - stop - RETVAL=$? - ;; - restart|force-reload) - restart - RETVAL=$? - ;; - reload) - $SUPERVISORCTL $OPTIONS reload - RETVAL=$? - ;; - condrestart) - [ -f $LOCKFILE ] && restart - RETVAL=$? - ;; - status) - $SUPERVISORCTL $OPTIONS status - if running ; then - RETVAL=0 - else - RETVAL=1 - fi - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" - exit 1 + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + restart|force-reload) + restart + RETVAL=$? + ;; + reload) + $SUPERVISORCTL $OPTIONS reload + RETVAL=$? + ;; + condrestart) + [ -f $LOCKFILE ] && restart + RETVAL=$? + ;; + status) + $SUPERVISORCTL $OPTIONS status + if running ; then + RETVAL=0 + else + RETVAL=1 + fi + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" + exit 1 esac exit $RETVAL diff --git a/init.d/Tomcat-init b/init.d/Tomcat-init index 2e05d8f3..71f67bfd 100755 --- a/init.d/Tomcat-init +++ b/init.d/Tomcat-init @@ -22,16 +22,16 @@ TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatu SHUTDOWN_WAIT=20 tomcat_pid() { - echo `ps -ef | grep $CATALINA_HOME/ | grep -v grep | tr -s " "|cut -d" " -f2` + echo `ps -ef | grep $CATALINA_HOME/ | grep -v grep | tr -s " "|cut -d" " -f2` } start() { pid=$(tomcat_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m" else echo -e "\e[00;32mStarting tomcat\e[00m" - if [ `user_exists $TOMCAT_USER` = "1" ];then + if [ `user_exists $TOMCAT_USER` = "1" ]; then su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh else $CATALINA_HOME/bin/startup.sh @@ -41,9 +41,9 @@ start() { return 0 } -status(){ +status() { pid=$(tomcat_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m" else echo -e "\e[00;31mTomcat is not running\e[00m" @@ -52,9 +52,9 @@ status(){ stop() { pid=$(tomcat_pid) - if [ -n "$pid" ];then + if [ -n "$pid" ]; then echo -e "\e[00;31mStoping Tomcat\e[00m" - $CATALINA_HOME/bin/shutdown.sh + $CATALINA_HOME/bin/shutdown.sh let kwait=$SHUTDOWN_WAIT count=0; @@ -65,7 +65,7 @@ stop() { let count=$count+1; done - if [ $count -gt $kwait ];then + if [ $count -gt $kwait ]; then echo -n -e "\n\e[00;31mkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\e[00m" kill -9 $pid fi @@ -76,7 +76,7 @@ stop() { return 0 } -user_exists(){ +user_exists() { if id -u $1 >/dev/null 2>&1; then echo "1" else @@ -85,25 +85,21 @@ user_exists(){ } case $1 in - start) - start - ;; - - stop) - stop - ;; - - restart) - stop - start - ;; - - status) + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) status - ;; - - *) + ;; + *) echo -e $TOMCAT_USAGE - ;; + ;; esac exit 0 diff --git a/install.sh b/install.sh index bd7cccdb..f40dd74e 100755 --- a/install.sh +++ b/install.sh @@ -35,434 +35,433 @@ mkdir -p $wwwroot_dir/default $wwwlogs_dir [ -d /data ] && chmod 755 /data # Use default SSH port 22. If you use another SSH port on your server -if [ -e "/etc/ssh/sshd_config" ];then - [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && ssh_port=22 || ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'` - while :; do echo - read -p "Please input SSH port(Default: $ssh_port): " SSH_PORT - [ -z "$SSH_PORT" ] && SSH_PORT=$ssh_port - if [ $SSH_PORT -eq 22 >/dev/null 2>&1 -o $SSH_PORT -gt 1024 >/dev/null 2>&1 -a $SSH_PORT -lt 65535 >/dev/null 2>&1 ];then - break - else - echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}" - fi - done - - if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$SSH_PORT" != '22' ];then - sed -i "s@^#Port.*@&\nPort $SSH_PORT@" /etc/ssh/sshd_config - elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ];then - sed -i "s@^Port.*@Port $SSH_PORT@" /etc/ssh/sshd_config +if [ -e "/etc/ssh/sshd_config" ]; then + [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && ssh_port=22 || ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'` + while :; do echo + read -p "Please input SSH port(Default: $ssh_port): " SSH_PORT + [ -z "$SSH_PORT" ] && SSH_PORT=$ssh_port + if [ $SSH_PORT -eq 22 >/dev/null 2>&1 -o $SSH_PORT -gt 1024 >/dev/null 2>&1 -a $SSH_PORT -lt 65535 >/dev/null 2>&1 ]; then + break + else + echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}" fi + done + + if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "$SSH_PORT" != '22' ]; then + sed -i "s@^#Port.*@&\nPort $SSH_PORT@" /etc/ssh/sshd_config + elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ]; then + sed -i "s@^Port.*@Port $SSH_PORT@" /etc/ssh/sshd_config + fi fi # check Web server while :; do echo - read -p "Do you want to install Web server? [y/n]: " Web_yn - if [[ ! $Web_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$Web_yn" == 'y' ];then - # Nginx/Tegine/OpenResty - while :; do echo - echo 'Please select Nginx server:' - echo -e "\t${CMSG}1${CEND}. Install Nginx" - echo -e "\t${CMSG}2${CEND}. Install Tengine" - echo -e "\t${CMSG}3${CEND}. Install OpenResty" - echo -e "\t${CMSG}4${CEND}. Do not install" - read -p "Please input a number:(Default 1 press Enter) " Nginx_version - [ -z "$Nginx_version" ] && Nginx_version=1 - if [[ ! $Nginx_version =~ ^[1-4]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - else - [ "$Nginx_version" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; Nginx_version=Other; } - [ "$Nginx_version" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; Nginx_version=Other; } - [ "$Nginx_version" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; Nginx_version=Other; } - break - fi - done - # Apache - while :; do echo - echo 'Please select Apache server:' - echo -e "\t${CMSG}1${CEND}. Install Apache-2.4" - echo -e "\t${CMSG}2${CEND}. Install Apache-2.2" - echo -e "\t${CMSG}3${CEND}. Do not install" - read -p "Please input a number:(Default 3 press Enter) " Apache_version - [ -z "$Apache_version" ] && Apache_version=3 - if [[ ! $Apache_version =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - [ "$Apache_version" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; Apache_version=Other; } - break - fi - done - # Tomcat - #while :; do echo - # echo 'Please select tomcat server:' - # echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" - # echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" - # echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" - # echo -e "\t${CMSG}4${CEND}. Do not install" - # read -p "Please input a number:(Default 4 press Enter) " Tomcat_version - # [ -z "$Tomcat_version" ] && Tomcat_version=4 - # if [[ ! $Tomcat_version =~ ^[1-4]$ ]];then - # echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - # else - # [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } - # if [ "$Tomcat_version" == '1' ];then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[1-2]$ ]];then - # echo "${CWARNING}input error! Please only input number 1,2${CEND}" - # else - # break - # fi - # done - # elif [ "$Tomcat_version" == '2' ];then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[1-3]$ ]];then - # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - # else - # break - # fi - # done - # elif [ "$Tomcat_version" == '3' ];then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[2-3]$ ]];then - # echo "${CWARNING}input error! Please only input number 2,3${CEND}" - # else - # break - # fi - # done - # fi - # break - # fi - #done + read -p "Do you want to install Web server? [y/n]: " Web_yn + if [[ ! $Web_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$Web_yn" == 'y' ]; then + # Nginx/Tegine/OpenResty + while :; do echo + echo 'Please select Nginx server:' + echo -e "\t${CMSG}1${CEND}. Install Nginx" + echo -e "\t${CMSG}2${CEND}. Install Tengine" + echo -e "\t${CMSG}3${CEND}. Install OpenResty" + echo -e "\t${CMSG}4${CEND}. Do not install" + read -p "Please input a number:(Default 1 press Enter) " Nginx_version + [ -z "$Nginx_version" ] && Nginx_version=1 + if [[ ! $Nginx_version =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + [ "$Nginx_version" != '4' -a -e "$nginx_install_dir/sbin/nginx" ] && { echo "${CWARNING}Nginx already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$tengine_install_dir/sbin/nginx" ] && { echo "${CWARNING}Tengine already installed! ${CEND}"; Nginx_version=Other; } + [ "$Nginx_version" != '4' -a -e "$openresty_install_dir/nginx/sbin/nginx" ] && { echo "${CWARNING}OpenResty already installed! ${CEND}"; Nginx_version=Other; } + break fi - break + done + # Apache + while :; do echo + echo 'Please select Apache server:' + echo -e "\t${CMSG}1${CEND}. Install Apache-2.4" + echo -e "\t${CMSG}2${CEND}. Install Apache-2.2" + echo -e "\t${CMSG}3${CEND}. Do not install" + read -p "Please input a number:(Default 3 press Enter) " Apache_version + [ -z "$Apache_version" ] && Apache_version=3 + if [[ ! $Apache_version =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + [ "$Apache_version" != '3' -a -e "$apache_install_dir/conf/httpd.conf" ] && { echo "${CWARNING}Aapche already installed! ${CEND}"; Apache_version=Other; } + break + fi + done + # Tomcat + #while :; do echo + # echo 'Please select tomcat server:' + # echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" + # echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" + # echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" + # echo -e "\t${CMSG}4${CEND}. Do not install" + # read -p "Please input a number:(Default 4 press Enter) " Tomcat_version + # [ -z "$Tomcat_version" ] && Tomcat_version=4 + # if [[ ! $Tomcat_version =~ ^[1-4]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + # else + # [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } + # if [ "$Tomcat_version" == '1' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[1-2]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2${CEND}" + # else + # break + # fi + # done + # elif [ "$Tomcat_version" == '2' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[1-3]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + # else + # break + # fi + # done + # elif [ "$Tomcat_version" == '3' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[2-3]$ ]]; then + # echo "${CWARNING}input error! Please only input number 2,3${CEND}" + # else + # break + # fi + # done + # fi + # break + # fi + #done fi + break + fi done # choice database while :; do echo - read -p "Do you want to install Database? [y/n]: " DB_yn - if [[ ! $DB_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$DB_yn" == 'y' ];then - [ -d "$db_install_dir/support-files" ] && { echo "${CWARNING}Database already installed! ${CEND}"; DB_yn=Other; break; } - while :; do echo - echo 'Please select a version of the Database:' - echo -e "\t${CMSG}1${CEND}. Install MySQL-5.7" - echo -e "\t${CMSG}2${CEND}. Install MySQL-5.6" - echo -e "\t${CMSG}3${CEND}. Install MySQL-5.5" - echo -e "\t${CMSG}4${CEND}. Install MariaDB-10.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.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-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 - [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } - (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" - done - # 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 - - break - fi - done + read -p "Do you want to install Database? [y/n]: " DB_yn + if [[ ! $DB_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$DB_yn" == 'y' ]; then + [ -d "$db_install_dir/support-files" ] && { echo "${CWARNING}Database already installed! ${CEND}"; DB_yn=Other; break; } + while :; do echo + echo 'Please select a version of the Database:' + echo -e "\t${CMSG}1${CEND}. Install MySQL-5.7" + echo -e "\t${CMSG}2${CEND}. Install MySQL-5.6" + echo -e "\t${CMSG}3${CEND}. Install MySQL-5.5" + echo -e "\t${CMSG}4${CEND}. Install MariaDB-10.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.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-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 + [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } + (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" + done + # 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 + break fi - break + done fi + break + fi done # check PHP while :; do echo - read -p "Do you want to install PHP? [y/n]: " PHP_yn - if [[ ! $PHP_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$PHP_yn" == 'y' ];then - [ -e "$php_install_dir/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; PHP_yn=Other; break; } - while :; do echo - echo 'Please select a version of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install php-5.3" - echo -e "\t${CMSG}2${CEND}. Install php-5.4" - echo -e "\t${CMSG}3${CEND}. Install php-5.5" - echo -e "\t${CMSG}4${CEND}. Install php-5.6" - echo -e "\t${CMSG}5${CEND}. Install php-7.0" - read -p "Please input a number:(Default 3 press Enter) " PHP_version - [ -z "$PHP_version" ] && PHP_version=3 - if [[ ! $PHP_version =~ ^[1-5]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3,4,5${CEND}" - else - while :; do echo - read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn - if [[ ! $PHP_cache_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$PHP_cache_yn" == 'y' ];then - if [ $PHP_version == 1 ];then - while :; do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" - echo -e "\t${CMSG}2${CEND}. Install XCache" - echo -e "\t${CMSG}3${CEND}. Install APCU" - echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-4]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - else - break - fi - done - fi - if [ $PHP_version == 2 ];then - while :; do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" - echo -e "\t${CMSG}2${CEND}. Install XCache" - echo -e "\t${CMSG}3${CEND}. Install APCU" - echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-4]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - else - break - fi - done - fi - if [ $PHP_version == 3 ];then - while :; do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" - echo -e "\t${CMSG}2${CEND}. Install XCache" - echo -e "\t${CMSG}3${CEND}. Install APCU" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi - done - fi - if [ $PHP_version == 4 ];then - while :; do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" - echo -e "\t${CMSG}2${CEND}. Install XCache" - echo -e "\t${CMSG}3${CEND}. Install APCU" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi - done - fi - if [ $PHP_version == 5 ];then - while :; do - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" - echo -e "\t${CMSG}3${CEND}. Install APCU" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1,3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,3${CEND}" - else - break - fi - done - fi - fi - break - fi - done - if [ "$PHP_cache" == '2' ];then - while :; do - read -p "Please input xcache admin password: " xcache_admin_pass - (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" - done + read -p "Do you want to install PHP? [y/n]: " PHP_yn + if [[ ! $PHP_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$PHP_yn" == 'y' ]; then + [ -e "$php_install_dir/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; PHP_yn=Other; break; } + while :; do echo + echo 'Please select a version of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install php-5.3" + echo -e "\t${CMSG}2${CEND}. Install php-5.4" + echo -e "\t${CMSG}3${CEND}. Install php-5.5" + echo -e "\t${CMSG}4${CEND}. Install php-5.6" + echo -e "\t${CMSG}5${CEND}. Install php-7.0" + read -p "Please input a number:(Default 3 press Enter) " PHP_version + [ -z "$PHP_version" ] && PHP_version=3 + if [[ ! $PHP_version =~ ^[1-5]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4,5${CEND}" + else + while :; do echo + read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn + if [[ ! $PHP_cache_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$PHP_cache_yn" == 'y' ]; then + if [ $PHP_version == 1 ]; then + while :; do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}2${CEND}. Install XCache" + echo -e "\t${CMSG}3${CEND}. Install APCU" + echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + break fi - if [ "$PHP_version" != '5' -a "$PHP_cache" != '1' -a "${armPlatform}" != "y" ];then - while :; do echo - read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn - if [[ ! $ZendGuardLoader_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done + done + fi + if [ $PHP_version == 2 ]; then + while :; do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}2${CEND}. Install XCache" + echo -e "\t${CMSG}3${CEND}. Install APCU" + echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + break fi - - # ionCube - if [ "${TARGET_ARCH}" != "arm64" ];then - while :; do echo - read -p "Do you want to install ionCube? [y/n]: " ionCube_yn - if [[ ! $ionCube_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done + done + fi + if [ $PHP_version == 3 ]; then + while :; do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}2${CEND}. Install XCache" + echo -e "\t${CMSG}3${CEND}. Install APCU" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break fi - - # ImageMagick or GraphicsMagick - while :; do echo - read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn - if [[ ! $Magick_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done - - if [ "$Magick_yn" == 'y' ];then - while :; do - echo 'Please select ImageMagick or GraphicsMagick:' - echo -e "\t${CMSG}1${CEND}. Install ImageMagick" - echo -e "\t${CMSG}2${CEND}. Install GraphicsMagick" - read -p "Please input a number:(Default 1 press Enter) " Magick - [ -z "$Magick" ] && Magick=1 - if [[ ! $Magick =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi - done + done + fi + if [ $PHP_version == 4 ]; then + while :; do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}2${CEND}. Install XCache" + echo -e "\t${CMSG}3${CEND}. Install APCU" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break fi - break + done fi + if [ $PHP_version == 5 ]; then + while :; do + echo 'Please select a opcode cache of the PHP:' + echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" + echo -e "\t${CMSG}3${CEND}. Install APCU" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "$PHP_cache" ] && PHP_cache=1 + if [[ ! $PHP_cache =~ ^[1,3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,3${CEND}" + else + break + fi + done + fi + fi + break + fi + done + if [ "$PHP_cache" == '2' ]; then + while :; do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" done + fi + if [ "$PHP_version" != '5' -a "$PHP_cache" != '1' -a "${armPlatform}" != "y" ]; then + while :; do echo + read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn + if [[ ! $ZendGuardLoader_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + fi + + # ionCube + if [ "${TARGET_ARCH}" != "arm64" ]; then + while :; do echo + read -p "Do you want to install ionCube? [y/n]: " ionCube_yn + if [[ ! $ionCube_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + fi + + # ImageMagick or GraphicsMagick + while :; do echo + read -p "Do you want to install ImageMagick or GraphicsMagick? [y/n]: " Magick_yn + if [[ ! $Magick_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + + if [ "$Magick_yn" == 'y' ]; then + while :; do + echo 'Please select ImageMagick or GraphicsMagick:' + echo -e "\t${CMSG}1${CEND}. Install ImageMagick" + echo -e "\t${CMSG}2${CEND}. Install GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "$Magick" ] && Magick=1 + if [[ ! $Magick =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi + done + fi + break fi - break + done fi + break + fi done # check Pureftpd while :; do echo - read -p "Do you want to install Pure-FTPd? [y/n]: " FTP_yn - if [[ ! $FTP_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - [ "$FTP_yn" == 'y' -a -e "$pureftpd_install_dir/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; FTP_yn=Other; } - break - fi + read -p "Do you want to install Pure-FTPd? [y/n]: " FTP_yn + if [[ ! $FTP_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + [ "$FTP_yn" == 'y' -a -e "$pureftpd_install_dir/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; FTP_yn=Other; } + break + fi done # check phpMyAdmin -if [[ $PHP_version =~ ^[1-5]$ ]] || [ -e "$php_install_dir/bin/phpize" ];then - while :; do echo - read -p "Do you want to install phpMyAdmin? [y/n]: " phpMyAdmin_yn - if [[ ! $phpMyAdmin_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - [ "$phpMyAdmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpMyAdmin_yn=Other; } - break - fi - done +if [[ $PHP_version =~ ^[1-5]$ ]] || [ -e "$php_install_dir/bin/phpize" ]; then + while :; do echo + read -p "Do you want to install phpMyAdmin? [y/n]: " phpMyAdmin_yn + if [[ ! $phpMyAdmin_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + [ "$phpMyAdmin_yn" == 'y' -a -d "$wwwroot_dir/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; phpMyAdmin_yn=Other; } + break + fi + done fi # check redis while :; do echo - read -p "Do you want to install redis? [y/n]: " redis_yn - if [[ ! $redis_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to install redis? [y/n]: " redis_yn + if [[ ! $redis_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done # check memcached while :; do echo - read -p "Do you want to install memcached? [y/n]: " memcached_yn - if [[ ! $memcached_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to install memcached? [y/n]: " memcached_yn + if [[ ! $memcached_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done # check jemalloc or tcmalloc -if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ];then - while :; do echo - 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 - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$je_tc_malloc_yn" == 'y' ];then - echo 'Please select jemalloc or tcmalloc:' - echo -e "\t${CMSG}1${CEND}. jemalloc" - echo -e "\t${CMSG}2${CEND}. tcmalloc" - while :; do - read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc - [ -z "$je_tc_malloc" ] && je_tc_malloc=1 - if [[ ! $je_tc_malloc =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi - done - fi +if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ]; then + while :; do echo + 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 + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$je_tc_malloc_yn" == 'y' ]; then + echo 'Please select jemalloc or tcmalloc:' + echo -e "\t${CMSG}1${CEND}. jemalloc" + echo -e "\t${CMSG}2${CEND}. tcmalloc" + while :; do + read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc + [ -z "$je_tc_malloc" ] && je_tc_malloc=1 + if [[ ! $je_tc_malloc =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else break - fi - done + fi + done + fi + break + fi + done fi while :; do echo - read -p "Do you want to install HHVM? [y/n]: " HHVM_yn - if [[ ! $HHVM_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$HHVM_yn" == 'y' ];then - [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; HHVM_yn=Other; break; } - if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ];then - break - else - echo - echo "${CWARNING}HHVM only support CentOS6.5+ 64bit, CentOS7 64bit! ${CEND}" - echo "Press Ctrl+c to cancel or Press any key to continue..." - char=`get_char` - HHVM_yn=Other - fi - fi + read -p "Do you want to install HHVM? [y/n]: " HHVM_yn + if [[ ! $HHVM_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + if [ "$HHVM_yn" == 'y' ]; then + [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; HHVM_yn=Other; break; } + if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ]; then break + else + echo + echo "${CWARNING}HHVM only support CentOS6.5+ 64bit, CentOS7 64bit! ${CEND}" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + HHVM_yn=Other + fi fi + break + fi done # get the IP information @@ -478,214 +477,214 @@ checkDownload 2>&1 | tee $oneinstack_dir/install.log # init . ./include/memory.sh -if [ "$OS" == 'CentOS' ];then - . include/init_CentOS.sh 2>&1 | tee -a $oneinstack_dir/install.log - [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ] && export CC="gcc44" CXX="g++44" -elif [ "$OS" == 'Debian' ];then - . include/init_Debian.sh 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$OS" == 'Ubuntu' ];then - . include/init_Ubuntu.sh 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$OS" == 'CentOS' ]; then + . include/init_CentOS.sh 2>&1 | tee -a $oneinstack_dir/install.log + [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ] && export CC="gcc44" CXX="g++44" +elif [ "$OS" == 'Debian' ]; then + . include/init_Debian.sh 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$OS" == 'Ubuntu' ]; then + . include/init_Ubuntu.sh 2>&1 | tee -a $oneinstack_dir/install.log fi # jemalloc or tcmalloc -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ];then - . include/jemalloc.sh - Install_jemalloc | tee -a $oneinstack_dir/install.log +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ]; then + . include/jemalloc.sh + Install_jemalloc | tee -a $oneinstack_dir/install.log fi -if [ "$DB_version" == '4' -a ! -e "/usr/local/lib/libjemalloc.so" ];then - . include/jemalloc.sh - Install_jemalloc | tee -a $oneinstack_dir/install.log +if [ "$DB_version" == '4' -a ! -e "/usr/local/lib/libjemalloc.so" ]; then + . include/jemalloc.sh + Install_jemalloc | tee -a $oneinstack_dir/install.log fi -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ];then - . include/tcmalloc.sh - Install_tcmalloc | tee -a $oneinstack_dir/install.log +if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ]; then + . include/tcmalloc.sh + Install_tcmalloc | tee -a $oneinstack_dir/install.log fi # Database -if [ "$DB_version" == '1' ];then - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . include/mysql-5.7.sh - Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '2' ];then - . include/mysql-5.6.sh - Install_MySQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '3' ];then - . include/mysql-5.5.sh - Install_MySQL-5-5 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '4' ];then - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . include/mariadb-10.1.sh - Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '5' ];then - . include/mariadb-10.0.sh - Install_MariaDB-10-0 2>&1 | tee -a $oneinstack_dir/install.log -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 - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . 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" == '9' ];then - . include/percona-5.5.sh - Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$DB_version" == '1' ]; then + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi + . include/mysql-5.7.sh + Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$DB_version" == '2' ]; then + . include/mysql-5.6.sh + Install_MySQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$DB_version" == '3' ]; then + . include/mysql-5.5.sh + Install_MySQL-5-5 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$DB_version" == '4' ]; then + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi + . include/mariadb-10.1.sh + Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$DB_version" == '5' ]; then + . include/mariadb-10.0.sh + Install_MariaDB-10-0 2>&1 | tee -a $oneinstack_dir/install.log +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 + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a $oneinstack_dir/install.log + fi + . 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" == '9' ]; then + . include/percona-5.5.sh + Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log fi # Apache -if [ "$Apache_version" == '1' ];then - . include/apache-2.4.sh - Install_Apache-2-4 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Apache_version" == '2' ];then - . include/apache-2.2.sh - Install_Apache-2-2 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$Apache_version" == '1' ]; then + . include/apache-2.4.sh + Install_Apache-2-4 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Apache_version" == '2' ]; then + . include/apache-2.2.sh + Install_Apache-2-2 2>&1 | tee -a $oneinstack_dir/install.log fi # PHP -if [ "$PHP_version" == '1' ];then - . include/php-5.3.sh - Install_PHP-5-3 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '2' ];then - . include/php-5.4.sh - Install_PHP-5-4 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '3' ];then - . include/php-5.5.sh - Install_PHP-5-5 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '4' ];then - . include/php-5.6.sh - Install_PHP-5-6 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '5' ];then - . include/php-7.0.sh - Install_PHP-7-0 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$PHP_version" == '1' ]; then + . include/php-5.3.sh + Install_PHP-5-3 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_version" == '2' ]; then + . include/php-5.4.sh + Install_PHP-5-4 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_version" == '3' ]; then + . include/php-5.5.sh + Install_PHP-5-5 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_version" == '4' ]; then + . include/php-5.6.sh + Install_PHP-5-6 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_version" == '5' ]; then + . include/php-7.0.sh + Install_PHP-7-0 2>&1 | tee -a $oneinstack_dir/install.log fi # ImageMagick or GraphicsMagick -if [ "$Magick" == '1' ];then - . include/ImageMagick.sh - [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick 2>&1 | tee -a $oneinstack_dir/install.log - [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Magick" == '2' ];then - . include/GraphicsMagick.sh - [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick 2>&1 | tee -a $oneinstack_dir/install.log - [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$Magick" == '1' ]; then + . include/ImageMagick.sh + [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick 2>&1 | tee -a $oneinstack_dir/install.log + [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Magick" == '2' ]; then + . include/GraphicsMagick.sh + [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick 2>&1 | tee -a $oneinstack_dir/install.log + [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a $oneinstack_dir/install.log fi # ionCube -if [ "$ionCube_yn" == 'y' ];then - . include/ioncube.sh - Install_ionCube 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$ionCube_yn" == 'y' ]; then + . include/ioncube.sh + Install_ionCube 2>&1 | tee -a $oneinstack_dir/install.log fi # PHP opcode cache -if [ "$PHP_cache" == '1' ] && [[ "$PHP_version" =~ ^[1,2]$ ]];then - . include/zendopcache.sh - Install_ZendOPcache 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '2' ];then - . include/xcache.sh - Install_XCache 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '3' ];then - . include/apcu.sh - Install_APCU 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '4' -a "$PHP_version" == '2' ];then - . include/eaccelerator-1.0-dev.sh - Install_eAccelerator-1-0-dev 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '4' -a "$PHP_version" == '1' ];then - . include/eaccelerator-0.9.sh - Install_eAccelerator-0-9 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$PHP_cache" == '1' ] && [[ "$PHP_version" =~ ^[1,2]$ ]]; then + . include/zendopcache.sh + Install_ZendOPcache 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_cache" == '2' ]; then + . include/xcache.sh + Install_XCache 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_cache" == '3' ]; then + . include/apcu.sh + Install_APCU 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_cache" == '4' -a "$PHP_version" == '2' ]; then + . include/eaccelerator-1.0-dev.sh + Install_eAccelerator-1-0-dev 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$PHP_cache" == '4' -a "$PHP_version" == '1' ]; then + . include/eaccelerator-0.9.sh + Install_eAccelerator-0-9 2>&1 | tee -a $oneinstack_dir/install.log fi # ZendGuardLoader (php <= 5.6) -if [ "$ZendGuardLoader_yn" == 'y' ];then - . include/ZendGuardLoader.sh - Install_ZendGuardLoader 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$ZendGuardLoader_yn" == 'y' ]; then + . include/ZendGuardLoader.sh + Install_ZendGuardLoader 2>&1 | tee -a $oneinstack_dir/install.log fi # Web server -if [ "$Nginx_version" == '1' ];then - . include/nginx.sh - Install_Nginx 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Nginx_version" == '2' ];then - . include/tengine.sh - Install_Tengine 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Nginx_version" == '3' ];then - . include/openresty.sh - Install_OpenResty 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$Nginx_version" == '1' ]; then + . include/nginx.sh + Install_Nginx 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Nginx_version" == '2' ]; then + . include/tengine.sh + Install_Tengine 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Nginx_version" == '3' ]; then + . include/openresty.sh + Install_OpenResty 2>&1 | tee -a $oneinstack_dir/install.log fi # JDK -if [ "$JDK_version" == '1' ];then - . include/jdk-1.8.sh - Install-JDK-1-8 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$JDK_version" == '2' ];then - . include/jdk-1.7.sh - Install-JDK-1-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$JDK_version" == '3' ];then - . include/jdk-1.6.sh - Install-JDK-1-6 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$JDK_version" == '1' ]; then + . include/jdk-1.8.sh + Install-JDK-1-8 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$JDK_version" == '2' ]; then + . include/jdk-1.7.sh + Install-JDK-1-7 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$JDK_version" == '3' ]; then + . include/jdk-1.6.sh + Install-JDK-1-6 2>&1 | tee -a $oneinstack_dir/install.log fi -if [ "$Tomcat_version" == '1' ];then - . include/tomcat-8.sh - Install_tomcat-8 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Tomcat_version" == '2' ];then - . include/tomcat-7.sh - Install_tomcat-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Tomcat_version" == '3' ];then - . include/tomcat-6.sh - Install_tomcat-6 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$Tomcat_version" == '1' ]; then + . include/tomcat-8.sh + Install_tomcat-8 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Tomcat_version" == '2' ]; then + . include/tomcat-7.sh + Install_tomcat-7 2>&1 | tee -a $oneinstack_dir/install.log +elif [ "$Tomcat_version" == '3' ]; then + . include/tomcat-6.sh + Install_tomcat-6 2>&1 | tee -a $oneinstack_dir/install.log fi # Pure-FTPd -if [ "$FTP_yn" == 'y' ];then - . include/pureftpd.sh - Install_PureFTPd 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$FTP_yn" == 'y' ]; then + . include/pureftpd.sh + Install_PureFTPd 2>&1 | tee -a $oneinstack_dir/install.log fi # phpMyAdmin -if [ "$phpMyAdmin_yn" == 'y' ];then - . include/phpmyadmin.sh - Install_phpMyAdmin 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$phpMyAdmin_yn" == 'y' ]; then + . include/phpmyadmin.sh + Install_phpMyAdmin 2>&1 | tee -a $oneinstack_dir/install.log fi # redis -if [ "$redis_yn" == 'y' ];then - . include/redis.sh - [ ! -d "$redis_install_dir" ] && Install_redis-server 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ] && Install_php-redis 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$redis_yn" == 'y' ]; then + . include/redis.sh + [ ! -d "$redis_install_dir" ] && Install_redis-server 2>&1 | tee -a $oneinstack_dir/install.log + [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ] && Install_php-redis 2>&1 | tee -a $oneinstack_dir/install.log fi # memcached -if [ "$memcached_yn" == 'y' ];then - . include/memcached.sh - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ] && Install_php-memcache 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && Install_php-memcached 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$memcached_yn" == 'y' ]; then + . include/memcached.sh + [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached 2>&1 | tee -a $oneinstack_dir/install.log + [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ] && Install_php-memcache 2>&1 | tee -a $oneinstack_dir/install.log + [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && Install_php-memcached 2>&1 | tee -a $oneinstack_dir/install.log fi # index example -if [ ! -e "$wwwroot_dir/default/index.html" -a "$Web_yn" == 'y' ];then - . include/demo.sh - DEMO 2>&1 | tee -a $oneinstack_dir/install.log +if [ ! -e "$wwwroot_dir/default/index.html" -a "$Web_yn" == 'y' ]; then + . include/demo.sh + DEMO 2>&1 | tee -a $oneinstack_dir/install.log fi # get web_install_dir and db_install_dir . include/check_dir.sh # HHVM -if [ "$HHVM_yn" == 'y' ];then - . include/hhvm_CentOS.sh - Install_hhvm_CentOS 2>&1 | tee -a $oneinstack_dir/install.log +if [ "$HHVM_yn" == 'y' ]; then + . include/hhvm_CentOS.sh + Install_hhvm_CentOS 2>&1 | tee -a $oneinstack_dir/install.log fi # Starting DB @@ -718,12 +717,12 @@ echo "####################Congratulations########################" [ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`${CMSG}$memcached_install_dir${CEND}" [ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`${CMSG}http://$IPADDR/${CEND}" while :; do echo - echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}" - read -p "Do you want to restart OS ? [y/n]: " restart_yn - if [[ ! $restart_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}" + read -p "Do you want to restart OS ? [y/n]: " restart_yn + if [[ ! $restart_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done [ "$restart_yn" == 'y' ] && reboot diff --git a/pureftpd_vhost.sh b/pureftpd_vhost.sh index 276b92a9..a0f735d6 100755 --- a/pureftpd_vhost.sh +++ b/pureftpd_vhost.sh @@ -35,44 +35,44 @@ FTP_bin=$pureftpd_install_dir/bin/pure-pw USER() { while :; do echo - read -p "Please input a username: " User - if [ -z "$User" ]; then - echo "${CWARNING}username can't be NULL! ${CEND}" - else - break - fi + read -p "Please input a username: " User + if [ -z "$User" ]; then + echo "${CWARNING}username can't be NULL! ${CEND}" + else + break + fi done } PASSWORD() { while :; do echo - read -p "Please input the password: " Password - [ -n "`echo $Password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } - if (( ${#Password} >= 5 ));then - echo -e "${Password}\n$Password" > $FTP_tmp_passfile - break - else - echo "${CWARNING}Ftp password least 5 characters! ${CEND}" - fi + read -p "Please input the password: " Password + [ -n "`echo $Password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } + if (( ${#Password} >= 5 ));then + echo -e "${Password}\n$Password" > $FTP_tmp_passfile + break + else + echo "${CWARNING}Ftp password least 5 characters! ${CEND}" + fi done } DIRECTORY() { while :; do echo - read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory - if [ -z "$Directory" ]; then - Directory="$wwwroot_dir" - fi - if [ ! -d "$Directory" ];then - echo "${CWARNING}The directory does not exist${CEND}" - else - break - fi + read -p "Please input the directory(Default directory: $wwwroot_dir): " Directory + if [ -z "$Directory" ]; then + Directory="$wwwroot_dir" + fi + if [ ! -d "$Directory" ]; then + echo "${CWARNING}The directory does not exist${CEND}" + else + break + fi done } while :; do - printf " + printf " What Are You Doing? \t${CMSG}1${CEND}. UserAdd \t${CMSG}2${CEND}. UserMod @@ -82,83 +82,83 @@ What Are You Doing? \t${CMSG}6${CEND}. ShowUser \t${CMSG}q${CEND}. Exit " - read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-6,q]$ ]];then - echo "${CFAILURE}input error! Please only input 1 ~ 6 and q${CEND}" - else - case "$Number" in - 1) - USER - [ -e "$Passwdfile" ] && [ -n "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] is already existed! ${CEND}"; continue; } - PASSWORD;DIRECTORY - $FTP_bin useradd $User -f $Passwdfile -u $run_user -g $run_user -d $Directory -m < $FTP_tmp_passfile - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 - echo "#####################################" - echo - echo "[$User] create successful! " - echo - echo "You user name is : ${CMSG}$User${CEND}" - echo "You Password is : ${CMSG}$Password${CEND}" - echo "You directory is : ${CMSG}$Directory${CEND}" - echo - ;; - 2) - USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } - DIRECTORY - $FTP_bin usermod $User -f $Passwdfile -d $Directory -m - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 - echo "#####################################" - echo - echo "[$User] modify a successful! " - echo - echo "You user name is : ${CMSG}$User${CEND}" - echo "You new directory is : ${CMSG}$Directory${CEND}" - echo - ;; - 3) - USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } - PASSWORD - $FTP_bin passwd $User -f $Passwdfile -m < $FTP_tmp_passfile - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 - echo "#####################################" - echo - echo "[$User] Password changed successfully! " - echo - echo "You user name is : ${CMSG}$User${CEND}" - echo "You new password is : ${CMSG}$Password${CEND}" - echo - ;; - 4) - if [ ! -e "$Passwdfile" ];then - echo "${CQUESTION}User was not existed! ${CEND}" - else - $FTP_bin list - fi + read -p "Please input the correct option: " Number + if [[ ! $Number =~ ^[1-6,q]$ ]]; then + echo "${CFAILURE}input error! Please only input 1 ~ 6 and q${CEND}" + else + case "$Number" in + 1) + USER + [ -e "$Passwdfile" ] && [ -n "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] is already existed! ${CEND}"; continue; } + PASSWORD;DIRECTORY + $FTP_bin useradd $User -f $Passwdfile -u $run_user -g $run_user -d $Directory -m < $FTP_tmp_passfile + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + echo "#####################################" + echo + echo "[$User] create successful! " + echo + echo "You user name is : ${CMSG}$User${CEND}" + echo "You Password is : ${CMSG}$Password${CEND}" + echo "You directory is : ${CMSG}$Directory${CEND}" + echo + ;; + 2) + USER + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + DIRECTORY + $FTP_bin usermod $User -f $Passwdfile -d $Directory -m + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + echo "#####################################" + echo + echo "[$User] modify a successful! " + echo + echo "You user name is : ${CMSG}$User${CEND}" + echo "You new directory is : ${CMSG}$Directory${CEND}" + echo + ;; + 3) + USER + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + PASSWORD + $FTP_bin passwd $User -f $Passwdfile -m < $FTP_tmp_passfile + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + echo "#####################################" + echo + echo "[$User] Password changed successfully! " + echo + echo "You user name is : ${CMSG}$User${CEND}" + echo "You new password is : ${CMSG}$Password${CEND}" + echo + ;; + 4) + if [ ! -e "$Passwdfile" ]; then + echo "${CQUESTION}User was not existed! ${CEND}" + else + $FTP_bin list + fi - USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } - $FTP_bin userdel $User -f $Passwdfile -m - $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 - echo - echo "[$User] have been deleted! " - ;; - 5) - if [ ! -e "$Passwdfile" ];then - echo "${CQUESTION}User was not existed! ${CEND}" - else - $FTP_bin list - fi - ;; - 6) - USER - [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } - $FTP_bin show $User - ;; - q) - exit - ;; - esac - fi + USER + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + $FTP_bin userdel $User -f $Passwdfile -m + $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1 + echo + echo "[$User] have been deleted! " + ;; + 5) + if [ ! -e "$Passwdfile" ]; then + echo "${CQUESTION}User was not existed! ${CEND}" + else + $FTP_bin list + fi + ;; + 6) + USER + [ -e "$Passwdfile" ] && [ -z "`grep ^${User}: $Passwdfile`" ] && { echo "${CQUESTION}[$User] was not existed! ${CEND}"; continue; } + $FTP_bin show $User + ;; + q) + exit + ;; + esac + fi done diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index 26255818..b537c4ca 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -27,25 +27,25 @@ printf " Reset_db_root_password() { -[ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; } -while :; do echo + [ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; } + while :; do echo read -p "Please input the root password of database: " New_dbrootpwd [ -n "`echo $New_dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and &${CEND}"; continue; } (( ${#New_dbrootpwd} >= 5 )) && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" -done - -$db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h localhost > /dev/null 2>&1 -status_Localhost=`echo $?` -$db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h 127.0.0.1 > /dev/null 2>&1 -status_127=`echo $?` -if [ $status_Localhost == '0' -a $status_127 == '0' ]; then + done + + $db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h localhost > /dev/null 2>&1 + status_Localhost=`echo $?` + $db_install_dir/bin/mysqladmin -uroot -p"$dbrootpwd" password "$New_dbrootpwd" -h 127.0.0.1 > /dev/null 2>&1 + status_127=`echo $?` + if [ $status_Localhost == '0' -a $status_127 == '0' ]; then sed -i "s+^dbrootpwd.*+dbrootpwd='$New_dbrootpwd'+" ./options.conf echo echo "Password reset succesfully! " echo "The new password: ${CMSG}${New_dbrootpwd}${CEND}" echo -else + else echo "${CFAILURE}Reset Database root password failed! ${CEND}" -fi + fi } Reset_db_root_password diff --git a/shadowsocks.sh b/shadowsocks.sh index 5e290f02..1d6d143c 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -19,7 +19,7 @@ printf " ####################################################################### " -cd src +pushd src > /dev/null . ../options.conf . ../include/color.sh . ../include/check_os.sh @@ -33,186 +33,185 @@ PUBLIC_IPADDR=`../include/get_public_ipaddr.py` [ "$CentOS_RHEL_version" == '5' ] && { echo "${CWARNING}Shadowsocks only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } Check_shadowsocks() { - [ -f /usr/local/bin/ss-server ] && SS_version=1 - [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 + [ -f /usr/local/bin/ss-server ] && SS_version=1 + [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 } AddUser_shadowsocks() { -while :; do echo + while :; do echo read -p "Please input password for shadowsocks: " Shadowsocks_password [ -n "`echo $Shadowsocks_password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" -done + done } Iptables_set() { -if [ -e '/etc/sysconfig/iptables' ];then + if [ -e '/etc/sysconfig/iptables' ]; then Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1` -elif [ -e '/etc/iptables.up.rules' ];then + elif [ -e '/etc/iptables.up.rules' ]; then Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1` -fi - -if [ -n "$Shadowsocks_Already_port" ];then + fi + + if [ -n "$Shadowsocks_Already_port" ]; then Shadowsocks_Default_port=`expr $Shadowsocks_Already_port + 1` -else + else Shadowsocks_Default_port=9001 -fi - -while :; do echo + fi + + while :; do echo read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port - if [ $Shadowsocks_port -ge 1 >/dev/null 2>&1 -a $Shadowsocks_port -le 65535 >/dev/null 2>&1 ];then - [ -z "`netstat -an | grep :$Shadowsocks_port`" ] && break || echo "${CWARNING}This port is already used! ${CEND}" + if [ $Shadowsocks_port -ge 1 >/dev/null 2>&1 -a $Shadowsocks_port -le 65535 >/dev/null 2>&1 ]; then + [ -z "`netstat -an | grep :$Shadowsocks_port`" ] && break || echo "${CWARNING}This port is already used! ${CEND}" else - echo "${CWARNING}input error! Input range: 1~65535${CEND}" + echo "${CWARNING}input error! Input range: 1~65535${CEND}" fi -done - -if [ "$OS" == 'CentOS' ];then - if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ];then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - service iptables save + done + + if [ "$OS" == 'CentOS' ]; then + if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + service iptables save fi -elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then - if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ];then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT - iptables-save > /etc/iptables.up.rules + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + iptables-save > /etc/iptables.up.rules fi -else + else echo "${CWARNING}This port is already in iptables! ${CEND}" -fi - + fi } Def_parameter() { -if [ "$OS" == 'CentOS' ]; then + if [ "$OS" == 'CentOS' ]; then while :; do echo - echo 'Please select Shadowsocks server version:' - echo -e "\t${CMSG}1${CEND}. Install Shadowsocks-libev" - echo -e "\t${CMSG}2${CEND}. Install Shadowsocks-python" - read -p "Please input a number:(Default 1 press Enter) " SS_version - [ -z "$SS_version" ] && SS_version=1 - if [[ ! $SS_version =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi + echo 'Please select Shadowsocks server version:' + echo -e "\t${CMSG}1${CEND}. Install Shadowsocks-libev" + echo -e "\t${CMSG}2${CEND}. Install Shadowsocks-python" + read -p "Please input a number:(Default 1 press Enter) " SS_version + [ -z "$SS_version" ] && SS_version=1 + if [[ ! $SS_version =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi done AddUser_shadowsocks Iptables_set for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto do - yum -y install $Package + yum -y install $Package done -elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];then + elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then SS_version=2 AddUser_shadowsocks Iptables_set apt-get -y update for Package in python-dev python-pip curl wget unzip gcc swig automake make perl cpio git do - apt-get -y install $Package + apt-get -y install $Package done -fi + fi } Install_shadowsocks-python() { -src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src - -which pip > /dev/null 2>&1 -[ $? -ne 0 ] && [ "$OS" == 'CentOS' ] && { python ez_setup.py install; sleep 1; easy_install pip; } - -if [ -f /usr/bin/pip ]; then + src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src + + which pip > /dev/null 2>&1 + [ $? -ne 0 ] && [ "$OS" == 'CentOS' ] && { python ez_setup.py install; sleep 1; easy_install pip; } + + if [ -f /usr/bin/pip ]; then pip install M2Crypto pip install greenlet pip install gevent pip install shadowsocks if [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ]; then - /bin/cp ../init.d/Shadowsocks-python-init /etc/init.d/shadowsocks - chmod +x /etc/init.d/shadowsocks - [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults - [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks + /bin/cp ../init.d/Shadowsocks-python-init /etc/init.d/shadowsocks + chmod +x /etc/init.d/shadowsocks + [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults + [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks else - echo - echo "${CQUESTION}Shadowsocks-python install failed! Please visit https://oneinstack.com${CEND}" - exit 1 + echo + echo "${CQUESTION}Shadowsocks-python install failed! Please visit https://oneinstack.com${CEND}" + exit 1 fi -fi + fi } Install_shadowsocks-libev() { -git clone https://github.com/shadowsocks/shadowsocks-libev.git -cd shadowsocks-libev -./configure -make -j ${THREAD} && make install -cd .. -if [ -f /usr/local/bin/ss-server ];then + git clone https://github.com/shadowsocks/shadowsocks-libev.git + pushd shadowsocks-libev + ./configure + make -j ${THREAD} && make install + popd + if [ -f /usr/local/bin/ss-server ]; then /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } -else - echo - echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}" - exit 1 -fi + else + echo + echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}" + exit 1 + fi } Uninstall_shadowsocks(){ -while :; do echo + while :; do echo read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn - if [[ ! $Shadowsocks_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $Shadowsocks_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done - -if [ "$Shadowsocks_yn" == 'y' ]; then + done + + if [ "$Shadowsocks_yn" == 'y' ]; then [ -n "`ps -ef | grep -v grep | grep -iE "ssserver|ss-server"`" ] && /etc/init.d/shadowsocks stop [ "$OS" == 'CentOS' ] && chkconfig --del shadowsocks [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks - if [ "$SS_version" == '1' ];then - rm -f /usr/local/bin/ss-local - rm -f /usr/local/bin/ss-tunnel - rm -f /usr/local/bin/ss-server - rm -f /usr/local/bin/ss-manager - rm -f /usr/local/bin/ss-redir - rm -f /usr/local/lib/libshadowsocks.a - rm -f /usr/local/lib/libshadowsocks.la - rm -f /usr/local/include/shadowsocks.h - rm -f /usr/local/lib/pkgconfig/shadowsocks-libev.pc - rm -f /usr/local/share/man/man1/ss-local.1 - rm -f /usr/local/share/man/man1/ss-tunnel.1 - rm -f /usr/local/share/man/man1/ss-server.1 - rm -f /usr/local/share/man/man1/ss-manager.1 - rm -f /usr/local/share/man/man1/ss-redir.1 - rm -f /usr/local/share/man/man8/shadowsocks.8 - if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-libev uninstall success! ${CEND}" - else - echo "${CFAILURE}Shadowsocks-libev uninstall failed! ${CEND}" - fi - elif [ "$SS_version" == '2' ];then - pip uninstall -y shadowsocks - if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-python uninstall success! ${CEND}" - else - echo "${CFAILURE}Shadowsocks-python uninstall failed! ${CEND}" - fi + if [ "$SS_version" == '1' ]; then + rm -f /usr/local/bin/ss-local + rm -f /usr/local/bin/ss-tunnel + rm -f /usr/local/bin/ss-server + rm -f /usr/local/bin/ss-manager + rm -f /usr/local/bin/ss-redir + rm -f /usr/local/lib/libshadowsocks.a + rm -f /usr/local/lib/libshadowsocks.la + rm -f /usr/local/include/shadowsocks.h + rm -f /usr/local/lib/pkgconfig/shadowsocks-libev.pc + rm -f /usr/local/share/man/man1/ss-local.1 + rm -f /usr/local/share/man/man1/ss-tunnel.1 + rm -f /usr/local/share/man/man1/ss-server.1 + rm -f /usr/local/share/man/man1/ss-manager.1 + rm -f /usr/local/share/man/man1/ss-redir.1 + rm -f /usr/local/share/man/man8/shadowsocks.8 + if [ $? -eq 0 ]; then + echo "${CSUCCESS}Shadowsocks-libev uninstall success! ${CEND}" + else + echo "${CFAILURE}Shadowsocks-libev uninstall failed! ${CEND}" + fi + elif [ "$SS_version" == '2' ]; then + pip uninstall -y shadowsocks + if [ $? -eq 0 ]; then + echo "${CSUCCESS}Shadowsocks-python uninstall success! ${CEND}" + else + echo "${CFAILURE}Shadowsocks-python uninstall failed! ${CEND}" + fi fi -else + else echo "${CMSG}Shadowsocks uninstall cancelled! ${CEND}" -fi + fi } Config_shadowsocks(){ -[ ! -d '/etc/shadowsocks' ] && mkdir /etc/shadowsocks -[ "$SS_version" == '1' ] && cat > /etc/shadowsocks/config.json< /etc/shadowsocks/config.json< /etc/shadowsocks/config.json< /etc/shadowsocks/config.json<> $LogFile ; exit 1 ; } if [ -n "`ls $OldFile 2>/dev/null`" ];then - /bin/rm -f $OldFile - echo "[$OldFile] Delete Old File Success" >> $LogFile + /bin/rm -f $OldFile + echo "[$OldFile] Delete Old File Success" >> $LogFile else - echo "[$OldFile] Delete Old Backup File" >> $LogFile + echo "[$OldFile] Delete Old Backup File" >> $LogFile fi if [ -e "$NewFile" ];then - echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile + echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile else - $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile - cd $backup_dir - tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1 - echo "[$NewFile] Backup success ">> $LogFile - /bin/rm -f $DumpFile + $db_install_dir/bin/mysqldump -uroot -p$dbrootpwd --databases $DBname > $DumpFile + cd $backup_dir + tar czf $NewFile ${DumpFile##*/} >> $LogFile 2>&1 + echo "[$NewFile] Backup success ">> $LogFile + /bin/rm -f $DumpFile fi diff --git a/tools/mabs.sh b/tools/mabs.sh index 6eac6c7d..b7a33890 100755 --- a/tools/mabs.sh +++ b/tools/mabs.sh @@ -4,45 +4,42 @@ ###################### proc defination ######################## # ignore rule -ignore_init() -{ - # ignore password - array_ignore_pwd_length=0 - if [ -f ./ignore_pwd ]; then - while read IGNORE_PWD - do - array_ignore_pwd[$array_ignore_pwd_length]=$IGNORE_PWD - let array_ignore_pwd_length=$array_ignore_pwd_length+1 - done < ./ignore_pwd - fi - - # ignore ip address - array_ignore_ip_length=0 - if [ -f ./ignore_ip ]; then - while read IGNORE_IP - do - array_ignore_ip[$array_ignore_ip_length]=$IGNORE_IP - let array_ignore_ip_length=$array_ignore_ip_length+1 - done < ./ignore_ip - fi +ignore_init() { + # ignore password + array_ignore_pwd_length=0 + if [ -f ./ignore_pwd ]; then + while read IGNORE_PWD + do + array_ignore_pwd[$array_ignore_pwd_length]=$IGNORE_PWD + let array_ignore_pwd_length=$array_ignore_pwd_length+1 + done < ./ignore_pwd + fi + + # ignore ip address + array_ignore_ip_length=0 + if [ -f ./ignore_ip ]; then + while read IGNORE_IP + do + array_ignore_ip[$array_ignore_ip_length]=$IGNORE_IP + let array_ignore_ip_length=$array_ignore_ip_length+1 + done < ./ignore_ip + fi } -show_version() -{ - echo "version: 1.0" - echo "updated date: 2014-06-08" +show_version() { + echo "version: 1.0" + echo "updated date: 2014-06-08" } -show_usage() -{ - echo -e "`printf %-16s "Usage: $0"` [-h|--help]" - echo -e "`printf %-16s ` [-v|-V|--version]" - echo -e "`printf %-16s ` [-l|--iplist ... ]" - echo -e "`printf %-16s ` [-c|--config ... ]" - echo -e "`printf %-16s ` [-t|--sshtimeout ... ]" - echo -e "`printf %-16s ` [-T|--fttimeout ... ]" - echo -e "`printf %-16s ` [-L|--bwlimit ... ]" - echo -e "`printf %-16s ` [-n|--ignore]" +show_usage() { + echo -e "`printf %-16s "Usage: $0"` [-h|--help]" + echo -e "`printf %-16s ` [-v|-V|--version]" + echo -e "`printf %-16s ` [-l|--iplist ... ]" + echo -e "`printf %-16s ` [-c|--config ... ]" + echo -e "`printf %-16s ` [-t|--sshtimeout ... ]" + echo -e "`printf %-16s ` [-T|--fttimeout ... ]" + echo -e "`printf %-16s ` [-L|--bwlimit ... ]" + echo -e "`printf %-16s ` [-n|--ignore]" } IPLIST="iplist.txt" @@ -60,42 +57,42 @@ TEMP=`getopt -o hvVl:c:t:T:L:n --long help,version,iplist:,config:,sshtimeout:,f eval set -- "$TEMP" while :; do - [ -z "$1" ] && break; - case "$1" in - -h|--help) - show_usage; exit 0 - ;; - -v|-V|--version) - show_version; exit 0 - ;; - -l|--iplist) - IPLIST=$2; shift 2 - ;; - -c|--config) - CONFIG_FILE=$2; shift 2 - ;; - -t|--sshtimeout) - SSHTIMEOUT=$2; shift 2 - ;; - -T|--fttimeout) - SCPTIMEOUT=$2; shift 2 - ;; - -L|--bwlimit) - BWLIMIT=$2; shift 2 - ;; - --log) - LOG_FILE=$2; shift 2 - ;; - -n|--ignore) - IGNRFLAG="ignr"; shift - ;; - --) - shift - ;; - *) - echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 - ;; - esac + [ -z "$1" ] && break; + case "$1" in + -h|--help) + show_usage; exit 0 + ;; + -v|-V|--version) + show_version; exit 0 + ;; + -l|--iplist) + IPLIST=$2; shift 2 + ;; + -c|--config) + CONFIG_FILE=$2; shift 2 + ;; + -t|--sshtimeout) + SSHTIMEOUT=$2; shift 2 + ;; + -T|--fttimeout) + SCPTIMEOUT=$2; shift 2 + ;; + -L|--bwlimit) + BWLIMIT=$2; shift 2 + ;; + --log) + LOG_FILE=$2; shift 2 + ;; + -n|--ignore) + IGNRFLAG="ignr"; shift + ;; + --) + shift + ;; + *) + echo -e "\033[31mERROR: unknown argument! \033[0m\n" && show_usage && exit 1 + ;; + esac done ################ main ####################### @@ -108,59 +105,59 @@ IP_count=$(egrep -v '^#|^$' $IPLIST|wc -l) IP_init=1 while [[ $IP_init -le $IP_count ]] do - egrep -v '^#|^$' $IPLIST | sed -n "$IP_init,$(expr $IP_init + 50)p" > $IPLIST.tmp - - IPSEQ=0 - - while read IP PORT USER PASSWD PASSWD_2ND PASSWD_3RD PASSWD_4TH OTHERS - # while read Line - do - [ -z "`echo $IP | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|CNS'`" ] && continue - if [ "`python ./ckssh.py $IP $PORT`" == 'no' ];then - [ ! -e ipnologin.txt ] && > ipnologin.txt - [ -z "`grep $IP ipnologin.txt | grep $(date +%F)`" ] && echo "`date +%F_%H%M` $IP" >> ipnologin.txt - continue - fi - - #[ -e "~/.ssh/known_hosts" ] && grep $IP ~/.ssh/known_hosts | sed -i "/$IP/d" ~/.ssh/known_hosts - - let IPSEQ=$IPSEQ+1 - - if [ $IGNRFLAG == "ignr" ]; then - ignore_init - ignored_flag=0 - - i=0 - while [ $i -lt $array_ignore_pwd_length ] - do - [ ${PASSWD}x == ${array_ignore_pwd[$i]}x ] && ignored_flag=1 && break - let i=$i+1 - done - - [ $ignored_flag -eq 1 ] && continue - - j=0 - while [ $j -lt $array_ignore_ip_length ] - do - [ ${IP}x == ${array_ignore_ip[$j]}x ] && ignored_flag=1 && break - let j=$j+1 - done - - [ $ignored_flag -eq 1 ] && continue - fi - - PASSWD_USE=$PASSWD - - IPcode=$(echo "ibase=16;$(echo "$IP" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - Portcode=$(echo "ibase=16;$(echo "$PORT" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - #USER=$USER - PWcode=$(echo "ibase=16;$(echo "$PASSWD_USE" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - Othercode=$(echo "ibase=16;$(echo "$OTHERS" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') - #echo $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode - ./thread.sh $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode | tee logs/$IP.log & - done < $IPLIST.tmp - sleep 3 - IP_init=$(expr $IP_init + 50) + egrep -v '^#|^$' $IPLIST | sed -n "$IP_init,$(expr $IP_init + 50)p" > $IPLIST.tmp + + IPSEQ=0 + + while read IP PORT USER PASSWD PASSWD_2ND PASSWD_3RD PASSWD_4TH OTHERS + # while read Line + do + [ -z "`echo $IP | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|CNS'`" ] && continue + if [ "`python ./ckssh.py $IP $PORT`" == 'no' ]; then + [ ! -e ipnologin.txt ] && > ipnologin.txt + [ -z "`grep $IP ipnologin.txt | grep $(date +%F)`" ] && echo "`date +%F_%H%M` $IP" >> ipnologin.txt + continue + fi + + #[ -e "~/.ssh/known_hosts" ] && grep $IP ~/.ssh/known_hosts | sed -i "/$IP/d" ~/.ssh/known_hosts + + let IPSEQ=$IPSEQ+1 + + if [ $IGNRFLAG == "ignr" ]; then + ignore_init + ignored_flag=0 + + i=0 + while [ $i -lt $array_ignore_pwd_length ] + do + [ ${PASSWD}x == ${array_ignore_pwd[$i]}x ] && ignored_flag=1 && break + let i=$i+1 + done + + [ $ignored_flag -eq 1 ] && continue + + j=0 + while [ $j -lt $array_ignore_ip_length ] + do + [ ${IP}x == ${array_ignore_ip[$j]}x ] && ignored_flag=1 && break + let j=$j+1 + done + + [ $ignored_flag -eq 1 ] && continue + fi + + PASSWD_USE=$PASSWD + + IPcode=$(echo "ibase=16;$(echo "$IP" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Portcode=$(echo "ibase=16;$(echo "$PORT" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + #USER=$USER + PWcode=$(echo "ibase=16;$(echo "$PASSWD_USE" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + Othercode=$(echo "ibase=16;$(echo "$OTHERS" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n') + #echo $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode + ./thread.sh $IPcode $Portcode $USER $PWcode $CONFIG_FILE $SSHTIMEOUT $SCPTIMEOUT $BWLIMIT $Othercode | tee logs/$IP.log & + done < $IPLIST.tmp + sleep 3 + IP_init=$(expr $IP_init + 50) done ENDDATETIME=`date "+%F %T"` diff --git a/tools/mscp.exp b/tools/mscp.exp index dd32eb58..ae7c4dde 100755 --- a/tools/mscp.exp +++ b/tools/mscp.exp @@ -1,23 +1,23 @@ #!/usr/bin/expect -- proc Usage_Exit {self} { - puts "" - puts "Usage: $self ip user passwd port sourcefile destdir direction bwlimit timeout" - puts "" - puts " sourcefile: a file or directory to be transferred" - puts " 需要拷贝目录时目录名后不要带 /, 否则会拷贝该目录下的所有文件" - puts " destdir: the location that the sourcefile to be put into" - puts " direction: pull or push" - puts " pull: remote -> local" - puts " push: local -> remote" - puts " bwlimit: bandwidth limit, kbit/s, 0 means no limit" - puts " timeout: timeout of expect, s, -1 means no timeout" - puts "" - exit 1 + puts "" + puts "Usage: $self ip user passwd port sourcefile destdir direction bwlimit timeout" + puts "" + puts " sourcefile: a file or directory to be transferred" + puts " 需要拷贝目录时目录名后不要带 /, 否则会拷贝该目录下的所有文件" + puts " destdir: the location that the sourcefile to be put into" + puts " direction: pull or push" + puts " pull: remote -> local" + puts " push: local -> remote" + puts " bwlimit: bandwidth limit, kbit/s, 0 means no limit" + puts " timeout: timeout of expect, s, -1 means no timeout" + puts "" + exit 1 } if { [llength $argv] < 9 } { - Usage_Exit $argv0 + Usage_Exit $argv0 } set ipcode [lindex $argv 0] @@ -37,122 +37,122 @@ set yesnoflag 0 set timeout $timeoutflag for {} {1} {} { -# for is only used to retry when "Interrupted system call" occured + # for is only used to retry when "Interrupted system call" occured -if { $direction == "pull" } { + if { $direction == "pull" } { if { $bwlimit > 0 } { - spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir } elseif { $bwlimit == 0 } { - spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $ip:$sourcefile $destdir } else { - Usage_Exit $argv0 + Usage_Exit $argv0 } -} elseif { $direction == "push" } { + } elseif { $direction == "push" } { if { $bwlimit > 0 } { - spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + spawn rsync -crazP --delete --bwlimit=$bwlimit -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir } elseif { $bwlimit == 0 } { - spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir + spawn rsync -crazP --delete -e "/usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port" $sourcefile $ip:$destdir } else { - Usage_Exit $argv0 + Usage_Exit $argv0 } -} else { + } else { Usage_Exit $argv0 -} + } -expect { + expect { "assword:" { - send "$passwd\r" - break; + send "$passwd\r" + break; } "yes/no)?" { - set yesnoflag 1 - send "yes\r" - break; + set yesnoflag 1 + send "yes\r" + break; } "FATAL" { - puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 } timeout { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 } "No route to host" { - puts "\nCONNECTERROR: $ip No route to host!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 } "Connection Refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 } "Connection refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 } "Host key verification failed" { - puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 } "Illegal host key" { - puts "\nCONNECTERROR: $ip Illegal host key!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 } "Connection Timed Out" { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 } "Interrupted system call" { - puts "\n$ip Interrupted system call!!!\n" + puts "\n$ip Interrupted system call!!!\n" } -} + } } if { $yesnoflag == 1 } { - expect { - "assword:" { - send "$passwd\r" - } + expect { + "assword:" { + send "$passwd\r" + } - "yes/no)?" { - set yesnoflag 2 - send "yes\r" - } + "yes/no)?" { + set yesnoflag 2 + send "yes\r" } + } } if { $yesnoflag == 2 } { - expect { - "assword:" { - send "$passwd\r" - } + expect { + "assword:" { + send "$passwd\r" } + } } expect { - "assword:" { - send "$passwd\r" - puts "\nPASSWORDERROR: $ip Password error!!!\n" - exit 1 - } + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } - eof { - puts "OK_SCP: $ip\n" - exit 0; - } + eof { + puts "OK_SCP: $ip\n" + exit 0; + } } diff --git a/tools/mssh.exp b/tools/mssh.exp index 8d7e2ea4..194006f8 100755 --- a/tools/mssh.exp +++ b/tools/mssh.exp @@ -1,8 +1,8 @@ #!/usr/bin/expect -- if { [llength $argv] < 4 } { - puts "Usage: $argv0 ip user passwd port commands timeout" - exit 1 + puts "Usage: $argv0 ip user passwd port commands timeout" + exit 1 } match_max 600000 @@ -22,108 +22,108 @@ set timeout $timeoutflag for {} {1} {} { -# for is only used to retry when "Interrupted system call" occured + # for is only used to retry when "Interrupted system call" occured -spawn /usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port $ip + spawn /usr/bin/ssh -o GSSAPIAuthentication=no -q -l$user -p$port $ip -expect { + expect { "assword:" { - send "$passwd\r" - break; + send "$passwd\r" + break; } "yes/no)?" { - set yesnoflag 1 - send "yes\r" - break; + set yesnoflag 1 + send "yes\r" + break; } "FATAL" { - puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip occur FATAL ERROR!!!\n" + exit 1 } timeout { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 } "No route to host" { - puts "\nCONNECTERROR: $ip No route to host!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip No route to host!!!\n" + exit 1 } "Connection Refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 } "Connection refused" { - puts "\nCONNECTERROR: $ip Connection Refused!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Connection Refused!!!\n" + exit 1 } "Host key verification failed" { - puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Host key verification failed!!!\n" + exit 1 } "Illegal host key" { - puts "\nCONNECTERROR: $ip Illegal host key!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Illegal host key!!!\n" + exit 1 } "Connection Timed Out" { - puts "\nCONNECTERROR: $ip Logon timeout!!!\n" - exit 1 + puts "\nCONNECTERROR: $ip Logon timeout!!!\n" + exit 1 } "Interrupted system call" { - puts "\n$ip Interrupted system call!!!\n" + puts "\n$ip Interrupted system call!!!\n" } -} + } } if { $yesnoflag == 1 } { - expect { - "assword:" { - send "$passwd\r" - } - - "yes/no)?" { - set yesnoflag 2 - send "yes\r" - } + expect { + "assword:" { + send "$passwd\r" + } + + "yes/no)?" { + set yesnoflag 2 + send "yes\r" } + } } if { $yesnoflag == 2 } { - expect { - "assword:" { - send "$passwd\r" - } + expect { + "assword:" { + send "$passwd\r" } + } } expect { - "@" {send "$commands \r"} - "assword:" { - send "$passwd\r" - puts "\nPASSWORDERROR: $ip Password error!!!\n" - exit 1 - } + "@" {send "$commands \r"} + "assword:" { + send "$passwd\r" + puts "\nPASSWORDERROR: $ip Password error!!!\n" + exit 1 + } } expect { - "@" {send "sleep 1\r"} + "@" {send "sleep 1\r"} } expect { - "@" {send "exit\r"} + "@" {send "exit\r"} } expect eof { - puts "OK_SSH: $ip\n" - exit 0; + puts "OK_SSH: $ip\n" + exit 0; } diff --git a/tools/thread.sh b/tools/thread.sh index 576cf383..0c126ebc 100755 --- a/tools/thread.sh +++ b/tools/thread.sh @@ -16,30 +16,30 @@ BWLIMIT=$8 while read eachline do - [ -z "`echo $eachline | grep -E '^com|^file'`" ] && continue - - myKEYWORD=`echo $eachline | awk -F"$myIFS" '{ print $1 }'` - myCONFIGLINE=`echo $eachline | awk -F"$myIFS" '{ print $2 }'` - - if [ "$myKEYWORD"x == "file"x ]; then - SOURCEFILE=`echo $myCONFIGLINE | awk '{ print $1 }'` - DESTDIR=`echo $myCONFIGLINE | awk '{ print $2 }'` - DIRECTION=`echo $myCONFIGLINE | awk '{ print $3 }'` - ./mscp.exp $IP $USER $PASSWD $PORT $SOURCEFILE $DESTDIR $DIRECTION $BWLIMIT $SCPTIMEOUT - - [ $? -ne 0 ] && echo -e "\033[31mSCP Try Out All Password Failed\033[0m\n" - - elif [ "$myKEYWORD"x == "com"x ]; then - ./mssh.exp $IP $USER $PASSWD $PORT "${myCONFIGLINE}" $SSHTIMEOUT - [ $? -ne 0 ] && echo -e "\033[31mSSH Try Out All Password Failed\033[0m\n" - - else - echo "ERROR: configuration wrong! [$eachline] " - echo " where KEYWORD should not be [$myKEYWORD], but 'com' or 'file'" - echo " if you dont want to run it, you can comment it with '#'" - echo "" - exit - fi + [ -z "`echo $eachline | grep -E '^com|^file'`" ] && continue + + myKEYWORD=`echo $eachline | awk -F"$myIFS" '{ print $1 }'` + myCONFIGLINE=`echo $eachline | awk -F"$myIFS" '{ print $2 }'` + + if [ "$myKEYWORD"x == "file"x ]; then + SOURCEFILE=`echo $myCONFIGLINE | awk '{ print $1 }'` + DESTDIR=`echo $myCONFIGLINE | awk '{ print $2 }'` + DIRECTION=`echo $myCONFIGLINE | awk '{ print $3 }'` + ./mscp.exp $IP $USER $PASSWD $PORT $SOURCEFILE $DESTDIR $DIRECTION $BWLIMIT $SCPTIMEOUT + + [ $? -ne 0 ] && echo -e "\033[31mSCP Try Out All Password Failed\033[0m\n" + + elif [ "$myKEYWORD"x == "com"x ]; then + ./mssh.exp $IP $USER $PASSWD $PORT "${myCONFIGLINE}" $SSHTIMEOUT + [ $? -ne 0 ] && echo -e "\033[31mSSH Try Out All Password Failed\033[0m\n" + + else + echo "ERROR: configuration wrong! [$eachline] " + echo " where KEYWORD should not be [$myKEYWORD], but 'com' or 'file'" + echo " if you dont want to run it, you can comment it with '#'" + echo "" + exit + fi done < $CONFIG_FILE diff --git a/tools/website_bk.sh b/tools/website_bk.sh index 9fda7875..800a673b 100755 --- a/tools/website_bk.sh +++ b/tools/website_bk.sh @@ -18,21 +18,21 @@ OldFile=$backup_dir/Web_${WebSite}_$(date +%Y%m%d --date="$expired_days days ago [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist" >> $LogFile ; exit 1 ; } if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ];then - if [ -n "`ls $OldFile 2>/dev/null`" ];then - /bin/rm -f $OldFile - echo "[$OldFile] Delete Old File Success" >> $LogFile - else - echo "[$OldFile] Delete Old Backup File" >> $LogFile - fi + if [ -n "`ls $OldFile 2>/dev/null`" ];then + /bin/rm -f $OldFile + echo "[$OldFile] Delete Old File Success" >> $LogFile + else + echo "[$OldFile] Delete Old Backup File" >> $LogFile + fi - if [ -e "$NewFile" ];then - echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile - else - cd $wwwroot_dir - tar czf $NewFile ./${WebSite} >> $LogFile 2>&1 - echo "[$NewFile] Backup success ">> $LogFile - cd - - fi + if [ -e "$NewFile" ];then + echo "[$NewFile] The Backup File is exists, Can't Backup" >> $LogFile + else + pushd $wwwroot_dir > /dev/null + tar czf $NewFile ./${WebSite} >> $LogFile 2>&1 + echo "[$NewFile] Backup success ">> $LogFile + popd > /dev/null + fi else - rsync -crazP --delete $wwwroot_dir/$WebSite $backup_dir + rsync -crazP --delete $wwwroot_dir/$WebSite $backup_dir fi diff --git a/uninstall.sh b/uninstall.sh index 3d0a8a64..b0b72c95 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -28,7 +28,7 @@ printf " Usage(){ -printf " + printf " Usage: $0 [ ${CMSG}all${CEND} | ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}hhvm${CEND} | ${CMSG}pureftpd${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} ] ${CMSG}all${CEND} --->Uninstall All ${CMSG}web${CEND} --->Uninstall Nginx/Tengine/Apache/Tomcat @@ -43,136 +43,136 @@ ${CMSG}memcached${CEND} --->Uninstall Memcached } Uninstall_status() { -while :; do echo + while :; do echo read -p "Do you want to uninstall? [y/n]: " uninstall_yn echo - if [[ ! $uninstall_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! ${uninstall_yn} =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done + done } Print_Warn() { -echo -echo "${CWARNING}You will uninstall OneinStack, Please backup your configure files and DB data! ${CEND}" + echo + echo "${CWARNING}You will uninstall OneinStack, Please backup your configure files and DB data! ${CEND}" } Print_web() { -[ -d "$nginx_install_dir" ] && echo "$nginx_install_dir" -[ -d "$tengine_install_dir" ] && echo "$tengine_install_dir" -[ -d "$openresty_install_dir" ] && echo "$openresty_install_dir" -[ -e "/etc/init.d/nginx" ] && echo '/etc/init.d/nginx' -[ -e "/etc/logrotate.d/nginx" ] && echo '/etc/logrotate.d/nginx' - -[ -d "$apache_install_dir" ] && echo "$apache_install_dir" -[ -e "/etc/init.d/httpd" ] && echo "/etc/init.d/httpd" -[ -e "/etc/logrotate.d/apache" ] && echo "/etc/logrotate.d/apache" - -[ -d "$tomcat_install_dir" ] && echo "$tomcat_install_dir" -[ -e "/etc/init.d/tomcat" ] && echo "/etc/init.d/tomcat" -[ -e "/etc/logrotate.d/tomcat" ] && echo "/etc/logrotate.d/tomcat" -[ -d "/usr/java" ] && echo '/usr/java' -[ -d "/usr/local/apr" ] && echo '/usr/local/apr' + [ -d "${nginx_install_dir}" ] && echo "${nginx_install_dir}" + [ -d "${tengine_install_dir}" ] && echo "${tengine_install_dir}" + [ -d "${openresty_install_dir}" ] && echo "${openresty_install_dir}" + [ -e "/etc/init.d/nginx" ] && echo '/etc/init.d/nginx' + [ -e "/etc/logrotate.d/nginx" ] && echo '/etc/logrotate.d/nginx' + + [ -d "${apache_install_dir}" ] && echo "${apache_install_dir}" + [ -e "/etc/init.d/httpd" ] && echo "/etc/init.d/httpd" + [ -e "/etc/logrotate.d/apache" ] && echo "/etc/logrotate.d/apache" + + [ -d "${tomcat_install_dir}" ] && echo "${tomcat_install_dir}" + [ -e "/etc/init.d/tomcat" ] && echo "/etc/init.d/tomcat" + [ -e "/etc/logrotate.d/tomcat" ] && echo "/etc/logrotate.d/tomcat" + [ -d "/usr/java" ] && echo '/usr/java' + [ -d "/usr/local/apr" ] && echo '/usr/local/apr' } Uninstall_Web() { -[ -d "$nginx_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $nginx_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$nginx_install_dir/sbin:@@" /etc/profile; } -[ -d "$tengine_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $tengine_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$tengine_install_dir/sbin:@@" /etc/profile; } -[ -d "$openresty_install_dir" ] && { killall nginx > /dev/null 2>&1; rm -rf $openresty_install_dir /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@$openresty_install_dir/nginx/sbin:@@" /etc/profile; } -[ -d "$apache_install_dir" ] && { service httpd stop > /dev/null 2>&1; rm -rf $apache_install_dir /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@$apache_install_dir/bin:@@" /etc/profile; } -[ -d "$tomcat_install_dir" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf $tomcat_install_dir /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; } -[ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } -[ -e "$wwwroot_dir" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} -sed -i 's@^website_name=.*@website_name=@' ./options.conf -sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf -sed -i 's@^remote_bankup_yn=.*@remote_bankup_yn=n@' ./options.conf -echo "${CMSG}Web uninstall completed${CEND}" + [ -d "${nginx_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${nginx_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${nginx_install_dir}/sbin:@@" /etc/profile; } + [ -d "${tengine_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${tengine_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${tengine_install_dir}/sbin:@@" /etc/profile; } + [ -d "${openresty_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${openresty_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${openresty_install_dir}/nginx/sbin:@@" /etc/profile; } + [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; } + [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; } + [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } + [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} + sed -i 's@^website_name=.*@website_name=@' ./options.conf + sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf + sed -i 's@^remote_bankup_yn=.*@remote_bankup_yn=n@' ./options.conf + echo "${CMSG}Web uninstall completed${CEND}" } Print_DB() { -[ -e "$db_install_dir" ] && echo "$db_install_dir" -[ -e "/etc/init.d/mysqld" ] && echo "/etc/init.d/mysqld" -[ -e "/etc/my.cnf" ] && echo "/etc/my.cnf" + [ -e "${db_install_dir}" ] && echo "${db_install_dir}" + [ -e "/etc/init.d/mysqld" ] && echo "/etc/init.d/mysqld" + [ -e "/etc/my.cnf" ] && echo "/etc/my.cnf" } Uninstall_DB() { -[ -e "$db_install_dir" ] && { service mysqld stop > /dev/null 2>&1; rm -rf $db_install_dir /etc/init.d/mysqld /etc/my.cnf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf; } -id -u mysql >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel mysql -[ -e "$db_data_dir" ] && /bin/mv ${db_data_dir}{,$(date +%Y%m%d%H)} -sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf -sed -i "s@$db_install_dir/bin:@@" /etc/profile -echo "${CMSG}DB uninstall completed${CEND}" + [ -e "${db_install_dir}" ] && { service mysqld stop > /dev/null 2>&1; rm -rf ${db_install_dir} /etc/init.d/mysqld /etc/my.cnf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf; } + id -u mysql >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel mysql + [ -e "${db_data_dir}" ] && /bin/mv ${db_data_dir}{,$(date +%Y%m%d%H)} + sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf + sed -i "s@${db_install_dir}/bin:@@" /etc/profile + echo "${CMSG}DB uninstall completed${CEND}" } Print_PHP() { -[ -e "$php_install_dir" ] && echo "$php_install_dir" -[ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm" -[ -e "/usr/local/imagemagick" ] && echo "/usr/local/imagemagick" -[ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick' + [ -e "${php_install_dir}" ] && echo "${php_install_dir}" + [ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm" + [ -e "/usr/local/imagemagick" ] && echo "/usr/local/imagemagick" + [ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick' } Uninstall_PHP() { -[ -e "$php_install_dir/bin/phpize" -a -e "$php_install_dir/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf $php_install_dir /etc/init.d/php-fpm; } -[ -e "$php_install_dir/bin/phpize" -a ! -e "$php_install_dir/etc/php-fpm.conf" ] && rm -rf $php_install_dir -[ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick -[ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick -sed -i "s@$php_install_dir/bin:@@" /etc/profile -echo "${CMSG}PHP uninstall completed${CEND}" + [ -e "${php_install_dir}/bin/phpize" -a -e "${php_install_dir}/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf ${php_install_dir} /etc/init.d/php-fpm; } + [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && rm -rf ${php_install_dir} + [ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick + [ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick + sed -i "s@${php_install_dir}/bin:@@" /etc/profile + echo "${CMSG}PHP uninstall completed${CEND}" } Print_HHVM() { -[ -e "/usr/bin/hhvm" ] && echo "/usr/bin/hhvm" -[ -e "/etc/hhvm" ] && echo "/etc/hhvm" -[ -e "/var/log/hhvm" ] && echo "/var/log/hhvm" -[ -e "/etc/supervisord.conf" ] && echo "/etc/supervisord.conf" -[ -e "/etc/init.d/supervisord" ] && echo "/etc/init.d/supervisord" + [ -e "/usr/bin/hhvm" ] && echo "/usr/bin/hhvm" + [ -e "/etc/hhvm" ] && echo "/etc/hhvm" + [ -e "/var/log/hhvm" ] && echo "/var/log/hhvm" + [ -e "/etc/supervisord.conf" ] && echo "/etc/supervisord.conf" + [ -e "/etc/init.d/supervisord" ] && echo "/etc/init.d/supervisord" } Uninstall_HHVM() { -[ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; } -[ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; } -echo "${CMSG}HHVM uninstall completed${CEND}" + [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; } + [ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; } + echo "${CMSG}HHVM uninstall completed${CEND}" } Print_PureFtpd() { -[ -e "$pureftpd_install_dir" ] && echo "$pureftpd_install_dir" -[ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd" + [ -e "$pureftpd_install_dir" ] && echo "$pureftpd_install_dir" + [ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd" } Uninstall_PureFtpd() { -[ -e "$pureftpd_install_dir" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf $pureftpd_install_dir /etc/init.d/pureftpd; } -echo "${CMSG}Pureftpd uninstall completed${CEND}" + [ -e "$pureftpd_install_dir" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf $pureftpd_install_dir /etc/init.d/pureftpd; } + echo "${CMSG}Pureftpd uninstall completed${CEND}" } Print_Redis() { -[ -e "$redis_install_dir" ] && echo "$redis_install_dir" -[ -e "/etc/init.d/redis-server" ] && echo "/etc/init.d/redis-server" + [ -e "$redis_install_dir" ] && echo "$redis_install_dir" + [ -e "/etc/init.d/redis-server" ] && echo "/etc/init.d/redis-server" } Uninstall_Redis() { -[ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } -[ -e "$php_install_dir/etc/php.d/ext-redis.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-redis.ini -echo "${CMSG}Redis uninstall completed${CEND}" + [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } + [ -e "${php_install_dir}/etc/php.d/ext-redis.ini" ] && rm -rf ${php_install_dir}/etc/php.d/ext-redis.ini + echo "${CMSG}Redis uninstall completed${CEND}" } Print_Memcached() { -[ -e "$memcached_install_dir" ] && echo "$memcached_install_dir" -[ -e "/etc/init.d/memcached" ] && echo "/etc/init.d/memcached" -[ -e "/usr/bin/memcached" ] && echo "/usr/bin/memcached" + [ -e "${memcached_install_dir}" ] && echo "${memcached_install_dir}" + [ -e "/etc/init.d/memcached" ] && echo "/etc/init.d/memcached" + [ -e "/usr/bin/memcached" ] && echo "/usr/bin/memcached" } Uninstall_Memcached() { -[ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } -[ -e "$php_install_dir/etc/php.d/ext-memcache.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcache.ini -[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini -echo "${CMSG}Memcached uninstall completed${CEND}" + [ -e "${memcached_install_dir}" ] && { service memcached stop > /dev/null 2>&1; rm -rf ${memcached_install_dir} /etc/init.d/memcached /usr/bin/memcached; } + [ -e "${php_install_dir}/etc/php.d/ext-memcache.ini" ] && rm -rf ${php_install_dir}/etc/php.d/ext-memcache.ini + [ -e "${php_install_dir}/etc/php.d/ext-memcached.ini" ] && rm -rf ${php_install_dir}/etc/php.d/ext-memcached.ini + echo "${CMSG}Memcached uninstall completed${CEND}" } Menu(){ while :; do - printf " + printf " What Are You Doing? \t${CMSG}0${CEND}. Uninstall All \t${CMSG}1${CEND}. Uninstall Nginx/Tengine/Apache/Tomcat @@ -184,148 +184,148 @@ What Are You Doing? \t${CMSG}7${CEND}. Uninstall Memcached \t${CMSG}q${CEND}. Exit " - echo - read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[0-7,q]$ ]];then - echo "${CWARNING}input error! Please only input 0,1,2,3,4,5,6,7 and q${CEND}" - else - case "$Number" in - 0) - Print_Warn - Print_web - Print_DB - Print_PHP - Print_HHVM - Print_PureFtpd - Print_Redis - Print_Memcached + echo + read -p "Please input the correct option: " Number + if [[ ! $Number =~ ^[0-7,q]$ ]]; then + echo "${CWARNING}input error! Please only input 0,1,2,3,4,5,6,7 and q${CEND}" + else + case "$Number" in + 0) + Print_Warn + Print_web + Print_DB + Print_PHP + Print_HHVM + Print_PureFtpd + Print_Redis + Print_Memcached - Uninstall_status - if [ "$uninstall_yn" == 'y' ];then - Uninstall_Web - Uninstall_DB - Uninstall_PHP - Uninstall_HHVM - Uninstall_PureFtpd - Uninstall_Redis - Uninstall_Memcached - else - exit - fi - ;; - 1) - Print_Warn - Print_web - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Web || exit - ;; - 2) - Print_Warn - Print_DB - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_DB || exit - ;; - 3) - Print_PHP - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_PHP || exit - ;; - 4) - Print_HHVM - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_HHVM || exit - ;; - 5) - Print_PureFtpd - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_PureFtpd || exit - ;; - 6) - Print_Redis - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Redis || exit - ;; - 7) - Print_Memcached - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Memcached || exit - ;; - q) - exit - ;; - esac - fi + Uninstall_status + if [ "${uninstall_yn}" == 'y' ]; then + Uninstall_Web + Uninstall_DB + Uninstall_PHP + Uninstall_HHVM + Uninstall_PureFtpd + Uninstall_Redis + Uninstall_Memcached + else + exit + fi + ;; + 1) + Print_Warn + Print_web + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Web || exit + ;; + 2) + Print_Warn + Print_DB + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_DB || exit + ;; + 3) + Print_PHP + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_PHP || exit + ;; + 4) + Print_HHVM + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_HHVM || exit + ;; + 5) + Print_PureFtpd + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_PureFtpd || exit + ;; + 6) + Print_Redis + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Redis || exit + ;; + 7) + Print_Memcached + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Memcached || exit + ;; + q) + exit + ;; + esac + fi done } -if [ $# == 0 ];then - Menu -elif [ $# == 1 ];then - case $1 in - all) - Print_Warn - Print_web - Print_DB - Print_PHP - Print_HHVM - Print_PureFtpd - Print_Redis - Print_Memcached +if [ $# == 0 ]; then + Menu +elif [ $# == 1 ]; then + case $1 in + all) + Print_Warn + Print_web + Print_DB + Print_PHP + Print_HHVM + Print_PureFtpd + Print_Redis + Print_Memcached - Uninstall_status - if [ "$uninstall_yn" == 'y' ];then - Uninstall_Web - Uninstall_DB - Uninstall_PHP - Uninstall_HHVM - Uninstall_PureFtpd - Uninstall_Redis - Uninstall_Memcached - else - exit - fi - ;; - web) - Print_Warn - Print_web - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Web || exit - ;; - db) - Print_Warn - Print_DB - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_DB || exit - ;; - php) - Print_PHP - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_PHP || exit - ;; - hhvm) - Print_HHVM - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_HHVM || exit - ;; - pureftpd) - Print_PureFtpd - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_PureFtpd || exit - ;; - redis) - Print_Redis - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Redis || exit - ;; - memcached) - Print_Memcached - Uninstall_status - [ "$uninstall_yn" == 'y' ] && Uninstall_Memcached || exit - ;; - *) - Usage - ;; - esac -else + Uninstall_status + if [ "${uninstall_yn}" == 'y' ]; then + Uninstall_Web + Uninstall_DB + Uninstall_PHP + Uninstall_HHVM + Uninstall_PureFtpd + Uninstall_Redis + Uninstall_Memcached + else + exit + fi + ;; + web) + Print_Warn + Print_web + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Web || exit + ;; + db) + Print_Warn + Print_DB + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_DB || exit + ;; + php) + Print_PHP + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_PHP || exit + ;; + hhvm) + Print_HHVM + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_HHVM || exit + ;; + pureftpd) + Print_PureFtpd + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_PureFtpd || exit + ;; + redis) + Print_Redis + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Redis || exit + ;; + memcached) + Print_Memcached + Uninstall_status + [ "${uninstall_yn}" == 'y' ] && Uninstall_Memcached || exit + ;; + *) Usage + ;; + esac +else + Usage fi diff --git a/upgrade.sh b/upgrade.sh index 17550537..1944de65 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -41,7 +41,7 @@ PUBLIC_IPADDR=`./include/get_public_ipaddr.py` IPADDR_COUNTRY=`./include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}'` Usage(){ -printf " + printf " Usage: $0 [ ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}redis${CEND} | ${CMSG}phpmyadmin${CEND} ] ${CMSG}web${CEND} --->Upgrade Nginx/Tengine/OpenResty ${CMSG}db${CEND} --->Upgrade MySQL/MariaDB/Percona @@ -53,7 +53,7 @@ ${CMSG}phpmyadmin${CEND} --->Upgrade phpMyAdmin } Menu(){ -while :; do + while :; do printf " What Are You Doing? \t${CMSG}1${CEND}. Upgrade Nginx/Tengine/OpenResty @@ -65,77 +65,68 @@ What Are You Doing? " echo read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-5,q]$ ]];then - echo "${CWARNING}input error! Please only input 1,2,3,4,5 and q${CEND}" + if [[ ! $Number =~ ^[1-5,q]$ ]]; then + echo "${CWARNING}input error! Please only input 1,2,3,4,5 and q${CEND}" else - case "$Number" in - 1) - if [ -e "$nginx_install_dir/sbin/nginx" ];then - Upgrade_Nginx - elif [ -e "$tengine_install_dir/sbin/nginx" ];then - Upgrade_Tengine - elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ];then - Upgrade_OpenResty - fi - ;; - - 2) - Upgrade_DB - ;; - - 3) - Upgrade_PHP - ;; - 4) - Upgrade_Redis - ;; - - 5) - Upgrade_phpMyAdmin - ;; - - q) - exit - ;; - esac - fi -done -} - -if [ $# == 0 ];then - Menu -elif [ $# == 1 ];then - case $1 in - web) - if [ -e "$nginx_install_dir/sbin/nginx" ];then - Upgrade_Nginx - elif [ -e "$tengine_install_dir/sbin/nginx" ];then - Upgrade_Tengine - elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ];then - Upgrade_OpenResty + case "$Number" in + 1) + if [ -e "$nginx_install_dir/sbin/nginx" ]; then + Upgrade_Nginx + elif [ -e "$tengine_install_dir/sbin/nginx" ]; then + Upgrade_Tengine + elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ]; then + Upgrade_OpenResty fi ;; - - db) + 2) Upgrade_DB ;; - - php) + 3) Upgrade_PHP ;; - - redis) + 4) Upgrade_Redis ;; - - phpmyadmin) + 5) Upgrade_phpMyAdmin ;; - - *) - Usage + q) + exit ;; - esac -else + esac + fi + done +} + +if [ $# == 0 ]; then + Menu +elif [ $# == 1 ]; then + case $1 in + web) + if [ -e "$nginx_install_dir/sbin/nginx" ]; then + Upgrade_Nginx + elif [ -e "$tengine_install_dir/sbin/nginx" ]; then + Upgrade_Tengine + elif [ -e "$openresty_install_dir/nginx/sbin/nginx" ]; then + Upgrade_OpenResty + fi + ;; + db) + Upgrade_DB + ;; + php) + Upgrade_PHP + ;; + redis) + Upgrade_Redis + ;; + phpmyadmin) + Upgrade_phpMyAdmin + ;; + *) Usage + ;; + esac +else + Usage fi diff --git a/versions.txt b/versions.txt index fe2c78f7..3e3a13ff 100644 --- a/versions.txt +++ b/versions.txt @@ -16,9 +16,9 @@ apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.15 -mysql_5_6_version=5.6.33 -mysql_5_5_version=5.5.52 +mysql_5_7_version=5.7.16 +mysql_5_6_version=5.6.34 +mysql_5_5_version=5.5.53 mariadb_10_1_version=10.1.18 mariadb_10_0_version=10.0.27 @@ -44,14 +44,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.6 -ImageMagick_version=6.9.6-0 +ImageMagick_version=6.9.6-2 imagick_version=3.4.1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 -curl_version=7.35.0 +curl_version=7.50.3 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 diff --git a/vhost.sh b/vhost.sh index fc6e02ca..a05d4efc 100755 --- a/vhost.sh +++ b/vhost.sh @@ -27,7 +27,7 @@ printf " [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } Usage() { -printf " + printf " Usage: $0 [ ${CMSG}add${CEND} | ${CMSG}del${CEND} ] ${CMSG}add${CEND} --->Add Virtualhost ${CMSG}del${CEND} --->Delete Virtualhost @@ -36,97 +36,97 @@ ${CMSG}del${CEND} --->Delete Virtualhost } Choose_env() { -if [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then + if [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=111 while :; do echo - echo 'Please choose to use environment:' - echo -e "\t${CMSG}1${CEND}. Use php" - echo -e "\t${CMSG}2${CEND}. Use java" - echo -e "\t${CMSG}3${CEND}. Use hhvm" - read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-3]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi + echo 'Please choose to use environment:' + echo -e "\t${CMSG}1${CEND}. Use php" + echo -e "\t${CMSG}2${CEND}. Use java" + echo -e "\t${CMSG}3${CEND}. Use hhvm" + read -p "Please input a number:(Default 1 press Enter) " Choose_number + [ -z "$Choose_number" ] && Choose_number=1 + if [[ ! $Choose_number =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break + fi done [ "$Choose_number" == '1' ] && NGX_FLAG=php [ "$Choose_number" == '2' ] && NGX_FLAG=java [ "$Choose_number" == '3' ] && NGX_FLAG=hhvm -elif [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ];then + elif [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=110 while :; do echo - echo 'Please choose to use environment:' - echo -e "\t${CMSG}1${CEND}. Use php" - echo -e "\t${CMSG}2${CEND}. Use java" - read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi + echo 'Please choose to use environment:' + echo -e "\t${CMSG}1${CEND}. Use php" + echo -e "\t${CMSG}2${CEND}. Use java" + read -p "Please input a number:(Default 1 press Enter) " Choose_number + [ -z "$Choose_number" ] && Choose_number=1 + if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi done [ "$Choose_number" == '1' ] && NGX_FLAG=php [ "$Choose_number" == '2' ] && NGX_FLAG=java -elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ];then + elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=100 NGX_FLAG=php -elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then + elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=101 while :; do echo - echo 'Please choose to use environment:' - echo -e "\t${CMSG}1${CEND}. Use php" - echo -e "\t${CMSG}2${CEND}. Use hhvm" - read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi + echo 'Please choose to use environment:' + echo -e "\t${CMSG}1${CEND}. Use php" + echo -e "\t${CMSG}2${CEND}. Use hhvm" + read -p "Please input a number:(Default 1 press Enter) " Choose_number + [ -z "$Choose_number" ] && Choose_number=1 + if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi done [ "$Choose_number" == '1' ] && NGX_FLAG=php [ "$Choose_number" == '2' ] && NGX_FLAG=hhvm -elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then + elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=011 while :; do echo - echo 'Please choose to use environment:' - echo -e "\t${CMSG}1${CEND}. Use java" - echo -e "\t${CMSG}2${CEND}. Use hhvm" - read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]];then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi + echo 'Please choose to use environment:' + echo -e "\t${CMSG}1${CEND}. Use java" + echo -e "\t${CMSG}2${CEND}. Use hhvm" + read -p "Please input a number:(Default 1 press Enter) " Choose_number + [ -z "$Choose_number" ] && Choose_number=1 + if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi done [ "$Choose_number" == '1' ] && NGX_FLAG=java [ "$Choose_number" == '2' ] && NGX_FLAG=hhvm -elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ];then + elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=010 NGX_FLAG=java -elif [ ! -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ];then + elif [ ! -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=001 NGX_FLAG=hhvm -else + else Number=000 NGX_FLAG=php -fi + fi -if [ "$NGX_FLAG" == 'php' ];then + if [ "$NGX_FLAG" == 'php' ]; then NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n }") -elif [ "$NGX_FLAG" == 'java' ];then + elif [ "$NGX_FLAG" == 'java' ]; then NGX_CONF=$(echo -e "location ~ {\n proxy_pass http://127.0.0.1:8080;\n include proxy.conf;\n }") -elif [ "$NGX_FLAG" == 'hhvm' ];then + elif [ "$NGX_FLAG" == 'hhvm' ]; then NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n fastcgi_pass unix:/var/log/hhvm/sock;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n include fastcgi_params;\n }") -fi + fi } Create_self_SSL() { -printf " + printf " You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. @@ -135,190 +135,190 @@ For some fields there will be a default value, If you enter '.', the field will be left blank. " -echo -read -p "Country Name (2 letter code) [CN]: " SELFSIGNEDSSL_C -[ -z "$SELFSIGNEDSSL_C" ] && SELFSIGNEDSSL_C=CN - -echo -read -p "State or Province Name (full name) [Shanghai]: " SELFSIGNEDSSL_ST -[ -z "$SELFSIGNEDSSL_ST" ] && SELFSIGNEDSSL_ST=Shanghai - -echo -read -p "Locality Name (eg, city) [Shanghai]: " SELFSIGNEDSSL_L -[ -z "$SELFSIGNEDSSL_L" ] && SELFSIGNEDSSL_L=Shanghai - -echo -read -p "Organization Name (eg, company) [LinuxEye Inc.]: " SELFSIGNEDSSL_O -[ -z "$SELFSIGNEDSSL_O" ] && SELFSIGNEDSSL_O='LinuxEye Inc.' - -echo -read -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU -[ -z "$SELFSIGNEDSSL_OU" ] && SELFSIGNEDSSL_OU='IT Dept.' - -openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 -/bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} -/bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} -openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1 + echo + read -p "Country Name (2 letter code) [CN]: " SELFSIGNEDSSL_C + [ -z "$SELFSIGNEDSSL_C" ] && SELFSIGNEDSSL_C=CN + + echo + read -p "State or Province Name (full name) [Shanghai]: " SELFSIGNEDSSL_ST + [ -z "$SELFSIGNEDSSL_ST" ] && SELFSIGNEDSSL_ST=Shanghai + + echo + read -p "Locality Name (eg, city) [Shanghai]: " SELFSIGNEDSSL_L + [ -z "$SELFSIGNEDSSL_L" ] && SELFSIGNEDSSL_L=Shanghai + + echo + read -p "Organization Name (eg, company) [LinuxEye Inc.]: " SELFSIGNEDSSL_O + [ -z "$SELFSIGNEDSSL_O" ] && SELFSIGNEDSSL_O='LinuxEye Inc.' + + echo + read -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU + [ -z "$SELFSIGNEDSSL_OU" ] && SELFSIGNEDSSL_OU='IT Dept.' + + openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 + /bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} + /bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} + openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1 } Create_SSL() { -if [ -e "/usr/local/bin/certbot-auto" -a -e "/root/.local/share/letsencrypt/bin/letsencrypt" ];then + if [ -e "/usr/local/bin/certbot-auto" -a -e "/root/.local/share/letsencrypt/bin/letsencrypt" ]; then while :; do echo - read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn - if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn + if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done - if [ "$letsencrypt_yn" == 'y' ];then - PUBLIC_IPADDR=`./include/get_public_ipaddr.py` - for D in $domain $moredomainame - do - Domain_IPADDR=`ping $D -c1 | sed '1{s/[^(]*(//;s/).*//;q}'` - [ "$PUBLIC_IPADDR" != "$Domain_IPADDR" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for $D${CEND}"; echo; exit 1; } - done - - #add Email - while : - do - echo - read -p "Please enter Administrator Email(example: admin@linuxeye.com): " Admin_Email - if [ -z "`echo $Admin_Email | grep '.*@.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - break - fi - done - [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`" - [ "$nginx_ssl_yn" == 'y' ] && S=nginx - [ "$apache_ssl_yn" == 'y' ] && S=httpd - [ ! -d "$wwwroot_dir/$domain/.well-known" ] && mkdir -p $wwwroot_dir/$domain/.well-known;chown -R $run_user.$run_user $wwwroot_dir/$domain/.well-known - certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start" - if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ];then - [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key} - ln -s /etc/letsencrypt/live/$domain/fullchain.pem $PATH_SSL/$domain.crt - ln -s /etc/letsencrypt/live/$domain/privkey.pem $PATH_SSL/$domain.key - if [ -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then - Cron_Command='/etc/init.d/nginx reload;/etc/init.d/httpd graceful' - elif [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then - Cron_Command='/etc/init.d/nginx reload' - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then - Cron_Command='/etc/init.d/httpd graceful' - fi - [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "`grep "$domain $moredomainame_D" $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file + if [ "$letsencrypt_yn" == 'y' ]; then + PUBLIC_IPADDR=`./include/get_public_ipaddr.py` + for D in $domain $moredomainame + do + Domain_IPADDR=`ping $D -c1 | sed '1{s/[^(]*(//;s/).*//;q}'` + [ "$PUBLIC_IPADDR" != "$Domain_IPADDR" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for $D${CEND}"; echo; exit 1; } + done + + #add Email + while : + do + echo + read -p "Please enter Administrator Email(example: admin@linuxeye.com): " Admin_Email + if [ -z "`echo $Admin_Email | grep '.*@.*\..*'`" ]; then + echo "${CWARNING}input error! ${CEND}" else - echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}" - exit 1 + break fi + done + [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`" + [ "$nginx_ssl_yn" == 'y' ] && S=nginx + [ "$apache_ssl_yn" == 'y' ] && S=httpd + [ ! -d "$wwwroot_dir/$domain/.well-known" ] && mkdir -p $wwwroot_dir/$domain/.well-known;chown -R $run_user.$run_user $wwwroot_dir/$domain/.well-known + certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start" + if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ]; then + [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key} + ln -s /etc/letsencrypt/live/$domain/fullchain.pem $PATH_SSL/$domain.crt + ln -s /etc/letsencrypt/live/$domain/privkey.pem $PATH_SSL/$domain.key + if [ -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then + Cron_Command='/etc/init.d/nginx reload;/etc/init.d/httpd graceful' + elif [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + Cron_Command='/etc/init.d/nginx reload' + elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then + Cron_Command='/etc/init.d/httpd graceful' + fi + [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root + [ -z "`grep "$domain $moredomainame_D" $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file + else + echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}" + exit 1 + fi else - Create_self_SSL + Create_self_SSL fi -else + else Create_self_SSL -fi + fi } Print_ssl() { -if [ "$letsencrypt_yn" == 'y' ];then + if [ "$letsencrypt_yn" == 'y' ]; then echo "`printf "%-30s" "Let's Encrypt SSL Certificate:"`${CMSG}/etc/letsencrypt/live/$domain/fullchain.pem${CEND}" echo "`printf "%-30s" "SSL Private Key:"`${CMSG}/etc/letsencrypt/live/$domain/privkey.pem${CEND}" -else + else echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}" echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}" echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}" -fi + fi } Input_Add_domain() { -if [ -e "$web_install_dir/sbin/nginx" ];then + if [ -e "$web_install_dir/sbin/nginx" ]; then while :; do echo - read -p "Do you want to setup SSL under Nginx? [y/n]: " nginx_ssl_yn - if [[ ! $nginx_ssl_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to setup SSL under Nginx? [y/n]: " nginx_ssl_yn + if [[ ! $nginx_ssl_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done -elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachectl" ];then + elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachectl" ]; then while :; do echo - read -p "Do you want to setup SSL under Apache? [y/n]: " apache_ssl_yn - if [[ ! $apache_ssl_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to setup SSL under Apache? [y/n]: " apache_ssl_yn + if [[ ! $apache_ssl_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done -fi + fi -[ "$apache_ssl_yn" == 'y' ] && { PATH_SSL=$apache_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } -[ "$nginx_ssl_yn" == 'y' ] && { PATH_SSL=$web_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } + [ "$apache_ssl_yn" == 'y' ] && { PATH_SSL=$apache_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } + [ "$nginx_ssl_yn" == 'y' ] && { PATH_SSL=$web_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } -while :; do echo + while :; do echo read -p "Please input domain(example: www.linuxeye.com): " domain if [ -z "`echo $domain | grep '.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" + echo "${CWARNING}input error! ${CEND}" else - break + break fi -done + done -if [ -e "$web_install_dir/conf/vhost/$domain.conf" -o -e "$apache_install_dir/conf/vhost/$domain.conf" -o -e "$tomcat_install_dir/conf/vhost/$domain.xml" ]; then + if [ -e "$web_install_dir/conf/vhost/$domain.conf" -o -e "$apache_install_dir/conf/vhost/$domain.conf" -o -e "$tomcat_install_dir/conf/vhost/$domain.xml" ]; then [ -e "$web_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Nginx/Tengine/OpenResty already exist! \nYou can delete ${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND} and re-create" [ -e "$apache_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Apache already exist! \nYou can delete ${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND} and re-create" [ -e "$tomcat_install_dir/conf/vhost/$domain.xml" ] && echo -e "$domain in the Tomcat already exist! \nYou can delete ${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND} and re-create" exit -else + else echo "domain=$domain" -fi + fi -while :; do echo + while :; do echo read -p "Do you want to add more domain name? [y/n]: " moredomainame_yn - if [[ ! $moredomainame_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $moredomainame_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done + done -if [ "$moredomainame_yn" == 'y' ]; then + if [ "$moredomainame_yn" == 'y' ]; then while :; do echo - read -p "Type domainname or IP(example: linuxeye.com 121.43.8.8): " moredomain - if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - [ "$moredomain" == "$domain" ] && echo "${CWARNING}Domain name already exists! ${CND}" && continue - echo domain list="$moredomain" - moredomainame=" $moredomain" - break - fi + read -p "Type domainname or IP(example: linuxeye.com 121.43.8.8): " moredomain + if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then + echo "${CWARNING}input error! ${CEND}" + else + [ "$moredomain" == "$domain" ] && echo "${CWARNING}Domain name already exists! ${CND}" && continue + echo domain list="$moredomain" + moredomainame=" $moredomain" + break + fi done Apache_Domain_alias=ServerAlias$moredomainame Tomcat_Domain_alias=$(for D in `echo $moredomainame`; do echo "$D"; done) - if [ -e "$web_install_dir/sbin/nginx" ];then - while :; do echo - read -p "Do you want to redirect from $moredomain to $domain? [y/n]: " redirect_yn - if [[ ! $redirect_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done - [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") + if [ -e "$web_install_dir/sbin/nginx" ]; then + while :; do echo + read -p "Do you want to redirect from $moredomain to $domain? [y/n]: " redirect_yn + if [[ ! $redirect_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") fi -fi + fi -if [ "$nginx_ssl_yn" == 'y' ]; then + if [ "$nginx_ssl_yn" == 'y' ]; then while :; do echo - read -p "Do you want to redirect all HTTP requests to HTTPS? [y/n]: " https_yn - if [[ ! $https_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi + read -p "Do you want to redirect all HTTP requests to HTTPS? [y/n]: " https_yn + if [[ ! $https_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then @@ -329,114 +329,114 @@ if [ "$nginx_ssl_yn" == 'y' ]; then Create_SSL Nginx_conf=$(echo -e "listen 80;\nlisten $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\nssl_prefer_server_ciphers on;\nssl_session_timeout 10m;\nssl_session_cache builtin:1000 shared:SSL:10m;\nssl_buffer_size 1400;\nadd_header Strict-Transport-Security max-age=15768000;\nssl_stapling on;\nssl_stapling_verify on;\n") Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") -elif [ "$apache_ssl_yn" == 'y' ]; then + elif [ "$apache_ssl_yn" == 'y' ]; then Create_SSL Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") [ -z "`grep 'Listen 443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@Listen 80@&\nListen 443@" $apache_install_dir/conf/httpd.conf [ -z "`grep 'ServerName 0.0.0.0:443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@ServerName 0.0.0.0:80@&\nServerName 0.0.0.0:443@" $apache_install_dir/conf/httpd.conf -else + else Nginx_conf='listen 80;' -fi + fi -while :; do echo + while :; do echo echo "Please input the directory for the domain:$domain :" read -p "(Default directory: $wwwroot_dir/$domain): " vhostdir - if [ -n "$vhostdir" -a -z "`echo $vhostdir | grep '^/'`" ];then - echo "${CWARNING}input error! Press Enter to continue...${CEND}" + if [ -n "$vhostdir" -a -z "`echo $vhostdir | grep '^/'`" ]; then + echo "${CWARNING}input error! Press Enter to continue...${CEND}" else - if [ -z "$vhostdir" ]; then - vhostdir="$wwwroot_dir/$domain" - echo "Virtual Host Directory=${CMSG}$vhostdir${CEND}" - fi - echo - echo "Create Virtul Host directory......" - mkdir -p $vhostdir - echo "set permissions of Virtual Host directory......" - chown -R ${run_user}.$run_user $vhostdir - break + if [ -z "$vhostdir" ]; then + vhostdir="$wwwroot_dir/$domain" + echo "Virtual Host Directory=${CMSG}$vhostdir${CEND}" + fi + echo + echo "Create Virtul Host directory......" + mkdir -p $vhostdir + echo "set permissions of Virtual Host directory......" + chown -R ${run_user}.$run_user $vhostdir + break fi -done + done } Nginx_anti_hotlinking() { -while :; do echo + while :; do echo read -p "Do you want to add hotlink protection? [y/n]: " anti_hotlinking_yn - if [[ ! $anti_hotlinking_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $anti_hotlinking_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done + done -if [ -n "`echo $domain | grep '.*\..*\..*'`" ];then + if [ -n "`echo $domain | grep '.*\..*\..*'`" ]; then domain_allow="*.${domain#*.} $domain" -else + else domain_allow="*.$domain $domain" -fi + fi -if [ "$anti_hotlinking_yn" == 'y' ];then + if [ "$anti_hotlinking_yn" == 'y' ]; then if [ "$moredomainame_yn" == 'y' ]; then - domain_allow_all=$domain_allow$moredomainame + domain_allow_all=$domain_allow$moredomainame else - domain_allow_all=$domain_allow + domain_allow_all=$domain_allow fi anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {\n valid_referers none blocked $domain_allow_all;\n if (\$invalid_referer) {\n #rewrite ^/ http://www.linuxeye.com/403.html;\n return 403;\n }\n }") -else + else anti_hotlinking= -fi + fi } Nginx_rewrite() { -[ ! -d "$web_install_dir/conf/rewrite" ] && mkdir $web_install_dir/conf/rewrite -while :; do echo + [ ! -d "$web_install_dir/conf/rewrite" ] && mkdir $web_install_dir/conf/rewrite + while :; do echo read -p "Allow Rewrite rule? [y/n]: " rewrite_yn - if [[ ! $rewrite_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $rewrite_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done -if [ "$rewrite_yn" == 'n' ];then + done + if [ "$rewrite_yn" == 'n' ]; then rewrite="none" touch "$web_install_dir/conf/rewrite/$rewrite.conf" -else + else echo echo "Please input the rewrite of programme :" echo "${CMSG}wordpress${CEND},${CMSG}discuz${CEND},${CMSG}opencart${CEND},${CMSG}thinkphp${CEND},${CMSG}laravel${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND} rewrite was exist." read -p "(Default rewrite: other):" rewrite if [ "$rewrite" == "" ]; then - rewrite="other" + rewrite="other" fi echo "You choose rewrite=${CMSG}$rewrite${CEND}" [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") - if [ -e "config/$rewrite.conf" ];then - /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf + if [ -e "config/$rewrite.conf" ]; then + /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf else - touch "$web_install_dir/conf/rewrite/$rewrite.conf" + touch "$web_install_dir/conf/rewrite/$rewrite.conf" fi -fi + fi } Nginx_log() { -while :; do echo + while :; do echo read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn - if [[ ! $access_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $access_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done -if [ "$access_yn" == 'n' ]; then + done + if [ "$access_yn" == 'n' ]; then N_log="access_log off;" -else + else N_log="access_log $wwwlogs_dir/${domain}_nginx.log combined;" echo "You access log file=${CMSG}$wwwlogs_dir/${domain}_nginx.log${CEND}" -fi + fi } Create_nginx_tomcat_conf() { -[ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost -cat > $web_install_dir/conf/vhost/$domain.conf << EOF + [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost + cat > $web_install_dir/conf/vhost/$domain.conf << EOF server { $Nginx_conf server_name $domain$moredomainame; @@ -457,72 +457,72 @@ $NGX_CONF } EOF -[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf -cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF + cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF $Tomcat_Domain_alias EOF -[ -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 + [ -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 -if [ $? == 0 ];then + echo + $web_install_dir/sbin/nginx -t + if [ $? == 0 ]; then echo "Reload Nginx......" $web_install_dir/sbin/nginx -s reload /etc/init.d/tomcat restart -else + else rm -rf $web_install_dir/conf/vhost/$domain.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 -fi + fi -printf " + printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # For more information please visit https://oneinstack.com # ####################################################################### " -echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" -echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" -echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" -echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" + echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" + echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" + echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } Create_tomcat_conf() { -cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF + cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF $Tomcat_Domain_alias EOF -[ -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 + [ -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 + echo + /etc/init.d/tomcat restart -printf " + printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # For more information please visit https://oneinstack.com # ####################################################################### " -echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" -echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" -echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -echo "`printf "%-30s" "index url:"`${CMSG}http://${domain}:8080/${CEND}" + echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" + echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" + echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + echo "`printf "%-30s" "index url:"`${CMSG}http://${domain}:8080/${CEND}" } Create_nginx_php-fpm_hhvm_conf() { -[ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost -cat > $web_install_dir/conf/vhost/$domain.conf << EOF + [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost + cat > $web_install_dir/conf/vhost/$domain.conf << EOF server { $Nginx_conf server_name $domain$moredomainame; @@ -544,54 +544,54 @@ location ~ .*\.(js|css)?$ { } EOF -[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf -echo -$web_install_dir/sbin/nginx -t -if [ $? == 0 ];then + echo + $web_install_dir/sbin/nginx -t + if [ $? == 0 ]; then echo "Reload Nginx......" $web_install_dir/sbin/nginx -s reload -else + else rm -rf $web_install_dir/conf/vhost/$domain.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 -fi + fi -printf " + printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # For more information please visit https://oneinstack.com # ####################################################################### " -echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" -echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" -echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" -[ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" + echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" + echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + [ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" + [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } Apache_log() { -while :; do echo + while :; do echo read -p "Allow Apache access_log? [y/n]: " access_yn - if [[ ! $access_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! $access_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done + done -if [ "$access_yn" == 'n' ]; then + if [ "$access_yn" == 'n' ]; then A_log='CustomLog "/dev/null" common' -else + else A_log="CustomLog \"$wwwlogs_dir/${domain}_apache.log\" common" echo "You access log file=$wwwlogs_dir/${domain}_apache.log" -fi + fi } Create_apache_conf() { -[ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= -[ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost -cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + [ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= + [ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost + cat > $apache_install_dir/conf/vhost/$domain.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$vhostdir" @@ -610,7 +610,7 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF EOF -[ "$apache_ssl_yn" == 'y' ] && cat >> $apache_install_dir/conf/vhost/$domain.conf << EOF + [ "$apache_ssl_yn" == 'y' ] && cat >> $apache_install_dir/conf/vhost/$domain.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$vhostdir" @@ -631,32 +631,32 @@ EOF EOF -echo -$apache_install_dir/bin/apachectl -t -if [ $? == 0 ];then + echo + $apache_install_dir/bin/apachectl -t + if [ $? == 0 ]; then echo "Restart Apache......" /etc/init.d/httpd restart -else + else rm -rf $apache_install_dir/conf/vhost/$domain.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 -fi + fi -printf " + printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # For more information please visit https://oneinstack.com # ####################################################################### " -echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" -echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" -echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" + echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" + echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" } Create_nginx_apache_mod-php_conf() { -# Nginx/Tengine/OpenResty -[ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost -cat > $web_install_dir/conf/vhost/$domain.conf << EOF + # Nginx/Tengine/OpenResty + [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost + cat > $web_install_dir/conf/vhost/$domain.conf << EOF server { $Nginx_conf server_name $domain$moredomainame; @@ -687,22 +687,22 @@ location ~ .*\.(js|css)?$ { } EOF -[ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf -echo -$web_install_dir/sbin/nginx -t -if [ $? == 0 ];then + echo + $web_install_dir/sbin/nginx -t + if [ $? == 0 ]; then echo "Reload Nginx......" $web_install_dir/sbin/nginx -s reload -else + else rm -rf $web_install_dir/conf/vhost/$domain.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" -fi + fi -# Apache -[ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= -[ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost -cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + # Apache + [ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= + [ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost + cat > $apache_install_dir/conf/vhost/$domain.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$vhostdir" @@ -723,232 +723,231 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF EOF -echo -$apache_install_dir/bin/apachectl -t -if [ $? == 0 ];then + echo + $apache_install_dir/bin/apachectl -t + if [ $? == 0 ]; then echo "Restart Apache......" /etc/init.d/httpd restart -else + else rm -rf $apache_install_dir/conf/vhost/$domain.conf exit 1 -fi + fi -printf " + printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # For more information please visit https://oneinstack.com # ####################################################################### " -echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" -echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" -echo "`printf "%-30s" "Apache Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" -echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" -[ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" -[ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" + echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" + echo "`printf "%-30s" "Apache Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" + echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + [ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" + [ "$nginx_ssl_yn" == 'y' ] && Print_ssl } Add_Vhost() { - if [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then - Choose_env - Input_Add_domain - Nginx_anti_hotlinking - if [ "$NGX_FLAG" == 'java' ];then - Nginx_log - Create_nginx_tomcat_conf - else - Nginx_rewrite - Nginx_log - Create_nginx_php-fpm_hhvm_conf - fi - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then - Choose_env - Input_Add_domain - Apache_log - Create_apache_conf - elif [ ! -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" -a -e "$tomcat_install_dir/conf/server.xml" ];then - Choose_env - Input_Add_domain - Create_tomcat_conf - elif [ -e "$web_install_dir/sbin/nginx" -a -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ];then - Choose_env - Input_Add_domain - Nginx_anti_hotlinking - if [ "$NGX_FLAG" == 'java' ];then - Nginx_log - Create_nginx_tomcat_conf - elif [ "$NGX_FLAG" == 'hhvm' ];then - Nginx_rewrite - Nginx_log - Create_nginx_php-fpm_hhvm_conf - elif [ "$NGX_FLAG" == 'php' ];then - #Nginx_rewrite - Nginx_log - Apache_log - Create_nginx_apache_mod-php_conf - fi + if [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + Choose_env + Input_Add_domain + Nginx_anti_hotlinking + if [ "$NGX_FLAG" == 'java' ]; then + Nginx_log + Create_nginx_tomcat_conf + else + Nginx_rewrite + Nginx_log + Create_nginx_php-fpm_hhvm_conf fi + elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then + Choose_env + Input_Add_domain + Apache_log + Create_apache_conf + elif [ ! -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" -a -e "$tomcat_install_dir/conf/server.xml" ]; then + Choose_env + Input_Add_domain + Create_tomcat_conf + elif [ -e "$web_install_dir/sbin/nginx" -a -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ]; then + Choose_env + Input_Add_domain + Nginx_anti_hotlinking + if [ "$NGX_FLAG" == 'java' ]; then + Nginx_log + Create_nginx_tomcat_conf + elif [ "$NGX_FLAG" == 'hhvm' ]; then + Nginx_rewrite + Nginx_log + Create_nginx_php-fpm_hhvm_conf + elif [ "$NGX_FLAG" == 'php' ]; then + #Nginx_rewrite + Nginx_log + Apache_log + Create_nginx_apache_mod-php_conf + fi + fi } Del_NGX_Vhost() { - if [ -e "$web_install_dir/sbin/nginx" ];then - [ -d "$web_install_dir/conf/vhost" ] && Domain_List=`ls $web_install_dir/conf/vhost | sed "s@.conf@@g"` - if [ -n "$Domain_List" ];then - echo - echo "Virtualhost list:" - echo ${CMSG}$Domain_List${CEND} + if [ -e "$web_install_dir/sbin/nginx" ]; then + [ -d "$web_install_dir/conf/vhost" ] && Domain_List=`ls $web_install_dir/conf/vhost | sed "s@.conf@@g"` + if [ -n "$Domain_List" ]; then + echo + echo "Virtualhost list:" + echo ${CMSG}$Domain_List${CEND} + while :; do echo + read -p "Please input a domain you want to delete: " domain + if [ -z "`echo $domain | grep '.*\..*'`" ]; then + echo "${CWARNING}input error! ${CEND}" + else + if [ -e "$web_install_dir/conf/vhost/${domain}.conf" ]; then + Directory=`grep ^root $web_install_dir/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}'` + rm -rf $web_install_dir/conf/vhost/${domain}.conf + $web_install_dir/sbin/nginx -s reload while :; do echo - read -p "Please input a domain you want to delete: " domain - if [ -z "`echo $domain | grep '.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - if [ -e "$web_install_dir/conf/vhost/${domain}.conf" ];then - Directory=`grep ^root $web_install_dir/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}'` - rm -rf $web_install_dir/conf/vhost/${domain}.conf - $web_install_dir/sbin/nginx -s reload - while :; do echo - read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn - if [[ ! $Del_Vhost_wwwroot_yn =~ ^[y,n]$ ]];then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done - if [ "$Del_Vhost_wwwroot_yn" == 'y' ];then - echo "Press Ctrl+c to cancel or Press any key to continue..." - char=`get_char` - rm -rf $Directory - fi - echo "${CSUCCESS}Domain: ${domain} has been deleted.${CEND}" - else - echo "${CWARNING}Virtualhost: $domain was not exist! ${CEND}" - fi - break - fi + read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn + if [[ ! $Del_Vhost_wwwroot_yn =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi done - - else - echo "${CWARNING}Virtualhost was not exist! ${CEND}" + if [ "$Del_Vhost_wwwroot_yn" == 'y' ]; then + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + rm -rf $Directory + fi + echo "${CSUCCESS}Domain: ${domain} has been deleted.${CEND}" + else + echo "${CWARNING}Virtualhost: $domain was not exist! ${CEND}" + fi + break fi + done + else + echo "${CWARNING}Virtualhost was not exist! ${CEND}" fi + fi } Del_Apache_Vhost() { - if [ -e "$apache_install_dir/conf/httpd.conf" ];then - if [ -e "$web_install_dir/sbin/nginx" ];then - rm -rf $apache_install_dir/conf/vhost/${domain}.conf - /etc/init.d/httpd restart - else - Domain_List=`ls $apache_install_dir/conf/vhost | grep -v '0.conf' | sed "s@.conf@@g"` - if [ -n "$Domain_List" ];then - echo - echo "Virtualhost list:" - echo ${CMSG}$Domain_List${CEND} - while :; do echo - read -p "Please input a domain you want to delete: " domain - if [ -z "`echo $domain | grep '.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - if [ -e "$apache_install_dir/conf/vhost/${domain}.conf" ];then - Directory=`grep '^ Date: Tue, 1 Nov 2016 11:23:58 +0800 Subject: [PATCH 601/617] Update by kaneawk --- README.md | 2 +- addons.sh | 551 ++++----- config/nginx.conf | 2 +- config/nginx_apache.conf | 2 +- config/nginx_tomcat.conf | 2 +- include/alisql-5.6.sh | 209 ++++ include/apache-2.2.sh | 69 +- include/apache-2.4.sh | 79 +- include/check_dir.sh | 1 + include/check_download.sh | 1054 +++++++++-------- include/check_os.sh | 54 +- include/check_sw.sh | 167 +++ include/demo.sh | 2 +- include/eaccelerator-1.0-dev.sh | 51 - .../{eaccelerator-0.9.sh => eaccelerator.sh} | 24 +- include/hhvm_CentOS.sh | 40 +- include/init_CentOS.sh | 96 +- include/init_Debian.sh | 40 +- include/init_Ubuntu.sh | 62 +- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/memcached.sh | 35 +- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/pureftpd.sh | 58 +- include/tengine.sh | 2 +- include/tomcat-6.sh | 164 +-- include/tomcat-7.sh | 162 +-- include/tomcat-8.sh | 162 +-- include/upgrade_web.sh | 2 +- include/xcache.sh | 17 +- include/zendopcache.sh | 44 +- init.d/Memcached-init-CentOS | 4 +- init.d/Memcached-init-Ubuntu | 22 +- init.d/Pureftpd-init | 10 +- init.d/Redis-server-init | 5 +- init.d/Shadowsocks-python-init | 9 + init.d/Tomcat-init | 9 + install.sh | 537 +++++---- options.conf | 2 + shadowsocks.sh | 131 +- uninstall.sh | 2 +- versions.txt | 22 +- vhost.sh | 771 ++++++------ 51 files changed, 2602 insertions(+), 2097 deletions(-) create mode 100644 include/alisql-5.6.sh create mode 100644 include/check_sw.sh delete mode 100644 include/eaccelerator-1.0-dev.sh rename include/{eaccelerator-0.9.sh => eaccelerator.sh} (65%) diff --git a/README.md b/README.md index a5c1b1c8..d043c280 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Script properties: - Continually updated - Source compiler installation, most stable source is the latest version, and download from the official site - Some security optimization -- Providing a plurality of database versions (MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5,Percona-5.7, Percona-5.6, Percona-5.5) +- Providing a plurality of database versions (MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5, Percona-5.7, Percona-5.6, Percona-5.5, AliSQL-5.6) - Providing multiple PHP versions (php-7, php-5.6, php-5.5, php-5.4, php-5.3) - Provide Nginx, Tengine, OpenResty - Providing a plurality of Apache version (Apache-2.4, Apache-2.2) diff --git a/addons.sh b/addons.sh index c1bcf671..8f6b4c1c 100755 --- a/addons.sh +++ b/addons.sh @@ -19,7 +19,7 @@ printf " " # get pwd -sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf +sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf . ./versions.txt . ./options.conf @@ -33,8 +33,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./include/zendopcache.sh . ./include/xcache.sh . ./include/apcu.sh -. ./include/eaccelerator-0.9.sh -. ./include/eaccelerator-1.0-dev.sh +. ./include/eaccelerator.sh . ./include/ZendGuardLoader.sh . ./include/ioncube.sh @@ -47,62 +46,62 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./include/redis.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } # Check PHP -if [ -e "$php_install_dir/bin/phpize" ]; then - PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` - phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir` +if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) + PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') PHP_main_version=${PHP_detail_version%.*} - [ "$PHP_main_version" == '5.3' ] && PHP_version=1 - [ "$PHP_main_version" == '5.4' ] && PHP_version=2 - [ "$PHP_main_version" == '5.5' ] && PHP_version=3 - [ "$PHP_main_version" == '5.6' ] && PHP_version=4 - [ "$PHP_main_version" == '7.0' ] && PHP_version=5 + + case "${PHP_main_version}" in + "5.3") + PHP_version=1 + ;; + "5.4") + PHP_version=2 + ;; + "5.5") + PHP_version=3 + ;; + "5.6") + PHP_version=4 + ;; + "7.0" | "7.1") + PHP_version=5 + ;; + *) + echo "${CFAILURE}Your PHP version ${PHP_main_version} is not supported! ${CEND}" + kill -9 $$ + ;; + esac +else + echo "${CFAILURE}Couldn't find phpize! ${CEND}" + kill -9 $$ fi # Check PHP Extensions Check_PHP_Extension() { - [ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP $PHP_extension module already installed! ${CEND}"; exit 1; } + [ -e "${php_install_dir}/etc/php.d/ext-${PHP_extension}.ini" ] && { echo "${CWARNING}PHP ${PHP_extension} module already installed! ${CEND}"; exit 1; } } # restart PHP Restart_PHP() { - [ -e "$apache_install_dir/conf/httpd.conf" ] && /etc/init.d/httpd restart || /etc/init.d/php-fpm restart + [ -e "${apache_install_dir}/conf/httpd.conf" ] && /etc/init.d/httpd restart || /etc/init.d/php-fpm restart } # Check succ Check_succ() { - [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; } + [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP ${PHP_extension} module installed successfully! ${CEND}"; } } # Uninstall succ Uninstall_succ() { - [ -e "$php_install_dir/etc/php.d/ext-${PHP_extension}.ini" ] && { rm -rf $php_install_dir/etc/php.d/ext-${PHP_extension}.ini; Restart_PHP; echo; echo "${CMSG}PHP $PHP_extension module uninstall completed${CEND}"; } || { echo; echo "${CWARNING}$PHP_extension module does not exist! ${CEND}"; } -} - -# PHP 5.5,5,6,7.0 install opcache -Install_opcache() { - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF -[opcache] -zend_extension=opcache.so -opcache.enable=1 -opcache.memory_consumption=$Memory_limit -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=4000 -opcache.revalidate_freq=60 -opcache.save_comments=0 -opcache.fast_shutdown=1 -opcache.enable_cli=1 -;opcache.optimization_level=0 -EOF + [ -e "${php_install_dir}/etc/php.d/ext-${PHP_extension}.ini" ] && { rm -rf ${php_install_dir}/etc/php.d/ext-${PHP_extension}.ini; Restart_PHP; echo; echo "${CMSG}PHP ${PHP_extension} module uninstall completed${CEND}"; } || { echo; echo "${CWARNING}${PHP_extension} module does not exist! ${CEND}"; } } Install_letsencrypt() { - if [ "$CentOS_RHEL_version" == '7' ]; then + if [ "${CentOS_RHEL_version}" == '7' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch @@ -112,7 +111,7 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF - elif [ "$CentOS_RHEL_version" == '6' ]; then + elif [ "${CentOS_RHEL_version}" == '6' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch @@ -124,30 +123,35 @@ gpgcheck=0 EOF fi - pushd $oneinstack_dir/src + pushd ${oneinstack_dir}/src src_url=https://dl.eff.org/certbot-auto && Download_src /bin/mv certbot-auto /usr/local/bin/ chmod +x /usr/local/bin/certbot-auto certbot-auto -n - certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" + popd + 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}" + else + echo; echo "${CFAILURE}Let's Encrypt client install failed, Please try again! ${CEND}" + fi } Uninstall_letsencrypt() { rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt - [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - sed -i '/certbot-auto/d' $Cron_file + [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root + sed -i '/certbot-auto/d' ${Cron_file} echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } ACTION_FUN() { while :; do echo - echo 'Please select an action:' + echo "Please select an action:" echo -e "\t${CMSG}1${CEND}. install" echo -e "\t${CMSG}2${CEND}. uninstall" read -p "Please input a number:(Default 1 press Enter) " ACTION - [ -z "$ACTION" ] && ACTION=1 - if [[ ! $ACTION =~ ^[1,2]$ ]]; then + [ -z "${ACTION}" ] && ACTION=1 + if [[ ! "${ACTION}" =~ ^[1,2]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2${CEND}" else break @@ -168,253 +172,260 @@ What Are You Doing? \t${CMSG}q${CEND}. Exit " read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-7,q]$ ]]; then + if [[ ! "${Number}" =~ ^[1-7,q]$ ]]; then echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}" else - case "$Number" in - 1) - ACTION_FUN - while :; do echo - echo 'Please select a opcode cache of the PHP:' - echo -e "\t${CMSG}1${CEND}. Zend OPcache" - echo -e "\t${CMSG}2${CEND}. XCache" - echo -e "\t${CMSG}3${CEND}. APCU" - echo -e "\t${CMSG}4${CEND}. eAccelerator" - read -p "Please input a number:(Default 1 press Enter) " PHP_cache - [ -z "$PHP_cache" ] && PHP_cache=1 - if [[ ! $PHP_cache =~ ^[1-4]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + case "${Number}" in + 1) + ACTION_FUN + while :; do echo + echo "Please select a opcode cache of the PHP:" + echo -e "\t${CMSG}1${CEND}. Zend OPcache" + echo -e "\t${CMSG}2${CEND}. XCache" + echo -e "\t${CMSG}3${CEND}. APCU" + echo -e "\t${CMSG}4${CEND}. eAccelerator" + read -p "Please input a number:(Default 1 press Enter) " PHP_cache + [ -z "${PHP_cache}" ] && PHP_cache=1 + if [[ ! "${PHP_cache}" =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + case "${PHP_cache}" in + 1) + PHP_extension=opcache + ;; + 2) + PHP_extension=xcache + ;; + 3) + PHP_extension=apcu + ;; + 4) + PHP_extension=eaccelerator + ;; + esac + break + fi + done + if [ "${ACTION}" = '1' ]; then + Check_PHP_Extension + if [ -e ${php_install_dir}/etc/php.d/ext-ZendGuardLoader.ini ]; then + echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install ${PHP_extension}! ${CEND}"; echo; exit 1 + else + case "${PHP_cache}" in + 1) + pushd ${oneinstack_dir}/src + if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src + Install_ZendOPcache + else + src_url=http://www.php.net/distributions/php-${PHP_detail_version}.tar.gz && Download_src + Install_ZendOPcache + fi + popd + Check_succ + ;; + 2) + if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]]; then + while :; do + read -p "Please input xcache admin password: " xcache_admin_pass + (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=$(echo -n "${xcache_admin_pass}" | md5sum | awk '{print $1}') ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" + done + checkDownload + Install_XCache + Check_succ + else + echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 + fi + ;; + 3) + if [[ "${PHP_main_version}" =~ ^5.[3-6]$|^7.[0-1]$ ]]; then + checkDownload + Install_APCU + Check_succ + else + echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1 + fi + ;; + 4) + if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then + checkDownload + Install_eAccelerator + Check_succ + else + echo "${CWARNING}Your php does not support eAccelerator! ${CEND}"; exit 1 + fi + ;; + esac + fi else - [ $PHP_cache = 1 ] && PHP_extension=opcache - [ $PHP_cache = 2 ] && PHP_extension=xcache - [ $PHP_cache = 3 ] && PHP_extension=apcu - [ $PHP_cache = 4 ] && PHP_extension=eaccelerator - break + Uninstall_succ fi - done - if [ $ACTION = 1 ]; then - Check_PHP_Extension - if [ -e $php_install_dir/etc/php.d/ext-ZendGuardLoader.ini ]; then - echo; echo "${CWARNING}You have to install ZendGuardLoader, You need to uninstall it before install $PHP_extension! ${CEND}"; echo; exit 1 - else - if [ $PHP_cache = 1 ]; then - pushd $oneinstack_dir/src - if [[ $PHP_main_version =~ ^5.[3-4]$ ]]; then - src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src - Install_ZendOPcache - elif [ "$PHP_main_version" == '5.5' ]; then - src_url=http://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src - tar xzf php-$php_5_version.tar.gz - pushd php-$php_5_version/ext/opcache - Install_opcache - elif [ "$PHP_main_version" == '5.6' ]; then - src_url=http://www.php.net/distributions/php-$php_6_version.tar.gz && Download_src - tar xzf php-$php_6_version.tar.gz - pushd php-$php_6_version/ext/opcache - Install_opcache - elif [ "$PHP_main_version" == '7.0' ]; then - src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src - tar xzf php-$php_7_version.tar.gz - pushd php-$php_7_version/ext/opcache - Install_opcache - fi - Check_succ - elif [ $PHP_cache = 2 ]; then - pushd $oneinstack_dir/src - if [[ $PHP_main_version =~ ^5.[3-6]$ ]]; then - while :; do - read -p "Please input xcache admin password: " xcache_admin_pass - (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" - done - checkDownload - Install_XCache - Check_succ + ;; + 2) + ACTION_FUN + while :; do echo + echo "Please select ZendGuardLoader/ionCube:" + echo -e "\t${CMSG}1${CEND}. ZendGuardLoader" + echo -e "\t${CMSG}2${CEND}. ionCube Loader" + read -p "Please input a number:(Default 1 press Enter) " Loader + [ -z "${Loader}" ] && Loader=1 + if [[ ! "${Loader}" =~ ^[1,2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + [ "${Loader}" = '1' ] && PHP_extension=ZendGuardLoader + [ "${Loader}" = '2' ] && PHP_extension=0ioncube + break + fi + done + if [ "${ACTION}" = '1' ]; then + Check_PHP_Extension + if [ "${Loader}" = '1' ]; then + if [[ "${PHP_main_version}" =~ ^5.[3-6]$ ]] || [ "${armPlatform}" != 'y' ]; then + if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then + echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 + else + ZendGuardLoader_yn='y' && checkDownload + Install_ZendGuardLoader + Check_succ + fi else - echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1 + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; fi - elif [ ${PHP_cache} = 3 ]; then - checkDownload - Install_APCU - Check_succ - elif [ $PHP_cache = 4 ]; then - if [ "$PHP_main_version" == '5.3' ]; then - checkDownload - Install_eAccelerator-0-9 - Check_succ - elif [ "$PHP_main_version" == '5.4' ]; then - checkDownload - Install_eAccelerator-1-0-dev - Check_succ + elif [ "${Loader}" = '2' ]; then + if [[ "${PHP_main_version}" =~ ^5.[3-6]$|^7.0$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then + ionCube_yn='y' && checkDownload + Install_ionCube + Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; else - echo "${CWARNING}Your php does not support eAccelerator! ${CEND}"; exit 1 + echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}"; fi fi - fi - else - Uninstall_succ - fi - ;; - 2) - ACTION_FUN - while :; do echo - echo 'Please select ZendGuardLoader/ionCube:' - echo -e "\t${CMSG}1${CEND}. ZendGuardLoader" - echo -e "\t${CMSG}2${CEND}. ionCube Loader" - read -p "Please input a number:(Default 1 press Enter) " Loader - [ -z "$Loader" ] && Loader=1 - if [[ ! $Loader =~ ^[1,2]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" else - [ $Loader = 1 ] && PHP_extension=ZendGuardLoader - [ $Loader = 2 ] && PHP_extension=0ioncube - break + Uninstall_succ fi - done - if [ ${ACTION} = "1" ]; then - Check_PHP_Extension - if [ ${Loader} = "1" ]; then - if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]] && [ "${armPlatform}" != "y" ]; then - if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then - echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1 - else - ZendGuardLoader_yn=y && checkDownload - Install_ZendGuardLoader - Check_succ - fi + ;; + 3) + ACTION_FUN + while :; do echo + echo "Please select ImageMagick/GraphicsMagick:" + echo -e "\t${CMSG}1${CEND}. ImageMagick" + echo -e "\t${CMSG}2${CEND}. GraphicsMagick" + read -p "Please input a number:(Default 1 press Enter) " Magick + [ -z "${Magick}" ] && Magick=1 + if [[ ! "${Magick}" =~ ^[1,2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" else - echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform arm does not support ${PHP_extension}! ${CEND}"; + [ "${Magick}" = '1' ] && PHP_extension=imagick + [ "${Magick}" = '2' ] && PHP_extension=gmagick + break fi - elif [ ${Loader} = "2" ]; then - if [[ ${PHP_main_version} =~ ^5.[3-6]$|^7.0$ ]] && [ "${TARGET_ARCH}" != "arm64" ]; then - ionCube_yn=y && checkDownload - Install_ionCube - Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}"; - else - echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform arm64 does not support ${PHP_extension}! ${CEND}"; + done + if [ "${ACTION}" = '1' ]; then + Check_PHP_Extension + Magick_yn=y && checkDownload + if [ "${Magick}" = '1' ]; then + [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick + Install_php-imagick + Check_succ + elif [ "${Magick}" = '2' ]; then + [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick + Install_php-gmagick + Check_succ fi - fi - else - Uninstall_succ - fi - ;; - 3) - ACTION_FUN - while :; do echo - echo 'Please select ImageMagick/GraphicsMagick:' - echo -e "\t${CMSG}1${CEND}. ImageMagick" - echo -e "\t${CMSG}2${CEND}. GraphicsMagick" - read -p "Please input a number:(Default 1 press Enter) " Magick - [ -z "$Magick" ] && Magick=1 - if [[ ! $Magick =~ ^[1,2]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" else - [ $Magick = 1 ] && PHP_extension=imagick - [ $Magick = 2 ] && PHP_extension=gmagick - break + Uninstall_succ + [ -d "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick + [ -d "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick fi - done - if [ $ACTION = 1 ]; then - Check_PHP_Extension - Magick_yn=y && checkDownload - if [ $Magick = 1 ]; then - [ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick - Install_php-imagick - Check_succ - elif [ $Magick = 2 ]; then - [ ! -d "/usr/local/graphicsmagick" ] && Install_GraphicsMagick - Install_php-gmagick + ;; + 4) + ACTION_FUN + PHP_extension=fileinfo + if [ "${ACTION}" = '1' ]; then + Check_PHP_Extension + pushd ${oneinstack_dir}/src + src_url=http://www.php.net/distributions/php-${PHP_detail_version}.tar.gz && Download_src + tar xzf php-${PHP_detail_version}.tar.gz + pushd php-${PHP_detail_version}/ext/fileinfo + ${php_install_dir}/bin/phpize + ./configure --with-php-config=${php_install_dir}/bin/php-config + make -j ${THREAD} && make install + popd;popd + echo "extension=fileinfo.so" > ${php_install_dir}/etc/php.d/ext-fileinfo.ini Check_succ - fi - else - Uninstall_succ - [ -d "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick - [ -d "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick - fi - ;; - 4) - ACTION_FUN - PHP_extension=fileinfo - if [ $ACTION = 1 ]; then - Check_PHP_Extension - pushd $oneinstack_dir/src - src_url=http://www.php.net/distributions/php-$PHP_detail_version.tar.gz && Download_src - tar xzf php-$PHP_detail_version.tar.gz - pushd php-$PHP_detail_version/ext/fileinfo - $php_install_dir/bin/phpize - ./configure --with-php-config=$php_install_dir/bin/php-config - make -j ${THREAD} && make install - echo 'extension=fileinfo.so' > $php_install_dir/etc/php.d/ext-fileinfo.ini - Check_succ - else - Uninstall_succ - fi - ;; - 5) - ACTION_FUN - while :; do echo - echo 'Please select memcache/memcached PHP Extension:' - echo -e "\t${CMSG}1${CEND}. memcache PHP Extension" - echo -e "\t${CMSG}2${CEND}. memcached PHP Extension" - echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension" - read -p "Please input a number:(Default 1 press Enter) " Memcache - [ -z "$Memcache" ] && Memcache=1 - if [[ ! $Memcache =~ ^[1-3]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" else - [ $Memcache = 1 ] && PHP_extension=memcache - [ $Memcache = 2 ] && PHP_extension=memcached - break + Uninstall_succ fi - done - if [ $ACTION = 1 ]; then - if [ $Memcache = 1 ]; then - Check_PHP_Extension - memcached_yn=y && checkDownload - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - Install_php-memcache - Check_succ - elif [ $Memcache = 2 ]; then - Check_PHP_Extension - memcached_yn=y && checkDownload - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - Install_php-memcached - Check_succ - elif [ $Memcache = 3 ]; then - PHP_extension=memcache && Check_PHP_Extension - PHP_extension=memcached && Check_PHP_Extension + ;; + 5) + ACTION_FUN + while :; do echo + echo "Please select memcache/memcached PHP Extension:" + echo -e "\t${CMSG}1${CEND}. memcache PHP Extension" + echo -e "\t${CMSG}2${CEND}. memcached PHP Extension" + echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension" + read -p "Please input a number:(Default 1 press Enter) " Memcache + [ -z "${Memcache}" ] && Memcache=1 + if [[ ! "${Memcache}" =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + [ "${Memcache}" = '1' ] && PHP_extension=memcache + [ "${Memcache}" = '2' ] && PHP_extension=memcached + break + fi + done + if [ "${ACTION}" = '1' ]; then memcached_yn=y && checkDownload - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached - Install_php-memcache - Install_php-memcached - [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } + case "${Memcache}" in + 1) + [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached + Check_PHP_Extension + Install_php-memcache + Check_succ + ;; + 2) + [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached + Check_PHP_Extension + Install_php-memcached + Check_succ + ;; + 3) + [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached + PHP_extension=memcache && Check_PHP_Extension + Install_php-memcache + PHP_extension=memcached && Check_PHP_Extension + Install_php-memcached + [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; } + ;; + esac + else + PHP_extension=memcache && Uninstall_succ + PHP_extension=memcached && Uninstall_succ + [ -e "${memcached_install_dir}" ] && { service memcached stop > /dev/null 2>&1; rm -rf ${memcached_install_dir} /etc/init.d/memcached /usr/bin/memcached; } fi - else - PHP_extension=memcache && Uninstall_succ - PHP_extension=memcached && Uninstall_succ - [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; } - fi - ;; - 6) - ACTION_FUN - if [ $ACTION = 1 ]; then - PHP_extension=redis && Check_PHP_Extension + ;; + 6) + ACTION_FUN + PHP_extension=redis redis_yn=y && checkDownload - [ ! -d "$redis_install_dir" ] && Install_redis-server - Install_php-redis - else - Uninstall_succ - [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; } - fi - ;; - 7) - ACTION_FUN - if [ $ACTION = 1 ]; then - Install_letsencrypt - else - Uninstall_letsencrypt - fi - ;; - q) + if [ "${ACTION}" = '1' ]; then + [ ! -d "${redis_install_dir}" ] && Install_redis-server + Check_PHP_Extension + Install_php-redis + else + Uninstall_succ + [ -e "${redis_install_dir}" ] && { service redis-server stop > /dev/null 2>&1; rm -rf ${redis_install_dir} /etc/init.d/redis-server /usr/local/bin/redis-*; } + fi + ;; + 7) + ACTION_FUN + if [ "${ACTION}" = '1' ]; then + Install_letsencrypt + else + Uninstall_letsencrypt + fi + ;; + q) exit ;; esac diff --git a/config/nginx.conf b/config/nginx.conf index ccd8af7c..134f1704 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -76,7 +76,7 @@ http { fastcgi_index index.php; include fastcgi.conf; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index 81b04935..842882b9 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -81,7 +81,7 @@ http { proxy_pass http://127.0.0.1:88; include proxy.conf; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index 55f6f472..a3dbab36 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -70,7 +70,7 @@ http { allow 127.0.0.1; deny all; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh new file mode 100644 index 00000000..58d6066f --- /dev/null +++ b/include/alisql-5.6.sh @@ -0,0 +1,209 @@ +#!/bin/bash +# Author: yeho +# 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 +} diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 98472d60..27df289a 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -15,9 +15,10 @@ Install_Apache-2-2() { tar xzf httpd-$apache_2_version.tar.gz pushd httpd-$apache_2_version [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir - [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker - ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir + [ "${Ubuntu_version}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c + LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all make -j ${THREAD} && make install + unset LDFLAGS if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd @@ -61,16 +62,16 @@ Install_Apache-2-2() { #logrotate apache log cat > /etc/logrotate.d/apache << EOF $wwwlogs_dir/*apache.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate -[ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` -endscript + daily + rotate 5 + missingok + dateext + compress + notifempty + sharedscripts + postrotate + [ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` + endscript } EOF @@ -78,37 +79,37 @@ EOF cat >> $apache_install_dir/conf/vhost/0.conf << EOF NameVirtualHost *:$TMP_PORT - ServerAdmin admin@linuxeye.com - DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP - ErrorLog "$wwwlogs_dir/error_apache.log" - CustomLog "$wwwlogs_dir/access_apache.log" common + ServerAdmin admin@linuxeye.com + DocumentRoot "$wwwroot_dir/default" + ServerName $TMP_IP + ErrorLog "$wwwlogs_dir/error_apache.log" + CustomLog "$wwwlogs_dir/access_apache.log" common - SetOutputFilter DEFLATE - Options FollowSymLinks ExecCGI - AllowOverride All - Order allow,deny - Allow from all - DirectoryIndex index.html index.php + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php - SetHandler server-status - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + SetHandler server-status + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 EOF cat >> $apache_install_dir/conf/httpd.conf < - AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript - - RequestHeader edit "If-None-Match" "^(.*)-gzip(.*)\$" "\$1\$2" - Header edit "ETag" "^(.*)-gzip(.*)\$" "\$1\$2" - - DeflateCompressionLevel 6 - SetOutputFilter DEFLATE + AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript + + RequestHeader edit "If-None-Match" "^(.*)-gzip(.*)\$" "\$1\$2" + Header edit "ETag" "^(.*)-gzip(.*)\$" "\$1\$2" + + DeflateCompressionLevel 6 + SetOutputFilter DEFLATE ServerTokens ProductOnly diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 8bed32cf..a7207e85 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -24,9 +24,9 @@ Install_Apache-2-4() { [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir /bin/cp -R ../apr-$apr_version ./srclib/apr /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util - [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker - ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir + LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all make -j ${THREAD} && make install + unset LDFLAGS if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd @@ -62,9 +62,12 @@ Install_Apache-2-4() { fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf - sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf - sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf - sed -i 's@^#LoadModule\(.*\)mod_ssl.so@LoadModule\1mod_ssl.so@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_suexec.so)@\1@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_vhost_alias.so)@\1@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_rewrite.so)@\1@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_deflate.so)@\1@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_expires.so)@\1@' $apache_install_dir/conf/httpd.conf + sed -ri 's@^#(.*mod_ssl.so)@\1@' $apache_install_dir/conf/httpd.conf sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf sed -i "s@^@@" $apache_install_dir/conf/httpd.conf @@ -73,54 +76,54 @@ Install_Apache-2-4() { #logrotate apache log cat > /etc/logrotate.d/apache << EOF $wwwlogs_dir/*apache.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate -[ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` -endscript + daily + rotate 5 + missingok + dateext + compress + notifempty + sharedscripts + postrotate + [ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` + endscript } EOF mkdir $apache_install_dir/conf/vhost cat >> $apache_install_dir/conf/vhost/0.conf << EOF - ServerAdmin admin@linuxeye.com - DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP - ErrorLog "$wwwlogs_dir/error_apache.log" - CustomLog "$wwwlogs_dir/access_apache.log" common + ServerAdmin admin@linuxeye.com + DocumentRoot "$wwwroot_dir/default" + ServerName $TMP_IP + ErrorLog "$wwwlogs_dir/error_apache.log" + CustomLog "$wwwlogs_dir/access_apache.log" common - SetOutputFilter DEFLATE - Options FollowSymLinks ExecCGI - Require all granted - AllowOverride All - Order allow,deny - Allow from all - DirectoryIndex index.html index.php + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + Require all granted + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php - SetHandler server-status - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + SetHandler server-status + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 EOF cat >> $apache_install_dir/conf/httpd.conf < - AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript - - RequestHeader edit "If-None-Match" "^(.*)-gzip(.*)\$" "\$1\$2" - Header edit "ETag" "^(.*)-gzip(.*)\$" "\$1\$2" - - DeflateCompressionLevel 6 - SetOutputFilter DEFLATE + AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript + + RequestHeader edit "If-None-Match" "^(.*)-gzip(.*)\$" "\$1\$2" + Header edit "ETag" "^(.*)-gzip(.*)\$" "\$1\$2" + + DeflateCompressionLevel 6 + SetOutputFilter DEFLATE ServerTokens ProductOnly diff --git a/include/check_dir.sh b/include/check_dir.sh index 054c61ca..171143b8 100644 --- a/include/check_dir.sh +++ b/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 "$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 "$alisql_install_dir/support-files" ] && { db_install_dir=$alisql_install_dir; db_data_dir=$alisql_data_dir; } # check Nginx dir [ -e "$nginx_install_dir/sbin/nginx" ] && web_install_dir=$nginx_install_dir diff --git a/include/check_download.sh b/include/check_download.sh index 6ec9506d..8396c9dc 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -7,425 +7,473 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -checkDownload() { - pushd ${oneinstack_dir}/src +checkDownload(){ mirrorLink=http://mirrors.linuxeye.com/oneinstack/src - + pushd ${oneinstack_dir}/src + # Web if [ "${Web_yn}" == 'y' ]; then echo "Download openSSL..." src_url=https://www.openssl.org/source/openssl-${openssl_version}.tar.gz && Download_src - if [ "${Nginx_version}" == "1" ]; then - echo "Download nginx..." - src_url=http://nginx.org/download/nginx-${nginx_version}.tar.gz && Download_src - fi - if [ "${Nginx_version}" == "2" ]; then - echo "Download tengine..." - src_url=http://tengine.taobao.org/download/tengine-${tengine_version}.tar.gz && Download_src - fi - if [ "${Nginx_version}" == "3" ]; then - echo "Download openresty..." - src_url=https://openresty.org/download/openresty-${openresty_version}.tar.gz && Download_src - fi - - if [[ "${Nginx_version}" =~ ^[1-3]$ || ${Apache_version} == "1" ]]; then + case "${Nginx_version}" in + 1) + echo "Download nginx..." + src_url=http://nginx.org/download/nginx-${nginx_version}.tar.gz && Download_src + ;; + 2) + echo "Download tengine..." + src_url=http://tengine.taobao.org/download/tengine-${tengine_version}.tar.gz && Download_src + ;; + 3) + echo "Download openresty..." + src_url=https://openresty.org/download/openresty-${openresty_version}.tar.gz && Download_src + ;; + esac + + if [[ "${Nginx_version}" =~ ^[1-3]$ || ${Apache_version} == '1' ]]; then echo "Download pcre..." src_url=${mirrorLink}/pcre-${pcre_version}.tar.gz && Download_src fi - + # apache - if [ "${Apache_version}" == "1" ]; then + if [ "${Apache_version}" == '1' ]; then echo "Download apache 2.4..." src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_4_version}.tar.gz && Download_src fi - if [ "${Apache_version}" == "2" ]; then + if [ "${Apache_version}" == '2' ]; then echo "Download apache 2.2..." src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_2_version}.tar.gz && Download_src - + echo "Download mod_remoteip.c for apache 2.2..." src_url=${mirrorLink}/mod_remoteip.c && Download_src fi - + # tomcat - if [ "${Tomcat_version}" == "1" ]; then - echo "Download tomcat 8..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src - fi - if [ "${Tomcat_version}" == "2" ]; then - echo "Download tomcat 7..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src - fi - if [ "${Tomcat_version}" == "3" ]; then - echo "Download tomcat 6..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src - fi - + case "${Tomcat_version}" in + 1) + echo "Download tomcat 8..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src + ;; + 2) + echo "Download tomcat 7..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src + ;; + 3) + echo "Download tomcat 6..." + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src + ;; + esac + if [[ "${JDK_version}" =~ ^[1-3]$ ]]; then - if [ "${JDK_version}" == "1" ]; then - echo "Download jdk 1.8..." - JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" - fi - if [ "${JDK_version}" == "2" ]; then - echo "Download jdk 1.7..." - JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" - fi - if [ "${JDK_version}" == "3" ]; then - echo "Download jdk 1.6..." - JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" - fi + case "${JDK_version}" in + 1) + echo "Download JDK 1.8..." + JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + ;; + 2) + echo "Download JDK 1.7..." + JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + ;; + 3) + echo "Download JDK 1.6..." + JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" + ;; + esac + # start download... src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src fi fi - - if [ "${DB_yn}" == "y" ]; then + + if [ "${DB_yn}" == 'y' ]; then if [[ "${DB_version}" =~ ^[1,4,7]$ ]] && [ "${dbInstallMethods}" == "2" ]; then echo "Download boost..." [ "${IPADDR_COUNTRY}"x == "CN"x ] && DOWN_ADDR_BOOST=${mirrorLink} || DOWN_ADDR_BOOST=http://downloads.sourceforge.net/project/boost/boost/${boost_version} boostVersion2=$(echo ${boost_version} | awk -F. '{print $1}')_$(echo ${boost_version} | awk -F. '{print $2}')_$(echo ${boost_version} | awk -F. '{print $3}') src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src fi - - if [ "${DB_version}" == "1" ]; then - # mysql 5.7 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "`../include/check_port.py aliyun-oss.linuxeye.com 80`" == 'True' ]; then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 + + case "${DB_version}" in + 1) + # MySQL 5.7 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == "aliyun" -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.7 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi fi + fi + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MySQL 5.7 binary package..." + FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MySQL 5.7 source package..." + FILE_NAME=mysql-${mysql_5_7_version}.tar.gz + fi + # start download + wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME} + wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + # verifying download + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + ;; + + 2) + # MySQL 5.6 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == "aliyun" -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi fi fi - fi - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MySQL 5.7 binary package..." - FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MySQL 5.7 source package..." - FILE_NAME=mysql-${mysql_5_7_version}.tar.gz - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "2" ]; then - # mysql 5.6 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ]; then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.6 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MySQL 5.6 binary package..." + FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MySQL 5.6 source package..." + FILE_NAME=mysql-${mysql_5_6_version}.tar.gz + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ + else + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + ;; + + 3) + # MySQL 5.5 + if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == "aliyun" -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 + else + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then + DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then + DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + else + DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + fi fi + fi + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MySQL 5.5 binary package..." + FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MySQL 5.5 source package..." + FILE_NAME=mysql-${mysql_5_5_version}.tar.gz + src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src + 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}.md5 + MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + ;; + + 4) + # MariaDB 10.1 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MariaDB 10.1 binary package..." + FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi - fi - fi - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MySQL 5.6 binary package..." - FILE_NAME=mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MySQL 5.5 source package..." - FILE_NAME=mysql-${mysql_5_6_version}.tar.gz - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -4c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "3" ]; then - # mysql 5.5 - if [ "${IPADDR_COUNTRY}"x == "CN"x -a "${IPADDR_ISP}" == 'aliyun' -a "$(../include/check_port.py aliyun-oss.linuxeye.com 80)" == 'True' ]; then - DOWN_ADDR_MYSQL=http://aliyun-oss.linuxeye.com/mysql/MySQL-5.5 - else - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == 'True' ]; then - DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MariaDB 10.1 source package..." + FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi + fi + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - if [ "$(../include/check_port.py cdn.mysql.com 80)" == 'True' ]; then - DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + echo "[${CMSG}${FILE_NAME}${CEND}] found." + fi + ;; + + 5) + # MariaDB 10.0 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MariaDB 10.0 binary package..." + FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MariaDB 10.0 source package..." + FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi fi - fi - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MySQL 5.5 binary package..." - FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MySQL 5.5 source package..." - FILE_NAME=mysql-${mysql_5_5_version}.tar.gz - src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src - 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) - - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" ] && break || continue - done - fi - - if [ "${DB_version}" == "4" ]; then - # mariaDB 10.1 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MariaDB 10.1 binary package..." - FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + echo "[${CMSG}${FILE_NAME}${CEND}] found." fi - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MariaDB 10.1 source package..." - FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + ;; + + 6) + # MariaDB 5.5 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download MariaDB 5.5 binary package..." + FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download MariaDB 5.5 source package..." + FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + fi fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ]; then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "5" ]; then - # mariaDB 10.0 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MariaDB 10.0 binary package..." - FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + echo "[${CMSG}${FILE_NAME}${CEND}] found." fi - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MariaDB 10.0 source package..." - FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + ;; + + 7) + # Precona 5.7 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download Percona 5.7 binary package..." + FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download Percona 5.7 source package..." + FILE_NAME=percona-server-${percona_5_7_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ]; then + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - if [ "${DB_version}" == "6" ]; then - # mariaDB 5.5 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download MariaDB 5.5 binary package..." - FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + echo "[${CMSG}${FILE_NAME}${CEND}] found." fi - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download MariaDB 5.5 source package..." - FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source - MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + ;; + + 8) + # Precona 5.6 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download Percona 5.6 binary package..." + perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download Percona 5.6 source package..." + FILE_NAME=percona-server-${percona_5_6_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_MARIADB}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ]; then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "7" ]; then - # precona 5.7 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download Percona 5.7 binary package..." - FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download Percona 5.7 source package..." - FILE_NAME=percona-server-${percona_5_7_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + echo "[${CMSG}${FILE_NAME}${CEND}] found." fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ]; then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "8" ]; then - # precona 5.6 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download Percona 5.6 binary package..." - perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") - FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download Percona 5.6 source package..." - FILE_NAME=percona-server-${percona_5_6_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } - else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + ;; + + 9) + # Percona 5.5 + if [ "${dbInstallMethods}" == '1' ]; then + echo "Download Percona 5.5 binary package..." + perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + elif [ "${dbInstallMethods}" == '2' ]; then + echo "Download Percona 5.5 source package..." + FILE_NAME=percona-server-${percona_5_5_version}.tar.gz + if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then + DOWN_ADDR_PERCONA=${mirrorLink} + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + else + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + fi fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - if [ "${tryDlCount}" == "6" ]; then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi - - if [ "${DB_version}" == "9" ]; then - # precona 5.5 - if [ "${dbInstallMethods}" == "1" ]; then - echo "Download Percona 5.5 binary package..." - perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") - FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - elif [ "${dbInstallMethods}" == "2" ]; then - echo "Download Percona 5.5 source package..." - FILE_NAME=percona-server-${percona_5_5_version}.tar.gz - if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + tryDlCount=0 + while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + let "tryDlCount++" + [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue + done + if [ "${tryDlCount}" == '6' ]; then + echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" + kill -9 $$ else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + echo "[${CMSG}${FILE_NAME}${CEND}] found." fi - fi - tryDlCount=0 - while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ];do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 - let "tryDlCount++" - [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == "6" ] && break || continue - done - - if [ "${tryDlCount}" == "6" ]; then - echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}" - kill -9 $$ - else - echo "[${CMSG}${FILE_NAME}${CEND}] found." - fi - fi + ;; + + 10) + # 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 + ;; + esac fi # PHP - if [ "${PHP_yn}" == "y" ]; then + if [ "${PHP_yn}" == 'y' ]; then # php 5.3 5.4 5.5 5.6 5.7 echo "PHP common..." src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${libiconv_version}.tar.gz && Download_src @@ -434,117 +482,129 @@ checkDownload() { src_url=http://downloads.sourceforge.net/project/mhash/mhash/${mhash_version}/mhash-${mhash_version}.tar.gz && Download_src src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_version}/mcrypt-${mcrypt_version}.tar.gz && Download_src src_url=${mirrorLink}/libiconv-glibc-2.16.patch && Download_src - - if [[ "${PHP_version}" =~ ^[1-3]$ ]]; then - # php 5.3 5.4 5.5 - src_url=${mirrorLink}/fpm-race-condition.patch && Download_src - fi - - if [ "${PHP_version}" == "1" ]; then - # php 5.3 - src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src - src_url=${mirrorLink}/php5.3patch && Download_src - if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then - if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ]; then - src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src + + case "${PHP_version}" in + 1) + # php 5.3 + src_url=${mirrorLink}/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src + src_url=${mirrorLink}/php5.3patch && Download_src + # Use the special ssl for php5.3 + if [ "${Debian_version}" == '8' -o "${Ubuntu_version}" == "16" ]; then + if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ]; then + src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src + fi fi - fi - src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "2" ]; then - src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "3" ]; then - src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "4" ]; then - src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src - fi - if [ "${PHP_version}" == "5" ]; then - src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src - fi + src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src + src_url=${mirrorLink}/fpm-race-condition.patch && Download_src + ;; + 2) + src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src + src_url=${mirrorLink}/fpm-race-condition.patch && Download_src + ;; + 3) + src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src + src_url=${mirrorLink}/fpm-race-condition.patch && Download_src + ;; + 4) + src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src + ;; + 5) + src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src + ;; + esac fi - + # PHP OPCache - if [ "${PHP_cache}" == "1" ] && [[ "$PHP_version" =~ ^[1,2]$ ]]; then - # php 5.3 5.4 - echo "Download Zend OPCache..." - src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src - fi - if [ "${PHP_cache}" == "2" ] && [[ "$PHP_version" =~ ^[1-4]$ ]]; then - # php 5.3 5.4 5.5 5.6 - echo "Download xcache..." - src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src - fi - if [ "${PHP_cache}" == "3" ]; then - # php 5.3 5.4 5.5 5.6 7.0 - echo "Download apcu..." - if [ "${PHP_version}" != "5" ]; then - src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src - else - src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src - fi - fi - if [ "${PHP_cache}" == "4" -a "${PHP_version}" == "2" ]; then - echo "Download eaccelerator 1.0 dev..." - src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src - elif [ "${PHP_cache}" == "4" -a "${PHP_version}" == "1" ]; then - echo "Download eaccelerator 0.9..." - src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src - fi - - # Zend Guard Loader - if [ "${ZendGuardLoader_yn}" == "y" -a "${armPlatform}" != "y" ]; then - if [ "${PHP_version}" == "4" ]; then - if [ "${OS_BIT}" == "64" ]; then - # 64 bit - echo "Download ZendGuardLoader for php 5.6..." - src_url=${mirrorLink}/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download ZendGuardLoader for php 5.6..." - src_url=${mirrorLink}/zend-loader-php5.6-linux-i386.tar.gz && Download_src + case "${PHP_cache}" in + 1) + if [[ "$PHP_version" =~ ^[1,2]$ ]]; then + # php 5.3 5.4 + echo "Download Zend OPCache..." + src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src fi - fi - if [ "${PHP_version}" == "3" ]; then - if [ "${OS_BIT}" == "64" ]; then - # 64 bit - echo "Download ZendGuardLoader for php 5.5..." - src_url=${mirrorLink}/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download ZendGuardLoader for php 5.5..." - src_url=${mirrorLink}/zend-loader-php5.5-linux-i386.tar.gz && Download_src + ;; + 2) + if [[ "$PHP_version" =~ ^[1-4]$ ]]; then + # php 5.3 5.4 5.5 5.6 + echo "Download xcache..." + src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src fi - fi - if [ "${PHP_version}" == "2" ]; then - if [ "${OS_BIT}" == "64" ]; then - # 64 bit - echo "Download ZendGuardLoader for php 5.4..." - src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + ;; + 3) + # php 5.3 5.4 5.5 5.6 7.0 + echo "Download apcu..." + if [ "${PHP_version}" != '5' ]; then + src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src else - # 32 bit - echo "Download ZendGuardLoader for php 5.4..." - src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src fi - fi - if [ "${PHP_version}" == "1" ]; then - if [ "${OS_BIT}" == "64" ]; then - # 64 bit - echo "Download ZendGuardLoader for php 5.3..." - src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src - else - # 32 bit - echo "Download ZendGuardLoader for php 5.3..." - src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + ;; + 4) + # php 5.3 5.4 + if [ "${PHP_version}" == '1' ]; then + echo "Download eaccelerator 0.9..." + src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src + elif [ "${PHP_version}" == '2' ]; then + echo "Download eaccelerator 1.0 dev..." + src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src fi - fi + ;; + esac + + # Zend Guard Loader + if [ "${ZendGuardLoader_yn}" == 'y' -a "${armPlatform}" != 'y' ]; then + case "${PHP_version}" in + 4) + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download zend loader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.6..." + src_url=${mirrorLink}/zend-loader-php5.6-linux-i386.tar.gz && Download_src + fi + ;; + 3) + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download zend loader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.5..." + src_url=${mirrorLink}/zend-loader-php5.5-linux-i386.tar.gz && Download_src + fi + ;; + 2) + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download zend loader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.4..." + src_url=${mirrorLink}/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz && Download_src + fi + ;; + 1) + if [ "${OS_BIT}" == "64" ]; then + # 64 bit + echo "Download zend loader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src + else + # 32 bit + echo "Download zend loader for php 5.3..." + src_url=${mirrorLink}/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz && Download_src + fi + ;; + esac fi - - if [ "${ionCube_yn}" == "y" ]; then + + if [ "${ionCube_yn}" == 'y' ]; then echo "Download ioncube..." if [ "${OS_BIT}" == '64' ]; then - src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src + src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && Download_src else if [ "${TARGET_ARCH}" == "armv7" ]; then src_url=http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz && Download_src @@ -553,23 +613,23 @@ checkDownload() { fi fi fi - - if [ "${Magick_yn}" == "y" ]; then - if [ "${Magick}" == "1" ]; then + + if [ "${Magick_yn}" == 'y' ]; then + if [ "${Magick}" == '1' ]; then echo "Download ImageMagick..." src_url=${mirrorLink}/ImageMagick-${ImageMagick_version}.tar.gz && Download_src - if [ "${PHP_version}" == "1" ]; then + if [ "${PHP_version}" == '1' ]; then echo "Download image for php 5.3..." src_url=https://pecl.php.net/get/imagick-${imagick_for_php53_version}.tgz && Download_src - else + else echo "Download imagick..." src_url=http://pecl.php.net/get/imagick-${imagick_version}.tgz && Download_src fi else echo "Download graphicsmagick..." src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${GraphicsMagick_version}/GraphicsMagick-${GraphicsMagick_version}.tar.gz && Download_src - if [ "${PHP_version}" == "5" ]; then - echo "Download gmagick for php7..." + if [ "${PHP_version}" == '5' ]; then + echo "Download gmagick for php 7.x..." src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src else echo "Download gmagick for php..." @@ -577,18 +637,18 @@ checkDownload() { fi fi fi - - if [ "${FTP_yn}" == "y" ]; then + + if [ "${FTP_yn}" == 'y' ]; then echo "Download pureftpd..." src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src fi - - if [ "${phpMyAdmin_yn}" == "y" ]; then + + if [ "${phpMyAdmin_yn}" == 'y' ]; then echo "Download phpMyAdmin..." src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpMyAdmin_version}/phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz && Download_src fi - - if [ "${redis_yn}" == "y" ]; then + + if [ "${redis_yn}" == 'y' ]; then echo "Download redis..." src_url=http://download.redis.io/releases/redis-${redis_version}.tar.gz && Download_src if [ "${OS}" == "CentOS" ]; then @@ -596,57 +656,61 @@ checkDownload() { src_url=${mirrorLink}/start-stop-daemon.c && Download_src fi # redis addon - if [ "${PHP_version}" == "5" ]; then - echo "Download redis pecl for php7..." + if [ "${PHP_version}" == '5' ]; then + echo "Download redis pecl for php 7.x..." src_url=http://pecl.php.net/get/redis-${redis_pecl_for_php7_version}.tgz && Download_src else echo "Download redis pecl..." src_url=http://pecl.php.net/get/redis-${redis_pecl_version}.tgz && Download_src fi fi - - if [ "${memcached_yn}" == "y" ]; then + + if [ "${memcached_yn}" == 'y' ]; then echo "Download memcached..." src_url=http://www.memcached.org/files/memcached-${memcached_version}.tar.gz && Download_src - if [ "${PHP_version}" == "5" ]; then - echo "Download pecl memcache for php7..." + if [ "${PHP_version}" == '5' ]; then + echo "Download pecl memcache for php 7.x..." + # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src - echo "Download php-memcached for php7..." + echo "Download php-memcached for php 7.x..." src_url=${mirrorLink}/php-memcached-php7.tgz && Download_src else - echo "Download pecl memcache for php7..." + echo "Download pecl memcache for php..." src_url=http://pecl.php.net/get/memcache-${memcache_pecl_version}.tgz && Download_src - echo "Download php-memcached for php7..." - src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src + echo "Download php-memcached for php..." + src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src fi - + echo "Download libmemcached..." src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_version}/+download/libmemcached-${libmemcached_version}.tar.gz && Download_src fi - - if [ "${je_tc_malloc_yn}" == "y" ]; then - if [ "${je_tc_malloc}" == "1" ]; then + + if [ "${je_tc_malloc_yn}" == 'y' ]; then + if [ "${je_tc_malloc}" == '1' ]; then echo "Download jemalloc..." src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src - elif [ "${je_tc_malloc}" == "2" ]; then + elif [ "${je_tc_malloc}" == '2' ]; then echo "Download tcmalloc..." src_url=${mirrorLink}/gperftools-${tcmalloc_version}.tar.gz && Download_src fi fi - + # others - if [ "${OS}" == "CentOS" ]; then - echo "Download tmux for CentOS..." - src_url=${mirrorLink}/libevent-${libevent_version}.tar.gz && Download_src - src_url=${mirrorLink}/tmux-${tmux_version}.tar.gz && Download_src - - echo "Download htop for CentOS..." - src_url=http://hisham.hm/htop/releases/${htop_version}/htop-${htop_version}.tar.gz && Download_src - fi - - if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then - echo "Download bison for Ubuntu..." - src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_version}.tar.gz && Download_src + if [ "${downloadDepsSrc}" == '1' ]; then + if [ "${OS}" == "CentOS" ]; then + echo "Download tmux for CentOS..." + src_url=${mirrorLink}/libevent-${libevent_version}.tar.gz && Download_src + src_url=https://github.com/tmux/tmux/releases/download/${tmux_version}/tmux-${tmux_version}.tar.gz && Download_src + + echo "Download htop for CentOS..." + src_url=http://hisham.hm/htop/releases/${htop_version}/htop-${htop_version}.tar.gz && Download_src + fi + + if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then + echo "Download bison for Ubuntu..." + src_url=http://ftp.gnu.org/gnu/bison/bison-${bison_version}.tar.gz && Download_src + fi fi + popd } diff --git a/include/check_os.sh b/include/check_os.sh index 0c283b06..d0772120 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -16,36 +16,39 @@ if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ]; elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ]; then OS=CentOS CentOS_RHEL_version=6 -elif [ -n "$(grep bian /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Debian' ]; then +elif [ -n "$(grep 'bian' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Debian" ]; then OS=Debian [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Debian_version=$(lsb_release -sr | awk -F. '{print $1}') -elif [ -n "$(grep Deepin /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Deepin' ]; then +elif [ -n "$(grep 'Deepin' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Deepin" ]; then OS=Debian [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Debian_version=$(lsb_release -sr | awk -F. '{print $1}') -elif [ -n "$(grep Ubuntu /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Ubuntu' -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then +# kali rolling +elif [ -n "$(grep 'Kali GNU/Linux Rolling' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Kali" ]; then + OS=Debian + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + if [ -n "$(grep 'VERSION="2016.*"' /etc/os-release)" ]; then + Debian_version=8 + else + echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" + kill -9 $$ + fi +elif [ -n "$(grep 'Ubuntu' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Ubuntu" -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then OS=Ubuntu [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}') [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16 +elif [ -n "$(grep 'elementary' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'elementary' ]; then + OS=Ubuntu + [ ! -e "$(which lsb_release)" ] && { apt-get -y update; apt-get -y install lsb-release; clear; } + Ubuntu_version=16 else echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}" kill -9 $$ fi -if uname -m | grep -Eqi "arm"; then - armPlatform="y" - if uname -m | grep -Eqi "armv7"; then - TARGET_ARCH="armv7" - elif uname -m | grep -Eqi "armv8"; then - TARGET_ARCH="arm64" - else - TARGET_ARCH="unknown" - fi -fi - -if [ $(getconf WORD_BIT) == 32 ] && [ $(getconf LONG_BIT) == 64 ]; then +if [ "$(getconf WORD_BIT)" == "32" ] && [ "$(getconf LONG_BIT)" == "64" ]; then OS_BIT=64 SYS_BIG_FLAG=x64 #jdk SYS_BIT_a=x86_64;SYS_BIT_b=x86_64; #mariadb @@ -58,19 +61,32 @@ fi LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}') [ $LIBC_YN == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux +if uname -m | grep -Eqi "arm"; then + armPlatform="y" + if uname -m | grep -Eqi "armv7"; then + TARGET_ARCH="armv7" + elif uname -m | grep -Eqi "armv8"; then + TARGET_ARCH="arm64" + else + TARGET_ARCH="unknown" + fi +fi + THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l) # Percona -if [ -f "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0" ]; then - if [ "${Debian_version}" == "6" ]; then +if [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + if [ "${Debian_version}" == '6' ]; then sslLibVer=ssl098 else sslLibVer=ssl100 fi -elif [ -f "/usr/lib64/libssl.so.10" ]; then - if [ "${CentOS_RHEL_version}" == "5" ]; then +elif [ "${OS}" == "CentOS" ]; then + if [ "${CentOS_RHEL_version}" == '5' ]; then sslLibVer=ssl098e else sslLibVer=ssl101 fi +else + sslLibVer=unknown fi diff --git a/include/check_sw.sh b/include/check_sw.sh new file mode 100644 index 00000000..e137f2f3 --- /dev/null +++ b/include/check_sw.sh @@ -0,0 +1,167 @@ +#!/bin/bash +# Author: Alpha Eva +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# https://oneinstack.com +# https://github.com/lj2007331/oneinstack + +installDepsDebian() { + echo "${CMSG}Removing the conflicting packages...${CEND}" + pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" + for Package in ${pkgList};do + apt-get -y remove --purge ${Package} + done + dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P + + apt-get -y update + echo "${CMSG}Installing dependencies packages...${CEND}" + # critical security updates + grep security /etc/apt/sources.list > /tmp/security.sources.list + apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list + + apt-get autoremove + + # Install needed packages + case "${Debian_version}" in + [6,7]) + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc wget" + ;; + 8) + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc wget" + ;; + *) + echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}" + kill -9 $$ + ;; + esac + + for Package in ${pkgList}; do + apt-get -y install ${Package} + done +} + +installDepsCentOS() { + sed -i 's@^exclude@#exclude@' /etc/yum.conf + yum clean all + + yum makecache + # Uninstall the conflicting packages + echo "${CMSG}Removing the conflicting packages...${CEND}" + if [ "${CentOS_RHEL_version}" == '7' ]; then + yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server" + yum -y install iptables-services + systemctl mask firewalld.service + systemctl enable iptables.service + elif [ "${CentOS_RHEL_version}" == '6' ]; then + yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" + elif [ "${CentOS_RHEL_version}" == '5' ]; then + yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" + fi + + echo "${CMSG}Installing dependencies packages...${CEND}" + yum check-update + # Install needed packages + pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz wget" + for Package in ${pkgList}; do + yum -y install ${Package} + done + + yum -y update bash openssl glibc + + # use gcc-4.4 + if [ -n "$(gcc --version | head -n1 | grep '4\.1\.')" ]; then + yum -y install gcc44 gcc44-c++ libstdc++44-devel + export CC="gcc44" CXX="g++44" + fi +} + +installDepsUbuntu() { + # Uninstall the conflicting software + echo "${CMSG}Removing the conflicting packages...${CEND}" + pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" + for Package in ${pkgList}; do + apt-get -y remove --purge ${Package} + done + dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P + + apt-get autoremove + + echo "${CMSG}Installing dependencies packages...${CEND}" + apt-get -y update + # critical security updates + grep security /etc/apt/sources.list > /tmp/security.sources.list + apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list + + # Install needed packages + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate wget" + for Package in ${pkgList}; do + apt-get -y install ${Package} --force-yes + done + + if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then + apt-get -y install libcloog-ppl1 + apt-get -y remove bison + ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype + elif [ "${Ubuntu_version}" == "13" ]; then + apt-get -y install bison libcloog-ppl1 + elif [ "${Ubuntu_version}" == "12" ]; then + apt-get -y install bison libcloog-ppl0 + else + apt-get -y install bison libcloog-ppl1 + fi +} + +installDepsBySrc() { + pushd ${oneinstack_dir}/src + + if [ "${OS}" == "Ubuntu" ]; then + if [[ "${Ubuntu_version}" =~ ^14$|^15$ ]]; then + # Install bison on ubt 14.x 15.x + tar xzf bison-${bison_version}.tar.gz + pushd bison-${bison_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf bison-${bison_version} + fi + elif [ "${OS}" == "CentOS" ]; then + # Install tmux + if [ ! -e "$(which tmux)" ]; then + # Install libevent first + tar xzf libevent-${libevent_version}.tar.gz + pushd libevent-${libevent_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf libevent-${libevent_version} + + tar xzf tmux-${tmux_version}.tar.gz + pushd tmux-${tmux_version} + CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure + make -j ${THREAD} && make install + popd + rm -rf tmux-${tmux_version} + + if [ "${OS_BIT}" == "64" ]; then + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 + else + ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 + fi + fi + + # install htop + if [ ! -e "$(which htop)" ]; then + tar xzf htop-${htop_version}.tar.gz + pushd htop-${htop_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf htop-${htop_version} + fi + else + echo "No need to install software from source packages." + fi + popd +} diff --git a/include/demo.sh b/include/demo.sh index 8784ad87..4042d562 100644 --- a/include/demo.sh +++ b/include/demo.sh @@ -23,7 +23,7 @@ DEMO() { sed -i 's@https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js@http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js@' ${wwwroot_dir}/default/proberv.php fi - echo '' > ${wwwroot_dir}/default/phpinfo.php + echo "" > ${wwwroot_dir}/default/phpinfo.php case "${PHP_cache}" in 1) src_url=http://mirrors.linuxeye.com/oneinstack/src/ocp.php && Download_src diff --git a/include/eaccelerator-1.0-dev.sh b/include/eaccelerator-1.0-dev.sh deleted file mode 100644 index a0aae6ec..00000000 --- a/include/eaccelerator-1.0-dev.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Author: yeho -# 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_eAccelerator-1-0-dev() { - pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` - /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz - tar xzf eaccelerator-eaccelerator-42067ac.tar.gz - pushd eaccelerator-eaccelerator-42067ac - ${php_install_dir}/bin/phpize - ./configure --enable-eaccelerator=shared --with-php-config=${php_install_dir}/bin/php-config - make -j ${THREAD} && make install - popd - if [ -f "${phpExtensionDir}/eaccelerator.so" ]; then - mkdir /var/eaccelerator_cache;chown -R ${run_user}.${run_user} /var/eaccelerator_cache - cat > ${php_install_dir}/etc/php.d/ext-eaccelerator.ini << EOF -[eaccelerator] -zend_extension=${phpExtensionDir}/eaccelerator.so -eaccelerator.shm_size=64 -eaccelerator.cache_dir=/var/eaccelerator_cache -eaccelerator.enable=1 -eaccelerator.optimizer=1 -eaccelerator.check_mtime=1 -eaccelerator.debug=0 -eaccelerator.filter= -eaccelerator.shm_max=0 -eaccelerator.shm_ttl=0 -eaccelerator.shm_prune_period=0 -eaccelerator.shm_only=0 -eaccelerator.compress=0 -eaccelerator.compress_level=9 -eaccelerator.keys=disk_only -eaccelerator.sessions=disk_only -eaccelerator.content=disk_only -EOF - echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - rm -rf eaccelerator-eaccelerator-42067ac - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf - sysctl -p - else - echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" - fi - popd -} diff --git a/include/eaccelerator-0.9.sh b/include/eaccelerator.sh similarity index 65% rename from include/eaccelerator-0.9.sh rename to include/eaccelerator.sh index 7e662dde..9c2729bf 100644 --- a/include/eaccelerator-0.9.sh +++ b/include/eaccelerator.sh @@ -8,11 +8,23 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_eAccelerator-0-9() { +Install_eAccelerator() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` - tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 - pushd eaccelerator-${eaccelerator_version} + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) + case "${PHP_version}" in + 1) + tar jxf eaccelerator-${eaccelerator_version}.tar.bz2 + pushd eaccelerator-${eaccelerator_version} + ;; + 2) + /bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz + tar xzf eaccelerator-eaccelerator-42067ac.tar.gz + pushd eaccelerator-eaccelerator-42067ac + ;; + *) + echo "${CWARNING}Your php does not support eAccelerator! ${CEND}" + kill -9 $$ + esac ${php_install_dir}/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=${php_install_dir}/bin/php-config make -j ${THREAD} && make install @@ -40,9 +52,9 @@ eaccelerator.sessions=disk_only eaccelerator.content=disk_only EOF echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}" - [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf + [ -z "$(grep 'kernel.shmmax = 67108864' /etc/sysctl.conf)" ] && echo "kernel.shmmax = 67108864" >> /etc/sysctl.conf sysctl -p - rm -rf eaccelerator-${eaccelerator_version} + rm -rf eaccelerator-${eaccelerator_version} eaccelerator-eaccelerator-42067ac else echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}" fi diff --git a/include/hhvm_CentOS.sh b/include/hhvm_CentOS.sh index 49cc4a58..eb934d22 100644 --- a/include/hhvm_CentOS.sh +++ b/include/hhvm_CentOS.sh @@ -9,10 +9,11 @@ # https://github.com/lj2007331/oneinstack Install_hhvm_CentOS() { - pushd ${oneinstack_dir}/src - id -u $run_user >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - if [ "$CentOS_RHEL_version" == '7' ]; then + + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} + + if [ "${CentOS_RHEL_version}" == '7' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch @@ -33,7 +34,7 @@ EOF [ ! -e "/usr/bin/hhvm" -a "/usr/local/bin/hhvm" ] && ln -s /usr/local/bin/hhvm /usr/bin/hhvm fi - if [ "$CentOS_RHEL_version" == '6' ]; then + if [ "${CentOS_RHEL_version}" == '6' ]; then [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=Extra Packages for Enterprise Linux 6 - \$basearch @@ -43,12 +44,12 @@ failovermethod=priority enabled=1 gpgcheck=0 EOF - - for Package in libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel libevent-devel libcurl-devel libmemcached-devel lcms2 inotify-tools - do - yum -y install $Package + # Install needed packages + pkgList="libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel libevent-devel libcurl-devel libmemcached-devel lcms2 inotify-tools" + for Package in ${pkgList}; do + yum -y install ${Package} done - + # Uninstall the conflicting packages yum -y remove libwebp boost-system boost-filesystem cat > /etc/yum.repos.d/hhvm.repo << EOF @@ -61,7 +62,7 @@ EOF yum --disablerepo=epel -y install mysql mysql-devel mysql-libs yum --disablerepo=epel -y install hhvm fi - + userdel -r nginx;userdel -r saslauth rm -rf /var/log/hhvm mkdir /var/log/hhvm @@ -126,13 +127,13 @@ memory_limit = 400000000 post_max_size = 50000000 EOF - if [ -e "$web_install_dir/sbin/nginx" -a -e "/usr/bin/hhvm" -a ! -e "$php_install_dir" ]; then - sed -i 's@/dev/shm/php-cgi.sock@/var/log/hhvm/sock@' $web_install_dir/conf/nginx.conf - [ -z "`grep 'fastcgi_param SCRIPT_FILENAME' $web_install_dir/conf/nginx.conf`" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" $web_install_dir/conf/nginx.conf - sed -i 's@include fastcgi.conf;@include fastcgi_params;@' $web_install_dir/conf/nginx.conf + if [ -e "${web_install_dir}/sbin/nginx" -a -e "/usr/bin/hhvm" -a ! -e "${php_install_dir}" ]; then + sed -i 's@/dev/shm/php-cgi.sock@/var/log/hhvm/sock@' ${web_install_dir}/conf/nginx.conf + [ -z "$(grep 'fastcgi_param SCRIPT_FILENAME' ${web_install_dir}/conf/nginx.conf)" ] && sed -i "s@fastcgi_index index.php;@&\n\t\tfastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;@" ${web_install_dir}/conf/nginx.conf + sed -i 's@include fastcgi.conf;@include fastcgi_params;@' ${web_install_dir}/conf/nginx.conf service nginx reload fi - + rm -rf /etc/ld.so.conf.d/*_64.conf ldconfig # Supervisor @@ -141,18 +142,17 @@ EOF easy_install supervisor echo_supervisord_conf > /etc/supervisord.conf sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf - [ -z "`grep 'program:hhvm' /etc/supervisord.conf`" ] && cat >> /etc/supervisord.conf << EOF + [ -z "$(grep 'program:hhvm' /etc/supervisord.conf)" ] && cat >> /etc/supervisord.conf << EOF [program:hhvm] -command=/usr/bin/hhvm --mode server --user $run_user --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf +command=/usr/bin/hhvm --mode server --user ${run_user} --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf numprocs=1 ; number of processes copies to start (def 1) directory=/tmp ; directory to cwd to before exec (def no cwd) autostart=true ; start at supervisord start (default: true) autorestart=unexpected ; whether/when to restart (default: unexpected) stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) EOF - /bin/cp ../init.d/Supervisor-init-CentOS /etc/init.d/supervisord + /bin/cp ${oneinstack_dir}/init.d/Supervisor-init-CentOS /etc/init.d/supervisord chmod +x /etc/init.d/supervisord chkconfig supervisord on service supervisord start - popd } diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index c7257370..eab8b731 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -8,43 +8,11 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -sed -i 's@^exclude@#exclude@' /etc/yum.conf -yum clean all - -yum makecache - -if [ "$CentOS_RHEL_version" == '7' ]; then - yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server" - yum -y install iptables-services - systemctl mask firewalld.service - systemctl enable iptables.service -elif [ "$CentOS_RHEL_version" == '6' ]; then - yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client" -elif [ "$CentOS_RHEL_version" == '5' ]; then - yum -y groupremove "FTP Server" "Windows File Server" "PostgreSQL Database" "News Server" "MySQL Database" "DNS Name Server" "Web Server" "Dialup Networking Support" "Mail Server" "Ruby" "Office/Productivity" "Sound and Video" "Printing Support" "OpenFabrics Enterprise Distribution" -fi - -yum check-update - -# Install needed packages -for Package in deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz -do - yum -y install $Package -done - -yum -y update bash openssl glibc - -# use gcc-4.4 -if [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ]; then - yum -y install gcc44 gcc44-c++ libstdc++44-devel - export CC="gcc44" CXX="g++44" -fi - # closed Unnecessary services and remove obsolete rpm package -[ "$CentOS_RHEL_version" == '7' ] && [ "`systemctl is-active NetworkManager.service`" == 'active' ] && NM_flag=1 -for Service in `chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis|NetworkManager'`;do chkconfig --level 3 $Service off;done -[ "$NM_flag" == '1' ] && systemctl enable NetworkManager.service -for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog;do chkconfig --level 3 $Service on;done +[ "${CentOS_RHEL_version}" == '7' ] && [ "$(systemctl is-active NetworkManager.service)" == 'active' ] && NM_flag=1 +for Service in $(chkconfig --list | grep 3:on | awk '{print $1}' | grep -vE 'nginx|httpd|tomcat|mysqld|php-fpm|pureftpd|redis-server|memcached|supervisord|aegis|NetworkManager');do chkconfig --level 3 ${Service} off;done +[ "${NM_flag}" == '1' ] && systemctl enable NetworkManager.service +for Service in sshd network crond iptables messagebus irqbalance syslog rsyslog;do chkconfig --level 3 ${Service} on;done # Close SELINUX setenforce 0 @@ -54,7 +22,7 @@ sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\\\$ " -HISTTIMEFORMAT="%F %T \`whoami\` " +HISTTIMEFORMAT="%F %T \$(whoami) " alias l='ls -AFhlt' alias lh='l | head' @@ -66,7 +34,7 @@ alias egrep='egrep --color' alias fgrep='fgrep --color' EOF -[ -z "`grep ^'PROMPT_COMMAND=' /etc/bashrc`" ] && cat >> /etc/bashrc << EOF +[ -z "$(grep ^'PROMPT_COMMAND=' /etc/bashrc)" ] && cat >> /etc/bashrc << EOF PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }' EOF @@ -82,7 +50,7 @@ cat >> /etc/security/limits.conf < /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } +[ ! -e "/var/spool/cron/root" -o -z "$(grep 'ntpdate' /var/spool/cron/root)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } # iptables -if [ -e '/etc/sysconfig/iptables' ] && [ -n "`grep '^:INPUT DROP' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables`" ]; then +if [ -e "/etc/sysconfig/iptables" ] && [ -n "$(grep '^:INPUT DROP' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables)" ]; then IPTABLES_STATUS=yes else IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ]; then - [ -e '/etc/sysconfig/iptables' ] && /bin/mv /etc/sysconfig/iptables{,_bk} +if [ "$IPTABLES_STATUS" == "no" ]; then + [ -e "/etc/sysconfig/iptables" ] && /bin/mv /etc/sysconfig/iptables{,_bk} cat > /etc/sysconfig/iptables << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -182,41 +150,9 @@ COMMIT EOF fi -FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/sysconfig/iptables` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/sysconfig/iptables +FW_PORT_FLAG=$(grep -ow "dport ${SSH_PORT}" /etc/sysconfig/iptables) +[ -z "${FW_PORT_FLAG}" -a "${SSH_PORT}" != "22" ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport ${SSH_PORT} -j ACCEPT@" /etc/sysconfig/iptables service iptables restart service sshd restart -# install tmux -if [ ! -e "`which tmux`" ]; then - pushd ${oneinstack_dir}/src - tar xzf libevent-${libevent_version}.tar.gz - pushd libevent-${libevent_version} - ./configure - make -j ${THREAD} && make install - popd - - tar xzf tmux-${tmux_version}.tar.gz - pushd tmux-${tmux_version} - CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure - make -j ${THREAD} && make install - popd - - if [ "$OS_BIT" == '64' ]; then - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5 - else - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5 - fi -fi - -# install htop -if [ ! -e "`which htop`" ]; then - tar xzf htop-${htop_version}.tar.gz - pushd htop-${htop_version} - ./configure - make -j ${THREAD} && make install - popd -fi - . /etc/profile -popd diff --git a/include/init_Debian.sh b/include/init_Debian.sh index e0e20c32..d6b7c838 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -8,29 +8,11 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* -do - apt-get -y remove --purge $Package -done -dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P - -apt-get -y update - -# critical security updates -grep security /etc/apt/sources.list > /tmp/security.sources.list -apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list - -# Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc -do - apt-get -y install $Package -done - # Custom profile cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ' -HISTTIMEFORMAT="%F %T \`whoami\` " +HISTTIMEFORMAT="%F %T \$(whoami) " alias l='ls -AFhlt --color=auto' alias lh='l | head' @@ -47,11 +29,11 @@ EOF sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc # history -[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "$(grep history-timestamp ~/.bashrc)" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf -[ -z "`grep 'session required pam_limits.so' /etc/pam.d/common-session`" ] && echo 'session required pam_limits.so' >> /etc/pam.d/common-session +[ -z "$(grep 'session required pam_limits.so' /etc/pam.d/common-session)" ] && echo "session required pam_limits.so" >> /etc/pam.d/common-session sed -i '/^# End of file/,$d' /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/sysctl.conf << EOF +[ -z "$(grep 'fs.file-max' /etc/sysctl.conf)" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 @@ -105,17 +87,17 @@ init q # Update time ntpdate pool.ntp.org -[ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ ! -e "/var/spool/cron/crontabs/root" -o -z "$(grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ]; then +if [ -e "/etc/iptables.up.rules" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules)" ]; then IPTABLES_STATUS=yes else IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ]; then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} +if [ "${IPTABLES_STATUS}" == "no" ]; then + [ -e "/etc/iptables.up.rules" ] && /bin/mv /etc/iptables.up.rules{,_bk} cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -139,8 +121,8 @@ COMMIT EOF fi -FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules +FW_PORT_FLAG=$(grep -ow "dport ${SSH_PORT}" /etc/iptables.up.rules) +[ -z "${FW_PORT_FLAG}" -a "${SSH_PORT}" != "22" ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport ${SSH_PORT} -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules cat > /etc/network/if-pre-up.d/iptables << EOF #!/bin/bash diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index 461e53ff..f23f7b21 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -8,45 +8,10 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-* -do - apt-get -y remove --purge $Package -done -dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P - -apt-get -y update - -# critical security updates -grep security /etc/apt/sources.list > /tmp/security.sources.list -apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list - -# Install needed packages -for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate -do - apt-get -y install $Package -done - -if [[ "$Ubuntu_version" =~ ^14$|^15$ ]]; then - apt-get -y install libcloog-ppl1 - apt-get -y remove bison - pushd ${oneinstack_dir}/src - tar xzf bison-${bison_version}.tar.gz - pushd bison-${bison_version} - ./configure - make -j ${THREAD} && make install - popd - rm -rf bison-${bison_version} - ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype -elif [ "$Ubuntu_version" == '13' ]; then - apt-get -y install bison libcloog-ppl1 -elif [ "$Ubuntu_version" == '12' ]; then - apt-get -y install bison libcloog-ppl0 -fi - # Custom profile cat > /etc/profile.d/oneinstack.sh << EOF HISTSIZE=10000 -HISTTIMEFORMAT="%F %T \`whoami\` " +HISTTIMEFORMAT="%F %T \$(whoami) " alias l='ls -AFhlt --color=auto' alias lh='l | head' @@ -63,14 +28,14 @@ EOF sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc # PS1 -[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc +[ -z "$(grep ^PS1 ~/.bashrc)" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc # history -[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc +[ -z "$(grep history-timestamp ~/.bashrc)" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf -[ -z "`grep 'session required pam_limits.so' /etc/pam.d/common-session`" ] && echo 'session required pam_limits.so' >> /etc/pam.d/common-session +[ -z "$(grep 'session required pam_limits.so' /etc/pam.d/common-session)" ] && echo "session required pam_limits.so" >> /etc/pam.d/common-session sed -i '/^# End of file/,$d' /etc/security/limits.conf cat >> /etc/security/limits.conf <> /etc/sysctl.conf << EOF +[ -z "$(grep 'fs.file-max' /etc/sysctl.conf)" ] && cat >> /etc/sysctl.conf << EOF fs.file-max=65535 fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 @@ -120,22 +85,22 @@ sysctl -p sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup sed -i 's@^@#@g' /etc/init/tty[3-6].conf -echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local +echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local sed -i 's@^@#@g' /etc/init/control-alt-delete.conf # Update time ntpdate pool.ntp.org -[ ! -e "/var/spool/cron/crontabs/root" -o -z "`grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } +[ ! -e "/var/spool/cron/crontabs/root" -o -z "$(grep ntpdate /var/spool/cron/crontabs/root 2>/dev/null)" ] && { echo "*/20 * * * * $(which ntpdate) pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/crontabs/root;chmod 600 /var/spool/cron/crontabs/root; } # iptables -if [ -e '/etc/iptables.up.rules' ] && [ -n "`grep '^:INPUT DROP' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules`" -a -n "`grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules`" ]; then +if [ -e "/etc/iptables.up.rules" ] && [ -n "$(grep '^:INPUT DROP' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/iptables.up.rules)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/iptables.up.rules)" ]; then IPTABLES_STATUS=yes else IPTABLES_STATUS=no fi -if [ "$IPTABLES_STATUS" == 'no' ]; then - [ -e '/etc/iptables.up.rules' ] && /bin/mv /etc/iptables.up.rules{,_bk} +if [ "${IPTABLES_STATUS}" == "no" ]; then + [ -e "/etc/iptables.up.rules" ] && /bin/mv /etc/iptables.up.rules{,_bk} cat > /etc/iptables.up.rules << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. @@ -159,8 +124,8 @@ COMMIT EOF fi -FW_PORT_FLAG=`grep -ow "dport $SSH_PORT" /etc/iptables.up.rules` -[ -z "$FW_PORT_FLAG" -a "$SSH_PORT" != '22' ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport $SSH_PORT -j ACCEPT@" /etc/iptables.up.rules +FW_PORT_FLAG=$(grep -ow "dport ${SSH_PORT}" /etc/iptables.up.rules) +[ -z "${FW_PORT_FLAG}" -a "${SSH_PORT}" != "22" ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport ${SSH_PORT} -j ACCEPT@" /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules cat > /etc/network/if-pre-up.d/iptables << EOF #!/bin/bash @@ -171,4 +136,3 @@ service ssh restart . /etc/profile . ~/.bashrc -popd diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 4ae34d28..ca1d2b0b 100644 --- a/include/mariadb-10.0.sh +++ b/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 "drop database test;" ${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 ldconfig service mysqld stop diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 8ac71a20..4f02016e 100644 --- a/include/mariadb-10.1.sh +++ b/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 "drop database test;" ${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 ldconfig service mysqld stop diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 9c8c83ca..470fe8fe 100644 --- a/include/mariadb-5.5.sh +++ b/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 "drop database test;" ${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 ldconfig service mysqld stop diff --git a/include/memcached.sh b/include/memcached.sh index 408cf69b..ec03f70d 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -10,9 +10,11 @@ Install_memcached() { pushd ${oneinstack_dir}/src + # memcached server id -u memcached >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached + tar xzf memcached-${memcached_version}.tar.gz pushd memcached-${memcached_version} [ ! -d "${memcached_install_dir}" ] && mkdir -p ${memcached_install_dir} @@ -23,11 +25,12 @@ Install_memcached() { echo "${CSUCCESS}memcached installed successfully! ${CEND}" rm -rf memcached-${memcached_version} ln -s ${memcached_install_dir}/bin/memcached /usr/bin/memcached - [ "$OS" == 'CentOS' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } + [ "${OS}" == "CentOS" ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } sed -i "s@/usr/local/memcached@${memcached_install_dir}@g" /etc/init.d/memcached - [ -n "`grep 'CACHESIZE=' /etc/init.d/memcached`" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=`expr $Mem / 8`@" /etc/init.d/memcached - [ -n "`grep 'start_instance default 256;' /etc/init.d/memcached`" ] && sed -i "s@start_instance default 256;@start_instance default `expr $Mem / 8`;@" /etc/init.d/memcached + let memcachedCache="${Mem}/8" + [ -n "$(grep 'CACHESIZE=' /etc/init.d/memcached)" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=${memcachedCache}@" /etc/init.d/memcached + [ -n "$(grep 'start_instance default 256;' /etc/init.d/memcached)" ] && sed -i "s@start_instance default 256;@start_instance default ${memcachedCache};@" /etc/init.d/memcached service memcached start rm -rf memcached-${memcached_version} else @@ -40,11 +43,12 @@ Install_memcached() { Install_php-memcache() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) if [ -e "${php_install_dir}/bin/phpize" ]; then # php memcache extension - if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + if [ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}')" == '7' ]; then #git clone https://github.com/websupport-sk/pecl-memcache.git + #cd pecl-memcache tar xzf pecl-memcache-php7.tgz pushd pecl-memcache-php7 else @@ -56,7 +60,7 @@ Install_php-memcache() { make -j ${THREAD} && make install popd if [ -f "${phpExtensionDir}/memcache.so" ]; then - echo 'extension=memcache.so' > ${php_install_dir}/etc/php.d/ext-memcache.ini + echo "extension=memcache.so" > ${php_install_dir}/etc/php.d/ext-memcache.ini echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}" rm -rf pecl-memcache-php7 memcache-${memcache_pecl_version} else @@ -68,20 +72,21 @@ Install_php-memcache() { Install_php-memcached() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) if [ -e "${php_install_dir}/bin/phpize" ]; then # php memcached extension - tar xzf libmemcached-$libmemcached_version.tar.gz - pushd libmemcached-$libmemcached_version - [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure + tar xzf libmemcached-${libmemcached_version}.tar.gz + pushd libmemcached-${libmemcached_version} + [ "${OS}" == "CentOS" ] && yum -y install cyrus-sasl-devel + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure ./configure --with-memcached=${memcached_install_dir} make -j ${THREAD} && make install popd - rm -rf libmemcached-$libmemcached_version + rm -rf libmemcached-${libmemcached_version} - if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then + if [ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}')" == '7' ]; then #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git + #cd php-memcached tar xzf php-memcached-php7.tgz pushd php-memcached-php7 else @@ -93,7 +98,7 @@ Install_php-memcached() { make -j ${THREAD} && make install popd if [ -f "${phpExtensionDir}/memcached.so" ]; then - cat > ${php_install_dir}/etc/php.d/ext-memcached.ini << EOF + cat > ${php_install_dir}/etc/php.d/ext-memcached.ini << EOF extension=memcached.so memcached.use_sasl=1 EOF diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 40f79d5c..87e49d28 100644 --- a/include/mysql-5.5.sh +++ b/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 "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 + 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 echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 86db9db9..e2a6ef82 100644 --- a/include/mysql-5.6.sh +++ b/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 "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 + 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 echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 87e1db5d..2cbd99e6 100644 --- a/include/mysql-5.7.sh +++ b/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@'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 + 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 echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig diff --git a/include/nginx.sh b/include/nginx.sh index f48f9342..7e06f567 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -35,7 +35,7 @@ Install_Nginx() { fi [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir - ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ]; then popd diff --git a/include/openresty.sh b/include/openresty.sh index b4fb4743..2f875c99 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -32,7 +32,7 @@ Install_OpenResty() { fi [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ]; then popd diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 5bf9b2da..b0d4aafe 100644 --- a/include/percona-5.5.sh +++ b/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 "drop database test;" ${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 ldconfig service mysqld stop diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 43a33123..7d07a32e 100644 --- a/include/percona-5.6.sh +++ b/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 "drop database test;" ${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 ldconfig service mysqld stop diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 846fe3cc..56751b20 100644 --- a/include/percona-5.7.sh +++ b/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@'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 + 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 echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/mysql.conf ldconfig diff --git a/include/pureftpd.sh b/include/pureftpd.sh index cd63a396..63415939 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -10,53 +10,53 @@ Install_PureFTPd() { pushd ${oneinstack_dir}/src - - id -u $run_user >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - - tar xzf pure-ftpd-$pureftpd_version.tar.gz - pushd pure-ftpd-$pureftpd_version - [ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir - ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 + + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} + + tar xzf pure-ftpd-${pureftpd_version}.tar.gz + pushd pure-ftpd-${pureftpd_version} + [ ! -d "${pureftpd_install_dir}" ] && mkdir -p ${pureftpd_install_dir} + ./configure --prefix=${pureftpd_install_dir} CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 make -j ${THREAD} && make install - if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ]; then - echo "${CSUCCESS}Pure-Ftp installed successfully! ${CEND}" - [ ! -e "$pureftpd_install_dir/etc" ] && mkdir $pureftpd_install_dir/etc - cp configuration-file/pure-config.pl $pureftpd_install_dir/sbin - sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@" $pureftpd_install_dir/sbin/pure-config.pl - chmod +x $pureftpd_install_dir/sbin/pure-config.pl + if [ -e "${pureftpd_install_dir}/sbin/pure-ftpwho" ]; then + [ ! -e "${pureftpd_install_dir}/etc" ] && mkdir ${pureftpd_install_dir}/etc + /bin/cp configuration-file/pure-config.pl ${pureftpd_install_dir}/sbin popd - /bin/cp ../init.d/Pureftpd-init /etc/init.d/pureftpd - sed -i "s@/usr/local/pureftpd@$pureftpd_install_dir@g" /etc/init.d/pureftpd + sed -i "s@/usr/local/pureftpd@${pureftpd_install_dir}@" ${pureftpd_install_dir}/sbin/pure-config.pl + chmod +x ${pureftpd_install_dir}/sbin/pure-config.pl + /bin/cp ../init.d/Pureftpd-init /etc/init.d/pureftpd + /bin/cp ../config/pure-ftpd.conf ${pureftpd_install_dir}/etc + sed -i "s@/usr/local/pureftpd@${pureftpd_install_dir}@g" /etc/init.d/pureftpd chmod +x /etc/init.d/pureftpd - [ "$OS" == 'CentOS' ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } - [ "$Debian_version" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd + [ "${OS}" == "CentOS" ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } + [ "${Debian_version}" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd - /bin/cp ../config/pure-ftpd.conf $pureftpd_install_dir/etc - sed -i "s@^PureDB.*@PureDB $pureftpd_install_dir/etc/pureftpd.pdb@" $pureftpd_install_dir/etc/pure-ftpd.conf - sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" $pureftpd_install_dir/etc/pure-ftpd.conf + sed -i "s@^PureDB.*@PureDB ${pureftpd_install_dir}/etc/pureftpd.pdb@" ${pureftpd_install_dir}/etc/pure-ftpd.conf + sed -i "s@^LimitRecursion.*@LimitRecursion 65535 8@" ${pureftpd_install_dir}/etc/pure-ftpd.conf ulimit -s unlimited service pureftpd start - echo "${CSUCCESS}Pureftpd installed successfully! ${CEND}" - rm -rf pure-ftpd-$pureftpd_version # iptables Ftp - if [ "$OS" == 'CentOS' ]; then - if [ -z "`grep '20000:30000' /etc/sysconfig/iptables`" ]; then + if [ "${OS}" == "CentOS" ]; then + if [ -z "$(grep '20000:30000' /etc/sysconfig/iptables)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT service iptables save fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "`grep '20000:30000' /etc/iptables.up.rules`" ]; then + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep '20000:30000' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT iptables-save > /etc/iptables.up.rules fi fi + + echo "${CSUCCESS}Pure-Ftp installed successfully! ${CEND}" + rm -rf pure-ftpd-${pureftpd_version} else - rm -rf $pureftpd_install_dir + rm -rf ${pureftpd_install_dir} echo "${CFAILURE}Pure-Ftpd install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/tengine.sh b/include/tengine.sh index 99d343ee..6dad7c55 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -33,7 +33,7 @@ Install_Tengine() { fi [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir - ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then popd diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 83f3e040..b8a5b0fd 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -9,112 +9,120 @@ # https://github.com/lj2007331/oneinstack Install_tomcat-6() { - cd ${oneinstack_dir}/src + pushd ${oneinstack_dir}/src . /etc/profile - - id -u $run_user >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - - tar xzf apache-tomcat-$tomcat_6_version.tar.gz - [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir - /bin/cp -R apache-tomcat-$tomcat_6_version/* $tomcat_install_dir - rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - - if [ -e "$tomcat_install_dir/conf/server.xml" ]; then - /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib - cd $tomcat_install_dir/lib - [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina - cd $tomcat_install_dir/lib/catalina - jar xf ../catalina.jar - sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties - sed -i 's@^server.number=.*@server.number=6@' org/apache/catalina/util/ServerInfo.properties - sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties - jar cf ../catalina.jar ./* - cd ../../bin - rm -rf $tomcat_install_dir/lib/catalina - [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev - tar xzf tomcat-native.tar.gz - cd tomcat-native-*-src/jni/native/ + + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + + tar xzf apache-tomcat-${tomcat_6_version}.tar.gz + [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat_6_version}/* ${tomcat_install_dir} + rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then + rm -rf ${tomcat_install_dir} + echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + + /bin/cp catalina-jmx-remote.jar ${tomcat_install_dir}/lib + [ ! -d "${tomcat_install_dir}/lib/catalina" ] && mkdir ${tomcat_install_dir}/lib/catalina + pushd ${tomcat_install_dir}/lib/catalina + jar xf ../catalina.jar + sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties + sed -i 's@^server.number=.*@server.number=6@' org/apache/catalina/util/ServerInfo.properties + sed -i "s@^server.built=.*@server.built=$(date)@" org/apache/catalina/util/ServerInfo.properties + jar cf ../catalina.jar ./* + popd + rm -rf ${tomcat_install_dir}/lib/catalina + + [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev + pushd ${tomcat_install_dir}/bin + tar xzf tomcat-native.tar.gz + pushd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ]; then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' + popd + rm -rf tomcat-native-* + if [ -d "/usr/local/apr/lib" ]; then + [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 + let XmxMem="${Mem}/2" + cat > ${tomcat_install_dir}/bin/setenv.sh << EOF +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx${XmxMem}m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd ${oneinstack_dir}/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml - sed -i /ThreadLocalLeakPreventionListener/d $tomcat_install_dir/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then - if [ "$OS" == 'CentOS' ]; then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi + chmod +x ./*.sh + /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk} + popd # goto ${oneinstack_dir}/src + + /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf + sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml + sed -i /ThreadLocalLeakPreventionListener/d ${tomcat_install_dir}/conf/server.xml + if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then + if [ "${OS}" == "CentOS" ]; then + if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost + cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF -$tomcat_install_dir/logs/catalina.out { -daily -rotate 5 -missingok -dateext -compress -notifempty -copytruncate + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF +${tomcat_install_dir}/logs/catalina.out { + daily + rotate 5 + missingok + dateext + compress + notifempty + copytruncate } EOF - [ -z "`grep '/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - - tar xzf apache-tomcat-$tomcat_7_version.tar.gz - [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir - /bin/cp -R apache-tomcat-$tomcat_7_version/* $tomcat_install_dir - rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - - if [ -e "$tomcat_install_dir/conf/server.xml" ]; then - /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib - cd $tomcat_install_dir/lib - [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina - cd $tomcat_install_dir/lib/catalina - jar xf ../catalina.jar - sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties - sed -i 's@^server.number=.*@server.number=7@' org/apache/catalina/util/ServerInfo.properties - sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties - jar cf ../catalina.jar ./* - cd ../../bin - rm -rf $tomcat_install_dir/lib/catalina - [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev - tar xzf tomcat-native.tar.gz - cd tomcat-native-*-src/jni/native/ + + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + + tar xzf apache-tomcat-${tomcat_7_version}.tar.gz + [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat_7_version}/* ${tomcat_install_dir} + rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then + rm -rf ${tomcat_install_dir} + echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + + /bin/cp catalina-jmx-remote.jar ${tomcat_install_dir}/lib + [ ! -d "${tomcat_install_dir}/lib/catalina" ] && mkdir ${tomcat_install_dir}/lib/catalina + pushd ${tomcat_install_dir}/lib/catalina + jar xf ../catalina.jar + sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties + sed -i 's@^server.number=.*@server.number=7@' org/apache/catalina/util/ServerInfo.properties + sed -i "s@^server.built=.*@server.built=$(date)@" org/apache/catalina/util/ServerInfo.properties + jar cf ../catalina.jar ./* + popd + rm -rf ${tomcat_install_dir}/lib/catalina + + [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev + pushd ${tomcat_install_dir}/bin + tar xzf tomcat-native.tar.gz + pushd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ]; then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' + popd + rm -rf tomcat-native-* + if [ -d "/usr/local/apr/lib" ]; then + [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 + let XmxMem="${Mem}/2" + cat > ${tomcat_install_dir}/bin/setenv.sh << EOF +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx${XmxMem}m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd ${oneinstack_dir}/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + chmod +x ./*.sh + /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk} + popd # goto ${oneinstack_dir}/src + + /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf + sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then - if [ "$OS" == 'CentOS' ]; then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi + if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then + if [ "${OS}" == "CentOS" ]; then + if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost + cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF -$tomcat_install_dir/logs/catalina.out { -daily -rotate 5 -missingok -dateext -compress -notifempty -copytruncate + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF +${tomcat_install_dir}/logs/catalina.out { + daily + rotate 5 + missingok + dateext + compress + notifempty + copytruncate } EOF - [ -z "`grep '/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; } - - tar xzf apache-tomcat-$tomcat_8_version.tar.gz - [ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir - /bin/cp -R apache-tomcat-$tomcat_8_version/* $tomcat_install_dir - rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*} - - if [ -e "$tomcat_install_dir/conf/server.xml" ]; then - /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib - cd $tomcat_install_dir/lib - [ ! -d "$tomcat_install_dir/lib/catalina" ] && mkdir $tomcat_install_dir/lib/catalina - cd $tomcat_install_dir/lib/catalina - jar xf ../catalina.jar - sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties - sed -i 's@^server.number=.*@server.number=8@' org/apache/catalina/util/ServerInfo.properties - sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties - jar cf ../catalina.jar ./* - cd ../../bin - rm -rf $tomcat_install_dir/lib/catalina - [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev - tar xzf tomcat-native.tar.gz - cd tomcat-native-*-src/jni/native/ + + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + + tar xzf apache-tomcat-${tomcat_8_version}.tar.gz + [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat_8_version}/* ${tomcat_install_dir} + rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} + + if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then + rm -rf ${tomcat_install_dir} + echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + + /bin/cp catalina-jmx-remote.jar ${tomcat_install_dir}/lib + [ ! -d "${tomcat_install_dir}/lib/catalina" ] && mkdir ${tomcat_install_dir}/lib/catalina + pushd ${tomcat_install_dir}/lib/catalina + jar xf ../catalina.jar + sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties + sed -i 's@^server.number=.*@server.number=8@' org/apache/catalina/util/ServerInfo.properties + sed -i "s@^server.built=.*@server.built=$(date)@" org/apache/catalina/util/ServerInfo.properties + jar cf ../catalina.jar ./* + popd + rm -rf ${tomcat_install_dir}/lib/catalina + + [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev + pushd ${tomcat_install_dir}/bin + tar xzf tomcat-native.tar.gz + pushd tomcat-native-*-src/jni/native/ rm -rf /usr/local/apr ./configure --with-apr=/usr/bin/apr-1-config make -j ${THREAD} && make install - if [ -d "/usr/local/apr/lib" ]; then - [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256 - cat > $tomcat_install_dir/bin/setenv.sh << EOF -JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m -Dfile.encoding=UTF-8' + popd + rm -rf tomcat-native-* + if [ -d "/usr/local/apr/lib" ]; then + [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 + let XmxMem="${Mem}/2" + cat > ${tomcat_install_dir}/bin/setenv.sh << EOF +JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx${XmxMem}m -Dfile.encoding=UTF-8' CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" # -Djava.rmi.server.hostname=$IPADDR # -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password # -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access # -Dcom.sun.management.jmxremote.ssl=false" EOF - cd ../../../;rm -rf tomcat-native-* - chmod +x $tomcat_install_dir/bin/*.sh - /bin/mv $tomcat_install_dir/conf/server.xml{,_bk} - cd ${oneinstack_dir}/src - /bin/cp ../config/server.xml $tomcat_install_dir/conf - sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml + chmod +x ./*.sh + /bin/mv ${tomcat_install_dir}/conf/server.xml{,_bk} + popd # goto ${oneinstack_dir}/src + + /bin/cp ${oneinstack_dir}/config/server.xml ${tomcat_install_dir}/conf + sed -i "s@/usr/local/tomcat@${tomcat_install_dir}@g" ${tomcat_install_dir}/conf/server.xml - if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then - if [ "$OS" == 'CentOS' ]; then - if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - service iptables save - fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "`grep -w '8080' /etc/iptables.up.rules`" ]; then - iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi + if [ ! -e "${nginx_install_dir}/sbin/nginx" -a ! -e "${tengine_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then + if [ "${OS}" == "CentOS" ]; then + if [ -z "$(grep -w '8080' /etc/sysconfig/iptables)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + service iptables save + fi + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then + iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT + iptables-save > /etc/iptables.up.rules fi fi + fi - [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost - cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF + [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost + cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF - # logrotate tomcat catalina.out - cat > /etc/logrotate.d/tomcat << EOF -$tomcat_install_dir/logs/catalina.out { -daily -rotate 5 -missingok -dateext -compress -notifempty -copytruncate + # logrotate tomcat catalina.out + cat > /etc/logrotate.d/tomcat << EOF +${tomcat_install_dir}/logs/catalina.out { + daily + rotate 5 + missingok + dateext + compress + notifempty + copytruncate } EOF - [ -z "`grep ' ${php_install_dir}/etc/php.d/ext-xcache.ini << EOF [xcache-common] extension=xcache.so [xcache.admin] xcache.admin.enable_auth=On xcache.admin.user=admin -xcache.admin.pass="$xcache_admin_md5_pass" +xcache.admin.pass="${xcache_admin_md5_pass}" [xcache] -xcache.size=$(expr $Memory_limit / 2)M -xcache.count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.size=${xcacheSize}M +xcache.count=${xcacheCount} xcache.slots=8K xcache.ttl=3600 xcache.gc_interval=300 xcache.var_size=4M -xcache.var_count=$(expr `cat /proc/cpuinfo | grep -c processor` + 1) +xcache.var_count=${xcacheCount} xcache.var_slots=8K xcache.var_ttl=0 xcache.var_maxttl=0 diff --git a/include/zendopcache.sh b/include/zendopcache.sh index 0c3d7cc1..4aa16d10 100644 --- a/include/zendopcache.sh +++ b/include/zendopcache.sh @@ -10,19 +10,30 @@ Install_ZendOPcache() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` - tar xzf zendopcache-$zendopcache_version.tgz - pushd zendopcache-$zendopcache_version + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) + PHP_detail_version=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') + PHP_main_version=${PHP_detail_version%.*} + if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then + tar xvf zendopcache-${zendopcache_version}.tgz + pushd zendopcache-${zendopcache_version} + else + tar xvf php-${PHP_detail_version}.tar.gz + pushd php-${PHP_detail_version}/ext/opcache + fi + ${php_install_dir}/bin/phpize ./configure --with-php-config=${php_install_dir}/bin/php-config make -j ${THREAD} && make install popd if [ -f "${phpExtensionDir}/opcache.so" ]; then - cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF + # write opcache configs + if [[ "${PHP_main_version}" =~ ^5.[3-4]$ ]]; then + # For php 5.3 5.4 + cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF [opcache] zend_extension=${phpExtensionDir}/opcache.so opcache.enable=1 -opcache.memory_consumption=$Memory_limit +opcache.memory_consumption=${Memory_limit} opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 @@ -31,8 +42,29 @@ opcache.fast_shutdown=1 opcache.enable_cli=1 ;opcache.optimization_level=0 EOF + else + # For php 5.5+ + cat > ${php_install_dir}/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=${Memory_limit} +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=100000 +opcache.max_wasted_percentage=5 +opcache.use_cwd=1 +opcache.validate_timestamps=1 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.consistency_checks=0 +;opcache.optimization_level=0 +EOF + fi + echo "${CSUCCESS}PHP OPcache module installed successfully! ${CEND}" - rm -rf zendopcache-${zendopcache_version} + rm -rf zendopcache-${zendopcache_version} php-${PHP_detail_version} else echo "${CFAILURE}PHP OPcache module install failed, Please contact the author! ${CEND}" fi diff --git a/init.d/Memcached-init-CentOS b/init.d/Memcached-init-CentOS index f967724a..fe90d14b 100755 --- a/init.d/Memcached-init-CentOS +++ b/init.d/Memcached-init-CentOS @@ -27,10 +27,10 @@ start () { echo -n $"Starting $prog: " # insure that /var/run/memcached has proper permissions mkdir -p /var/run/memcached - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + if [ "$(stat -c %U /var/run/memcached)" != "$USER" ]; then chown $USER /var/run/memcached fi - $DAEMON -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS + daemon $DAEMON -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached diff --git a/init.d/Memcached-init-Ubuntu b/init.d/Memcached-init-Ubuntu index d8ef3c10..69bdbec5 100755 --- a/init.d/Memcached-init-Ubuntu +++ b/init.d/Memcached-init-Ubuntu @@ -1,4 +1,20 @@ -#! /bin/sh +#! /bin/bash +### BEGIN INIT INFO +# Provides: memcached +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: memcached - Memory caching daemon +# Description: memcached - Memory caching daemon +### END INIT INFO +# +# memcached: MemCached Daemon +# +# chkconfig: - 90 25 +# description: MemCached Daemon # PORT=11211 @@ -16,7 +32,7 @@ start_instance() { RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 - PORT=`expr $PORT + 1` + let PORT="$PORT+1" } stop_instance() { @@ -32,7 +48,7 @@ stop_instance() { start () { # insure that /var/run/memcached has proper permissions mkdir -p /var/run/memcached - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + if [ "$(stat -c %U /var/run/memcached)" != "$USER" ]; then chown $USER /var/run/memcached fi diff --git a/init.d/Pureftpd-init b/init.d/Pureftpd-init index c72344e5..c4feb6d9 100755 --- a/init.d/Pureftpd-init +++ b/init.d/Pureftpd-init @@ -1,5 +1,13 @@ #!/bin/bash -# +### BEGIN INIT INFO +# Provides: pureftpd +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Startup script for the pure-ftpd FTP Server +# Description: pureftpd daemon +### END INIT INFO # Startup script for the pure-ftpd FTP Server $Revision: 1.3 $ # # chkconfig: 2345 85 15 diff --git a/init.d/Redis-server-init b/init.d/Redis-server-init index 53be3f81..f8d43f27 100755 --- a/init.d/Redis-server-init +++ b/init.d/Redis-server-init @@ -11,7 +11,6 @@ # Description: redis-server - Persistent key-value db ### END INIT INFO - PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/redis/bin/redis-server DAEMON_ARGS=/usr/local/redis/etc/redis.conf @@ -31,7 +30,7 @@ case "$1" in chown redis:redis $PIDFILE if start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS then - echo "$NAME." + echo -e "\e[00;32m[OK]\e[00m" else echo "failed" fi @@ -40,7 +39,7 @@ case "$1" in echo -n "Stopping $DESC: " if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON then - echo "$NAME." + echo -e "\e[00;32m[OK]\e[00m" else echo "failed" fi diff --git a/init.d/Shadowsocks-python-init b/init.d/Shadowsocks-python-init index 753295e1..715735af 100755 --- a/init.d/Shadowsocks-python-init +++ b/init.d/Shadowsocks-python-init @@ -1,6 +1,15 @@ #!/bin/bash # Author: yeho # BLOG: https://blog.linuxeye.com +### BEGIN INIT INFO +# Provides: shadowsocks +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Start: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: shadowsocks - Shadowsocks-python starts daemon +# Description: shadowsocks - lightweight secured scoks5 proxy +### END INIT INFO # # chkconfig: - 90 10 # description: Shadowsocks start/stop/status/restart script diff --git a/init.d/Tomcat-init b/init.d/Tomcat-init index 71f67bfd..0c45c2f2 100755 --- a/init.d/Tomcat-init +++ b/init.d/Tomcat-init @@ -1,4 +1,13 @@ #!/bin/bash +### BEGIN INIT INFO +# Provides: tomcat +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: tomcat-server daemon +# Description: tomcat-server daemon +### END INIT INFO # # chkconfig: - 95 15 # description: Tomcat start/stop/status script diff --git a/install.sh b/install.sh index f40dd74e..bd5a261d 100755 --- a/install.sh +++ b/install.sh @@ -95,62 +95,62 @@ while :; do echo fi done # Tomcat - #while :; do echo - # echo 'Please select tomcat server:' - # echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" - # echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" - # echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" - # echo -e "\t${CMSG}4${CEND}. Do not install" - # read -p "Please input a number:(Default 4 press Enter) " Tomcat_version - # [ -z "$Tomcat_version" ] && Tomcat_version=4 - # if [[ ! $Tomcat_version =~ ^[1-4]$ ]]; then - # echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - # else - # [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } - # if [ "$Tomcat_version" == '1' ]; then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[1-2]$ ]]; then - # echo "${CWARNING}input error! Please only input number 1,2${CEND}" - # else - # break - # fi - # done - # elif [ "$Tomcat_version" == '2' ]; then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[1-3]$ ]]; then - # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - # else - # break - # fi - # done - # elif [ "$Tomcat_version" == '3' ]; then - # while :; do echo - # echo 'Please select JDK version:' - # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - # read -p "Please input a number:(Default 2 press Enter) " JDK_version - # [ -z "$JDK_version" ] && JDK_version=2 - # if [[ ! $JDK_version =~ ^[2-3]$ ]]; then - # echo "${CWARNING}input error! Please only input number 2,3${CEND}" - # else - # break - # fi - # done - # fi - # break - # fi - #done + while :; do echo + echo 'Please select tomcat server:' + echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" + echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" + echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" + echo -e "\t${CMSG}4${CEND}. Do not install" + read -p "Please input a number:(Default 4 press Enter) " Tomcat_version + [ -z "$Tomcat_version" ] && Tomcat_version=4 + if [[ ! $Tomcat_version =~ ^[1-4]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + else + [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } + if [ "$Tomcat_version" == '1' ]; then + while :; do echo + echo 'Please select JDK version:' + echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + read -p "Please input a number:(Default 2 press Enter) " JDK_version + [ -z "$JDK_version" ] && JDK_version=2 + if [[ ! $JDK_version =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi + done + elif [ "$Tomcat_version" == '2' ]; then + while :; do echo + echo 'Please select JDK version:' + echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + read -p "Please input a number:(Default 2 press Enter) " JDK_version + [ -z "$JDK_version" ] && JDK_version=2 + if [[ ! $JDK_version =~ ^[1-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + else + break + fi + done + elif [ "$Tomcat_version" == '3' ]; then + while :; do echo + echo 'Please select JDK version:' + echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + read -p "Please input a number:(Default 2 press Enter) " JDK_version + [ -z "$JDK_version" ] && JDK_version=2 + if [[ ! $JDK_version =~ ^[2-3]$ ]]; then + echo "${CWARNING}input error! Please only input number 2,3${CEND}" + else + break + fi + done + fi + break + fi + done fi break fi @@ -166,39 +166,42 @@ while :; do echo [ -d "$db_install_dir/support-files" ] && { echo "${CWARNING}Database already installed! ${CEND}"; DB_yn=Other; break; } while :; do echo echo 'Please select a version of the Database:' - echo -e "\t${CMSG}1${CEND}. Install MySQL-5.7" - echo -e "\t${CMSG}2${CEND}. Install MySQL-5.6" - echo -e "\t${CMSG}3${CEND}. Install MySQL-5.5" - echo -e "\t${CMSG}4${CEND}. Install MariaDB-10.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.7" - echo -e "\t${CMSG}8${CEND}. Install Percona-5.6" - echo -e "\t${CMSG}9${CEND}. Install Percona-5.5" + echo -e "\t${CMSG} 1${CEND}. Install MySQL-5.7" + echo -e "\t${CMSG} 2${CEND}. Install MySQL-5.6" + echo -e "\t${CMSG} 3${CEND}. Install MySQL-5.5" + echo -e "\t${CMSG} 4${CEND}. Install MariaDB-10.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.7" + echo -e "\t${CMSG} 8${CEND}. Install Percona-5.6" + echo -e "\t${CMSG} 9${CEND}. Install Percona-5.5" + echo -e "\t${CMSG}10${CEND}. Install AliSQL-5.6" read -p "Please input a number:(Default 2 press Enter) " DB_version [ -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}" - else + if [ ${DB_version} -ge 1 >/dev/null 2>&1 -a ${DB_version} -le 10 >/dev/null 2>&1 ]; then while :; do read -p "Please input the root password of database: " dbrootpwd [ -n "`echo $dbrootpwd | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } (( ${#dbrootpwd} >= 5 )) && sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ./options.conf && break || echo "${CWARNING}database root password least 5 characters! ${CEND}" done # 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 + else + echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6,7,8,9,10${CEND}" fi done fi @@ -418,7 +421,7 @@ while :; do echo done # check jemalloc or tcmalloc -if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ]; then +if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then while :; do echo 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 @@ -471,20 +474,42 @@ IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR` IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'` [ "`echo $IPADDR_COUNTRY_ISP | awk '{print $2}'`"x == '1000323'x ] && IPADDR_ISP=aliyun -# check download src -. ./include/check_download.sh -checkDownload 2>&1 | tee $oneinstack_dir/install.log +# Check binary dependencies packages +. ./include/check_sw.sh +case "${OS}" in + "CentOS") + installDepsCentOS 2>&1 | tee ${oneinstack_dir}/install.log + ;; + "Debian") + installDepsDebian 2>&1 | tee ${oneinstack_dir}/install.log + ;; + "Ubuntu") + installDepsUbuntu 2>&1 | tee ${oneinstack_dir}/install.log + ;; +esac # init . ./include/memory.sh -if [ "$OS" == 'CentOS' ]; then - . include/init_CentOS.sh 2>&1 | tee -a $oneinstack_dir/install.log - [ -n "`gcc --version | head -n1 | grep '4\.1\.'`" ] && export CC="gcc44" CXX="g++44" -elif [ "$OS" == 'Debian' ]; then - . include/init_Debian.sh 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$OS" == 'Ubuntu' ]; then - . include/init_Ubuntu.sh 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${OS}" in + "CentOS") + . include/init_CentOS.sh 2>&1 | tee -a ${oneinstack_dir}/install.log + [ -n "$(gcc --version | head -n1 | grep '4\.1\.')" ] && export CC="gcc44" CXX="g++44" + ;; + "Debian") + . include/init_Debian.sh 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + "Ubuntu") + . include/init_Ubuntu.sh 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; +esac + +# Check download source packages +. ./include/check_download.sh +downloadDepsSrc=1 +checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log + +# Install dependencies from source package +installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log # jemalloc or tcmalloc if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ]; then @@ -501,46 +526,60 @@ if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib fi # Database -if [ "$DB_version" == '1' ]; then - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . include/mysql-5.7.sh - Install_MySQL-5-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '2' ]; then - . include/mysql-5.6.sh - Install_MySQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '3' ]; then - . include/mysql-5.5.sh - Install_MySQL-5-5 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '4' ]; then - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . include/mariadb-10.1.sh - Install_MariaDB-10-1 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$DB_version" == '5' ]; then - . include/mariadb-10.0.sh - Install_MariaDB-10-0 2>&1 | tee -a $oneinstack_dir/install.log -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 - if [ "${dbInstallMethods}" == "2" ]; then - . include/boost.sh - installBoost 2>&1 | tee -a $oneinstack_dir/install.log - fi - . 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" == '9' ]; then - . include/percona-5.5.sh - Install_Percona-5-5 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${DB_version}" in + 1) + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log + fi + . include/mysql-5.7.sh + Install_MySQL-5-7 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 2) + . include/mysql-5.6.sh + Install_MySQL-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/mysql-5.5.sh + Install_MySQL-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 4) + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log + fi + . include/mariadb-10.1.sh + Install_MariaDB-10-1 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 5) + . include/mariadb-10.0.sh + Install_MariaDB-10-0 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 6) + . include/mariadb-5.5.sh + Install_MariaDB-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 7) + if [ "${dbInstallMethods}" == "2" ]; then + . include/boost.sh + installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log + fi + . include/percona-5.7.sh + Install_Percona-5-7 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 8) + . include/percona-5.6.sh + Install_Percona-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 9) + . include/percona-5.5.sh + Install_Percona-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 10) + . include/alisql-5.6.sh + Install_AliSQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log + ;; +esac # Apache if [ "$Apache_version" == '1' ]; then @@ -552,22 +591,28 @@ elif [ "$Apache_version" == '2' ]; then fi # PHP -if [ "$PHP_version" == '1' ]; then - . include/php-5.3.sh - Install_PHP-5-3 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '2' ]; then - . include/php-5.4.sh - Install_PHP-5-4 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '3' ]; then - . include/php-5.5.sh - Install_PHP-5-5 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '4' ]; then - . include/php-5.6.sh - Install_PHP-5-6 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_version" == '5' ]; then - . include/php-7.0.sh - Install_PHP-7-0 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${PHP_version}" in + 1) + . include/php-5.3.sh + Install_PHP-5-3 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 2) + . include/php-5.4.sh + Install_PHP-5-4 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/php-5.5.sh + Install_PHP-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 4) + . include/php-5.6.sh + Install_PHP-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 5) + . include/php-7.0.sh + Install_PHP-7-0 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; +esac # ImageMagick or GraphicsMagick if [ "$Magick" == '1' ]; then @@ -587,22 +632,28 @@ if [ "$ionCube_yn" == 'y' ]; then fi # PHP opcode cache -if [ "$PHP_cache" == '1' ] && [[ "$PHP_version" =~ ^[1,2]$ ]]; then - . include/zendopcache.sh - Install_ZendOPcache 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '2' ]; then - . include/xcache.sh - Install_XCache 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '3' ]; then - . include/apcu.sh - Install_APCU 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '4' -a "$PHP_version" == '2' ]; then - . include/eaccelerator-1.0-dev.sh - Install_eAccelerator-1-0-dev 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$PHP_cache" == '4' -a "$PHP_version" == '1' ]; then - . include/eaccelerator-0.9.sh - Install_eAccelerator-0-9 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${PHP_cache}" in + 1) + if [[ "${PHP_version}" =~ ^[1,2]$ ]]; then + . include/zendopcache.sh + Install_ZendOPcache 2>&1 | tee -a ${oneinstack_dir}/install.log + fi + ;; + 2) + . include/xcache.sh + Install_XCache 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/apcu.sh + Install_APCU 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 4) + if [[ "${PHP_version}" =~ ^[1,2]$ ]]; then + . include/eaccelerator.sh + Install_eAccelerator 2>&1 | tee -a ${oneinstack_dir}/install.log + fi + ;; +esac # ZendGuardLoader (php <= 5.6) if [ "$ZendGuardLoader_yn" == 'y' ]; then @@ -611,118 +662,130 @@ if [ "$ZendGuardLoader_yn" == 'y' ]; then fi # Web server -if [ "$Nginx_version" == '1' ]; then - . include/nginx.sh - Install_Nginx 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Nginx_version" == '2' ]; then - . include/tengine.sh - Install_Tengine 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Nginx_version" == '3' ]; then - . include/openresty.sh - Install_OpenResty 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${Nginx_version}" in + 1) + . include/nginx.sh + Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 2) + . include/tengine.sh + Install_Tengine 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/openresty.sh + Install_OpenResty 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; +esac # JDK -if [ "$JDK_version" == '1' ]; then - . include/jdk-1.8.sh - Install-JDK-1-8 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$JDK_version" == '2' ]; then - . include/jdk-1.7.sh - Install-JDK-1-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$JDK_version" == '3' ]; then - . include/jdk-1.6.sh - Install-JDK-1-6 2>&1 | tee -a $oneinstack_dir/install.log -fi - -if [ "$Tomcat_version" == '1' ]; then - . include/tomcat-8.sh - Install_tomcat-8 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Tomcat_version" == '2' ]; then - . include/tomcat-7.sh - Install_tomcat-7 2>&1 | tee -a $oneinstack_dir/install.log -elif [ "$Tomcat_version" == '3' ]; then - . include/tomcat-6.sh - Install_tomcat-6 2>&1 | tee -a $oneinstack_dir/install.log -fi +case "${JDK_version}" in + 1) + . include/jdk-1.8.sh + Install-JDK-1-8 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 2) + . include/jdk-1.7.sh + Install-JDK-1-7 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/jdk-1.6.sh + Install-JDK-1-6 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; +esac + +case "${Tomcat_version}" in + 1) + . include/tomcat-8.sh + Install_tomcat-8 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 2) + . include/tomcat-7.sh + Install_tomcat-7 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 3) + . include/tomcat-6.sh + Install_tomcat-6 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; +esac # Pure-FTPd -if [ "$FTP_yn" == 'y' ]; then +if [ "${FTP_yn}" == 'y' ]; then . include/pureftpd.sh - Install_PureFTPd 2>&1 | tee -a $oneinstack_dir/install.log + Install_PureFTPd 2>&1 | tee -a ${oneinstack_dir}/install.log fi # phpMyAdmin -if [ "$phpMyAdmin_yn" == 'y' ]; then +if [ "${phpMyAdmin_yn}" == 'y' ]; then . include/phpmyadmin.sh - Install_phpMyAdmin 2>&1 | tee -a $oneinstack_dir/install.log + Install_phpMyAdmin 2>&1 | tee -a ${oneinstack_dir}/install.log fi # redis -if [ "$redis_yn" == 'y' ]; then +if [ "${redis_yn}" == 'y' ]; then . include/redis.sh - [ ! -d "$redis_install_dir" ] && Install_redis-server 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ] && Install_php-redis 2>&1 | tee -a $oneinstack_dir/install.log + [ ! -d "${redis_install_dir}" ] && Install_redis-server 2>&1 | tee -a ${oneinstack_dir}/install.log + [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/redis.so" ] && Install_php-redis 2>&1 | tee -a ${oneinstack_dir}/install.log fi # memcached -if [ "$memcached_yn" == 'y' ]; then +if [ "${memcached_yn}" == 'y' ]; then . include/memcached.sh - [ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ] && Install_php-memcache 2>&1 | tee -a $oneinstack_dir/install.log - [ -e "$php_install_dir/bin/phpize" ] && [ ! -e "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && Install_php-memcached 2>&1 | tee -a $oneinstack_dir/install.log + [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached 2>&1 | tee -a ${oneinstack_dir}/install.log + [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcache.so" ] && Install_php-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log + [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcached.so" ] && Install_php-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log fi # index example -if [ ! -e "$wwwroot_dir/default/index.html" -a "$Web_yn" == 'y' ]; then +if [ ! -e "${wwwroot_dir}/default/index.html" -a "${Web_yn}" == 'y' ]; then . include/demo.sh - DEMO 2>&1 | tee -a $oneinstack_dir/install.log + DEMO 2>&1 | tee -a ${oneinstack_dir}/install.log fi # get web_install_dir and db_install_dir . include/check_dir.sh # HHVM -if [ "$HHVM_yn" == 'y' ]; then +if [ "${HHVM_yn}" == 'y' ]; then . include/hhvm_CentOS.sh - Install_hhvm_CentOS 2>&1 | tee -a $oneinstack_dir/install.log + Install_hhvm_CentOS 2>&1 | tee -a ${oneinstack_dir}/install.log fi # Starting DB [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} -[ -d "$db_install_dir/support-files" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && /etc/init.d/mysqld start +[ -d "${db_install_dir}/support-files" -a -z "$(ps -ef | grep -v grep | grep mysql)" ] && /etc/init.d/mysqld start echo "####################Congratulations########################" -[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" == '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}" -[ "$Web_yn" == 'y' -a "$Nginx_version" != '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Nginx install dir":`${CMSG}$web_install_dir${CEND}\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" -[ "$Web_yn" == 'y' -a "$Nginx_version" == '4' -a "$Apache_version" != '3' ] && echo -e "\n`printf "%-32s" "Apache install dir":`${CMSG}$apache_install_dir${CEND}" -[[ "$Tomcat_version" =~ ^[1,2]$ ]] && echo -e "\n`printf "%-32s" "Tomcat install dir":`${CMSG}$tomcat_install_dir${CEND}" -[ "$DB_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Database install dir:"`${CMSG}$db_install_dir${CEND}" -[ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database data dir:"`${CMSG}$db_data_dir${CEND}" -[ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database user:"`${CMSG}root${CEND}" -[ "$DB_yn" == 'y' ] && echo "`printf "%-32s" "Database password:"`${CMSG}${dbrootpwd}${CEND}" -[ "$PHP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "PHP install dir:"`${CMSG}$php_install_dir${CEND}" -[ "$PHP_cache" == '1' ] && echo "`printf "%-32s" "Opcache Control Panel url:"`${CMSG}http://$IPADDR/ocp.php${CEND}" -[ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache Control Panel url:"`${CMSG}http://$IPADDR/xcache${CEND}" -[ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache user:"`${CMSG}admin${CEND}" -[ "$PHP_cache" == '2' ] && echo "`printf "%-32s" "xcache password:"`${CMSG}$xcache_admin_pass${CEND}" -[ "$PHP_cache" == '3' ] && echo "`printf "%-32s" "APC Control Panel url:"`${CMSG}http://$IPADDR/apc.php${CEND}" -[ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator Control Panel url:"`${CMSG}http://$IPADDR/control.php${CEND}" -[ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator user:"`${CMSG}admin${CEND}" -[ "$PHP_cache" == '4' ] && echo "`printf "%-32s" "eAccelerator password:"`${CMSG}eAccelerator${CEND}" -[ "$FTP_yn" == 'y' ] && echo -e "\n`printf "%-32s" "Pure-FTPd install dir:"`${CMSG}$pureftpd_install_dir${CEND}" -[ "$FTP_yn" == 'y' ] && echo "`printf "%-32s" "Create FTP virtual script:"`${CMSG}./pureftpd_vhost.sh${CEND}" -[ "$phpMyAdmin_yn" == 'y' ] && echo -e "\n`printf "%-32s" "phpMyAdmin dir:"`${CMSG}$wwwroot_dir/default/phpMyAdmin${CEND}" -[ "$phpMyAdmin_yn" == 'y' ] && echo "`printf "%-32s" "phpMyAdmin Control Panel url:"`${CMSG}http://$IPADDR/phpMyAdmin${CEND}" -[ "$redis_yn" == 'y' ] && echo -e "\n`printf "%-32s" "redis install dir:"`${CMSG}$redis_install_dir${CEND}" -[ "$memcached_yn" == 'y' ] && echo -e "\n`printf "%-32s" "memcached install dir:"`${CMSG}$memcached_install_dir${CEND}" -[ "$Web_yn" == 'y' ] && echo -e "\n`printf "%-32s" "index url:"`${CMSG}http://$IPADDR/${CEND}" +[ "${Web_yn}" == 'y' -a "${Nginx_version}" != '4' -a "${Apache_version}" == '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}" +[ "${Web_yn}" == 'y' -a "${Nginx_version}" != '4' -a "${Apache_version}" != '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}" +[ "${Web_yn}" == 'y' -a "${Nginx_version}" == '4' -a "${Apache_version}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}" +[[ "${Tomcat_version}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}" +[ "${DB_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}" +[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}" +[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}" +[ "${DB_yn}" == 'y' ] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}" +[ "${PHP_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}" +[ "${PHP_cache}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel url:")${CMSG}http://${IPADDR}/ocp.php${CEND}" +[ "${PHP_cache}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel url:")${CMSG}http://${IPADDR}/xcache${CEND}" +[ "${PHP_cache}" == '2' ] && echo "$(printf "%-32s" "xcache user:")${CMSG}admin${CEND}" +[ "${PHP_cache}" == '2' ] && echo "$(printf "%-32s" "xcache password:")${CMSG}${xcache_admin_pass}${CEND}" +[ "${PHP_cache}" == '3' ] && echo "$(printf "%-32s" "APC Control Panel url:")${CMSG}http://${IPADDR}/apc.php${CEND}" +[ "${PHP_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator Control Panel url:")${CMSG}http://${IPADDR}/control.php${CEND}" +[ "${PHP_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator user:")${CMSG}admin${CEND}" +[ "${PHP_cache}" == '4' ] && echo "$(printf "%-32s" "eAccelerator password:")${CMSG}eAccelerator${CEND}" +[ "${FTP_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "Pure-FTPd install dir:")${CMSG}${pureftpd_install_dir}${CEND}" +[ "${FTP_yn}" == 'y' ] && echo "$(printf "%-32s" "Create FTP virtual script:")${CMSG}./pureftpd_vhost.sh${CEND}" +[ "${phpMyAdmin_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "phpMyAdmin dir:")${CMSG}${wwwroot_dir}/default/phpMyAdmin${CEND}" +[ "${phpMyAdmin_yn}" == 'y' ] && echo "$(printf "%-32s" "phpMyAdmin Control Panel url:")${CMSG}http://${IPADDR}/phpMyAdmin${CEND}" +[ "${redis_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "redis install dir:")${CMSG}${redis_install_dir}${CEND}" +[ "${memcached_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "memcached install dir:")${CMSG}${memcached_install_dir}${CEND}" +[ "${Web_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "index url:")${CMSG}http://${IPADDR}/${CEND}" while :; do echo echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}" read -p "Do you want to restart OS ? [y/n]: " restart_yn - if [[ ! $restart_yn =~ ^[y,n]$ ]]; then + if [[ ! "${restart_yn}" =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done -[ "$restart_yn" == 'y' ] && reboot +[ "${restart_yn}" == 'y' ] && reboot diff --git a/options.conf b/options.conf index b316993d..40fefe5b 100644 --- a/options.conf +++ b/options.conf @@ -14,6 +14,7 @@ tomcat_install_dir=/usr/local/tomcat mysql_install_dir=/usr/local/mysql mariadb_install_dir=/usr/local/mariadb percona_install_dir=/usr/local/percona +alisql_install_dir=/usr/local/alisql php_install_dir=/usr/local/php @@ -28,6 +29,7 @@ redis_install_dir=/usr/local/redis mysql_data_dir=/data/mysql mariadb_data_dir=/data/mariadb percona_data_dir=/data/percona +alisql_data_dir=/data/alisql # web directory, you can customize wwwroot_dir=/data/wwwroot diff --git a/shadowsocks.sh b/shadowsocks.sh index 1d6d143c..b46d5ba9 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -26,11 +26,11 @@ pushd src > /dev/null . ../include/download.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } -PUBLIC_IPADDR=`../include/get_public_ipaddr.py` +PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) -[ "$CentOS_RHEL_version" == '5' ] && { echo "${CWARNING}Shadowsocks only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } +[ "${CentOS_RHEL_version}" == '5' ] && { echo "${CWARNING}Shadowsocks only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } Check_shadowsocks() { [ -f /usr/local/bin/ss-server ] && SS_version=1 @@ -40,60 +40,61 @@ Check_shadowsocks() { AddUser_shadowsocks() { while :; do echo read -p "Please input password for shadowsocks: " Shadowsocks_password - [ -n "`echo $Shadowsocks_password | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } + [ -n "$(echo ${Shadowsocks_password} | grep '[+|&]')" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" done } Iptables_set() { if [ -e '/etc/sysconfig/iptables' ]; then - Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1` + Shadowsocks_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1) elif [ -e '/etc/iptables.up.rules' ]; then - Shadowsocks_Already_port=`grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1` + Shadowsocks_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1) fi - - if [ -n "$Shadowsocks_Already_port" ]; then - Shadowsocks_Default_port=`expr $Shadowsocks_Already_port + 1` + + if [ -n "${Shadowsocks_Already_port}" ]; then + let Shadowsocks_Default_port="${Shadowsocks_Already_port}+1" else Shadowsocks_Default_port=9001 fi - + while :; do echo - read -p "Please input Shadowsocks port(Default: $Shadowsocks_Default_port): " Shadowsocks_port - [ -z "$Shadowsocks_port" ] && Shadowsocks_port=$Shadowsocks_Default_port - if [ $Shadowsocks_port -ge 1 >/dev/null 2>&1 -a $Shadowsocks_port -le 65535 >/dev/null 2>&1 ]; then - [ -z "`netstat -an | grep :$Shadowsocks_port`" ] && break || echo "${CWARNING}This port is already used! ${CEND}" + read -p "Please input Shadowsocks port(Default: ${Shadowsocks_Default_port}): " Shadowsocks_port + [ -z "${Shadowsocks_port}" ] && Shadowsocks_port=${Shadowsocks_Default_port} + if [ ${Shadowsocks_port} -ge 1 >/dev/null 2>&1 -a ${Shadowsocks_port} -le 65535 >/dev/null 2>&1 ]; then + [ -z "$(netstat -an | grep :${Shadowsocks_port})" ] && break || echo "${CWARNING}This port is already used! ${CEND}" else echo "${CWARNING}input error! Input range: 1~65535${CEND}" fi done - - if [ "$OS" == 'CentOS' ]; then - if [ -z "`grep -E $Shadowsocks_port /etc/sysconfig/iptables`" ]; then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + + if [ "${OS}" == 'CentOS' ]; then + if [ -z "$(grep -E ${Shadowsocks_port} /etc/sysconfig/iptables)" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${Shadowsocks_port} -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${Shadowsocks_port} -j ACCEPT service iptables save fi - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "`grep -E $Shadowsocks_port /etc/iptables.up.rules`" ]; then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport $Shadowsocks_port -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport $Shadowsocks_port -j ACCEPT + elif [[ ${OS} =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep -E ${Shadowsocks_port} /etc/iptables.up.rules)" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${Shadowsocks_port} -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${Shadowsocks_port} -j ACCEPT iptables-save > /etc/iptables.up.rules fi else - echo "${CWARNING}This port is already in iptables! ${CEND}" + echo "${CWARNING}This port is already in iptables! ${CEND}" fi + } Def_parameter() { - if [ "$OS" == 'CentOS' ]; then + if [ "${OS}" == "CentOS" ]; then while :; do echo - echo 'Please select Shadowsocks server version:' + echo "Please select Shadowsocks server version:" echo -e "\t${CMSG}1${CEND}. Install Shadowsocks-libev" echo -e "\t${CMSG}2${CEND}. Install Shadowsocks-python" read -p "Please input a number:(Default 1 press Enter) " SS_version - [ -z "$SS_version" ] && SS_version=1 - if [[ ! $SS_version =~ ^[1-2]$ ]]; then + [ -z "${SS_version}" ] && SS_version=1 + if [[ ! "${SS_version}" =~ ^[1-2]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2${CEND}" else break @@ -101,17 +102,17 @@ Def_parameter() { done AddUser_shadowsocks Iptables_set - for Package in wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto - do - yum -y install $Package + pkgList="wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto pcre-devel" + for Package in ${pkgList}; do + yum -y install ${Package} done - elif [[ $OS =~ ^Ubuntu$|^Debian$ ]]; then + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then SS_version=2 AddUser_shadowsocks Iptables_set apt-get -y update - for Package in python-dev python-pip curl wget unzip gcc swig automake make perl cpio git - do + pkgList="python-dev python-pip curl wget unzip gcc swig automake make perl cpio git" + for Package in ${pkgList}; do apt-get -y install $Package done fi @@ -119,10 +120,10 @@ Def_parameter() { Install_shadowsocks-python() { src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src - + which pip > /dev/null 2>&1 - [ $? -ne 0 ] && [ "$OS" == 'CentOS' ] && { python ez_setup.py install; sleep 1; easy_install pip; } - + [ $? -ne 0 ] && [ "${OS}" == "CentOS" ] && { python ez_setup.py install; sleep 1; easy_install pip; } + if [ -f /usr/bin/pip ]; then pip install M2Crypto pip install greenlet @@ -131,8 +132,8 @@ Install_shadowsocks-python() { if [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ]; then /bin/cp ../init.d/Shadowsocks-python-init /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks - [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults + [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks else echo @@ -151,7 +152,7 @@ Install_shadowsocks-libev() { if [ -f /usr/local/bin/ss-server ]; then /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks - [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } + [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } else echo echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}" @@ -163,19 +164,19 @@ Install_shadowsocks-libev() { Uninstall_shadowsocks(){ while :; do echo read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn - if [[ ! $Shadowsocks_yn =~ ^[y,n]$ ]]; then + if [[ ! "${Shadowsocks_yn}" =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - - if [ "$Shadowsocks_yn" == 'y' ]; then - [ -n "`ps -ef | grep -v grep | grep -iE "ssserver|ss-server"`" ] && /etc/init.d/shadowsocks stop - [ "$OS" == 'CentOS' ] && chkconfig --del shadowsocks - [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove + + if [ "${Shadowsocks_yn}" == 'y' ]; then + [ -n "$(ps -ef | grep -v grep | grep -iE "ssserver|ss-server")" ] && /etc/init.d/shadowsocks stop + [ "${OS}" == "CentOS" ] && chkconfig --del shadowsocks + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks - if [ "$SS_version" == '1' ]; then + if [ "${SS_version}" == '1' ]; then rm -f /usr/local/bin/ss-local rm -f /usr/local/bin/ss-tunnel rm -f /usr/local/bin/ss-server @@ -192,44 +193,44 @@ Uninstall_shadowsocks(){ rm -f /usr/local/share/man/man1/ss-redir.1 rm -f /usr/local/share/man/man8/shadowsocks.8 if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-libev uninstall success! ${CEND}" + echo "${CSUCCESS}Shadowsocks-libev uninstall successful! ${CEND}" else echo "${CFAILURE}Shadowsocks-libev uninstall failed! ${CEND}" fi - elif [ "$SS_version" == '2' ]; then + elif [ "${SS_version}" == '2' ]; then pip uninstall -y shadowsocks if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-python uninstall success! ${CEND}" + echo "${CSUCCESS}Shadowsocks-python uninstall successful! ${CEND}" else echo "${CFAILURE}Shadowsocks-python uninstall failed! ${CEND}" fi fi else - echo "${CMSG}Shadowsocks uninstall cancelled! ${CEND}" + echo "${CMSG}Unknown Shadowsocks version, uninstall failed! ${CEND}" fi } Config_shadowsocks(){ - [ ! -d '/etc/shadowsocks' ] && mkdir /etc/shadowsocks - [ "$SS_version" == '1' ] && cat > /etc/shadowsocks/config.json< /etc/shadowsocks/config.json << EOF { "server":"0.0.0.0", - "server_port":$Shadowsocks_port, + "server_port":${Shadowsocks_port}, "local_address":"127.0.0.1", "local_port":1080, - "password":"$Shadowsocks_password", + "password":"${Shadowsocks_password}", "timeout":300, "method":"aes-256-cfb", } EOF - [ "$SS_version" == '2' ] && cat > /etc/shadowsocks/config.json< /etc/shadowsocks/config.json << EOF { "server":"0.0.0.0", "local_address":"127.0.0.1", "local_port":1080, "port_password":{ - "$Shadowsocks_port":"$Shadowsocks_password" + "${Shadowsocks_port}":"${Shadowsocks_password}" }, "timeout":300, "method":"aes-256-cfb", @@ -240,14 +241,14 @@ EOF AddUser_Config_shadowsocks(){ [ ! -e /etc/shadowsocks/config.json ] && { echo "${CFAILURE}Shadowsocks is not installed! ${CEND}"; exit 1; } - [ -z "`grep \"$Shadowsocks_port\" /etc/shadowsocks/config.json`" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"$Shadowsocks_port\":\"$Shadowsocks_password\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } + [ -z "$(grep \"${Shadowsocks_port}\" /etc/shadowsocks/config.json)" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"${Shadowsocks_port}\":\"${Shadowsocks_password}\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } } Print_User_shadowsocks(){ printf " -Your Server IP: ${CMSG}$PUBLIC_IPADDR${CEND} -Your Server Port: ${CMSG}$Shadowsocks_port${CEND} -Your Password: ${CMSG}$Shadowsocks_password${CEND} +Your Server IP: ${CMSG}${PUBLIC_IPADDR}${CEND} +Your Server Port: ${CMSG}${Shadowsocks_port}${CEND} +Your Password: ${CMSG}${Shadowsocks_password}${CEND} Your Local IP: ${CMSG}127.0.0.1${CEND} Your Local Port: ${CMSG}1080${CEND} Your Encryption Method: ${CMSG}aes-256-cfb${CEND} @@ -257,15 +258,15 @@ Your Encryption Method: ${CMSG}aes-256-cfb${CEND} case "$1" in install) Def_parameter - [ "$SS_version" == '1' ] && Install_shadowsocks-libev - [ "$SS_version" == '2' ] && Install_shadowsocks-python + [ "${SS_version}" == '1' ] && Install_shadowsocks-libev + [ "${SS_version}" == '2' ] && Install_shadowsocks-python Config_shadowsocks service shadowsocks start Print_User_shadowsocks ;; adduser) Check_shadowsocks - if [ "$SS_version" == '2' ]; then + if [ "${SS_version}" == '2' ]; then AddUser_shadowsocks Iptables_set AddUser_Config_shadowsocks @@ -286,7 +287,7 @@ uninstall) ;; *) echo - echo $"Usage: ${CMSG}$0${CEND} { ${CMSG}install${CEND} | ${CMSG}adduser${CEND} | ${CMSG}uninstall${CEND} }" + echo "Usage: ${CMSG}$0${CEND} { ${CMSG}install${CEND} | ${CMSG}adduser${CEND} | ${CMSG}uninstall${CEND} }" echo exit 1 esac diff --git a/uninstall.sh b/uninstall.sh index b0b72c95..f1ea8cbd 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -98,7 +98,7 @@ Print_DB() { } Uninstall_DB() { - [ -e "${db_install_dir}" ] && { service mysqld stop > /dev/null 2>&1; rm -rf ${db_install_dir} /etc/init.d/mysqld /etc/my.cnf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf; } + [ -e "${db_install_dir}" ] && { service mysqld stop > /dev/null 2>&1; rm -rf ${db_install_dir} /etc/init.d/mysqld /etc/my.cnf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf; } id -u mysql >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel mysql [ -e "${db_data_dir}" ] && /bin/mv ${db_data_dir}{,$(date +%Y%m%d%H)} sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./options.conf diff --git a/versions.txt b/versions.txt index 3e3a13ff..eb95e866 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # newest software version # Web -nginx_version=1.10.1 +nginx_version=1.10.2 tengine_version=2.1.1 openresty_version=1.11.2.1 openssl_version=1.0.2j @@ -21,21 +21,23 @@ mysql_5_6_version=5.6.34 mysql_5_5_version=5.5.53 mariadb_10_1_version=10.1.18 -mariadb_10_0_version=10.0.27 -mariadb_5_5_version=5.5.52 +mariadb_10_0_version=10.0.28 +mariadb_5_5_version=5.5.53 -percona_5_7_version=5.7.14-8 -percona_5_6_version=5.6.32-78.1 +percona_5_7_version=5.7.15-9 +percona_5_6_version=5.6.33-79.0 percona_5_5_version=5.5.52-38.3 +alisql_5_6_version=5.6.32-1 + # JDK -jdk_8_version=1.8.0_102 +jdk_8_version=1.8.0_112 jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.11 -php_6_version=5.6.26 +php_7_version=7.0.12 +php_6_version=5.6.27 php_5_version=5.5.38 php_4_version=5.4.45 php_3_version=5.3.29 @@ -61,12 +63,12 @@ eaccelerator_version=0.9.6.1 pureftpd_version=1.0.43 # Redis -redis_version=3.2.4 +redis_version=3.2.5 redis_pecl_for_php7_version=3.0.0 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.31 +memcached_version=1.4.32 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 diff --git a/vhost.sh b/vhost.sh index a05d4efc..0dd82d1a 100755 --- a/vhost.sh +++ b/vhost.sh @@ -24,7 +24,7 @@ printf " . ./include/get_char.sh # Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } +[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } Usage() { printf " @@ -36,79 +36,87 @@ ${CMSG}del${CEND} --->Delete Virtualhost } Choose_env() { - if [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then + if [ -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=111 while :; do echo - echo 'Please choose to use environment:' + echo "Please choose to use environment:" echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use java" echo -e "\t${CMSG}3${CEND}. Use hhvm" read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-3]$ ]]; then + [ -z "${Choose_number}" ] && Choose_number=1 + if [[ ! ${Choose_number} =~ ^[1-3]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" else break fi done - [ "$Choose_number" == '1' ] && NGX_FLAG=php - [ "$Choose_number" == '2' ] && NGX_FLAG=java - [ "$Choose_number" == '3' ] && NGX_FLAG=hhvm - elif [ -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then + case "${Choose_number}" in + 1) + NGX_FLAG=php + ;; + 2) + NGX_FLAG=java + ;; + 3) + NGX_FLAG=hhvm + ;; + esac + elif [ -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=110 while :; do echo - echo 'Please choose to use environment:' + echo "Please choose to use environment:" echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use java" read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + [ -z "${Choose_number}" ] && Choose_number=1 + if [[ ! ${Choose_number} =~ ^[1-2]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2${CEND}" else break fi done - [ "$Choose_number" == '1' ] && NGX_FLAG=php - [ "$Choose_number" == '2' ] && NGX_FLAG=java - elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then + [ "${Choose_number}" == '1' ] && NGX_FLAG=php + [ "${Choose_number}" == '2' ] && NGX_FLAG=java + elif [ -e "${php_install_dir}/bin/phpize" -a ! -e "${tomcat_install_dir}/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=100 NGX_FLAG=php - elif [ -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then + elif [ -e "${php_install_dir}/bin/phpize" -a ! -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=101 while :; do echo - echo 'Please choose to use environment:' + echo "Please choose to use environment:" echo -e "\t${CMSG}1${CEND}. Use php" echo -e "\t${CMSG}2${CEND}. Use hhvm" read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + [ -z "${Choose_number}" ] && Choose_number=1 + if [[ ! ${Choose_number} =~ ^[1-2]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2${CEND}" else break fi done - [ "$Choose_number" == '1' ] && NGX_FLAG=php - [ "$Choose_number" == '2' ] && NGX_FLAG=hhvm - elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then + [ "${Choose_number}" == '1' ] && NGX_FLAG=php + [ "${Choose_number}" == '2' ] && NGX_FLAG=hhvm + elif [ ! -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=011 while :; do echo - echo 'Please choose to use environment:' + echo "Please choose to use environment:" echo -e "\t${CMSG}1${CEND}. Use java" echo -e "\t${CMSG}2${CEND}. Use hhvm" read -p "Please input a number:(Default 1 press Enter) " Choose_number - [ -z "$Choose_number" ] && Choose_number=1 - if [[ ! $Choose_number =~ ^[1-2]$ ]]; then + [ -z "${Choose_number}" ] && Choose_number=1 + if [[ ! ${Choose_number} =~ ^[1-2]$ ]]; then echo "${CWARNING}input error! Please only input number 1,2${CEND}" else break fi done - [ "$Choose_number" == '1' ] && NGX_FLAG=java - [ "$Choose_number" == '2' ] && NGX_FLAG=hhvm - elif [ ! -e "$php_install_dir/bin/phpize" -a -e "$tomcat_install_dir/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then + [ "${Choose_number}" == '1' ] && NGX_FLAG=java + [ "${Choose_number}" == '2' ] && NGX_FLAG=hhvm + elif [ ! -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a ! -e "/usr/bin/hhvm" ]; then Number=010 NGX_FLAG=java - elif [ ! -e "$php_install_dir/bin/phpize" -a ! -e "$tomcat_install_dir/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then + elif [ ! -e "${php_install_dir}/bin/phpize" -a ! -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then Number=001 NGX_FLAG=hhvm else @@ -116,13 +124,17 @@ Choose_env() { NGX_FLAG=php fi - if [ "$NGX_FLAG" == 'php' ]; then - NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n }") - elif [ "$NGX_FLAG" == 'java' ]; then - NGX_CONF=$(echo -e "location ~ {\n proxy_pass http://127.0.0.1:8080;\n include proxy.conf;\n }") - elif [ "$NGX_FLAG" == 'hhvm' ]; then - NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n fastcgi_pass unix:/var/log/hhvm/sock;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n include fastcgi_params;\n }") - fi + case "${NGX_FLAG}" in + "php") + NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n}") + ;; + "java") + NGX_CONF=$(echo -e "location ~ {\n proxy_pass http://127.0.0.1:8080;\n include proxy.conf;\n}") + ;; + "hhvm") + NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n fastcgi_pass unix:/var/log/hhvm/sock;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n include fastcgi_params;\n}") + ;; + esac } Create_self_SSL() { @@ -137,77 +149,77 @@ If you enter '.', the field will be left blank. echo read -p "Country Name (2 letter code) [CN]: " SELFSIGNEDSSL_C - [ -z "$SELFSIGNEDSSL_C" ] && SELFSIGNEDSSL_C=CN - + [ -z "${SELFSIGNEDSSL_C}" ] && SELFSIGNEDSSL_C="CN" + echo read -p "State or Province Name (full name) [Shanghai]: " SELFSIGNEDSSL_ST - [ -z "$SELFSIGNEDSSL_ST" ] && SELFSIGNEDSSL_ST=Shanghai - + [ -z "${SELFSIGNEDSSL_ST}" ] && SELFSIGNEDSSL_ST="Shanghai" + echo read -p "Locality Name (eg, city) [Shanghai]: " SELFSIGNEDSSL_L - [ -z "$SELFSIGNEDSSL_L" ] && SELFSIGNEDSSL_L=Shanghai - + [ -z "${SELFSIGNEDSSL_L}" ] && SELFSIGNEDSSL_L="Shanghai" + echo - read -p "Organization Name (eg, company) [LinuxEye Inc.]: " SELFSIGNEDSSL_O - [ -z "$SELFSIGNEDSSL_O" ] && SELFSIGNEDSSL_O='LinuxEye Inc.' - + read -p "Organization Name (eg, company) [Example Inc.]: " SELFSIGNEDSSL_O + [ -z "${SELFSIGNEDSSL_O}" ] && SELFSIGNEDSSL_O="Example Inc." + echo read -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU - [ -z "$SELFSIGNEDSSL_OU" ] && SELFSIGNEDSSL_OU='IT Dept.' - - openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 - /bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`} - /bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`} - openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1 + [ -z "${SELFSIGNEDSSL_O}U" ] && SELFSIGNEDSSL_OU="IT Dept." + + openssl req -new -newkey rsa:2048 -sha256 -nodes -out ${PATH_SSL}/${domain}.csr -keyout ${PATH_SSL}/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 + /bin/cp ${PATH_SSL}/${domain}.csr{,_bk.$(date +%Y-%m-%d_%H%M)} + /bin/cp ${PATH_SSL}/${domain}.key{,_bk.$(date +%Y-%m-%d_%H%M)} + openssl x509 -req -days 36500 -sha256 -in ${PATH_SSL}/${domain}.csr -signkey ${PATH_SSL}/${domain}.key -out ${PATH_SSL}/${domain}.crt > /dev/null 2>&1 } Create_SSL() { if [ -e "/usr/local/bin/certbot-auto" -a -e "/root/.local/share/letsencrypt/bin/letsencrypt" ]; then while :; do echo - read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn - if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]]; then + read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn + if [[ ! ${letsencrypt_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - if [ "$letsencrypt_yn" == 'y' ]; then - PUBLIC_IPADDR=`./include/get_public_ipaddr.py` - for D in $domain $moredomainame + if [ "${letsencrypt_yn}" == 'y' ]; then + PUBLIC_IPADDR=$(./include/get_public_ipaddr.py) + for D in ${domain} ${moredomainame} do - Domain_IPADDR=`ping $D -c1 | sed '1{s/[^(]*(//;s/).*//;q}'` - [ "$PUBLIC_IPADDR" != "$Domain_IPADDR" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for $D${CEND}"; echo; exit 1; } + Domain_IPADDR=$(ping ${D} -c1 | sed '1{s/[^(]*(//;s/).*//;q}') + [ "${PUBLIC_IPADDR}" != "${Domain_IPADDR}" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for ${D}${CEND}"; echo; exit 1; } done #add Email while : do echo - read -p "Please enter Administrator Email(example: admin@linuxeye.com): " Admin_Email - if [ -z "`echo $Admin_Email | grep '.*@.*\..*'`" ]; then + read -p "Please enter Administrator Email(example: admin@example.com): " Admin_Email + if [ -z "$(echo ${Admin_Email} | grep '.*@.*\..*')" ]; then echo "${CWARNING}input error! ${CEND}" else break fi done - [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`" - [ "$nginx_ssl_yn" == 'y' ] && S=nginx - [ "$apache_ssl_yn" == 'y' ] && S=httpd - [ ! -d "$wwwroot_dir/$domain/.well-known" ] && mkdir -p $wwwroot_dir/$domain/.well-known;chown -R $run_user.$run_user $wwwroot_dir/$domain/.well-known - certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start" - if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ]; then - [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key} - ln -s /etc/letsencrypt/live/$domain/fullchain.pem $PATH_SSL/$domain.crt - ln -s /etc/letsencrypt/live/$domain/privkey.pem $PATH_SSL/$domain.key - if [ -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then - Cron_Command='/etc/init.d/nginx reload;/etc/init.d/httpd graceful' - elif [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then - Cron_Command='/etc/init.d/nginx reload' - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then - Cron_Command='/etc/init.d/httpd graceful' + [ "${moredomainame_yn}" == 'y' ] && moredomainame_D="$(for D in ${moredomainame}; do echo -d ${D}; done)" + [ "${nginx_ssl_yn}" == 'y' ] && S=nginx + [ "${apache_ssl_yn}" == 'y' ] && S=httpd + [ ! -d "${wwwroot_dir}/${domain}/.well-known" ] && mkdir -p ${wwwroot_dir}/${domain}/.well-known;chown -R ${run_user}.${run_user} ${wwwroot_dir}/${domain}/.well-known + certbot-auto certonly --standalone --agree-tos --email ${Admin_Email} -d ${domain} ${moredomainame_D} --pre-hook "service ${S} stop" --post-hook "service ${S} start" + if [ -s "/etc/letsencrypt/live/${domain}/cert.pem" ]; then + [ -e "${PATH_SSL}/${domain}.crt" ] && rm -rf ${PATH_SSL}/${domain}.{crt,key} + ln -s /etc/letsencrypt/live/${domain}/fullchain.pem ${PATH_SSL}/${domain}.crt + ln -s /etc/letsencrypt/live/${domain}/privkey.pem ${PATH_SSL}/${domain}.key + if [ -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/conf/httpd.conf" ]; then + Cron_Command="/etc/init.d/nginx reload;/etc/init.d/httpd graceful" + elif [ -e "${web_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then + Cron_Command="/etc/init.d/nginx reload" + elif [ ! -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/conf/httpd.conf" ]; then + Cron_Command="/etc/init.d/httpd graceful" fi - [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "`grep "$domain $moredomainame_D" $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file + [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root + [ -z "$(grep "${domain} ${moredomainame_D}" ${Cron_file})" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=${wwwroot_dir}/${domain} -d ${domain} ${moredomainame_D};${Cron_Command}" >> $Cron_file else echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}" exit 1 @@ -221,31 +233,31 @@ Create_SSL() { } Print_ssl() { - if [ "$letsencrypt_yn" == 'y' ]; then - echo "`printf "%-30s" "Let's Encrypt SSL Certificate:"`${CMSG}/etc/letsencrypt/live/$domain/fullchain.pem${CEND}" - echo "`printf "%-30s" "SSL Private Key:"`${CMSG}/etc/letsencrypt/live/$domain/privkey.pem${CEND}" + if [ "${letsencrypt_yn}" == 'y' ]; then + echo "$(printf "%-30s" "Let's Encrypt SSL Certificate:")${CMSG}/etc/letsencrypt/live/${domain}/fullchain.pem${CEND}" + echo "$(printf "%-30s" "SSL Private Key:")${CMSG}/etc/letsencrypt/live/${domain}/privkey.pem${CEND}" else - echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}" - echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}" - echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}" + echo "$(printf "%-30s" "Self-signed SSL Certificate:")${CMSG}${PATH_SSL}/${domain}.crt${CEND}" + echo "$(printf "%-30s" "SSL Private Key:")${CMSG}${PATH_SSL}/${domain}.key${CEND}" + echo "$(printf "%-30s" "SSL CSR File:")${CMSG}${PATH_SSL}/${domain}.csr${CEND}" fi } Input_Add_domain() { - if [ -e "$web_install_dir/sbin/nginx" ]; then + if [ -e "${web_install_dir}/sbin/nginx" ]; then while :; do echo read -p "Do you want to setup SSL under Nginx? [y/n]: " nginx_ssl_yn - if [[ ! $nginx_ssl_yn =~ ^[y,n]$ ]]; then + if [[ ! ${nginx_ssl_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachectl" ]; then + elif [ ! -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/bin/apachectl" ]; then while :; do echo read -p "Do you want to setup SSL under Apache? [y/n]: " apache_ssl_yn - if [[ ! $apache_ssl_yn =~ ^[y,n]$ ]]; then + if [[ ! ${apache_ssl_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break @@ -253,106 +265,106 @@ Input_Add_domain() { done fi - [ "$apache_ssl_yn" == 'y' ] && { PATH_SSL=$apache_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } - [ "$nginx_ssl_yn" == 'y' ] && { PATH_SSL=$web_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; } + [ "${apache_ssl_yn}" == 'y' ] && { PATH_SSL=${apache_install_dir}/conf/ssl; [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL}; } + [ "${nginx_ssl_yn}" == 'y' ] && { PATH_SSL=${web_install_dir}/conf/ssl; [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL}; } while :; do echo - read -p "Please input domain(example: www.linuxeye.com): " domain - if [ -z "`echo $domain | grep '.*\..*'`" ]; then + read -p "Please input domain(example: www.example.com): " domain + if [ -z "$(echo ${domain} | grep '.*\..*')" ]; then echo "${CWARNING}input error! ${CEND}" else break fi done - if [ -e "$web_install_dir/conf/vhost/$domain.conf" -o -e "$apache_install_dir/conf/vhost/$domain.conf" -o -e "$tomcat_install_dir/conf/vhost/$domain.xml" ]; then - [ -e "$web_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Nginx/Tengine/OpenResty already exist! \nYou can delete ${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND} and re-create" - [ -e "$apache_install_dir/conf/vhost/$domain.conf" ] && echo -e "$domain in the Apache already exist! \nYou can delete ${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND} and re-create" - [ -e "$tomcat_install_dir/conf/vhost/$domain.xml" ] && echo -e "$domain in the Tomcat already exist! \nYou can delete ${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND} and re-create" + if [ -e "${web_install_dir}/conf/vhost/${domain}.conf" -o -e "${apache_install_dir}/conf/vhost/${domain}.conf" -o -e "${tomcat_install_dir}/conf/vhost/${domain}.xml" ]; then + [ -e "${web_install_dir}/conf/vhost/${domain}.conf" ] && echo -e "${domain} in the Nginx/Tengine/OpenResty already exist! \nYou can delete ${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND} and re-create" + [ -e "${apache_install_dir}/conf/vhost/${domain}.conf" ] && echo -e "${domain} in the Apache already exist! \nYou can delete ${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND} and re-create" + [ -e "${tomcat_install_dir}/conf/vhost/${domain}.xml" ] && echo -e "${domain} in the Tomcat already exist! \nYou can delete ${CMSG}${tomcat_install_dir}/conf/vhost/${domain}.xml${CEND} and re-create" exit else - echo "domain=$domain" + echo "domain=${domain}" fi while :; do echo read -p "Do you want to add more domain name? [y/n]: " moredomainame_yn - if [[ ! $moredomainame_yn =~ ^[y,n]$ ]]; then + if [[ ! ${moredomainame_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - if [ "$moredomainame_yn" == 'y' ]; then + if [ "${moredomainame_yn}" == 'y' ]; then while :; do echo - read -p "Type domainname or IP(example: linuxeye.com 121.43.8.8): " moredomain - if [ -z "`echo $moredomain | grep '.*\..*'`" ]; then + read -p "Type domainname or IP(example: example.com or 121.43.8.8): " moredomain + if [ -z "$(echo ${moredomain} | grep '.*\..*')" ]; then echo "${CWARNING}input error! ${CEND}" else - [ "$moredomain" == "$domain" ] && echo "${CWARNING}Domain name already exists! ${CND}" && continue + [ "${moredomain}" == "${domain}" ] && echo "${CWARNING}Domain name already exists! ${CND}" && continue echo domain list="$moredomain" moredomainame=" $moredomain" break fi done - Apache_Domain_alias=ServerAlias$moredomainame - Tomcat_Domain_alias=$(for D in `echo $moredomainame`; do echo "$D"; done) + Apache_Domain_alias=ServerAlias${moredomainame} + Tomcat_Domain_alias=$(for D in $(echo ${moredomainame}); do echo "${D}"; done) - if [ -e "$web_install_dir/sbin/nginx" ]; then + if [ -e "${web_install_dir}/sbin/nginx" ]; then while :; do echo - read -p "Do you want to redirect from $moredomain to $domain? [y/n]: " redirect_yn - if [[ ! $redirect_yn =~ ^[y,n]$ ]]; then + read -p "Do you want to redirect from ${moredomain} to ${domain}? [y/n]: " redirect_yn + if [[ ! ${redirect_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") + [ "${redirect_yn}" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n}") fi fi - if [ "$nginx_ssl_yn" == 'y' ]; then + if [ "${nginx_ssl_yn}" == 'y' ]; then while :; do echo read -p "Do you want to redirect all HTTP requests to HTTPS? [y/n]: " https_yn - if [[ ! $https_yn =~ ^[y,n]$ ]]; then + if [[ ! ${https_yn} =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then - LISTENOPT='443 ssl http2' + if [[ "$(${web_install_dir}/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then + LISTENOPT="443 ssl http2" else - LISTENOPT='443 ssl spdy' + LISTENOPT="443 ssl spdy" fi Create_SSL - Nginx_conf=$(echo -e "listen 80;\nlisten $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\nssl_prefer_server_ciphers on;\nssl_session_timeout 10m;\nssl_session_cache builtin:1000 shared:SSL:10m;\nssl_buffer_size 1400;\nadd_header Strict-Transport-Security max-age=15768000;\nssl_stapling on;\nssl_stapling_verify on;\n") - Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") + Nginx_conf=$(echo -e "listen 80;\n listen ${LISTENOPT};\n ssl_certificate ${PATH_SSL}/${domain}.crt;\n ssl_certificate_key ${PATH_SSL}/${domain}.key;\n ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\n ssl_prefer_server_ciphers on;\n ssl_session_timeout 10m;\n ssl_session_cache builtin:1000 shared:SSL:10m;\n ssl_buffer_size 1400;\n add_header Strict-Transport-Security max-age=15768000;\n ssl_stapling on;\n ssl_stapling_verify on;\n") + Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"${PATH_SSL}/${domain}.crt\"\n SSLCertificateKeyFile \"${PATH_SSL}/${domain}.key\"") elif [ "$apache_ssl_yn" == 'y' ]; then Create_SSL - Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"") - [ -z "`grep 'Listen 443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@Listen 80@&\nListen 443@" $apache_install_dir/conf/httpd.conf - [ -z "`grep 'ServerName 0.0.0.0:443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@ServerName 0.0.0.0:80@&\nServerName 0.0.0.0:443@" $apache_install_dir/conf/httpd.conf + Apache_SSL=$(echo -e "SSLEngine on\n SSLCertificateFile \"${PATH_SSL}/${domain}.crt\"\n SSLCertificateKeyFile \"${PATH_SSL}/${domain}.key\"") + [ -z "$(grep 'Listen 443' ${apache_install_dir}/conf/httpd.conf)" ] && sed -i "s@Listen 80@&\nListen 443@" ${apache_install_dir}/conf/httpd.conf + [ -z "$(grep 'ServerName 0.0.0.0:443' ${apache_install_dir}/conf/httpd.conf)" ] && sed -i "s@ServerName 0.0.0.0:80@&\nServerName 0.0.0.0:443@" ${apache_install_dir}/conf/httpd.conf else - Nginx_conf='listen 80;' + Nginx_conf="listen 80;" fi while :; do echo - echo "Please input the directory for the domain:$domain :" - read -p "(Default directory: $wwwroot_dir/$domain): " vhostdir - if [ -n "$vhostdir" -a -z "`echo $vhostdir | grep '^/'`" ]; then + echo "Please input the directory for the domain:${domain} :" + read -p "(Default directory: ${wwwroot_dir}/${domain}): " vhostdir + if [ -n "${vhostdir}" -a -z "$(echo ${vhostdir} | grep '^/')" ]; then echo "${CWARNING}input error! Press Enter to continue...${CEND}" else - if [ -z "$vhostdir" ]; then - vhostdir="$wwwroot_dir/$domain" - echo "Virtual Host Directory=${CMSG}$vhostdir${CEND}" + if [ -z "${vhostdir}" ]; then + vhostdir="${wwwroot_dir}/${domain}" + echo "Virtual Host Directory=${CMSG}${vhostdir}${CEND}" fi echo echo "Create Virtul Host directory......" - mkdir -p $vhostdir + mkdir -p ${vhostdir} echo "set permissions of Virtual Host directory......" - chown -R ${run_user}.$run_user $vhostdir + chown -R ${run_user}.${run_user} ${vhostdir} break fi done @@ -368,115 +380,117 @@ Nginx_anti_hotlinking() { fi done - if [ -n "`echo $domain | grep '.*\..*\..*'`" ]; then - domain_allow="*.${domain#*.} $domain" + if [ -n "$(echo ${domain} | grep '.*\..*\..*')" ]; then + domain_allow="*.${domain#*.} ${domain}" else - domain_allow="*.$domain $domain" + domain_allow="*.${domain} ${domain}" fi - if [ "$anti_hotlinking_yn" == 'y' ]; then - if [ "$moredomainame_yn" == 'y' ]; then - domain_allow_all=$domain_allow$moredomainame + if [ "${anti_hotlinking_yn}" == 'y' ]; then + if [ "${moredomainame_yn}" == 'y' ]; then + domain_allow_all=${domain_allow}${moredomainame} else - domain_allow_all=$domain_allow + domain_allow_all=${domain_allow} fi - anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {\n valid_referers none blocked $domain_allow_all;\n if (\$invalid_referer) {\n #rewrite ^/ http://www.linuxeye.com/403.html;\n return 403;\n }\n }") + anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {\n valid_referers none blocked ${domain_allow_all};\n if (\$invalid_referer) {\n #rewrite ^/ http://www.example.com/403.html;\n return 403;\n }\n }") else anti_hotlinking= fi } Nginx_rewrite() { - [ ! -d "$web_install_dir/conf/rewrite" ] && mkdir $web_install_dir/conf/rewrite + [ ! -d "${web_install_dir}/conf/rewrite" ] && mkdir ${web_install_dir}/conf/rewrite while :; do echo read -p "Allow Rewrite rule? [y/n]: " rewrite_yn - if [[ ! $rewrite_yn =~ ^[y,n]$ ]]; then + if [[ ! "${rewrite_yn}" =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - if [ "$rewrite_yn" == 'n' ]; then + if [ "${rewrite_yn}" == 'n' ]; then rewrite="none" - touch "$web_install_dir/conf/rewrite/$rewrite.conf" + touch "${web_install_dir}/conf/rewrite/${rewrite}.conf" else echo echo "Please input the rewrite of programme :" echo "${CMSG}wordpress${CEND},${CMSG}discuz${CEND},${CMSG}opencart${CEND},${CMSG}thinkphp${CEND},${CMSG}laravel${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND} rewrite was exist." read -p "(Default rewrite: other):" rewrite - if [ "$rewrite" == "" ]; then + if [ "${rewrite}" == "" ]; then rewrite="other" fi echo "You choose rewrite=${CMSG}$rewrite${CEND}" - [ "$NGX_FLAG" == 'php' -a "$rewrite" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") - if [ -e "config/$rewrite.conf" ]; then - /bin/cp config/$rewrite.conf $web_install_dir/conf/rewrite/$rewrite.conf + [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") + if [ -e "config/${rewrite}.conf" ]; then + /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/rewrite/${rewrite}.conf else - touch "$web_install_dir/conf/rewrite/$rewrite.conf" + touch "${web_install_dir}/conf/rewrite/${rewrite}.conf" fi fi } Nginx_log() { - while :; do echo +while :; do echo read -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_yn - if [[ ! $access_yn =~ ^[y,n]$ ]]; then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + if [[ ! "${access_yn}" =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi - done - if [ "$access_yn" == 'n' ]; then +done +if [ "${access_yn}" == 'n' ]; then N_log="access_log off;" - else - N_log="access_log $wwwlogs_dir/${domain}_nginx.log combined;" - echo "You access log file=${CMSG}$wwwlogs_dir/${domain}_nginx.log${CEND}" - fi +else + N_log="access_log ${wwwlogs_dir}/${domain}_nginx.log combined;" + echo "You access log file=${CMSG}${wwwlogs_dir}/${domain}_nginx.log${CEND}" +fi } Create_nginx_tomcat_conf() { - [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost - cat > $web_install_dir/conf/vhost/$domain.conf << EOF + [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost + cat > ${web_install_dir}/conf/vhost/${domain}.conf << EOF server { -$Nginx_conf -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.jsp; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + ${Nginx_conf} + server_name ${domain}${moredomainame}; + ${N_log} + index index.html index.htm index.jsp; + root ${vhostdir}; + ${Nginx_redirect} + ${anti_hotlinking} + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; - } -location ~ .*\.(js|css)?$ { + } + location ~ .*\.(js|css)?$ { expires 7d; access_log off; - } -$NGX_CONF + } + ${NGX_CONF} + #error_page 404 = /404.html; + #error_page 502 = /502.html; } EOF - [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf - cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF - $Tomcat_Domain_alias - + cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF + ${Tomcat_Domain_alias} + EOF - [ -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 + [ -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 + ${web_install_dir}/sbin/nginx -t if [ $? == 0 ]; then echo "Reload Nginx......" - $web_install_dir/sbin/nginx -s reload + ${web_install_dir}/sbin/nginx -s reload /etc/init.d/tomcat restart else - rm -rf $web_install_dir/conf/vhost/$domain.conf + rm -rf ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -487,23 +501,23 @@ EOF # For more information please visit https://oneinstack.com # ####################################################################### " - echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" - echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" - echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" - echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" - [ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" + echo "$(printf "%-30s" "Nginx Virtualhost conf:")${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND}" + echo "$(printf "%-30s" "Tomcat Virtualhost conf:")${CMSG}${tomcat_install_dir}/conf/vhost/${domain}.xml${CEND}" + echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" + [ "${nginx_ssl_yn}" == 'y' ] && Print_ssl } Create_tomcat_conf() { - cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF - $Tomcat_Domain_alias - + cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF + ${Tomcat_Domain_alias} + + prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF - [ -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 + [ -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 @@ -514,45 +528,47 @@ EOF # For more information please visit https://oneinstack.com # ####################################################################### " - echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" - echo "`printf "%-30s" "Tomcat Virtualhost conf:"`${CMSG}$tomcat_install_dir/conf/vhost/$domain.xml${CEND}" - echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" - echo "`printf "%-30s" "index url:"`${CMSG}http://${domain}:8080/${CEND}" + echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" + echo "$(printf "%-30s" "Tomcat Virtualhost conf:")${CMSG}${tomcat_install_dir}/conf/vhost/${domain}.xml${CEND}" + echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" + echo "$(printf "%-30s" "index url:")${CMSG}http://${domain}:8080/${CEND}" } Create_nginx_php-fpm_hhvm_conf() { - [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost - cat > $web_install_dir/conf/vhost/$domain.conf << EOF + [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost + cat > ${web_install_dir}/conf/vhost/${domain}.conf << EOF server { -$Nginx_conf -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.php; -include $web_install_dir/conf/rewrite/$rewrite.conf; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -$NGX_CONF -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + ${Nginx_conf} + server_name ${domain}${moredomainame}; + ${N_log} + index index.html index.htm index.php; + include ${web_install_dir}/conf/rewrite/${rewrite}.conf; + root ${vhostdir}; + ${Nginx_redirect} + ${anti_hotlinking} + ${NGX_CONF} + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; - } -location ~ .*\.(js|css)?$ { + } + location ~ .*\.(js|css)?$ { expires 7d; access_log off; - } + } + #error_page 404 = /404.html; + #error_page 502 = /502.html; } EOF - [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo - $web_install_dir/sbin/nginx -t + ${web_install_dir}/sbin/nginx -t if [ $? == 0 ]; then echo "Reload Nginx......" - $web_install_dir/sbin/nginx -s reload + ${web_install_dir}/sbin/nginx -s reload else - rm -rf $web_install_dir/conf/vhost/$domain.conf + rm -rf ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -563,81 +579,81 @@ EOF # For more information please visit https://oneinstack.com # ####################################################################### " - echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" - echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" - echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" - [ "$rewrite_yn" == 'y' ] && echo "`printf "%-30s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" - [ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" + echo "$(printf "%-30s" "Virtualhost conf:")${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND}" + echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" + [ "${rewrite_yn}" == 'y' ] && echo "$(printf "%-30s" "Rewrite rule:")${CMSG}${web_install_dir}/conf/rewrite/${rewrite}.conf${CEND}" + [ "${nginx_ssl_yn}" == 'y' ] && Print_ssl } Apache_log() { while :; do echo read -p "Allow Apache access_log? [y/n]: " access_yn - if [[ ! $access_yn =~ ^[y,n]$ ]]; then + if [[ ! "${access_yn}" =~ ^[y,n]$ ]]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break fi done - if [ "$access_yn" == 'n' ]; then + if [ "${access_yn}" == 'n' ]; then A_log='CustomLog "/dev/null" common' else - A_log="CustomLog \"$wwwlogs_dir/${domain}_apache.log\" common" - echo "You access log file=$wwwlogs_dir/${domain}_apache.log" + A_log="CustomLog \"${wwwlogs_dir}/${domain}_apache.log\" common" + echo "You access log file=${wwwlogs_dir}/${domain}_apache.log" fi } Create_apache_conf() { - [ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= - [ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost - cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && R_TMP='Require all granted' || R_TMP= + [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost + cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF - ServerAdmin admin@linuxeye.com - DocumentRoot "$vhostdir" - ServerName $domain - $Apache_Domain_alias - ErrorLog "$wwwlogs_dir/${domain}_error_apache.log" - $A_log - - SetOutputFilter DEFLATE - Options FollowSymLinks ExecCGI - $R_TMP - AllowOverride All - Order allow,deny - Allow from all - DirectoryIndex index.html index.php + ServerAdmin admin@example.com + DocumentRoot "${vhostdir}" + ServerName ${domain} + ${Apache_Domain_alias} + ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" + ${A_log} + + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + ${R_TMP} + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php EOF - [ "$apache_ssl_yn" == 'y' ] && cat >> $apache_install_dir/conf/vhost/$domain.conf << EOF + [ "$apache_ssl_yn" == 'y' ] && cat >> ${apache_install_dir}/conf/vhost/${domain}.conf << EOF - ServerAdmin admin@linuxeye.com - DocumentRoot "$vhostdir" - ServerName $domain - $Apache_Domain_alias - $Apache_SSL - ErrorLog "$wwwlogs_dir/${domain}_error_apache.log" - $A_log - - SetOutputFilter DEFLATE - Options FollowSymLinks ExecCGI - $R_TMP - AllowOverride All - Order allow,deny - Allow from all - DirectoryIndex index.html index.php + ServerAdmin admin@example.com + DocumentRoot "${vhostdir}" + ServerName ${domain} + ${Apache_Domain_alias} + ${Apache_SSL} + ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" + ${A_log} + + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + ${R_TMP} + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php EOF echo - $apache_install_dir/bin/apachectl -t + ${apache_install_dir}/bin/apachectl -t if [ $? == 0 ]; then echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf $apache_install_dir/conf/vhost/$domain.conf + rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -648,88 +664,88 @@ EOF # For more information please visit https://oneinstack.com # ####################################################################### " - echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" - echo "`printf "%-30s" "Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" - echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" + echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" + echo "$(printf "%-30s" "Virtualhost conf:")${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND}" + echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" } Create_nginx_apache_mod-php_conf() { # Nginx/Tengine/OpenResty - [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost - cat > $web_install_dir/conf/vhost/$domain.conf << EOF + [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost + cat > ${web_install_dir}/conf/vhost/${domain}.conf << EOF server { -$Nginx_conf -server_name $domain$moredomainame; -$N_log -index index.html index.htm index.php; -root $vhostdir; -$Nginx_redirect -$anti_hotlinking -location / { + ${Nginx_conf} + server_name ${domain}${moredomainame}; + ${N_log} + index index.html index.htm index.php; + root ${vhostdir}; + ${Nginx_redirect} + ${anti_hotlinking} + location / { try_files \$uri @apache; - } -location @apache { + } + location @apache { proxy_pass http://127.0.0.1:88; include proxy.conf; - } -location ~ .*\.(php|php5|cgi|pl)?$ { + } + location ~ .*\.(php|php5|cgi|pl)?$ { proxy_pass http://127.0.0.1:88; include proxy.conf; - } -location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; - } -location ~ .*\.(js|css)?$ { + } + location ~ .*\.(js|css)?$ { expires 7d; access_log off; - } + } } EOF - [ "$https_yn" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" $web_install_dir/conf/vhost/$domain.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo - $web_install_dir/sbin/nginx -t + ${web_install_dir}/sbin/nginx -t if [ $? == 0 ]; then echo "Reload Nginx......" - $web_install_dir/sbin/nginx -s reload + ${web_install_dir}/sbin/nginx -s reload else - rm -rf $web_install_dir/conf/vhost/$domain.conf + rm -rf ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" fi # Apache - [ "`$apache_install_dir/bin/apachectl -v | awk -F'.' /version/'{print $2}'`" == '4' ] && R_TMP='Require all granted' || R_TMP= - [ ! -d $apache_install_dir/conf/vhost ] && mkdir $apache_install_dir/conf/vhost - cat > $apache_install_dir/conf/vhost/$domain.conf << EOF + [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && R_TMP="Require all granted" || R_TMP= + [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost + cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF - ServerAdmin admin@linuxeye.com - DocumentRoot "$vhostdir" - ServerName $domain - $Apache_Domain_alias - $Apache_SSL - ErrorLog "$wwwlogs_dir/${domain}_error_apache.log" - $A_log - - SetOutputFilter DEFLATE - Options FollowSymLinks ExecCGI - $R_TMP - AllowOverride All - Order allow,deny - Allow from all - DirectoryIndex index.html index.php + ServerAdmin admin@example.com + DocumentRoot "${vhostdir}" + ServerName ${domain} + ${Apache_Domain_alias} + ${Apache_SSL} + ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" + ${A_log} + + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + ${R_TMP} + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php EOF echo - $apache_install_dir/bin/apachectl -t + ${apache_install_dir}/bin/apachectl -t if [ $? == 0 ]; then echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf $apache_install_dir/conf/vhost/$domain.conf + rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf exit 1 fi @@ -739,20 +755,20 @@ EOF # For more information please visit https://oneinstack.com # ####################################################################### " - echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}" - echo "`printf "%-30s" "Nginx Virtualhost conf:"`${CMSG}$web_install_dir/conf/vhost/$domain.conf${CEND}" - echo "`printf "%-30s" "Apache Virtualhost conf:"`${CMSG}$apache_install_dir/conf/vhost/$domain.conf${CEND}" - echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}" - [ "$rewrite_yn" == 'y' ] && echo "`printf "%-28s" "Rewrite rule:"`${CMSG}$web_install_dir/conf/rewrite/$rewrite.conf${CEND}" - [ "$nginx_ssl_yn" == 'y' ] && Print_ssl + echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" + echo "$(printf "%-30s" "Nginx Virtualhost conf:")${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND}" + echo "$(printf "%-30s" "Apache Virtualhost conf:")${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND}" + echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" + [ "${rewrite_yn}" == 'y' ] && echo "$(printf "%-28s" "Rewrite rule:")${CMSG}${web_install_dir}/conf/rewrite/${rewrite}.conf${CEND}" + [ "${nginx_ssl_yn}" == 'y' ] && Print_ssl } Add_Vhost() { - if [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ -e "${web_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" ]; then Choose_env Input_Add_domain Nginx_anti_hotlinking - if [ "$NGX_FLAG" == 'java' ]; then + if [ "${NGX_FLAG}" == "java" ]; then Nginx_log Create_nginx_tomcat_conf else @@ -760,71 +776,74 @@ Add_Vhost() { Nginx_log Create_nginx_php-fpm_hhvm_conf fi - elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ]; then + elif [ ! -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/conf/httpd.conf" ]; then Choose_env Input_Add_domain Apache_log Create_apache_conf - elif [ ! -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" -a -e "$tomcat_install_dir/conf/server.xml" ]; then + elif [ ! -e "${web_install_dir}/sbin/nginx" -a ! -e "${apache_install_dir}/conf/httpd.conf" -a -e "${tomcat_install_dir}/conf/server.xml" ]; then Choose_env Input_Add_domain Create_tomcat_conf - elif [ -e "$web_install_dir/sbin/nginx" -a -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ]; then + elif [ -e "${web_install_dir}/sbin/nginx" -a -e "$(ls ${apache_install_dir}/modules/libphp?.so 2>/dev/null)" ]; then Choose_env Input_Add_domain Nginx_anti_hotlinking - if [ "$NGX_FLAG" == 'java' ]; then + if [ "${NGX_FLAG}" == "java" ]; then Nginx_log Create_nginx_tomcat_conf - elif [ "$NGX_FLAG" == 'hhvm' ]; then + elif [ "${NGX_FLAG}" == "hhvm" ]; then Nginx_rewrite Nginx_log Create_nginx_php-fpm_hhvm_conf - elif [ "$NGX_FLAG" == 'php' ]; then + elif [ "${NGX_FLAG}" == "php" ]; then #Nginx_rewrite Nginx_log Apache_log Create_nginx_apache_mod-php_conf fi + else + echo "Error! ${CFAILURE}Web server${CEND} not found!" fi } Del_NGX_Vhost() { - if [ -e "$web_install_dir/sbin/nginx" ]; then - [ -d "$web_install_dir/conf/vhost" ] && Domain_List=`ls $web_install_dir/conf/vhost | sed "s@.conf@@g"` - if [ -n "$Domain_List" ]; then + if [ -e "${web_install_dir}/sbin/nginx" ]; then + [ -d "${web_install_dir}/conf/vhost" ] && Domain_List=$(ls ${web_install_dir}/conf/vhost | sed "s@.conf@@g") + if [ -n "${Domain_List}" ]; then echo echo "Virtualhost list:" - echo ${CMSG}$Domain_List${CEND} - while :; do echo - read -p "Please input a domain you want to delete: " domain - if [ -z "`echo $domain | grep '.*\..*'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - if [ -e "$web_install_dir/conf/vhost/${domain}.conf" ]; then - Directory=`grep ^root $web_install_dir/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}'` - rm -rf $web_install_dir/conf/vhost/${domain}.conf - $web_install_dir/sbin/nginx -s reload - while :; do echo - read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn - if [[ ! $Del_Vhost_wwwroot_yn =~ ^[y,n]$ ]]; then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break + echo ${CMSG}${Domain_List}${CEND} + while :; do echo + read -p "Please input a domain you want to delete: " domain + if [ -z "$(echo ${domain} | grep '.*\..*')" ]; then + echo "${CWARNING}input error! ${CEND}" + else + if [ -e "${web_install_dir}/conf/vhost/${domain}.conf" ]; then + Directory=$(grep ^root ${web_install_dir}/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}') + rm -rf ${web_install_dir}/conf/vhost/${domain}.conf + ${web_install_dir}/sbin/nginx -s reload + while :; do echo + read -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_yn + if [[ ! ${Del_Vhost_wwwroot_yn} =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + if [ "${Del_Vhost_wwwroot_yn}" == 'y' ]; then + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=$(get_char) + rm -rf ${Directory} fi - done - if [ "$Del_Vhost_wwwroot_yn" == 'y' ]; then - echo "Press Ctrl+c to cancel or Press any key to continue..." - char=`get_char` - rm -rf $Directory + echo "${CSUCCESS}Domain: ${domain} has been deleted.${CEND}" + else + echo "${CWARNING}Virtualhost: ${domain} was not exist! ${CEND}" fi - echo "${CSUCCESS}Domain: ${domain} has been deleted.${CEND}" - else - echo "${CWARNING}Virtualhost: $domain was not exist! ${CEND}" + break fi - break - fi - done + done + else echo "${CWARNING}Virtualhost was not exist! ${CEND}" fi @@ -832,42 +851,42 @@ Del_NGX_Vhost() { } Del_Apache_Vhost() { - if [ -e "$apache_install_dir/conf/httpd.conf" ]; then - if [ -e "$web_install_dir/sbin/nginx" ]; then - rm -rf $apache_install_dir/conf/vhost/${domain}.conf + if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then + if [ -e "${web_install_dir}/sbin/nginx" ]; then + rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf /etc/init.d/httpd restart else - Domain_List=`ls $apache_install_dir/conf/vhost | grep -v '0.conf' | sed "s@.conf@@g"` - if [ -n "$Domain_List" ]; then + Domain_List=$(ls ${apache_install_dir}/conf/vhost | grep -v '0.conf' | sed "s@.conf@@g") + if [ -n "${Domain_List}" ]; then echo echo "Virtualhost list:" - echo ${CMSG}$Domain_List${CEND} + echo ${CMSG}${Domain_List}${CEND} while :; do echo read -p "Please input a domain you want to delete: " domain - if [ -z "`echo $domain | grep '.*\..*'`" ]; then + if [ -z "$(echo ${domain} | grep '.*\..*')" ]; then echo "${CWARNING}input error! ${CEND}" else - if [ -e "$apache_install_dir/conf/vhost/${domain}.conf" ]; then - Directory=`grep '^ Date: Wed, 2 Nov 2016 09:35:33 +0800 Subject: [PATCH 602/617] Delete tcmalloc --- README.md | 2 +- config/index.html | 2 +- config/index_cn.html | 2 +- include/check_download.sh | 11 +-- include/jemalloc.sh | 4 +- include/mariadb-10.0.sh | 16 +--- include/mariadb-10.1.sh | 16 +--- include/mariadb-5.5.sh | 21 +---- include/mysql-5.5.sh | 17 +---- include/mysql-5.6.sh | 16 +--- include/mysql-5.7.sh | 16 +--- include/nginx.sh | 29 +++---- include/openresty.sh | 29 +++---- include/percona-5.5.sh | 21 +---- include/percona-5.6.sh | 16 +--- include/percona-5.7.sh | 16 +--- include/tcmalloc.sh | 28 ------- include/tengine.sh | 29 +++---- include/upgrade_db.sh | 17 +---- include/upgrade_web.sh | 6 +- init.d/Redis-server-init | 4 +- install.sh | 156 +++++++++++++++----------------------- versions.txt | 7 +- vhost.sh | 2 +- 24 files changed, 130 insertions(+), 353 deletions(-) delete mode 100644 include/tcmalloc.sh diff --git a/README.md b/README.md index d043c280..f4844c69 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Script properties: - According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php encryption and decryption tool ionCube, ZendGuardLoader - Installation Pureftpd, phpMyAdmin according to their needs - Install memcached, redis according to their needs -- Tcmalloc can use according to their needs or jemalloc optimize MySQL, Nginx +- Jemalloc optimize MySQL, Nginx - Providing add a virtual host script, include Let's Encrypt SSL certificate - Provide Nginx/Tengine, MySQL/MariaDB/Percona, PHP, Redis, phpMyAdmin upgrade script - Provide local backup and remote backup (rsync between servers) script diff --git a/config/index.html b/config/index.html index f6694c97..8dd397bd 100644 --- a/config/index.html +++ b/config/index.html @@ -22,7 +22,7 @@

Congratulations, OneinStack installed successfully!

-

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona
+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc.

+

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona
+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc.

Check environment:  Proberv phpinfo Opcache phpMyAdmin

Create Web virtual running script:  ./vhost.sh

Create FTP virtual running script:  ./pureftpd_vhost.sh

diff --git a/config/index_cn.html b/config/index_cn.html index 26efdfac..b35aa3cc 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -22,7 +22,7 @@

恭喜您,OneinStack 安装成功!

-

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc/tcmalloc 脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

+

OneinStack Linux+Nginx/Tengine+MySQL/MariaDB/Percona+PHP
+Pureftpd+phpMyAdmin+redis+memcached+jemalloc脚本中用到的软件包大多最新稳定版本,修复了一些安全性问题。

查看本地环境:  探针 phpinfo Opcache phpMyAdmin(为了更安全,建议重命名 phpMyAdmin 目录!)

创建 WEB 虚拟主机执行脚本:  ./vhost.sh

创建 FTP 虚拟账号执行脚本:  ./pureftpd_vhost.sh

diff --git a/include/check_download.sh b/include/check_download.sh index 8396c9dc..6d005e36 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -685,14 +685,9 @@ checkDownload(){ src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_version}/+download/libmemcached-${libmemcached_version}.tar.gz && Download_src fi - if [ "${je_tc_malloc_yn}" == 'y' ]; then - if [ "${je_tc_malloc}" == '1' ]; then - echo "Download jemalloc..." - src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src - elif [ "${je_tc_malloc}" == '2' ]; then - echo "Download tcmalloc..." - src_url=${mirrorLink}/gperftools-${tcmalloc_version}.tar.gz && Download_src - fi + if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then + echo "Download jemalloc..." + src_url=${mirrorLink}/jemalloc-${jemalloc_version}.tar.bz2 && Download_src fi # others diff --git a/include/jemalloc.sh b/include/jemalloc.sh index edd49d45..33ef5341 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -17,9 +17,9 @@ Install_jemalloc() { popd if [ -f "/usr/local/lib/libjemalloc.so" ]; then if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ]; then - ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 + ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 else - ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1 + ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1 fi echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index ca1d2b0b..32915d09 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -20,22 +20,10 @@ Install_MariaDB-10-0() { if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_10_0_version}.tar.gz pushd mariadb-${mariadb_10_0_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 - cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ -DSYSCONFDIR=/etc \ @@ -50,7 +38,7 @@ Install_MariaDB-10-0() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 4f02016e..083e235c 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -20,22 +20,10 @@ Install_MariaDB-10-1() { if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_10_1_version}.tar.gz pushd mariadb-${mariadb_10_1_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 - cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ -DSYSCONFDIR=/etc \ @@ -50,7 +38,7 @@ Install_MariaDB-10-1() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 470fe8fe..4bb59e15 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -20,26 +20,11 @@ Install_MariaDB-5-5() { if [ "${dbInstallMethods}" == "1" ]; then tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb_5_5_version}.tar.gz pushd mariadb-${mariadb_5_5_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 - - if [ "${armPlatform}" == "y" ]; then - patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch - fi - + [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ -DSYSCONFDIR=/etc \ @@ -55,7 +40,7 @@ Install_MariaDB-5-5() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 87e49d28..161487ab 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -20,24 +20,11 @@ Install_MySQL-5-5() { if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_5_version}.tar.gz pushd mysql-${mysql_5_5_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 - [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch - cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -53,7 +40,7 @@ Install_MySQL-5-5() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index e2a6ef82..508f7bdc 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -20,22 +20,10 @@ Install_MySQL-5-6() { if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_6_version}.tar.gz pushd mysql-${mysql_5_6_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 - cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -50,7 +38,7 @@ Install_MySQL-5-6() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 2cbd99e6..9a5390c9 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -20,22 +20,10 @@ Install_MySQL-5-7() { if [ "${dbInstallMethods}" == "1" ]; then tar xvf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${mysql_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql_5_7_version}.tar.gz pushd mysql-${mysql_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 - cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -50,7 +38,7 @@ Install_MySQL-5-7() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/nginx.sh b/include/nginx.sh index 7e06f567..4c959e92 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -26,16 +26,8 @@ Install_Nginx() { # close debug sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc - if [ "$je_tc_malloc" == '1' ]; then - malloc_module="--with-ld-opt='-ljemalloc'" - elif [ "$je_tc_malloc" == '2' ]; then - malloc_module='--with-google_perftools_module' - mkdir /tmp/tcmalloc - chown -R ${run_user}.$run_user /tmp/tcmalloc - fi - [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir - ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ]; then popd @@ -84,21 +76,20 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $nginx_install_dir/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf - [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate + daily + rotate 5 + missingok + dateext + compress + notifempty + sharedscripts + postrotate [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` -endscript + endscript } EOF popd diff --git a/include/openresty.sh b/include/openresty.sh index 2f875c99..0391cc66 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -23,16 +23,8 @@ Install_OpenResty() { openresty_version_tmp=${openresty_version%.*} sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug - if [ "$je_tc_malloc" == '1' ]; then - malloc_module="--with-ld-opt='-ljemalloc'" - elif [ "$je_tc_malloc" == '2' ]; then - malloc_module='--with-google_perftools_module' - mkdir /tmp/tcmalloc - chown -R ${run_user}.$run_user /tmp/tcmalloc - fi - [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ]; then popd @@ -81,21 +73,20 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $openresty_install_dir/nginx/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $openresty_install_dir/nginx/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $openresty_install_dir/nginx/conf/nginx.conf - [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $openresty_install_dir/nginx/conf/nginx.conf # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate + daily + rotate 5 + missingok + dateext + compress + notifempty + sharedscripts + postrotate [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` -endscript + endscript } EOF popd diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index b0d4aafe..14dbe8f8 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -21,26 +21,11 @@ Install_Percona-5-5() { perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_5_version}.tar.gz pushd percona-server-${percona_5_5_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 - - if [ "${armPlatform}" == "y" ]; then - patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch - fi - + [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ -DSYSCONFDIR=/etc \ @@ -56,7 +41,7 @@ Install_Percona-5-5() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 7d07a32e..af871590 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -21,22 +21,10 @@ Install_Percona-5-6() { perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_6_version}.tar.gz pushd percona-server-${percona_5_6_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 - cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ -DSYSCONFDIR=/etc \ @@ -52,7 +40,7 @@ Install_Percona-5-6() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 56751b20..5eda9891 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -20,22 +20,10 @@ Install_Percona-5-7() { if [ "${dbInstallMethods}" == "1" ]; then tar xvf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} - - if [ "${je_tc_malloc}" == "1" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - elif [ "${je_tc_malloc}" == "2" ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' ${percona_install_dir}/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona_5_7_version}.tar.gz pushd 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 - cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ -DSYSCONFDIR=/etc \ @@ -52,7 +40,7 @@ Install_Percona-5-7() { -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ - ${EXE_LINKER} + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' make -j ${THREAD} make install popd diff --git a/include/tcmalloc.sh b/include/tcmalloc.sh deleted file mode 100644 index bb2bc036..00000000 --- a/include/tcmalloc.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Author: yeho -# 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_tcmalloc() { - pushd ${oneinstack_dir}/src - tar xzf gperftools-$tcmalloc_version.tar.gz - pushd gperftools-$tcmalloc_version - ./configure --enable-frame-pointers - make -j ${THREAD} && make install - popd - if [ -f "/usr/local/lib/libtcmalloc.so" ]; then - echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf - ldconfig - echo "${CSUCCESS}tcmalloc module installed successfully! ${CEND}" - rm -rf gperftools-$tcmalloc_version - else - echo "${CFAILURE}tcmalloc module install failed, Please contact the author! ${CEND}" - kill -9 $$ - fi - popd -} diff --git a/include/tengine.sh b/include/tengine.sh index 6dad7c55..23c83148 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -24,16 +24,8 @@ Install_Tengine() { # close debug sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc - if [ "$je_tc_malloc" == '1' ]; then - malloc_module='--with-jemalloc' - elif [ "$je_tc_malloc" == '2' ]; then - malloc_module='--with-google_perftools_module' - mkdir /tmp/tcmalloc - chown -R ${run_user}.$run_user /tmp/tcmalloc - fi - [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir - ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-jemalloc make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then popd @@ -82,7 +74,6 @@ EOF sed -i "s@/data/wwwroot/default@$wwwroot_dir/default@" $tengine_install_dir/conf/nginx.conf sed -i "s@/data/wwwlogs@$wwwlogs_dir@g" $tengine_install_dir/conf/nginx.conf sed -i "s@^user www www@user $run_user $run_user@" $tengine_install_dir/conf/nginx.conf - [ "$je_tc_malloc" == '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $tengine_install_dir/conf/nginx.conf uname -r | awk -F'.' '{if ($1$2>=39)S=0;else S=1}{exit S}' && [ -z "`grep 'reuse_port on;' $tengine_install_dir/conf/nginx.conf`" ] && sed -i "s@worker_connections 51200;@worker_connections 51200;\n reuse_port on;@" $tengine_install_dir/conf/nginx.conf # worker_cpu_affinity @@ -91,16 +82,16 @@ EOF # logrotate nginx log cat > /etc/logrotate.d/nginx << EOF $wwwlogs_dir/*nginx.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate + daily + rotate 5 + missingok + dateext + compress + notifempty + sharedscripts + postrotate [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` -endscript + endscript } EOF popd diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 3dec7397..bb481493 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -53,10 +53,6 @@ Upgrade_DB() { #upgrade echo echo "Current $DB Version: ${CMSG}$OLD_DB_version${CEND}" - [ -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'"; } - [ -e /usr/local/lib/libjemalloc.so -a -e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=1; EXE_LINKER="-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'"; } - while :; do echo read -p "Please input upgrade $DB Version(example: $OLD_DB_version): " NEW_DB_version if [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` == `echo $OLD_DB_version | awk -F. '{print $1"."$2}'` ]; then @@ -95,11 +91,7 @@ Upgrade_DB() { tar xzf $DB_name.tar.gz [ ! -d "$mariadb_install_dir" ] && mkdir -p $mariadb_install_dir mv mariadb-${NEW_DB_version}-*-${SYS_BIT_b}/* $mariadb_install_dir - if [ "$je_tc_malloc" == '1' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe - elif [ "$je_tc_malloc" == '2' -a "`echo $OLD_DB_version_tmp | awk -F'.' '{print $1"."$2}'`" != '10.1' ]; then - sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mariadb_install_dir/bin/mysqld_safe - fi + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mariadb_install_dir/bin/mysqld_safe $mariadb_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mariadb_install_dir --datadir=$mariadb_data_dir chown mysql.mysql -R $mariadb_data_dir service mysqld start @@ -127,7 +119,7 @@ Upgrade_DB() { -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ - $EXE_LINKER + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' else cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \ -DMYSQL_DATADIR=$percona_data_dir \ @@ -142,7 +134,7 @@ Upgrade_DB() { -DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ - $EXE_LINKER + -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' fi make -j ${THREAD} service mysqld stop @@ -172,8 +164,7 @@ Upgrade_DB() { [ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir mv $DB_name/* $mysql_install_dir/ - [ "$je_tc_malloc" == '1' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe - [ "$je_tc_malloc" == '2' ] && sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libtcmalloc.so@' $mysql_install_dir/bin/mysqld_safe + sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 39ec7b2e..080a6f16 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -159,11 +159,7 @@ Upgrade_OpenResty() { openresty_version_tmp=${NEW_OpenResty_version%.*} sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug $openresty_install_dir/nginx/sbin/nginx -V &> $$ - openresty_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'` - rm -rf $$ - [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'" - [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module' - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' make -j ${THREAD} if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ]; then /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`} diff --git a/init.d/Redis-server-init b/init.d/Redis-server-init index f8d43f27..c1e2cea8 100755 --- a/init.d/Redis-server-init +++ b/init.d/Redis-server-init @@ -30,7 +30,7 @@ case "$1" in chown redis:redis $PIDFILE if start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS then - echo -e "\e[00;32m[OK]\e[00m" + echo "[OK]" else echo "failed" fi @@ -39,7 +39,7 @@ case "$1" in echo -n "Stopping $DESC: " if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON then - echo -e "\e[00;32m[OK]\e[00m" + echo "[OK]" else echo "failed" fi diff --git a/install.sh b/install.sh index bd5a261d..21a3b1df 100755 --- a/install.sh +++ b/install.sh @@ -95,62 +95,62 @@ while :; do echo fi done # Tomcat - while :; do echo - echo 'Please select tomcat server:' - echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" - echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" - echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" - echo -e "\t${CMSG}4${CEND}. Do not install" - read -p "Please input a number:(Default 4 press Enter) " Tomcat_version - [ -z "$Tomcat_version" ] && Tomcat_version=4 - if [[ ! $Tomcat_version =~ ^[1-4]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" - else - [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } - if [ "$Tomcat_version" == '1' ]; then - while :; do echo - echo 'Please select JDK version:' - echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - read -p "Please input a number:(Default 2 press Enter) " JDK_version - [ -z "$JDK_version" ] && JDK_version=2 - if [[ ! $JDK_version =~ ^[1-2]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi - done - elif [ "$Tomcat_version" == '2' ]; then - while :; do echo - echo 'Please select JDK version:' - echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" - echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - read -p "Please input a number:(Default 2 press Enter) " JDK_version - [ -z "$JDK_version" ] && JDK_version=2 - if [[ ! $JDK_version =~ ^[1-3]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" - else - break - fi - done - elif [ "$Tomcat_version" == '3' ]; then - while :; do echo - echo 'Please select JDK version:' - echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" - echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" - read -p "Please input a number:(Default 2 press Enter) " JDK_version - [ -z "$JDK_version" ] && JDK_version=2 - if [[ ! $JDK_version =~ ^[2-3]$ ]]; then - echo "${CWARNING}input error! Please only input number 2,3${CEND}" - else - break - fi - done - fi - break - fi - done + #while :; do echo + # echo 'Please select tomcat server:' + # echo -e "\t${CMSG}1${CEND}. Install Tomcat-8" + # echo -e "\t${CMSG}2${CEND}. Install Tomcat-7" + # echo -e "\t${CMSG}3${CEND}. Install Tomcat-6" + # echo -e "\t${CMSG}4${CEND}. Do not install" + # read -p "Please input a number:(Default 4 press Enter) " Tomcat_version + # [ -z "$Tomcat_version" ] && Tomcat_version=4 + # if [[ ! $Tomcat_version =~ ^[1-4]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + # else + # [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; } + # if [ "$Tomcat_version" == '1' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[1-2]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2${CEND}" + # else + # break + # fi + # done + # elif [ "$Tomcat_version" == '2' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}1${CEND}. Install JDK-1.8" + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[1-3]$ ]]; then + # echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + # else + # break + # fi + # done + # elif [ "$Tomcat_version" == '3' ]; then + # while :; do echo + # echo 'Please select JDK version:' + # echo -e "\t${CMSG}2${CEND}. Install JDK-1.7" + # echo -e "\t${CMSG}3${CEND}. Install JDK-1.6" + # read -p "Please input a number:(Default 2 press Enter) " JDK_version + # [ -z "$JDK_version" ] && JDK_version=2 + # if [[ ! $JDK_version =~ ^[2-3]$ ]]; then + # echo "${CWARNING}input error! Please only input number 2,3${CEND}" + # else + # break + # fi + # done + # fi + # break + # fi + #done fi break fi @@ -420,32 +420,6 @@ while :; do echo fi done -# check jemalloc or tcmalloc -if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then - while :; do echo - 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 - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - if [ "$je_tc_malloc_yn" == 'y' ]; then - echo 'Please select jemalloc or tcmalloc:' - echo -e "\t${CMSG}1${CEND}. jemalloc" - echo -e "\t${CMSG}2${CEND}. tcmalloc" - while :; do - read -p "Please input a number:(Default 1 press Enter) " je_tc_malloc - [ -z "$je_tc_malloc" ] && je_tc_malloc=1 - if [[ ! $je_tc_malloc =~ ^[1-2]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi - done - fi - break - fi - done -fi - while :; do echo read -p "Do you want to install HHVM? [y/n]: " HHVM_yn if [[ ! $HHVM_yn =~ ^[y,n]$ ]]; then @@ -511,18 +485,12 @@ checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log # Install dependencies from source package installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log -# jemalloc or tcmalloc -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '1' -a ! -e "/usr/local/lib/libjemalloc.so" ]; then - . include/jemalloc.sh - Install_jemalloc | tee -a $oneinstack_dir/install.log -fi -if [ "$DB_version" == '4' -a ! -e "/usr/local/lib/libjemalloc.so" ]; then - . include/jemalloc.sh - Install_jemalloc | tee -a $oneinstack_dir/install.log -fi -if [ "$je_tc_malloc_yn" == 'y' -a "$je_tc_malloc" == '2' -a ! -e "/usr/local/lib/libtcmalloc.so" ]; then - . include/tcmalloc.sh - Install_tcmalloc | tee -a $oneinstack_dir/install.log +# jemalloc +if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then + if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then + . include/jemalloc.sh + Install_jemalloc | tee -a $oneinstack_dir/install.log + fi fi # Database diff --git a/versions.txt b/versions.txt index eb95e866..a17f76af 100644 --- a/versions.txt +++ b/versions.txt @@ -45,8 +45,8 @@ php_3_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 -apcu_for_php7_version=5.1.6 -ImageMagick_version=6.9.6-2 +apcu_for_php7_version=5.1.7 +ImageMagick_version=6.9.6-3 imagick_version=3.4.1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 @@ -79,9 +79,6 @@ phpMyAdmin_version=4.4.15.8 # jemalloc jemalloc_version=4.2.1 -# tcmalloc -tcmalloc_version=2.5 - # boost boost_version=1.59.0 diff --git a/vhost.sh b/vhost.sh index 0dd82d1a..14b1a0fc 100755 --- a/vhost.sh +++ b/vhost.sh @@ -319,7 +319,7 @@ Input_Add_domain() { break fi done - [ "${redirect_yn}" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n}") + [ "${redirect_yn}" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") fi fi From d24ce53b7c21dfe4582cc16199a6581d9fa95937 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 11 Nov 2016 09:46:16 +0800 Subject: [PATCH 603/617] Fix php-5.3 --- addons.sh | 2 +- config/nginx.conf | 147 +++++++++++++++---------------- config/nginx_apache.conf | 157 +++++++++++++++++----------------- config/nginx_tomcat.conf | 143 ++++++++++++++++--------------- include/apache-2.2.sh | 2 +- include/apache-2.4.sh | 2 +- include/check_download.sh | 3 +- include/mariadb-10.0.sh | 3 +- include/mariadb-10.1.sh | 3 +- include/mariadb-5.5.sh | 3 +- include/mysql-5.5.sh | 3 +- include/mysql-5.6.sh | 3 +- include/mysql-5.7.sh | 3 +- include/percona-5.5.sh | 3 +- include/percona-5.6.sh | 3 +- include/percona-5.7.sh | 3 +- include/php-5.3.sh | 8 +- include/tengine.sh | 2 +- include/upgrade_memcached.sh | 54 ++++++++++++ include/upgrade_php.sh | 43 ++++++---- include/upgrade_phpmyadmin.sh | 2 +- include/upgrade_redis.sh | 3 +- uninstall.sh | 4 +- upgrade.sh | 17 +++- versions.txt | 16 ++-- vhost.sh | 32 ++++--- 26 files changed, 375 insertions(+), 289 deletions(-) create mode 100644 include/upgrade_memcached.sh diff --git a/addons.sh b/addons.sh index 8f6b4c1c..d44d0a4e 100755 --- a/addons.sh +++ b/addons.sh @@ -137,7 +137,7 @@ EOF } Uninstall_letsencrypt() { - rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt + rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root sed -i '/certbot-auto/d' ${Cron_file} echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; diff --git a/config/nginx.conf b/config/nginx.conf index 134f1704..38550cb3 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -6,86 +6,89 @@ pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { - use epoll; - worker_connections 51200; - multi_accept on; - } + use epoll; + worker_connections 51200; + multi_accept on; +} http { - include mime.types; - default_type application/octet-stream; - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 1024m; - client_body_buffer_size 10m; - sendfile on; - tcp_nopush on; - keepalive_timeout 120; - server_tokens off; - tcp_nodelay on; + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 1024m; + client_body_buffer_size 10m; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; + server_tokens off; + tcp_nodelay on; - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; - fastcgi_intercept_errors on; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; - #Gzip Compression - gzip on; - gzip_buffers 16 8k; - gzip_comp_level 6; - gzip_http_version 1.1; - gzip_min_length 256; - gzip_proxied any; - gzip_vary on; - gzip_types - text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml - text/javascript application/javascript application/x-javascript - text/x-json application/json application/x-web-app-manifest+json - text/css text/plain text/x-component - font/opentype application/x-font-ttf application/vnd.ms-fontobject - image/x-icon; - gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + #Gzip Compression + gzip on; + gzip_buffers 16 8k; + gzip_comp_level 6; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; - #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. - open_file_cache max=1000 inactive=20s; - open_file_cache_valid 30s; - open_file_cache_min_uses 2; - open_file_cache_errors on; + #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; ######################## default ############################ - server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.php; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; - } - location ~ [^/]\.php(/|$) { - #fastcgi_pass remote_php_ip:9000; - fastcgi_pass unix:/dev/shm/php-cgi.sock; - fastcgi_index index.php; - include fastcgi.conf; - } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; - } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } + server { + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.php; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; + } + location ~ [^/]\.php(/|$) { + #fastcgi_pass remote_php_ip:9000; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_index index.php; + include fastcgi.conf; + } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; + } + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } + location ~ /\.ht { + deny all; } + } ########################## vhost ############################# - include vhost/*.conf; + include vhost/*.conf; } diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index 842882b9..ece8deaf 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -6,91 +6,94 @@ pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { - use epoll; - worker_connections 51200; - multi_accept on; - } + use epoll; + worker_connections 51200; + multi_accept on; +} http { - include mime.types; - default_type application/octet-stream; - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 1024m; - client_body_buffer_size 10m; - sendfile on; - tcp_nopush on; - keepalive_timeout 120; - server_tokens off; - tcp_nodelay on; + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 1024m; + client_body_buffer_size 10m; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; + server_tokens off; + tcp_nodelay on; - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; - fastcgi_intercept_errors on; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; - #Gzip Compression - gzip on; - gzip_buffers 16 8k; - gzip_comp_level 6; - gzip_http_version 1.1; - gzip_min_length 256; - gzip_proxied any; - gzip_vary on; - gzip_types - text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml - text/javascript application/javascript application/x-javascript - text/x-json application/json application/x-web-app-manifest+json - text/css text/plain text/x-component - font/opentype application/x-font-ttf application/vnd.ms-fontobject - image/x-icon; - gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + #Gzip Compression + gzip on; + gzip_buffers 16 8k; + gzip_comp_level 6; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; - #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. - open_file_cache max=1000 inactive=20s; - open_file_cache_valid 30s; - open_file_cache_min_uses 2; - open_file_cache_errors on; + #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; ######################## default ############################ - server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.php; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; - } - location / { - try_files $uri @apache; - } - location @apache { - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } - location ~ [^/]\.php(/|$) { - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; - } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } + server { + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.php; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; + } + location / { + try_files $uri @apache; + } + location @apache { + proxy_pass http://127.0.0.1:88; + include proxy.conf; + } + location ~ [^/]\.php(/|$) { + proxy_pass http://127.0.0.1:88; + include proxy.conf; + } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; + } + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } + location ~ /\.ht { + deny all; } + } ########################## vhost ############################# - include vhost/*.conf; + include vhost/*.conf; } diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index a3dbab36..da082c79 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -6,84 +6,87 @@ pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { - use epoll; - worker_connections 51200; - multi_accept on; - } + use epoll; + worker_connections 51200; + multi_accept on; +} http { - include mime.types; - default_type application/octet-stream; - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 1024m; - client_body_buffer_size 10m; - sendfile on; - tcp_nopush on; - keepalive_timeout 120; - server_tokens off; - tcp_nodelay on; + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 1024m; + client_body_buffer_size 10m; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; + server_tokens off; + tcp_nodelay on; - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; - fastcgi_intercept_errors on; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; + fastcgi_intercept_errors on; - #Gzip Compression - gzip on; - gzip_buffers 16 8k; - gzip_comp_level 6; - gzip_http_version 1.1; - gzip_min_length 256; - gzip_proxied any; - gzip_vary on; - gzip_types - text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml - text/javascript application/javascript application/x-javascript - text/x-json application/json application/x-web-app-manifest+json - text/css text/plain text/x-component - font/opentype application/x-font-ttf application/vnd.ms-fontobject - image/x-icon; - gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + #Gzip Compression + gzip on; + gzip_buffers 16 8k; + gzip_comp_level 6; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; - #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. - open_file_cache max=1000 inactive=20s; - open_file_cache_valid 30s; - open_file_cache_min_uses 2; - open_file_cache_errors on; + #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; ######################## default ############################ - server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.jsp; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; - } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; - } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } - location ~ { - proxy_pass http://127.0.0.1:8080; - include proxy.conf; - } + server { + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.jsp; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; + } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; + } + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } + location ~ { + proxy_pass http://127.0.0.1:8080; + include proxy.conf; + } + location ~ /\.ht { + deny all; } + } ########################## vhost ############################# - include vhost/*.conf; + include vhost/*.conf; } diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 27df289a..d9acbfda 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -76,7 +76,7 @@ $wwwlogs_dir/*apache.log { EOF mkdir $apache_install_dir/conf/vhost - cat >> $apache_install_dir/conf/vhost/0.conf << EOF + cat > $apache_install_dir/conf/vhost/0.conf << EOF NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index a7207e85..23013d05 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -90,7 +90,7 @@ $wwwlogs_dir/*apache.log { EOF mkdir $apache_install_dir/conf/vhost - cat >> $apache_install_dir/conf/vhost/0.conf << EOF + cat > $apache_install_dir/conf/vhost/0.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" diff --git a/include/check_download.sh b/include/check_download.sh index 6d005e36..3845803c 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -107,7 +107,7 @@ checkDownload(){ if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} fi else @@ -492,6 +492,7 @@ checkDownload(){ if [ "${Debian_version}" == '8' -o "${Ubuntu_version}" == "16" ]; then if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ]; then src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src + src_url=${mirrorLink}/curl-7.35.0.tar.gz && Download_src fi fi src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 32915d09..3d442941 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -67,7 +67,6 @@ Install_MariaDB-10-0() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -194,7 +193,7 @@ EOF ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} chown mysql.mysql -R ${mariadb_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 083e235c..4ac49056 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -67,7 +67,6 @@ Install_MariaDB-10-1() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -194,7 +193,7 @@ EOF ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} chown mysql.mysql -R ${mariadb_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 4bb59e15..eac39946 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -69,7 +69,6 @@ Install_MariaDB-5-5() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -197,7 +196,7 @@ EOF ${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir} chown mysql.mysql -R ${mariadb_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 161487ab..1c715b48 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -69,7 +69,6 @@ Install_MySQL-5-5() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -200,7 +199,7 @@ EOF ${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} chown mysql.mysql -R ${mysql_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 508f7bdc..7fd16ef7 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -67,7 +67,6 @@ Install_MySQL-5-6() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -199,7 +198,7 @@ EOF ${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} chown mysql.mysql -R ${mysql_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 9a5390c9..ef39a857 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -67,7 +67,6 @@ Install_MySQL-5-7() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -200,7 +199,7 @@ EOF ${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir} chown mysql.mysql -R ${mysql_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} service mysqld start [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 14dbe8f8..6f69dcb5 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -70,7 +70,6 @@ Install_Percona-5-5() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -201,7 +200,7 @@ EOF ${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir} chown mysql.mysql -R ${percona_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/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 diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index af871590..772c21b0 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -69,7 +69,6 @@ Install_Percona-5-6() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -201,7 +200,7 @@ EOF ${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir} chown mysql.mysql -R ${percona_data_dir} - [ -d "/etc/mysql" ] && mv /etc/mysql{,_bk} + [ -d "/etc/mysql" ] && /bin/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 diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 5eda9891..692f84e2 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -69,7 +69,6 @@ Install_Percona-5-7() { popd # my.cnf - [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} cat > /etc/my.cnf << EOF [client] port = 3306 @@ -201,7 +200,7 @@ EOF ${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} + [ -d "/etc/mysql" ] && /bin/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 diff --git a/include/php-5.3.sh b/include/php-5.3.sh index d5c2fa24..13ecd6a2 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -34,16 +34,18 @@ Install_PHP-5-3() { OpenSSL_args='--with-openssl' fi - tar xzf curl-$curl_version.tar.gz - pushd curl-$curl_version if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then + tar xzf curl-7.35.0.tar.gz + pushd curl-7.35.0 LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl else + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version ./configure --prefix=/usr/local fi make -j ${THREAD} && make install popd - rm -rf curl-$curl_version + rm -rf curl-7.35.0 curl-$curl_version tar xzf libmcrypt-$libmcrypt_version.tar.gz pushd libmcrypt-$libmcrypt_version diff --git a/include/tengine.sh b/include/tengine.sh index 23c83148..185aadbe 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -25,7 +25,7 @@ Install_Tengine() { sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir - ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-jemalloc + ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-jemalloc make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then popd diff --git a/include/upgrade_memcached.sh b/include/upgrade_memcached.sh new file mode 100644 index 00000000..cae33d2c --- /dev/null +++ b/include/upgrade_memcached.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Author: yeho +# 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 + +Upgrade_Memcached() { + pushd ${oneinstack_dir}/src > /dev/null + [ ! -e "${memcached_install_dir}/bin/memcached" ] && echo "${CWARNING}Memcached is not installed on your system! ${CEND}" && exit 1 + OLD_Memcached_version=`$memcached_install_dir/bin/memcached -V | awk '{print $2}'` + echo "Current Memcached Version: ${CMSG}$OLD_Memcached_version${CEND}" + while :; do echo + read -p "Please input upgrade Memcached Version(example: 1.4.39): " NEW_Memcached_version + if [ "${NEW_Memcached_version}" != "$OLD_Memcached_version" ]; then + [ ! -e "memcached-${NEW_Memcached_version}.tar.gz" ] && wget --no-check-certificate -c http://www.memcached.org/files/memcached-${NEW_Memcached_version}.tar.gz > /dev/null 2>&1 + if [ -e "memcached-${NEW_Memcached_version}.tar.gz" ]; then + echo "Download [${CMSG}memcached-${NEW_Memcached_version}.tar.gz${CEND}] successfully! " + break + else + echo "${CWARNING}Memcached version does not exist! ${CEND}" + fi + else + echo "${CWARNING}input error! Upgrade Memcached version is the same as the old version${CEND}" + fi + done + + if [ -e "memcached-${NEW_Memcached_version}.tar.gz" ]; then + echo "[${CMSG}memcached-${NEW_Memcached_version}.tar.gz${CEND}] found" + echo "Press Ctrl+c to cancel or Press any key to continue..." + char=`get_char` + tar xzf memcached-${NEW_Memcached_version}.tar.gz + pushd memcached-${NEW_Memcached_version} + make clean + ./configure --prefix=${memcached_install_dir} + make -j ${THREAD} + + if [ -e "memcached" ]; then + echo "Restarting Memcached..." + service memcached stop + make install + service memcached start + popd > /dev/null + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Memcached_version${CEND} to ${CWARNING}${NEW_Memcached_version}${CEND}" + rm -rf memcached-${NEW_Memcached_version} + else + echo "${CFAILURE}Upgrade Memcached failed! ${CEND}" + fi + fi + popd > /dev/null +} diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh index 53c2c251..e02bf429 100644 --- a/include/upgrade_php.sh +++ b/include/upgrade_php.sh @@ -10,16 +10,16 @@ Upgrade_PHP() { pushd ${oneinstack_dir}/src > /dev/null - [ ! -e "$php_install_dir" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1 + [ ! -e "${php_install_dir}" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1 echo - OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'` + OLD_PHP_version=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'` echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}" while :; do echo read -p "Please input upgrade PHP Version: " NEW_PHP_version if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ]; then - [ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1 - if [ -e "php-$NEW_PHP_version.tar.gz" ]; then - echo "Download [${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] successfully! " + [ ! -e "php-${NEW_PHP_version}.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-${NEW_PHP_version}.tar.gz > /dev/null 2>&1 + if [ -e "php-${NEW_PHP_version}.tar.gz" ]; then + echo "Download [${CMSG}php-${NEW_PHP_version}.tar.gz${CEND}] successfully! " else echo "${CWARNING}PHP version does not exist! ${CEND}" fi @@ -29,24 +29,33 @@ Upgrade_PHP() { fi done - if [ -e "php-$NEW_PHP_version.tar.gz" ]; then - echo "[${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] found" + if [ -e "php-${NEW_PHP_version}.tar.gz" ]; then + echo "[${CMSG}php-${NEW_PHP_version}.tar.gz${CEND}] found" echo "Press Ctrl+c to cancel or Press any key to continue..." char=`get_char` - tar xzf php-$NEW_PHP_version.tar.gz + tar xzf php-${NEW_PHP_version}.tar.gz src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src - patch -d php-$NEW_PHP_version -p0 < fpm-race-condition.patch - pushd php-$NEW_PHP_version + patch -d php-${NEW_PHP_version} -p0 < fpm-race-condition.patch + pushd php-${NEW_PHP_version} make clean - $php_install_dir/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash + ${php_install_dir}/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash make ZEND_EXTRA_LIBS='-liconv' - echo "Stoping php-fpm..." - service php-fpm stop - make install + if [ -e "${apache_install_dir}/bin/apachectl" ]; then + echo "Stoping apache..." + service httpd stop + make install + echo "Starting apache..." + service httpd start + else + echo "Stoping php-fpm..." + service php-fpm stop + make install + echo "Starting php-fpm..." + service php-fpm start + fi popd > /dev/null - echo "Starting php-fpm..." - service php-fpm start - echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_PHP_version${CEND} to ${CWARNING}$NEW_PHP_version${CEND}" + echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_PHP_version${CEND} to ${CWARNING}${NEW_PHP_version}${CEND}" + rm -rf php-${NEW_PHP_version} fi popd > /dev/null } diff --git a/include/upgrade_phpmyadmin.sh b/include/upgrade_phpmyadmin.sh index 0826cf2f..d182c260 100644 --- a/include/upgrade_phpmyadmin.sh +++ b/include/upgrade_phpmyadmin.sh @@ -44,5 +44,5 @@ Upgrade_phpMyAdmin() { chown -R ${run_user}.$run_user ${wwwroot_dir}/default/phpMyAdmin echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_phpMyAdmin_version${CEND} to ${CWARNING}$NEW_phpMyAdmin_version${CEND}" fi - popd + popd > /dev/null } diff --git a/include/upgrade_redis.sh b/include/upgrade_redis.sh index bcb7a527..444e0b66 100644 --- a/include/upgrade_redis.sh +++ b/include/upgrade_redis.sh @@ -47,11 +47,12 @@ Upgrade_Redis() { service redis-server stop /bin/cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-sentinel,redis-server} $redis_install_dir/bin/ service redis-server start + popd > /dev/null echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_Redis_version${CEND} to ${CWARNING}$NEW_Redis_version${CEND}" + rm -rf redis-$NEW_Redis_version else echo "${CFAILURE}Upgrade Redis failed! ${CEND}" fi - popd > /dev/null fi popd > /dev/null } diff --git a/uninstall.sh b/uninstall.sh index f1ea8cbd..73d7a1eb 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -32,7 +32,7 @@ Usage(){ Usage: $0 [ ${CMSG}all${CEND} | ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}hhvm${CEND} | ${CMSG}pureftpd${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} ] ${CMSG}all${CEND} --->Uninstall All ${CMSG}web${CEND} --->Uninstall Nginx/Tengine/Apache/Tomcat -${CMSG}db${CEND} --->Uninstall MySQL/MariaDB/Percona +${CMSG}db${CEND} --->Uninstall MySQL/MariaDB/Percona/AliSQL ${CMSG}php${CEND} --->Uninstall PHP ${CMSG}hhvm${CEND} --->Uninstall HHVM ${CMSG}pureftpd${CEND} --->Uninstall PureFtpd @@ -176,7 +176,7 @@ while :; do What Are You Doing? \t${CMSG}0${CEND}. Uninstall All \t${CMSG}1${CEND}. Uninstall Nginx/Tengine/Apache/Tomcat -\t${CMSG}2${CEND}. Uninstall MySQL/MariaDB/Percona +\t${CMSG}2${CEND}. Uninstall MySQL/MariaDB/Percona/AliSQL \t${CMSG}3${CEND}. Uninstall PHP \t${CMSG}4${CEND}. Uninstall HHVM \t${CMSG}5${CEND}. Uninstall PureFtpd diff --git a/upgrade.sh b/upgrade.sh index 1944de65..dd90073a 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -31,6 +31,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf . ./include/upgrade_db.sh . ./include/upgrade_php.sh . ./include/upgrade_redis.sh +. ./include/upgrade_memcached.sh . ./include/upgrade_phpmyadmin.sh # Check if user is root @@ -42,11 +43,12 @@ IPADDR_COUNTRY=`./include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}'` Usage(){ printf " -Usage: $0 [ ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}redis${CEND} | ${CMSG}phpmyadmin${CEND} ] +Usage: $0 [ ${CMSG}web${CEND} | ${CMSG}db${CEND} | ${CMSG}php${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} | ${CMSG}phpmyadmin${CEND} ] ${CMSG}web${CEND} --->Upgrade Nginx/Tengine/OpenResty ${CMSG}db${CEND} --->Upgrade MySQL/MariaDB/Percona ${CMSG}php${CEND} --->Upgrade PHP ${CMSG}redis${CEND} --->Upgrade Redis +${CMSG}memcached${CEND} --->Upgrade Memcached ${CMSG}phpmyadmin${CEND} --->Upgrade phpMyAdmin " @@ -60,13 +62,14 @@ What Are You Doing? \t${CMSG}2${CEND}. Upgrade MySQL/MariaDB/Percona \t${CMSG}3${CEND}. Upgrade PHP \t${CMSG}4${CEND}. Upgrade Redis -\t${CMSG}5${CEND}. Upgrade phpMyAdmin +\t${CMSG}5${CEND}. Upgrade Memcached +\t${CMSG}6${CEND}. Upgrade phpMyAdmin \t${CMSG}q${CEND}. Exit " echo read -p "Please input the correct option: " Number - if [[ ! $Number =~ ^[1-5,q]$ ]]; then - echo "${CWARNING}input error! Please only input 1,2,3,4,5 and q${CEND}" + if [[ ! $Number =~ ^[1-6,q]$ ]]; then + echo "${CWARNING}input error! Please only input 1,2,3,4,5,6 and q${CEND}" else case "$Number" in 1) @@ -88,6 +91,9 @@ What Are You Doing? Upgrade_Redis ;; 5) + Upgrade_Memcached + ;; + 6) Upgrade_phpMyAdmin ;; q) @@ -120,6 +126,9 @@ elif [ $# == 1 ]; then redis) Upgrade_Redis ;; + memcached) + Upgrade_Memcached + ;; phpmyadmin) Upgrade_phpMyAdmin ;; diff --git a/versions.txt b/versions.txt index a17f76af..3eaf2434 100644 --- a/versions.txt +++ b/versions.txt @@ -1,7 +1,7 @@ # newest software version # Web nginx_version=1.10.2 -tengine_version=2.1.1 +tengine_version=2.1.2 openresty_version=1.11.2.1 openssl_version=1.0.2j @@ -20,7 +20,7 @@ mysql_5_7_version=5.7.16 mysql_5_6_version=5.6.34 mysql_5_5_version=5.5.53 -mariadb_10_1_version=10.1.18 +mariadb_10_1_version=10.1.19 mariadb_10_0_version=10.0.28 mariadb_5_5_version=5.5.53 @@ -36,8 +36,8 @@ jdk_7_version=1.7.0_80 jdk_6_version=1.6.0_45 # PHP -php_7_version=7.0.12 -php_6_version=5.6.27 +php_7_version=7.0.13 +php_6_version=5.6.28 php_5_version=5.5.38 php_4_version=5.4.45 php_3_version=5.3.29 @@ -46,14 +46,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 -ImageMagick_version=6.9.6-3 +ImageMagick_version=6.9.6-4 imagick_version=3.4.1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 -curl_version=7.50.3 +curl_version=7.51.0 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 @@ -68,7 +68,7 @@ redis_pecl_for_php7_version=3.0.0 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.32 +memcached_version=1.4.33 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 @@ -77,7 +77,7 @@ memcache_pecl_version=3.0.8 phpMyAdmin_version=4.4.15.8 # jemalloc -jemalloc_version=4.2.1 +jemalloc_version=4.3.1 # boost boost_version=1.59.0 diff --git a/vhost.sh b/vhost.sh index 14b1a0fc..5dc514fa 100755 --- a/vhost.sh +++ b/vhost.sh @@ -126,13 +126,13 @@ Choose_env() { case "${NGX_FLAG}" in "php") - NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n}") + NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n }") ;; "java") - NGX_CONF=$(echo -e "location ~ {\n proxy_pass http://127.0.0.1:8080;\n include proxy.conf;\n}") + NGX_CONF=$(echo -e "location ~ {\n proxy_pass http://127.0.0.1:8080;\n include proxy.conf;\n }") ;; "hhvm") - NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n fastcgi_pass unix:/var/log/hhvm/sock;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n include fastcgi_params;\n}") + NGX_CONF=$(echo -e "location ~ .*\.(php|php5)?$ {\n fastcgi_pass unix:/var/log/hhvm/sock;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n include fastcgi_params;\n }") ;; esac } @@ -219,9 +219,9 @@ Create_SSL() { Cron_Command="/etc/init.d/httpd graceful" fi [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "$(grep "${domain} ${moredomainame_D}" ${Cron_file})" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=${wwwroot_dir}/${domain} -d ${domain} ${moredomainame_D};${Cron_Command}" >> $Cron_file + [ -z "$(grep "${domain} ${moredomainame_D}" ${Cron_file})" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly --agree-tos --renew-by-default --webroot -w ${wwwroot_dir}/${domain} -d ${domain} ${moredomainame_D};${Cron_Command}" >> $Cron_file else - echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}" + echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed! ${CEND}" exit 1 fi else @@ -455,6 +455,8 @@ server { ${N_log} index index.html index.htm index.jsp; root ${vhostdir}; + #error_page 404 = /404.html; + #error_page 502 = /502.html; ${Nginx_redirect} ${anti_hotlinking} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { @@ -465,9 +467,10 @@ server { expires 7d; access_log off; } + location ~ /\.ht { + deny all; + } ${NGX_CONF} - #error_page 404 = /404.html; - #error_page 502 = /502.html; } EOF @@ -544,6 +547,8 @@ server { index index.html index.htm index.php; include ${web_install_dir}/conf/rewrite/${rewrite}.conf; root ${vhostdir}; + #error_page 404 = /404.html; + #error_page 502 = /502.html; ${Nginx_redirect} ${anti_hotlinking} ${NGX_CONF} @@ -555,8 +560,9 @@ server { expires 7d; access_log off; } - #error_page 404 = /404.html; - #error_page 502 = /502.html; + location ~ /\.ht { + deny all; + } } EOF @@ -667,6 +673,7 @@ EOF echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" echo "$(printf "%-30s" "Virtualhost conf:")${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND}" echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" + [ "${apache_ssl_yn}" == 'y' ] && Print_ssl } Create_nginx_apache_mod-php_conf() { @@ -700,6 +707,9 @@ server { expires 7d; access_log off; } + location ~ /\.ht { + deny all; + } } EOF @@ -820,7 +830,7 @@ Del_NGX_Vhost() { echo "${CWARNING}input error! ${CEND}" else if [ -e "${web_install_dir}/conf/vhost/${domain}.conf" ]; then - Directory=$(grep ^root ${web_install_dir}/conf/vhost/${domain}.conf | awk -F'[ ;]' '{print $2}') + Directory=$(grep '^ root' ${web_install_dir}/conf/vhost/${domain}.conf | head -1 | awk -F'[ ;]' '{print $(NF-1)}') rm -rf ${web_install_dir}/conf/vhost/${domain}.conf ${web_install_dir}/sbin/nginx -s reload while :; do echo @@ -867,7 +877,7 @@ Del_Apache_Vhost() { echo "${CWARNING}input error! ${CEND}" else if [ -e "${apache_install_dir}/conf/vhost/${domain}.conf" ]; then - Directory=$(grep '^ Date: Mon, 14 Nov 2016 13:31:54 +0800 Subject: [PATCH 604/617] Fix certbot --- addons.sh | 34 +++++++++++++------- config/index.html | 5 ++- config/index_cn.html | 5 ++- vhost.sh | 75 +++++++++++++++++++++++++++----------------- 4 files changed, 74 insertions(+), 45 deletions(-) diff --git a/addons.sh b/addons.sh index d44d0a4e..00be4bc3 100755 --- a/addons.sh +++ b/addons.sh @@ -13,7 +13,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# Install/Uninstall PHP Extensions # +# Install/Uninstall Extensions # # For more information please visit https://oneinstack.com # ####################################################################### " @@ -75,9 +75,6 @@ if [ -e "${php_install_dir}/bin/phpize" ]; then kill -9 $$ ;; esac -else - echo "${CFAILURE}Couldn't find phpize! ${CEND}" - kill -9 $$ fi # Check PHP Extensions @@ -124,12 +121,26 @@ EOF fi pushd ${oneinstack_dir}/src - src_url=https://dl.eff.org/certbot-auto && Download_src - /bin/mv certbot-auto /usr/local/bin/ - chmod +x /usr/local/bin/certbot-auto - certbot-auto -n + if [ "${OS}" == "CentOS" ]; then + pkgList="gcc dialog augeas-libs openssl openssl-devel libffi-devel redhat-rpm-config ca-certificates python python-devel python-virtualenv python-tools python-pip" + for Package in ${pkgList}; do + yum -y install ${Package} + done + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + pkgList="python python-dev virtualenv python-virtualenv gcc dialog libaugeas0 augeas-lenses libssl-dev libffi-dev ca-certificates" + for Package in ${pkgList}; do + apt-get -y install $Package + done + fi + if [ ! -e "~/.pip/pip.conf" ] ;then + # get the IP information + PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) + IPADDR_COUNTRY=$(../include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}') + [ "$IPADDR_COUNTRY"x != "CN"x ] && { mkdir ~/.pip; echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf; } + fi + pip install certbot popd - if [ -e "/root/.local/share/letsencrypt/bin/letsencrypt" ] && certbot-auto -h | grep '\-\-standalone' > /dev/null ; then + if [ -e "/usr/bin/certbot" ]; then echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" else echo; echo "${CFAILURE}Let's Encrypt client install failed, Please try again! ${CEND}" @@ -137,9 +148,10 @@ EOF } Uninstall_letsencrypt() { - rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt + pip uninstall -y certbot + rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - sed -i '/certbot-auto/d' ${Cron_file} + sed -i '/certbot/d' ${Cron_file} echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } diff --git a/config/index.html b/config/index.html index 8dd397bd..aa277da3 100644 --- a/config/index.html +++ b/config/index.html @@ -28,9 +28,8 @@

OneinStack Create FTP virtual running script:  ./pureftpd_vhost.sh

For feedback, questions, and to follow the progress of the project:   https://oneinstack.com

Author email:  

-

Donate:

-

          PayPal:  lj2007331@gmail.com

-

          AliPay:  lj2007331@gmail.com

+

Donate:    

+

          Paypal:  lj2007331@gmail.com   Alipay:  lj2007331@gmail.com

diff --git a/config/index_cn.html b/config/index_cn.html index b35aa3cc..48cff8e4 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -29,9 +29,8 @@

OneinStack Github 项目地址:  https://github.com/lj2007331/oneinstack

OneinStack 官网:  https://oneinstack.com

QQ 群:  558540514(付费千人群) 535783209(新)

-

赞助我们:

-

          支付宝:  lj2007331@gmail.com

-

          PayPal:  lj2007331@gmail.com

+

赞助我们:    

+

          Paypal:  lj2007331@gmail.com   支付宝:  lj2007331@gmail.com

diff --git a/vhost.sh b/vhost.sh index 5dc514fa..fcce8fdd 100755 --- a/vhost.sh +++ b/vhost.sh @@ -174,7 +174,7 @@ If you enter '.', the field will be left blank. } Create_SSL() { - if [ -e "/usr/local/bin/certbot-auto" -a -e "/root/.local/share/letsencrypt/bin/letsencrypt" ]; then + if [ -e "/usr/bin/certbot" ]; then while :; do echo read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn if [[ ! ${letsencrypt_yn} =~ ^[y,n]$ ]]; then @@ -202,11 +202,30 @@ Create_SSL() { break fi done + [ "${moredomainame_yn}" == 'y' ] && moredomainame_D="$(for D in ${moredomainame}; do echo -d ${D}; done)" - [ "${nginx_ssl_yn}" == 'y' ] && S=nginx - [ "${apache_ssl_yn}" == 'y' ] && S=httpd - [ ! -d "${wwwroot_dir}/${domain}/.well-known" ] && mkdir -p ${wwwroot_dir}/${domain}/.well-known;chown -R ${run_user}.${run_user} ${wwwroot_dir}/${domain}/.well-known - certbot-auto certonly --standalone --agree-tos --email ${Admin_Email} -d ${domain} ${moredomainame_D} --pre-hook "service ${S} stop" --post-hook "service ${S} start" + if [ "${nginx_ssl_yn}" == 'y' ]; then + [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost + echo "server { server_name ${domain}${moredomainame}; root ${vhostdir}; access_log off; }" > ${web_install_dir}/conf/vhost/${domain}.conf + /etc/init.d/nginx reload > /dev/null + fi + + if [ "${apache_ssl_yn}" == 'y' ]; then + [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost + cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF + + ServerAdmin admin@example.com + DocumentRoot "${vhostdir}" + ServerName ${domain} + ${Apache_Domain_alias} + ErrorLog "/dev/null" common + CustomLog "/dev/null" common + +EOF + /etc/init.d/httpd restart > /dev/null + fi + + certbot certonly --webroot --agree-tos --quiet --email ${Admin_Email} -w ${vhostdir} -d ${domain} ${moredomainame_D} if [ -s "/etc/letsencrypt/live/${domain}/cert.pem" ]; then [ -e "${PATH_SSL}/${domain}.crt" ] && rm -rf ${PATH_SSL}/${domain}.{crt,key} ln -s /etc/letsencrypt/live/${domain}/fullchain.pem ${PATH_SSL}/${domain}.crt @@ -219,7 +238,7 @@ Create_SSL() { Cron_Command="/etc/init.d/httpd graceful" fi [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "$(grep "${domain} ${moredomainame_D}" ${Cron_file})" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly --agree-tos --renew-by-default --webroot -w ${wwwroot_dir}/${domain} -d ${domain} ${moredomainame_D};${Cron_Command}" >> $Cron_file + [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * /usr/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file else echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed! ${CEND}" exit 1 @@ -277,6 +296,25 @@ Input_Add_domain() { fi done + while :; do echo + echo "Please input the directory for the domain:${domain} :" + read -p "(Default directory: ${wwwroot_dir}/${domain}): " vhostdir + if [ -n "${vhostdir}" -a -z "$(echo ${vhostdir} | grep '^/')" ]; then + echo "${CWARNING}input error! Press Enter to continue...${CEND}" + else + if [ -z "${vhostdir}" ]; then + vhostdir="${wwwroot_dir}/${domain}" + echo "Virtual Host Directory=${CMSG}${vhostdir}${CEND}" + fi + echo + echo "Create Virtul Host directory......" + mkdir -p ${vhostdir} + echo "set permissions of Virtual Host directory......" + chown -R ${run_user}.${run_user} ${vhostdir} + break + fi + done + if [ -e "${web_install_dir}/conf/vhost/${domain}.conf" -o -e "${apache_install_dir}/conf/vhost/${domain}.conf" -o -e "${tomcat_install_dir}/conf/vhost/${domain}.xml" ]; then [ -e "${web_install_dir}/conf/vhost/${domain}.conf" ] && echo -e "${domain} in the Nginx/Tengine/OpenResty already exist! \nYou can delete ${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND} and re-create" [ -e "${apache_install_dir}/conf/vhost/${domain}.conf" ] && echo -e "${domain} in the Apache already exist! \nYou can delete ${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND} and re-create" @@ -297,7 +335,7 @@ Input_Add_domain() { if [ "${moredomainame_yn}" == 'y' ]; then while :; do echo - read -p "Type domainname or IP(example: example.com or 121.43.8.8): " moredomain + read -p "Type domainname or IP(example: example.com other.example.com): " moredomain if [ -z "$(echo ${moredomain} | grep '.*\..*')" ]; then echo "${CWARNING}input error! ${CEND}" else @@ -349,25 +387,6 @@ Input_Add_domain() { else Nginx_conf="listen 80;" fi - - while :; do echo - echo "Please input the directory for the domain:${domain} :" - read -p "(Default directory: ${wwwroot_dir}/${domain}): " vhostdir - if [ -n "${vhostdir}" -a -z "$(echo ${vhostdir} | grep '^/')" ]; then - echo "${CWARNING}input error! Press Enter to continue...${CEND}" - else - if [ -z "${vhostdir}" ]; then - vhostdir="${wwwroot_dir}/${domain}" - echo "Virtual Host Directory=${CMSG}${vhostdir}${CEND}" - fi - echo - echo "Create Virtul Host directory......" - mkdir -p ${vhostdir} - echo "set permissions of Virtual Host directory......" - chown -R ${run_user}.${run_user} ${vhostdir} - break - fi - done } Nginx_anti_hotlinking() { @@ -415,7 +434,7 @@ Nginx_rewrite() { echo echo "Please input the rewrite of programme :" echo "${CMSG}wordpress${CEND},${CMSG}discuz${CEND},${CMSG}opencart${CEND},${CMSG}thinkphp${CEND},${CMSG}laravel${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND} rewrite was exist." - read -p "(Default rewrite: other):" rewrite + read -p "(Default rewrite: other): " rewrite if [ "${rewrite}" == "" ]; then rewrite="other" fi @@ -566,7 +585,7 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo ${web_install_dir}/sbin/nginx -t From feaf710781ecae41653b2cc79cacfacf8f5c0244 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 29 Nov 2016 22:05:21 +0800 Subject: [PATCH 605/617] Update versions.txt --- addons.sh | 47 ++++++++++++++++++++++++++++++++++++++------- include/check_sw.sh | 4 ++-- options.conf | 2 ++ shadowsocks.sh | 2 +- versions.txt | 15 +++++++++------ vhost.sh | 17 +++++++++++----- 6 files changed, 66 insertions(+), 21 deletions(-) diff --git a/addons.sh b/addons.sh index 00be4bc3..34846ff9 100755 --- a/addons.sh +++ b/addons.sh @@ -132,15 +132,48 @@ EOF apt-get -y install $Package done fi - if [ ! -e "~/.pip/pip.conf" ] ;then + # Install Python27 + if [ ! -e "${python_install_dir}/bin/python" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/Python-${python_version}.tgz && Download_src + tar xzf Python-${python_version}.tgz + pushd Python-${python_version} + ./configure --prefix=${python_install_dir} + make && make install + popd + rm -rf Python-${python_version} + fi + + if [ ! -e "${python_install_dir}/bin/easy_install" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.tar.gz && Download_src + tar xzf setuptools-${setuptools_version}.tar.gz + pushd setuptools-${setuptools_version} + ${python_install_dir}/bin/python setup.py install + popd + rm -rf setuptools-${setuptools_version} + fi + + if [ ! -e "${python_install_dir}/bin/pip" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/pip-${pip_version}.tar.gz && Download_src + tar xzf pip-${pip_version}.tar.gz + pushd pip-${pip_version} + ${python_install_dir}/bin/python setup.py install + popd + rm -rf pip-${pip_version} + fi + + if [ ! -e "/root/.pip/pip.conf" ] ;then # get the IP information PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) IPADDR_COUNTRY=$(../include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}') - [ "$IPADDR_COUNTRY"x != "CN"x ] && { mkdir ~/.pip; echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf; } + if [ "$IPADDR_COUNTRY"x != "CN"x ]; then + [ ! -d "/root/.pip" ] && mkdir /root/.pip + echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf + fi fi - pip install certbot + + ${python_install_dir}/bin/pip install certbot popd - if [ -e "/usr/bin/certbot" ]; then + if [ -e "${python_install_dir}/bin/certbot" ]; then echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" else echo; echo "${CFAILURE}Let's Encrypt client install failed, Please try again! ${CEND}" @@ -148,10 +181,10 @@ EOF } Uninstall_letsencrypt() { - pip uninstall -y certbot - rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt + ${python_install_dir}/bin/pip uninstall -y certbot + rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt ${python_install_dir} [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - sed -i '/certbot/d' ${Cron_file} + [ -e "$Cron_file" ] && sed -i '/certbot/d' ${Cron_file} echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } diff --git a/include/check_sw.sh b/include/check_sw.sh index e137f2f3..81ced2cf 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -9,7 +9,7 @@ installDepsDebian() { echo "${CMSG}Removing the conflicting packages...${CEND}" - pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" + pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" for Package in ${pkgList};do apt-get -y remove --purge ${Package} done @@ -80,7 +80,7 @@ installDepsCentOS() { installDepsUbuntu() { # Uninstall the conflicting software echo "${CMSG}Removing the conflicting packages...${CEND}" - pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" + pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*" for Package in ${pkgList}; do apt-get -y remove --purge ${Package} done diff --git a/options.conf b/options.conf index 40fefe5b..4e5a3e38 100644 --- a/options.conf +++ b/options.conf @@ -24,6 +24,8 @@ memcached_install_dir=/usr/local/memcached redis_install_dir=/usr/local/redis +python_install_dir=/usr/local/python + ######################################################################### # database data storage directory, you can freely specify mysql_data_dir=/data/mysql diff --git a/shadowsocks.sh b/shadowsocks.sh index b46d5ba9..272fd5f4 100755 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -62,7 +62,7 @@ Iptables_set() { read -p "Please input Shadowsocks port(Default: ${Shadowsocks_Default_port}): " Shadowsocks_port [ -z "${Shadowsocks_port}" ] && Shadowsocks_port=${Shadowsocks_Default_port} if [ ${Shadowsocks_port} -ge 1 >/dev/null 2>&1 -a ${Shadowsocks_port} -le 65535 >/dev/null 2>&1 ]; then - [ -z "$(netstat -an | grep :${Shadowsocks_port})" ] && break || echo "${CWARNING}This port is already used! ${CEND}" + [ -z "$(netstat -tpln | grep :${Shadowsocks_port}$)" ] && break || echo "${CWARNING}This port is already used! ${CEND}" else echo "${CWARNING}input error! Input range: 1~65535${CEND}" fi diff --git a/versions.txt b/versions.txt index 3eaf2434..7a75ef7f 100644 --- a/versions.txt +++ b/versions.txt @@ -2,7 +2,7 @@ # Web nginx_version=1.10.2 tengine_version=2.1.2 -openresty_version=1.11.2.1 +openresty_version=1.11.2.2 openssl_version=1.0.2j tomcat_8_version=8.0.30 @@ -24,11 +24,11 @@ mariadb_10_1_version=10.1.19 mariadb_10_0_version=10.0.28 mariadb_5_5_version=5.5.53 -percona_5_7_version=5.7.15-9 -percona_5_6_version=5.6.33-79.0 -percona_5_5_version=5.5.52-38.3 +percona_5_7_version=5.7.16-10 +percona_5_6_version=5.6.34-79.1 +percona_5_5_version=5.5.53-38.5 -alisql_5_6_version=5.6.32-1 +alisql_5_6_version=5.6.32-2 # JDK jdk_8_version=1.8.0_112 @@ -46,7 +46,7 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 -ImageMagick_version=6.9.6-4 +ImageMagick_version=6.9.6-6 imagick_version=3.4.1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 @@ -87,3 +87,6 @@ libevent_version=2.0.22-stable tmux_version=2.2 htop_version=2.0.2 bison_version=2.7.1 +python_version=2.7.12 +setuptools_version=28.8.0 +pip_version=9.0.1 diff --git a/vhost.sh b/vhost.sh index fcce8fdd..273663e2 100755 --- a/vhost.sh +++ b/vhost.sh @@ -174,7 +174,7 @@ If you enter '.', the field will be left blank. } Create_SSL() { - if [ -e "/usr/bin/certbot" ]; then + if [ -e "${python_install_dir}/bin/certbot" ]; then while :; do echo read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn if [[ ! ${letsencrypt_yn} =~ ^[y,n]$ ]]; then @@ -218,14 +218,21 @@ Create_SSL() { DocumentRoot "${vhostdir}" ServerName ${domain} ${Apache_Domain_alias} - ErrorLog "/dev/null" common - CustomLog "/dev/null" common + + SetOutputFilter DEFLATE + Options FollowSymLinks ExecCGI + Require all granted + AllowOverride All + Order allow,deny + Allow from all + DirectoryIndex index.html index.php + EOF /etc/init.d/httpd restart > /dev/null fi - certbot certonly --webroot --agree-tos --quiet --email ${Admin_Email} -w ${vhostdir} -d ${domain} ${moredomainame_D} + ${python_install_dir}/bin/certbot certonly --webroot --agree-tos --quiet --email ${Admin_Email} -w ${vhostdir} -d ${domain} ${moredomainame_D} if [ -s "/etc/letsencrypt/live/${domain}/cert.pem" ]; then [ -e "${PATH_SSL}/${domain}.crt" ] && rm -rf ${PATH_SSL}/${domain}.{crt,key} ln -s /etc/letsencrypt/live/${domain}/fullchain.pem ${PATH_SSL}/${domain}.crt @@ -238,7 +245,7 @@ EOF Cron_Command="/etc/init.d/httpd graceful" fi [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * /usr/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file + [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * ${python_install_dir}/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file else echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed! ${CEND}" exit 1 From 4e2a68501dbb59c4fb56de0224e2e244c8b6e844 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 3 Dec 2016 14:59:23 +0800 Subject: [PATCH 606/617] Add PHP-7.1 and Rename versions --- README.md | 2 +- include/alisql-5.6.sh | 10 +- include/apache-2.2.sh | 8 +- include/apache-2.4.sh | 8 +- include/check_download.sh | 155 ++++++++++++------------ include/jdk-1.6.sh | 6 +- include/jdk-1.7.sh | 6 +- include/jdk-1.8.sh | 6 +- include/jemalloc.sh | 2 +- include/mariadb-10.0.sh | 16 +-- include/mariadb-10.1.sh | 16 +-- include/mariadb-5.5.sh | 16 +-- include/mysql-5.5.sh | 16 +-- include/mysql-5.6.sh | 16 +-- include/mysql-5.7.sh | 16 +-- include/percona-5.5.sh | 12 +- include/percona-5.6.sh | 12 +- include/percona-5.7.sh | 16 +-- include/php-5.3.sh | 10 +- include/php-5.4.sh | 10 +- include/php-5.5.sh | 10 +- include/php-5.6.sh | 8 +- include/php-7.0.sh | 8 +- include/php-7.1.sh | 245 ++++++++++++++++++++++++++++++++++++++ include/tengine.sh | 2 +- include/tomcat-6.sh | 10 +- include/tomcat-7.sh | 10 +- include/tomcat-8.sh | 10 +- install.sh | 65 +++++----- versions.txt | 53 +++++---- vhost.sh | 4 +- 31 files changed, 519 insertions(+), 265 deletions(-) create mode 100644 include/php-7.1.sh diff --git a/README.md b/README.md index f4844c69..2bcf43da 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Script properties: - Source compiler installation, most stable source is the latest version, and download from the official site - Some security optimization - Providing a plurality of database versions (MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5, Percona-5.7, Percona-5.6, Percona-5.5, AliSQL-5.6) -- Providing multiple PHP versions (php-7, php-5.6, php-5.5, php-5.4, php-5.3) +- Providing multiple PHP versions (PHP-7.1, PHP-7.0, PHP-5.6, PHP-5.5, PHP-5.4, PHP-5.3) - Provide Nginx, Tengine, OpenResty - Providing a plurality of Apache version (Apache-2.4, Apache-2.2) - According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php encryption and decryption tool ionCube, ZendGuardLoader diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh index 58d6066f..111a39a8 100644 --- a/include/alisql-5.6.sh +++ b/include/alisql-5.6.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_AliSQL-5-6() { +Install_AliSQL56() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -17,8 +17,8 @@ Install_AliSQL-5-6() { [ ! -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} + tar xvf alisql-${alisql56_version}.tar.gz + pushd alisql-${alisql56_version} cmake . -DCMAKE_INSTALL_PREFIX=${alisql_install_dir} \ -DMYSQL_DATADIR=${alisql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -39,10 +39,10 @@ Install_AliSQL-5-6() { if [ -d "${alisql_install_dir}/support-files" ]; then echo "${CSUCCESS}AliSQL installed successfully! ${CEND}" - rm -rf alisql-${alisql_5_6_version} + rm -rf alisql-${alisql56_version} else rm -rf ${alisql_install_dir} - rm -rf alisql-${alisql_5_6_version} + rm -rf alisql-${alisql56_version} echo "${CFAILURE}AliSQL install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index d9acbfda..145f72b4 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -8,12 +8,12 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_Apache-2-2() { +Install_Apache22() { pushd ${oneinstack_dir}/src id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf httpd-$apache_2_version.tar.gz - pushd httpd-$apache_2_version + tar xzf httpd-$apache22_version.tar.gz + pushd httpd-$apache22_version [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir [ "${Ubuntu_version}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all @@ -22,7 +22,7 @@ Install_Apache-2-2() { if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd - rm -rf httpd-$apache_2_version + rm -rf httpd-$apache22_version else rm -rf $apache_install_dir echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 23013d05..bf493299 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_Apache-2-4() { +Install_Apache24() { pushd ${oneinstack_dir}/src tar xzf pcre-$pcre_version.tar.gz pushd pcre-$pcre_version @@ -17,10 +17,10 @@ Install_Apache-2-4() { popd id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf httpd-$apache_4_version.tar.gz + tar xzf httpd-$apache24_version.tar.gz tar xzf apr-$apr_version.tar.gz tar xzf apr-util-$apr_util_version.tar.gz - pushd httpd-$apache_4_version + pushd httpd-$apache24_version [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir /bin/cp -R ../apr-$apr_version ./srclib/apr /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util @@ -30,7 +30,7 @@ Install_Apache-2-4() { if [ -e "$apache_install_dir/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd - rm -rf httpd-$apache_4_version + rm -rf httpd-$apache24_version else rm -rf $apache_install_dir echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" diff --git a/include/check_download.sh b/include/check_download.sh index 3845803c..b1c6e2e4 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -7,7 +7,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -checkDownload(){ +checkDownload() { mirrorLink=http://mirrors.linuxeye.com/oneinstack/src pushd ${oneinstack_dir}/src @@ -40,11 +40,11 @@ checkDownload(){ echo "Download apache 2.4..." src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_4_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache24_version}.tar.gz && Download_src fi if [ "${Apache_version}" == '2' ]; then echo "Download apache 2.2..." - src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache_2_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache22_version}.tar.gz && Download_src echo "Download mod_remoteip.c for apache 2.2..." src_url=${mirrorLink}/mod_remoteip.c && Download_src @@ -54,18 +54,18 @@ checkDownload(){ case "${Tomcat_version}" in 1) echo "Download tomcat 8..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/apache-tomcat-${tomcat_8_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_8_version}/catalina-jmx-remote.jar && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat8_version}/apache-tomcat-${tomcat8_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat8_version}/catalina-jmx-remote.jar && Download_src ;; 2) echo "Download tomcat 7..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/apache-tomcat-${tomcat_7_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_7_version}/catalina-jmx-remote.jar && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat7_version}/apache-tomcat-${tomcat7_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat7_version}/catalina-jmx-remote.jar && Download_src ;; 3) echo "Download tomcat 6..." - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/apache-tomcat-${tomcat_6_version}.tar.gz && Download_src - src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat_6_version}/catalina-jmx-remote.jar && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat6_version}/apache-tomcat-${tomcat6_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/tomcat/v${tomcat6_version}/catalina-jmx-remote.jar && Download_src ;; esac @@ -73,15 +73,15 @@ checkDownload(){ case "${JDK_version}" in 1) echo "Download JDK 1.8..." - JDK_FILE="jdk-$(echo ${jdk_8_version} | awk -F. '{print $2}')u$(echo ${jdk_8_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + JDK_FILE="jdk-$(echo ${jdk18_version} | awk -F. '{print $2}')u$(echo ${jdk18_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" ;; 2) echo "Download JDK 1.7..." - JDK_FILE="jdk-$(echo ${jdk_7_version} | awk -F. '{print $2}')u$(echo ${jdk_7_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" + JDK_FILE="jdk-$(echo ${jdk17_version} | awk -F. '{print $2}')u$(echo ${jdk17_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.tar.gz" ;; 3) echo "Download JDK 1.6..." - JDK_FILE="jdk-$(echo ${jdk_6_version} | awk -F. '{print $2}')u$(echo ${jdk_6_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" + JDK_FILE="jdk-$(echo ${jdk16_version} | awk -F. '{print $2}')u$(echo ${jdk16_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" ;; esac # start download... @@ -121,10 +121,10 @@ checkDownload(){ fi if [ "${dbInstallMethods}" == '1' ]; then echo "Download MySQL 5.7 binary package..." - FILE_NAME=mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + FILE_NAME=mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MySQL 5.7 source package..." - FILE_NAME=mysql-${mysql_5_7_version}.tar.gz + FILE_NAME=mysql-${mysql57_version}.tar.gz fi # start download wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME} @@ -168,10 +168,10 @@ checkDownload(){ fi if [ "${dbInstallMethods}" == '1' ]; then 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-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MySQL 5.6 source package..." - FILE_NAME=mysql-${mysql_5_6_version}.tar.gz + FILE_NAME=mysql-${mysql56_version}.tar.gz 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}.md5 @@ -213,10 +213,10 @@ checkDownload(){ fi if [ "${dbInstallMethods}" == '1' ]; then echo "Download MySQL 5.5 binary package..." - FILE_NAME=mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz + FILE_NAME=mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}.tar.gz elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MySQL 5.5 source package..." - FILE_NAME=mysql-${mysql_5_5_version}.tar.gz + FILE_NAME=mysql-${mysql55_version}.tar.gz src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src fi wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME} @@ -240,25 +240,25 @@ checkDownload(){ # MariaDB 10.1 if [ "${dbInstallMethods}" == '1' ]; then echo "Download MariaDB 10.1 binary package..." - FILE_NAME=mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + FILE_NAME=mariadb-${mariadb101_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb101_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb101_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb101_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb101_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MariaDB 10.1 source package..." - FILE_NAME=mariadb-${mariadb_10_1_version}.tar.gz + FILE_NAME=mariadb-${mariadb101_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb101_version}/source MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_1_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb101_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_1_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_1_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb101_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb101_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi fi tryDlCount=0 @@ -279,25 +279,25 @@ checkDownload(){ # MariaDB 10.0 if [ "${dbInstallMethods}" == '1' ]; then echo "Download MariaDB 10.0 binary package..." - FILE_NAME=mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + FILE_NAME=mariadb-${mariadb100_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb100_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb100_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb100_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb100_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MariaDB 10.0 source package..." - FILE_NAME=mariadb-${mariadb_10_0_version}.tar.gz + FILE_NAME=mariadb-${mariadb100_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb100_version}/source MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_10_0_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb100_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_10_0_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_10_0_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb100_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb100_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi fi tryDlCount=0 @@ -318,25 +318,25 @@ checkDownload(){ # MariaDB 5.5 if [ "${dbInstallMethods}" == '1' ]; then echo "Download MariaDB 5.5 binary package..." - FILE_NAME=mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + FILE_NAME=mariadb-${mariadb55_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb55_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb55_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb55_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a} + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb55_version}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MariaDB 5.5 source package..." - FILE_NAME=mariadb-${mariadb_5_5_version}.tar.gz + FILE_NAME=mariadb-${mariadb55_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then - DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source + DOWN_ADDR_MARIADB=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb55_version}/source MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_5_5_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } + [ -z "${MARAIDB_TAR_MD5}" ] && { DOWN_ADDR_MARIADB=https://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb55_version}/source; MARAIDB_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MARIADB}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb_5_5_version}/source - MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb_5_5_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_MARIADB=https://downloads.mariadb.org/interstitial/mariadb-${mariadb55_version}/source + MARAIDB_TAR_MD5=$(curl -Lk http://archive.mariadb.org/mariadb-${mariadb55_version}/source/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}') fi fi tryDlCount=0 @@ -357,19 +357,19 @@ checkDownload(){ # Precona 5.7 if [ "${dbInstallMethods}" == '1' ]; then echo "Download Percona 5.7 binary package..." - FILE_NAME=Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + FILE_NAME=Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') elif [ "${dbInstallMethods}" == '2' ]; then echo "Download Percona 5.7 source package..." - FILE_NAME=percona-server-${percona_5_7_version}.tar.gz + FILE_NAME=percona-server-${percona57_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona_5_7_version}/source/tarball + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') fi fi @@ -391,20 +391,20 @@ checkDownload(){ # Precona 5.6 if [ "${dbInstallMethods}" == '1' ]; then echo "Download Percona 5.6 binary package..." - perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + perconaVerStr1=$(echo ${percona56_version} | sed "s@-@-rel@") FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') elif [ "${dbInstallMethods}" == '2' ]; then echo "Download Percona 5.6 source package..." - FILE_NAME=percona-server-${percona_5_6_version}.tar.gz + FILE_NAME=percona-server-${percona56_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona_5_6_version}/source/tarball + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') fi fi @@ -426,20 +426,20 @@ checkDownload(){ # Percona 5.5 if [ "${dbInstallMethods}" == '1' ]; then echo "Download Percona 5.5 binary package..." - perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + perconaVerStr1=$(echo ${percona55_version} | sed "s@-@-rel@") FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball - PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/binary/tarball + PERCONA_TAR_MD5=$(curl -Lk https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/binary/tarball/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') elif [ "${dbInstallMethods}" == '2' ]; then echo "Download Percona 5.5 source package..." - FILE_NAME=percona-server-${percona_5_5_version}.tar.gz + FILE_NAME=percona-server-${percona55_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else - DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona_5_5_version}/source/tarball + DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') fi fi @@ -461,7 +461,7 @@ checkDownload(){ # AliSQL 5.6 DOWN_ADDR_ALISQL=$mirrorLink echo "Download AliSQL 5.6 source package..." - FILE_NAME=alisql-${alisql_5_6_version}.tar.gz + FILE_NAME=alisql-${alisql56_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) @@ -495,22 +495,25 @@ checkDownload(){ src_url=${mirrorLink}/curl-7.35.0.tar.gz && Download_src fi fi - src_url=http://www.php.net/distributions/php-${php_3_version}.tar.gz && Download_src + src_url=http://www.php.net/distributions/php-${php53_version}.tar.gz && Download_src src_url=${mirrorLink}/fpm-race-condition.patch && Download_src ;; 2) - src_url=http://www.php.net/distributions/php-${php_4_version}.tar.gz && Download_src + src_url=http://www.php.net/distributions/php-${php54_version}.tar.gz && Download_src src_url=${mirrorLink}/fpm-race-condition.patch && Download_src ;; 3) - src_url=http://www.php.net/distributions/php-${php_5_version}.tar.gz && Download_src + src_url=http://www.php.net/distributions/php-${php55_version}.tar.gz && Download_src src_url=${mirrorLink}/fpm-race-condition.patch && Download_src ;; 4) - src_url=http://www.php.net/distributions/php-${php_6_version}.tar.gz && Download_src + src_url=http://www.php.net/distributions/php-${php56_version}.tar.gz && Download_src ;; 5) - src_url=http://www.php.net/distributions/php-${php_7_version}.tar.gz && Download_src + src_url=http://www.php.net/distributions/php-${php70_version}.tar.gz && Download_src + ;; + 6) + src_url=http://www.php.net/distributions/php-${php71_version}.tar.gz && Download_src ;; esac fi @@ -532,9 +535,9 @@ checkDownload(){ fi ;; 3) - # php 5.3 5.4 5.5 5.6 7.0 + # php 5.3 5.4 5.5 5.6 7.0 7.1 echo "Download apcu..." - if [ "${PHP_version}" != '5' ]; then + if [[ "$PHP_version" =~ ^[1-4]$ ]]; then src_url=http://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src else src_url=http://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src @@ -629,7 +632,7 @@ checkDownload(){ else echo "Download graphicsmagick..." src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${GraphicsMagick_version}/GraphicsMagick-${GraphicsMagick_version}.tar.gz && Download_src - if [ "${PHP_version}" == '5' ]; then + if [[ "$PHP_version" =~ ^[5-6]$ ]]; then echo "Download gmagick for php 7.x..." src_url=https://pecl.php.net/get/gmagick-${gmagick_for_php7_version}.tgz && Download_src else @@ -657,7 +660,7 @@ checkDownload(){ src_url=${mirrorLink}/start-stop-daemon.c && Download_src fi # redis addon - if [ "${PHP_version}" == '5' ]; then + if [[ "$PHP_version" =~ ^[5-6]$ ]]; then echo "Download redis pecl for php 7.x..." src_url=http://pecl.php.net/get/redis-${redis_pecl_for_php7_version}.tgz && Download_src else @@ -669,7 +672,7 @@ checkDownload(){ if [ "${memcached_yn}" == 'y' ]; then echo "Download memcached..." src_url=http://www.memcached.org/files/memcached-${memcached_version}.tar.gz && Download_src - if [ "${PHP_version}" == '5' ]; then + if [[ "$PHP_version" =~ ^[5-6]$ ]]; then echo "Download pecl memcache for php 7.x..." # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src diff --git a/include/jdk-1.6.sh b/include/jdk-1.6.sh index 6e7f58d4..4466a6d5 100644 --- a/include/jdk-1.6.sh +++ b/include/jdk-1.6.sh @@ -8,12 +8,12 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install-JDK-1-6() { +Install-JDK16() { pushd ${oneinstack_dir}/src - JDK_FILE="jdk-`echo $jdk_6_version | awk -F. '{print $2}'`u`echo $jdk_6_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" + JDK_FILE="jdk-`echo $jdk16_version | awk -F. '{print $2}'`u`echo $jdk16_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.bin" JAVA_dir=/usr/java - JDK_NAME="jdk$jdk_6_version" + JDK_NAME="jdk$jdk16_version" JDK_PATH=$JAVA_dir/$JDK_NAME [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` diff --git a/include/jdk-1.7.sh b/include/jdk-1.7.sh index 543704c5..e551c79a 100644 --- a/include/jdk-1.7.sh +++ b/include/jdk-1.7.sh @@ -8,12 +8,12 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install-JDK-1-7() { +Install-JDK17() { pushd ${oneinstack_dir}/src - JDK_FILE="jdk-`echo $jdk_7_version | awk -F. '{print $2}'`u`echo $jdk_7_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" + JDK_FILE="jdk-`echo $jdk17_version | awk -F. '{print $2}'`u`echo $jdk17_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" JAVA_dir=/usr/java - JDK_NAME="jdk$jdk_7_version" + JDK_NAME="jdk$jdk17_version" JDK_PATH=$JAVA_dir/$JDK_NAME [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` diff --git a/include/jdk-1.8.sh b/include/jdk-1.8.sh index 52b4d8b7..feca0aef 100644 --- a/include/jdk-1.8.sh +++ b/include/jdk-1.8.sh @@ -8,12 +8,12 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install-JDK-1-8() { +Install-JDK18() { pushd ${oneinstack_dir}/src - JDK_FILE="jdk-`echo $jdk_8_version | awk -F. '{print $2}'`u`echo $jdk_8_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" + JDK_FILE="jdk-`echo $jdk18_version | awk -F. '{print $2}'`u`echo $jdk18_version | awk -F_ '{print $NF}'`-linux-$SYS_BIG_FLAG.tar.gz" JAVA_dir=/usr/java - JDK_NAME="jdk$jdk_8_version" + JDK_NAME="jdk$jdk18_version" JDK_PATH=$JAVA_dir/$JDK_NAME [ "$OS" == 'CentOS' ] && [ -n "`rpm -qa | grep jdk`" ] && rpm -e `rpm -qa | grep jdk` diff --git a/include/jemalloc.sh b/include/jemalloc.sh index 33ef5341..f2da201d 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_jemalloc() { +Install_Jemalloc() { pushd ${oneinstack_dir}/src tar xjf jemalloc-$jemalloc_version.tar.bz2 pushd jemalloc-$jemalloc_version diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 3d442941..ecbecb69 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MariaDB-10-0() { +Install_MariaDB100() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MariaDB-10-0() { mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar zxf mariadb-${mariadb_10_0_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - mv mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + tar zxf mariadb-${mariadb100_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb100_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mariadb-${mariadb_10_0_version}.tar.gz - pushd mariadb-${mariadb_10_0_version} + tar xvf mariadb-${mariadb100_version}.tar.gz + pushd mariadb-${mariadb100_version} cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ -DSYSCONFDIR=/etc \ @@ -47,13 +47,13 @@ Install_MariaDB-10-0() { if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mariadb-${mariadb_10_0_version}-*-${SYS_BIT_b} + rm -rf mariadb-${mariadb100_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mariadb-${mariadb_10_0_version} + rm -rf mariadb-${mariadb100_version} fi else rm -rf ${mariadb_install_dir} - rm -rf mariadb-${mariadb_10_0_version} + rm -rf mariadb-${mariadb100_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 4ac49056..c1faf10a 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MariaDB-10-1() { +Install_MariaDB101() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MariaDB-10-1() { mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar zxf mariadb-${mariadb_10_1_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - mv mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + tar zxf mariadb-${mariadb101_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb101_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mariadb-${mariadb_10_1_version}.tar.gz - pushd mariadb-${mariadb_10_1_version} + tar xvf mariadb-${mariadb101_version}.tar.gz + pushd mariadb-${mariadb101_version} cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ -DSYSCONFDIR=/etc \ @@ -47,13 +47,13 @@ Install_MariaDB-10-1() { if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mariadb-${mariadb_10_1_version}-*-${SYS_BIT_b} + rm -rf mariadb-${mariadb101_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mariadb-${mariadb_10_1_version} + rm -rf mariadb-${mariadb101_version} fi else rm -rf ${mariadb_install_dir} - rm -rf mariadb-${mariadb_10_1_version} + rm -rf mariadb-${mariadb101_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index eac39946..941576c5 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MariaDB-5-5() { +Install_MariaDB55() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MariaDB-5-5() { mkdir -p ${mariadb_data_dir};chown mysql.mysql -R ${mariadb_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar zxf mariadb-${mariadb_5_5_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz - mv mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} + tar zxf mariadb-${mariadb55_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz + mv mariadb-${mariadb55_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mariadb-${mariadb_5_5_version}.tar.gz - pushd mariadb-${mariadb_5_5_version} + tar xvf mariadb-${mariadb55_version}.tar.gz + pushd mariadb-${mariadb55_version} [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \ -DMYSQL_DATADIR=${mariadb_data_dir} \ @@ -49,13 +49,13 @@ Install_MariaDB-5-5() { if [ -d "${mariadb_install_dir}/support-files" ]; then echo "${CSUCCESS}MariaDB installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mariadb-${mariadb_5_5_version}-*-${SYS_BIT_b} + rm -rf mariadb-${mariadb55_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mariadb-${mariadb_5_5_version} + rm -rf mariadb-${mariadb55_version} fi else rm -rf ${mariadb_install_dir} - rm -rf mariadb-${mariadb_5_5_version} + rm -rf mariadb-${mariadb55_version} echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 1c715b48..9e63a656 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MySQL-5-5() { +Install_MySQL55() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MySQL-5-5() { mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar xvf mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}.tar.gz - mv mysql-${mysql_5_5_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} + tar xvf mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}.tar.gz + mv mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mysql-${mysql_5_5_version}.tar.gz - pushd mysql-${mysql_5_5_version} + tar xvf mysql-${mysql55_version}.tar.gz + pushd mysql-${mysql55_version} [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ @@ -49,13 +49,13 @@ Install_MySQL-5-5() { if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mysql-${mysql_5_5_version}-*-${SYS_BIT_b} + rm -rf mysql-${mysql55_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mysql-${mysql_5_5_version} + rm -rf mysql-${mysql55_version} fi else rm -rf ${mysql_install_dir} - rm -rf mysql-${mysql_5_5_version} + rm -rf mysql-${mysql55_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 7fd16ef7..366d1317 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MySQL-5-6() { +Install_MySQL56() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MySQL-5-6() { mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar xvf mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - mv mysql-${mysql_5_6_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} + tar xvf mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + mv mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mysql-${mysql_5_6_version}.tar.gz - pushd mysql-${mysql_5_6_version} + tar xvf mysql-${mysql56_version}.tar.gz + pushd mysql-${mysql56_version} cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -47,13 +47,13 @@ Install_MySQL-5-6() { if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mysql-${mysql_5_6_version}-*-${SYS_BIT_b} + rm -rf mysql-${mysql56_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mysql-${mysql_5_6_version} + rm -rf mysql-${mysql56_version} fi else rm -rf ${mysql_install_dir} - rm -rf mysql-${mysql_5_6_version} + rm -rf mysql-${mysql56_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index ef39a857..7bbd0178 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_MySQL-5-7() { +Install_MySQL57() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_MySQL-5-7() { mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar xvf mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz - mv mysql-${mysql_5_7_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} + tar xvf mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + mv mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf mysql-${mysql_5_7_version}.tar.gz - pushd mysql-${mysql_5_7_version} + tar xvf mysql-${mysql57_version}.tar.gz + pushd mysql-${mysql57_version} cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \ -DMYSQL_DATADIR=${mysql_data_dir} \ -DSYSCONFDIR=/etc \ @@ -47,13 +47,13 @@ Install_MySQL-5-7() { if [ -d "${mysql_install_dir}/support-files" ]; then echo "${CSUCCESS}MySQL installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf mysql-${mysql_5_7_version}-*-${SYS_BIT_b} + rm -rf mysql-${mysql57_version}-*-${SYS_BIT_b} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf mysql-${mysql_5_7_version} + rm -rf mysql-${mysql57_version} fi else rm -rf ${mysql_install_dir} - rm -rf mysql-${mysql_5_7_version} + rm -rf mysql-${mysql57_version} echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 6f69dcb5..5efba056 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_Percona-5-5() { +Install_Percona55() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,13 +18,13 @@ Install_Percona-5-5() { mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - perconaVerStr1=$(echo ${percona_5_5_version} | sed "s@-@-rel@") + perconaVerStr1=$(echo ${percona55_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf percona-server-${percona_5_5_version}.tar.gz - pushd percona-server-${percona_5_5_version} + tar xvf percona-server-${percona55_version}.tar.gz + pushd percona-server-${percona55_version} [ "${armPlatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ @@ -52,11 +52,11 @@ Install_Percona-5-5() { if [ "${dbInstallMethods}" == "1" ]; then rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf percona-server-${percona_5_5_version} + rm -rf percona-server-${percona55_version} fi else rm -rf ${percona_install_dir} - rm -rf percona-server-${percona_5_5_version} + rm -rf percona-server-${percona55_version} echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 772c21b0..f6721ff2 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_Percona-5-6() { +Install_Percona56() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,13 +18,13 @@ Install_Percona-5-6() { mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - perconaVerStr1=$(echo ${percona_5_6_version} | sed "s@-@-rel@") + perconaVerStr1=$(echo ${percona56_version} | sed "s@-@-rel@") tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf percona-server-${percona_5_6_version}.tar.gz - pushd percona-server-${percona_5_6_version} + tar xvf percona-server-${percona56_version}.tar.gz + pushd percona-server-${percona56_version} cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ -DSYSCONFDIR=/etc \ @@ -51,11 +51,11 @@ Install_Percona-5-6() { if [ "${dbInstallMethods}" == "1" ]; then rm -rf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf percona-server-${percona_5_6_version} + rm -rf percona-server-${percona56_version} fi else rm -rf ${percona_install_dir} - rm -rf percona-server-${percona_5_6_version} + rm -rf percona-server-${percona56_version} echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 692f84e2..20ff26d3 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_Percona-5-7() { +Install_Percona57() { pushd ${oneinstack_dir}/src id -u mysql >/dev/null 2>&1 @@ -18,12 +18,12 @@ Install_Percona-5-7() { mkdir -p ${percona_data_dir};chown mysql.mysql -R ${percona_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar xvf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz - mv Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} + tar xvf Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz + mv Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then - tar xvf percona-server-${percona_5_7_version}.tar.gz - pushd percona-server-${percona_5_7_version} + tar xvf percona-server-${percona57_version}.tar.gz + pushd percona-server-${percona57_version} cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \ -DMYSQL_DATADIR=${percona_data_dir} \ -DSYSCONFDIR=/etc \ @@ -49,13 +49,13 @@ Install_Percona-5-7() { if [ -d "${percona_install_dir}/support-files" ]; then echo "${CSUCCESS}Percona installed successfully! ${CEND}" if [ "${dbInstallMethods}" == "1" ]; then - rm -rf Percona-Server-${percona_5_7_version}-Linux.${SYS_BIT_b}.${sslLibVer} + rm -rf Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer} elif [ "${dbInstallMethods}" == "2" ]; then - rm -rf percona-server-${percona_5_7_version} + rm -rf percona-server-${percona57_version} fi else rm -rf ${percona_install_dir} - rm -rf percona-server-${percona_5_7_version} + rm -rf percona-server-${percona57_version} echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" kill -9 $$ fi diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 13ecd6a2..f8e3d56d 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_PHP-5-3() { +Install_PHP53() { pushd ${oneinstack_dir}/src tar xzf libiconv-$libiconv_version.tar.gz @@ -82,9 +82,9 @@ Install_PHP-5-3() { id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf php-$php_3_version.tar.gz - patch -d php-$php_3_version -p0 < fpm-race-condition.patch - pushd php-$php_3_version + tar xzf php-$php53_version.tar.gz + patch -d php-$php53_version -p0 < fpm-race-condition.patch + pushd php-$php53_version patch -p1 < ../php5.3patch patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch make clean @@ -246,6 +246,6 @@ EOF service httpd restart fi popd - [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_3_version + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php53_version popd } diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 66bd1830..3ad9a324 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_PHP-5-4() { +Install_PHP54() { pushd ${oneinstack_dir}/src tar xzf libiconv-$libiconv_version.tar.gz @@ -59,9 +59,9 @@ Install_PHP-5-4() { id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf php-$php_4_version.tar.gz - patch -d php-$php_4_version -p0 < fpm-race-condition.patch - pushd php-$php_4_version + tar xzf php-$php54_version.tar.gz + patch -d php-$php54_version -p0 < fpm-race-condition.patch + pushd php-$php54_version make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then @@ -220,6 +220,6 @@ EOF service httpd restart fi popd - [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_4_version + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php54_version popd } diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 275967b9..500d3c03 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_PHP-5-5() { +Install_PHP55() { pushd ${oneinstack_dir}/src tar xzf libiconv-$libiconv_version.tar.gz @@ -58,9 +58,9 @@ Install_PHP-5-5() { id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf php-$php_5_version.tar.gz - patch -d php-$php_5_version -p0 < fpm-race-condition.patch - pushd php-$php_5_version + tar xzf php-$php55_version.tar.gz + patch -d php-$php55_version -p0 < fpm-race-condition.patch + pushd php-$php55_version [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then @@ -233,6 +233,6 @@ EOF service httpd restart fi popd - [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_5_version + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php55_version popd } diff --git a/include/php-5.6.sh b/include/php-5.6.sh index adb5e743..8598839e 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_PHP-5-6() { +Install_PHP56() { pushd ${oneinstack_dir}/src tar xzf libiconv-$libiconv_version.tar.gz @@ -59,8 +59,8 @@ Install_PHP-5-6() { id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf php-$php_6_version.tar.gz - pushd php-$php_6_version + tar xzf php-$php56_version.tar.gz + pushd php-$php56_version make clean [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' @@ -234,6 +234,6 @@ EOF service httpd restart fi popd - [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_6_version + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php56_version popd } diff --git a/include/php-7.0.sh b/include/php-7.0.sh index 8a3ee35d..2aaf5aff 100644 --- a/include/php-7.0.sh +++ b/include/php-7.0.sh @@ -8,7 +8,7 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_PHP-7-0() { +Install_PHP70() { pushd ${oneinstack_dir}/src tar xzf libiconv-$libiconv_version.tar.gz @@ -59,8 +59,8 @@ Install_PHP-7-0() { id -u $run_user >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf php-$php_7_version.tar.gz - pushd php-$php_7_version + tar xzf php-$php70_version.tar.gz + pushd php-$php70_version make clean ./buildconf [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir @@ -240,6 +240,6 @@ EOF service httpd restart fi popd - [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_7_version + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php70_version popd } diff --git a/include/php-7.1.sh b/include/php-7.1.sh new file mode 100644 index 00000000..20bd004b --- /dev/null +++ b/include/php-7.1.sh @@ -0,0 +1,245 @@ +#!/bin/bash +# Author: yeho +# 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_PHP71() { + pushd ${oneinstack_dir}/src + + tar xzf libiconv-$libiconv_version.tar.gz + patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch + pushd libiconv-$libiconv_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf libiconv-$libiconv_version + + tar xzf curl-$curl_version.tar.gz + pushd curl-$curl_version + ./configure --prefix=/usr/local + make -j ${THREAD} && make install + popd + rm -rf curl-$curl_version + + tar xzf libmcrypt-$libmcrypt_version.tar.gz + pushd libmcrypt-$libmcrypt_version + ./configure + make -j ${THREAD} && make install + ldconfig + pushd libltdl + ./configure --enable-ltdl-install + make -j ${THREAD} && make install + popd;popd + rm -rf libmcrypt-$libmcrypt_version + + tar xzf mhash-$mhash_version.tar.gz + pushd mhash-$mhash_version + ./configure + make -j ${THREAD} && make install + popd + rm -rf mhash-$mhash_version + + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + [ "$OS" == 'CentOS' ] && { ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config; [ "$OS_BIT" == '64' ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 || ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1; } + + tar xzf mcrypt-$mcrypt_version.tar.gz + pushd mcrypt-$mcrypt_version + ldconfig + ./configure + make -j ${THREAD} && make install + popd + rm -rf mcrypt-$mcrypt_version + + id -u $run_user >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + + tar xzf php-$php71_version.tar.gz + pushd php-$php71_version + make clean + ./buildconf + [ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + [ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache' + if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ]; then + ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \ + --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + else + ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ + --with-config-file-scan-dir=$php_install_dir/etc/php.d \ + --with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \ + --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ + --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ + --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ + --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ + --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ + --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ + --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + fi + make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} + make install + + if [ -e "$php_install_dir/bin/phpize" ]; then + echo "${CSUCCESS}PHP installed successfully! ${CEND}" + else + rm -rf $php_install_dir + echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" + kill -9 $$ + fi + + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile + . /etc/profile + + # wget -c http://pear.php.net/go-pear.phar + # $php_install_dir/bin/php go-pear.phar + + [ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d + /bin/cp php.ini-production $php_install_dir/etc/php.ini + + sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini + sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini + sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini + sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini + sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini + sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini + sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini + sed -i 's@^post_max_size.*@post_max_size = 100M@' $php_install_dir/etc/php.ini + sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini + sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini + sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini + sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini + [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + [ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=$Memory_limit +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=100000 +opcache.max_wasted_percentage=5 +opcache.use_cwd=1 +opcache.validate_timestamps=1 +opcache.revalidate_freq=60 +opcache.save_comments=0 +opcache.fast_shutdown=1 +opcache.consistency_checks=0 +;opcache.optimization_level=0 +EOF + + if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ]; then + # php-fpm Init Script + /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm + chmod +x /etc/init.d/php-fpm + [ "$OS" == 'CentOS' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } + [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d php-fpm defaults + + cat > $php_install_dir/etc/php-fpm.conf </dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - tar xzf apache-tomcat-${tomcat_6_version}.tar.gz + tar xzf apache-tomcat-${tomcat6_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} - /bin/cp -R apache-tomcat-${tomcat_6_version}/* ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat6_version}/* ${tomcat_install_dir} rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then @@ -81,7 +81,7 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + @@ -118,7 +118,7 @@ EOF [ "${OS}" == "CentOS" ] && { chkconfig --add tomcat; chkconfig tomcat on; } [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" - rm -rf apache-tomcat-${tomcat_6_version} + rm -rf apache-tomcat-${tomcat6_version} else popd echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 496a8bee..dfae18d7 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -8,16 +8,16 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_tomcat-7() { +Install_Tomcat7() { pushd ${oneinstack_dir}/src . /etc/profile id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - tar xzf apache-tomcat-${tomcat_7_version}.tar.gz + tar xzf apache-tomcat-${tomcat7_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} - /bin/cp -R apache-tomcat-${tomcat_7_version}/* ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat7_version}/* ${tomcat_install_dir} rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then @@ -81,7 +81,7 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + @@ -118,7 +118,7 @@ EOF [ "${OS}" == "CentOS" ] && { chkconfig --add tomcat; chkconfig tomcat on; } [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" - rm -rf apache-tomcat-${tomcat_7_version} + rm -rf apache-tomcat-${tomcat7_version} else popd echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 86c198af..99242179 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -8,16 +8,16 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack -Install_tomcat-8() { +Install_Tomcat8() { pushd ${oneinstack_dir}/src . /etc/profile id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - tar xzf apache-tomcat-${tomcat_8_version}.tar.gz + tar xzf apache-tomcat-${tomcat8_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} - /bin/cp -R apache-tomcat-${tomcat_8_version}/* ${tomcat_install_dir} + /bin/cp -R apache-tomcat-${tomcat8_version}/* ${tomcat_install_dir} rm -rf ${tomcat_install_dir}/webapps/{docs,examples,host-manager,manager,ROOT/*} if [ ! -e "${tomcat_install_dir}/conf/server.xml" ]; then @@ -81,7 +81,7 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + @@ -118,7 +118,7 @@ EOF [ "${OS}" == "CentOS" ] && { chkconfig --add tomcat; chkconfig tomcat on; } [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" - rm -rf apache-tomcat-${tomcat_8_version} + rm -rf apache-tomcat-${tomcat8_version} else popd echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}" diff --git a/install.sh b/install.sh index 21a3b1df..8ae2dd01 100755 --- a/install.sh +++ b/install.sh @@ -224,10 +224,11 @@ while :; do echo echo -e "\t${CMSG}3${CEND}. Install php-5.5" echo -e "\t${CMSG}4${CEND}. Install php-5.6" echo -e "\t${CMSG}5${CEND}. Install php-7.0" - read -p "Please input a number:(Default 3 press Enter) " PHP_version - [ -z "$PHP_version" ] && PHP_version=3 - if [[ ! $PHP_version =~ ^[1-5]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3,4,5${CEND}" + echo -e "\t${CMSG}6${CEND}. Install php-7.1" + read -p "Please input a number:(Default 4 press Enter) " PHP_version + [ -z "$PHP_version" ] && PHP_version=4 + if [[ ! $PHP_version =~ ^[1-6]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6${CEND}" else while :; do echo read -p "Do you want to install opcode cache of the PHP? [y/n]: " PHP_cache_yn @@ -297,7 +298,7 @@ while :; do echo fi done fi - if [ $PHP_version == 5 ]; then + if [[ $PHP_version =~ ^[5-6]$ ]]; then while :; do echo 'Please select a opcode cache of the PHP:' echo -e "\t${CMSG}1${CEND}. Install Zend OPcache" @@ -388,7 +389,7 @@ while :; do echo done # check phpMyAdmin -if [[ $PHP_version =~ ^[1-5]$ ]] || [ -e "$php_install_dir/bin/phpize" ]; then +if [[ $PHP_version =~ ^[1-6]$ ]] || [ -e "$php_install_dir/bin/phpize" ]; then while :; do echo read -p "Do you want to install phpMyAdmin? [y/n]: " phpMyAdmin_yn if [[ ! $phpMyAdmin_yn =~ ^[y,n]$ ]]; then @@ -489,7 +490,7 @@ installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then . include/jemalloc.sh - Install_jemalloc | tee -a $oneinstack_dir/install.log + Install_Jemalloc | tee -a $oneinstack_dir/install.log fi fi @@ -501,15 +502,15 @@ case "${DB_version}" in installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log fi . include/mysql-5.7.sh - Install_MySQL-5-7 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MySQL57 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 2) . include/mysql-5.6.sh - Install_MySQL-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MySQL56 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 3) . include/mysql-5.5.sh - Install_MySQL-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 4) if [ "${dbInstallMethods}" == "2" ]; then @@ -517,15 +518,15 @@ case "${DB_version}" in installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log fi . include/mariadb-10.1.sh - Install_MariaDB-10-1 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MariaDB101 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 5) . include/mariadb-10.0.sh - Install_MariaDB-10-0 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MariaDB100 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 6) . include/mariadb-5.5.sh - Install_MariaDB-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 7) if [ "${dbInstallMethods}" == "2" ]; then @@ -533,52 +534,56 @@ case "${DB_version}" in installBoost 2>&1 | tee -a ${oneinstack_dir}/install.log fi . include/percona-5.7.sh - Install_Percona-5-7 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 8) . include/percona-5.6.sh - Install_Percona-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 9) . include/percona-5.5.sh - Install_Percona-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 10) . include/alisql-5.6.sh - Install_AliSQL-5-6 2>&1 | tee -a $oneinstack_dir/install.log + Install_AliSQL56 2>&1 | tee -a $oneinstack_dir/install.log ;; esac # Apache if [ "$Apache_version" == '1' ]; then . include/apache-2.4.sh - Install_Apache-2-4 2>&1 | tee -a $oneinstack_dir/install.log + Install_Apache24 2>&1 | tee -a $oneinstack_dir/install.log elif [ "$Apache_version" == '2' ]; then . include/apache-2.2.sh - Install_Apache-2-2 2>&1 | tee -a $oneinstack_dir/install.log + Install_Apache22 2>&1 | tee -a $oneinstack_dir/install.log fi # PHP case "${PHP_version}" in 1) . include/php-5.3.sh - Install_PHP-5-3 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_PHP53 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 2) . include/php-5.4.sh - Install_PHP-5-4 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_PHP54 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 3) . include/php-5.5.sh - Install_PHP-5-5 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_PHP55 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 4) . include/php-5.6.sh - Install_PHP-5-6 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_PHP56 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 5) . include/php-7.0.sh - Install_PHP-7-0 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_PHP70 2>&1 | tee -a ${oneinstack_dir}/install.log + ;; + 6) + . include/php-7.1.sh + Install_PHP71 2>&1 | tee -a ${oneinstack_dir}/install.log ;; esac @@ -649,30 +654,30 @@ esac case "${JDK_version}" in 1) . include/jdk-1.8.sh - Install-JDK-1-8 2>&1 | tee -a ${oneinstack_dir}/install.log + Install-JDK18 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 2) . include/jdk-1.7.sh - Install-JDK-1-7 2>&1 | tee -a ${oneinstack_dir}/install.log + Install-JDK17 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 3) . include/jdk-1.6.sh - Install-JDK-1-6 2>&1 | tee -a ${oneinstack_dir}/install.log + Install-JDK16 2>&1 | tee -a ${oneinstack_dir}/install.log ;; esac case "${Tomcat_version}" in 1) . include/tomcat-8.sh - Install_tomcat-8 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Tomcat8 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 2) . include/tomcat-7.sh - Install_tomcat-7 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Tomcat7 2>&1 | tee -a ${oneinstack_dir}/install.log ;; 3) . include/tomcat-6.sh - Install_tomcat-6 2>&1 | tee -a ${oneinstack_dir}/install.log + Install_Tomcat6 2>&1 | tee -a ${oneinstack_dir}/install.log ;; esac diff --git a/versions.txt b/versions.txt index 7a75ef7f..49c855a0 100644 --- a/versions.txt +++ b/versions.txt @@ -5,49 +5,50 @@ tengine_version=2.1.2 openresty_version=1.11.2.2 openssl_version=1.0.2j -tomcat_8_version=8.0.30 -tomcat_7_version=7.0.69 -tomcat_6_version=6.0.45 +tomcat8_version=8.0.30 +tomcat7_version=7.0.69 +tomcat6_version=6.0.45 -apache_4_version=2.4.23 -apache_2_version=2.2.31 +apache24_version=2.4.23 +apache22_version=2.2.31 pcre_version=8.39 apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql_5_7_version=5.7.16 -mysql_5_6_version=5.6.34 -mysql_5_5_version=5.5.53 +mysql57_version=5.7.16 +mysql56_version=5.6.34 +mysql55_version=5.5.53 -mariadb_10_1_version=10.1.19 -mariadb_10_0_version=10.0.28 -mariadb_5_5_version=5.5.53 +mariadb101_version=10.1.19 +mariadb100_version=10.0.28 +mariadb55_version=5.5.53 -percona_5_7_version=5.7.16-10 -percona_5_6_version=5.6.34-79.1 -percona_5_5_version=5.5.53-38.5 +percona57_version=5.7.16-10 +percona56_version=5.6.34-79.1 +percona55_version=5.5.53-38.5 -alisql_5_6_version=5.6.32-2 +alisql56_version=5.6.32-2 # JDK -jdk_8_version=1.8.0_112 -jdk_7_version=1.7.0_80 -jdk_6_version=1.6.0_45 +jdk18_version=1.8.0_112 +jdk17_version=1.7.0_80 +jdk16_version=1.6.0_45 # PHP -php_7_version=7.0.13 -php_6_version=5.6.28 -php_5_version=5.5.38 -php_4_version=5.4.45 -php_3_version=5.3.29 +php71_version=7.1.0 +php70_version=7.0.13 +php56_version=5.6.28 +php55_version=5.5.38 +php54_version=5.4.45 +php53_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 ImageMagick_version=6.9.6-6 -imagick_version=3.4.1 +imagick_version=3.4.3RC1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 @@ -74,7 +75,7 @@ memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 # phpMyadmin -phpMyAdmin_version=4.4.15.8 +phpMyAdmin_version=4.4.15.9 # jemalloc jemalloc_version=4.3.1 @@ -88,5 +89,5 @@ tmux_version=2.2 htop_version=2.0.2 bison_version=2.7.1 python_version=2.7.12 -setuptools_version=28.8.0 +setuptools_version=30.0.0 pip_version=9.0.1 diff --git a/vhost.sh b/vhost.sh index 273663e2..b2c2dbde 100755 --- a/vhost.sh +++ b/vhost.sh @@ -503,10 +503,10 @@ EOF [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF - ${Tomcat_Domain_alias} + ${Tomcat_Domain_alias} + prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF [ -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 From 26664576c4bd89939451ed16565aebe34a3ecf9e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 24 Dec 2016 15:05:49 +0800 Subject: [PATCH 607/617] Add Nginx magento2 --- addons.sh | 8 +- config/magento2.conf | 171 +++++++++++++++++++++++++++++++++++++++ include/apache-2.2.sh | 7 +- include/apache-2.4.sh | 7 +- include/check_sw.sh | 8 +- include/init_CentOS.sh | 9 ++- include/memory.sh | 1 + include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/php-5.3.sh | 4 +- include/php-5.4.sh | 4 +- include/php-5.5.sh | 4 +- include/php-5.6.sh | 4 +- include/php-7.0.sh | 4 +- include/php-7.1.sh | 4 +- include/tengine.sh | 2 +- include/upgrade_web.sh | 2 +- init.d/Nginx-init-CentOS | 4 +- init.d/Pureftpd-init | 20 +---- install.sh | 4 +- options.conf | 4 + upgrade.sh | 2 +- versions.txt | 30 +++---- vhost.sh | 69 ++++++++++++---- 24 files changed, 288 insertions(+), 88 deletions(-) create mode 100644 config/magento2.conf diff --git a/addons.sh b/addons.sh index 34846ff9..09cfe614 100755 --- a/addons.sh +++ b/addons.sh @@ -132,13 +132,14 @@ EOF apt-get -y install $Package done fi - # Install Python27 - if [ ! -e "${python_install_dir}/bin/python" ] ;then + # Install Python + if [ ! -e "${python_install_dir}/bin/python" -a ! -e "${python_install_dir}/bin/python3" ] ;then src_url=http://mirrors.linuxeye.com/oneinstack/src/Python-${python_version}.tgz && Download_src tar xzf Python-${python_version}.tgz pushd Python-${python_version} ./configure --prefix=${python_install_dir} make && make install + [ ! -e "${python_install_dir}/bin/python" -a -e "${python_install_dir}/bin/python3" ] && ln -s ${python_install_dir}/bin/python{3,} popd rm -rf Python-${python_version} fi @@ -181,7 +182,7 @@ EOF } Uninstall_letsencrypt() { - ${python_install_dir}/bin/pip uninstall -y certbot + ${python_install_dir}/bin/pip uninstall -y certbot > /dev/null 2>&1 rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt ${python_install_dir} [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root [ -e "$Cron_file" ] && sed -i '/certbot/d' ${Cron_file} @@ -396,6 +397,7 @@ What Are You Doing? ./configure --with-php-config=${php_install_dir}/bin/php-config make -j ${THREAD} && make install popd;popd + rm -rf php-${PHP_detail_version} echo "extension=fileinfo.so" > ${php_install_dir}/etc/php.d/ext-fileinfo.ini Check_succ else diff --git a/config/magento2.conf b/config/magento2.conf new file mode 100644 index 00000000..5474a712 --- /dev/null +++ b/config/magento2.conf @@ -0,0 +1,171 @@ +server { + listen 80; + server_name oneinstack.com; + set $MAGE_ROOT /data/wwwroot/default; + root $MAGE_ROOT/pub; + index index.php; + autoindex off; + charset UTF-8; + error_page 404 403 = /errors/404.php; + #add_header "X-UA-Compatible" "IE=Edge"; + + # PHP entry point for setup application + location ~* ^/setup($|/) { + root $MAGE_ROOT; + location ~ ^/setup/index.php { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ ^/setup/(?!pub/). { + deny all; + } + + location ~ ^/setup/pub/ { + add_header X-Frame-Options "SAMEORIGIN"; + } + } + + # PHP entry point for update application + location ~* ^/update($|/) { + root $MAGE_ROOT; + location ~ ^/update/index.php { + fastcgi_split_path_info ^(/update/index.php)(/.+)$; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + } + + # Deny everything but index.php + location ~ ^/update/(?!pub/). { + deny all; + } + + location ~ ^/update/pub/ { + add_header X-Frame-Options "SAMEORIGIN"; + } + } + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location /pub/ { + location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) { + deny all; + } + alias $MAGE_ROOT/pub/; + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /static/ { + # Uncomment the following line in production mode + # expires max; + # Remove signature of the static files that is used to overcome the browser cache + location ~ ^/static/version { + rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; + } + + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + add_header X-Frame-Options "SAMEORIGIN"; + expires +1y; + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + } + + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + add_header X-Frame-Options "SAMEORIGIN"; + expires off; + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + } + + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /media/ { + try_files $uri $uri/ /get.php?$args; + location ~ ^/media/theme_customization/.*\.xml { + deny all; + } + + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + add_header X-Frame-Options "SAMEORIGIN"; + expires +1y; + try_files $uri $uri/ /get.php?$args; + } + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + add_header X-Frame-Options "SAMEORIGIN"; + expires off; + try_files $uri $uri/ /get.php?$args; + } + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /media/customer/ { + deny all; + } + + location /media/downloadable/ { + deny all; + } + + location /media/import/ { + deny all; + } + + # PHP entry point for main application + location ~ (index|get|static|report|404|503)\.php$ { + try_files $uri =404; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_buffers 1024 4k; + + fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; + fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600"; + fastcgi_read_timeout 600s; + fastcgi_connect_timeout 600s; + + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + gzip on; + gzip_disable "msie6"; + gzip_comp_level 6; + gzip_min_length 1100; + gzip_buffers 16 8k; + gzip_proxied any; + gzip_types + text/plain + text/css + text/js + text/xml + text/javascript + application/javascript + application/x-javascript + application/json + application/xml + application/xml+rss + image/svg+xml; + gzip_vary on; + + # Banned locations (only reached if the earlier PHP entry point regexes don't match) + location ~* (\.php$|\.htaccess$|\.git) { + deny all; + } +} diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 145f72b4..cf0e8838 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -45,12 +45,10 @@ Install_Apache22() { if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 - TMP_IP=$IPADDR elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 - TMP_IP=127.0.0.1 fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf @@ -70,7 +68,7 @@ $wwwlogs_dir/*apache.log { notifempty sharedscripts postrotate - [ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` + [ -e /var/run/httpd.pid ] && kill -USR1 \`cat /var/run/httpd.pid\` endscript } EOF @@ -81,7 +79,7 @@ NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP + ServerName 127.0.0.1 ErrorLog "$wwwlogs_dir/error_apache.log" CustomLog "$wwwlogs_dir/access_apache.log" common @@ -112,6 +110,7 @@ EOF SetOutputFilter DEFLATE +PidFile /var/run/httpd.pid ServerTokens ProductOnly ServerSignature Off Include conf/vhost/*.conf diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index bf493299..a2e28935 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -53,12 +53,10 @@ Install_Apache24() { if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf TMP_PORT=80 - TMP_IP=$IPADDR elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf TMP_PORT=88 - TMP_IP=127.0.0.1 fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf @@ -84,7 +82,7 @@ $wwwlogs_dir/*apache.log { notifempty sharedscripts postrotate - [ -f $apache_install_dir/logs/httpd.pid ] && kill -USR1 \`cat $apache_install_dir/logs/httpd.pid\` + [ -e /var/run/httpd.pid ] && kill -USR1 \`cat /var/run/httpd.pid\` endscript } EOF @@ -94,7 +92,7 @@ EOF ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" - ServerName $TMP_IP + ServerName 127.0.0.1 ErrorLog "$wwwlogs_dir/error_apache.log" CustomLog "$wwwlogs_dir/access_apache.log" common @@ -126,6 +124,7 @@ EOF SetOutputFilter DEFLATE +PidFile /var/run/httpd.pid ServerTokens ProductOnly ServerSignature Off Include conf/vhost/*.conf diff --git a/include/check_sw.sh b/include/check_sw.sh index 81ced2cf..6c5f31fa 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -26,10 +26,10 @@ installDepsDebian() { # Install needed packages case "${Debian_version}" in [6,7]) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; 8) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; *) echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}" @@ -63,7 +63,7 @@ installDepsCentOS() { echo "${CMSG}Installing dependencies packages...${CEND}" yum check-update # Install needed packages - pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sysstat patch bc expect rsync git lsof lrzsz wget" + pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sqlite-devel sysstat patch bc expect rsync git lsof lrzsz wget" for Package in ${pkgList}; do yum -y install ${Package} done @@ -95,7 +95,7 @@ installDepsUbuntu() { apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate wget" for Package in ${pkgList}; do apt-get -y install ${Package} --force-yes done diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index eab8b731..769fce33 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -63,8 +63,9 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #EOF # ip_conntrack table full dropping packets -[ ! -e "/etc/sysconfig/modules/iptables.modules" ] && { echo modprobe ip_conntrack > /etc/sysconfig/modules/iptables.modules; chmod +x /etc/sysconfig/modules/iptables.modules; } -modprobe ip_conntrack +[ ! -e "/etc/sysconfig/modules/iptables.modules" ] && { echo -e "modprobe nf_conntrack\nmodprobe nf_conntrack_ipv4" > /etc/sysconfig/modules/iptables.modules; chmod +x /etc/sysconfig/modules/iptables.modules; } +modprobe nf_conntrack +modprobe nf_conntrack_ipv4 echo options nf_conntrack hashsize=131072 > /etc/modprobe.d/nf_conntrack.conf # /etc/sysctl.conf @@ -83,10 +84,12 @@ net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 -net.ipv4.tcp_timestamps = 0 +net.ipv4.tcp_timestamps = 1 +net.ipv4.tcp_fin_timeout = 20 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 2 net.ipv4.tcp_tw_recycle = 1 +net.ipv4.tcp_syncookies = 1 #net.ipv4.tcp_tw_len = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_mem = 94500000 915000000 927000000 diff --git a/include/memory.sh b/include/memory.sh index e195e06f..e670d7c8 100644 --- a/include/memory.sh +++ b/include/memory.sh @@ -14,6 +14,7 @@ Swap=`free -m | awk '/Swap:/{print $2}'` if [ $Mem -le 640 ]; then Mem_level=512M Memory_limit=64 + THREAD=1 elif [ $Mem -gt 640 -a $Mem -le 1280 ]; then Mem_level=1G Memory_limit=128 diff --git a/include/nginx.sh b/include/nginx.sh index 4c959e92..78bf9f52 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -27,7 +27,7 @@ Install_Nginx() { sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir - ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' + ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' $nginx_modules_options make -j ${THREAD} && make install if [ -e "$nginx_install_dir/conf/nginx.conf" ]; then popd diff --git a/include/openresty.sh b/include/openresty.sh index 0391cc66..cbb064b2 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -24,7 +24,7 @@ Install_OpenResty() { sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' $nginx_modules_options make -j ${THREAD} && make install if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ]; then popd diff --git a/include/php-5.3.sh b/include/php-5.3.sh index f8e3d56d..fe77c936 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -99,7 +99,7 @@ Install_PHP53() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -110,7 +110,7 @@ Install_PHP53() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf $OpenSSL_args \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} diff --git a/include/php-5.4.sh b/include/php-5.4.sh index 3ad9a324..1e17f58c 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -74,7 +74,7 @@ Install_PHP54() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -85,7 +85,7 @@ Install_PHP54() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 500d3c03..99d4beed 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -73,7 +73,7 @@ Install_PHP55() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -84,7 +84,7 @@ Install_PHP55() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 8598839e..d18ae94f 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -74,7 +74,7 @@ Install_PHP56() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -85,7 +85,7 @@ Install_PHP56() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install diff --git a/include/php-7.0.sh b/include/php-7.0.sh index 2aaf5aff..6971555a 100644 --- a/include/php-7.0.sh +++ b/include/php-7.0.sh @@ -75,7 +75,7 @@ Install_PHP70() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -86,7 +86,7 @@ Install_PHP70() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install diff --git a/include/php-7.1.sh b/include/php-7.1.sh index 20bd004b..18f17a4c 100644 --- a/include/php-7.1.sh +++ b/include/php-7.1.sh @@ -75,7 +75,7 @@ Install_PHP71() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options else ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ --with-config-file-scan-dir=$php_install_dir/etc/php.d \ @@ -86,7 +86,7 @@ Install_PHP71() { --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex \ --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \ - --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options fi make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD} make install diff --git a/include/tengine.sh b/include/tengine.sh index 7b10323d..c55cf6e7 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -25,7 +25,7 @@ Install_Tengine() { sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir - ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-jemalloc + ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-jemalloc $nginx_modules_options make -j ${THREAD} && make install if [ -e "$tengine_install_dir/conf/nginx.conf" ]; then popd diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 080a6f16..3bfe7bf6 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -159,7 +159,7 @@ Upgrade_OpenResty() { openresty_version_tmp=${NEW_OpenResty_version%.*} sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-$openresty_version_tmp/auto/cc/gcc # close debug $openresty_install_dir/nginx/sbin/nginx -V &> $$ - ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' + ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit --with-ld-opt='-ljemalloc' $nginx_modules_options make -j ${THREAD} if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ]; then /bin/mv $openresty_install_dir/nginx/sbin/nginx{,`date +%m%d`} diff --git a/init.d/Nginx-init-CentOS b/init.d/Nginx-init-CentOS index e95c4bc9..5d61cb4c 100755 --- a/init.d/Nginx-init-CentOS +++ b/init.d/Nginx-init-CentOS @@ -59,7 +59,7 @@ start() { stop() { echo -n $"Stopping $prog: " - killproc $prog -QUIT + $nginx -s stop retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile @@ -76,7 +76,7 @@ restart() { reload() { configtest || return $? echo -n $"Reloading $prog: " - killproc $nginx -HUP + $nginx -s reload RETVAL=$? echo } diff --git a/init.d/Pureftpd-init b/init.d/Pureftpd-init index c4feb6d9..863c21c2 100755 --- a/init.d/Pureftpd-init +++ b/init.d/Pureftpd-init @@ -24,12 +24,10 @@ RETVAL=0 # Path to the pure-ftp binaries. -prog=pure-config.pl -fullpath=/usr/local/pureftpd/sbin/$prog -pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho +prog=pure-ftpd +fullpath=/usr/local/pureftpd/sbin/pure-config.pl pure_config=/usr/local/pureftpd/etc/pure-ftpd.conf - start() { echo -n $"Starting $prog: " $fullpath $pure_config --daemonize @@ -57,23 +55,11 @@ case "$1" in stop start ;; - condrestart) - if [ -f /var/lock/subsys/$prog ] ; then - stop - # avoid race - sleep 3 - start - fi - ;; status) status $prog - RETVAL=$? - if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then - $pureftpwho - fi ;; *) - echo $"Usage: $prog {start|stop|restart|condrestart|status}" + echo $"Usage: $prog {start|stop|restart|status}" RETVAL=1 esac exit $RETVAL diff --git a/install.sh b/install.sh index 8ae2dd01..6ddff473 100755 --- a/install.sh +++ b/install.sh @@ -322,7 +322,7 @@ while :; do echo (( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}" done fi - if [ "$PHP_version" != '5' -a "$PHP_cache" != '1' -a "${armPlatform}" != "y" ]; then + if [[ $PHP_version =~ ^[1-4]$ ]] && [ "$PHP_cache" != '1' -a "${armPlatform}" != "y" ]; then while :; do echo read -p "Do you want to install ZendGuardLoader? [y/n]: " ZendGuardLoader_yn if [[ ! $ZendGuardLoader_yn =~ ^[y,n]$ ]]; then @@ -334,7 +334,7 @@ while :; do echo fi # ionCube - if [ "${TARGET_ARCH}" != "arm64" ]; then + if [ "${TARGET_ARCH}" != "arm64" -a "$PHP_version" != '6' ]; then while :; do echo read -p "Do you want to install ionCube? [y/n]: " ionCube_yn if [[ ! $ionCube_yn =~ ^[y,n]$ ]]; then diff --git a/options.conf b/options.conf index 4e5a3e38..d2ba8f71 100644 --- a/options.conf +++ b/options.conf @@ -26,6 +26,10 @@ redis_install_dir=/usr/local/redis python_install_dir=/usr/local/python +# Add modules +nginx_modules_options='' +php_modules_options='' + ######################################################################### # database data storage directory, you can freely specify mysql_data_dir=/data/mysql diff --git a/upgrade.sh b/upgrade.sh index dd90073a..1e3c1562 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -13,7 +13,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# upgrade Web,Database,PHP,Redis,phpMyAdmin for OneinStack # +# upgrade Web,DB,PHP,Redis,Memcached,phpMyAdmin for OneinStack # # For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/versions.txt b/versions.txt index 49c855a0..b8046f52 100644 --- a/versions.txt +++ b/versions.txt @@ -9,18 +9,18 @@ tomcat8_version=8.0.30 tomcat7_version=7.0.69 tomcat6_version=6.0.45 -apache24_version=2.4.23 +apache24_version=2.4.25 apache22_version=2.2.31 pcre_version=8.39 apr_version=1.5.2 apr_util_version=1.5.4 # DB -mysql57_version=5.7.16 -mysql56_version=5.6.34 -mysql55_version=5.5.53 +mysql57_version=5.7.17 +mysql56_version=5.6.35 +mysql55_version=5.5.54 -mariadb101_version=10.1.19 +mariadb101_version=10.1.20 mariadb100_version=10.0.28 mariadb55_version=5.5.53 @@ -37,8 +37,8 @@ jdk16_version=1.6.0_45 # PHP php71_version=7.1.0 -php70_version=7.0.13 -php56_version=5.6.28 +php70_version=7.0.14 +php56_version=5.6.29 php55_version=5.5.38 php54_version=5.4.45 php53_version=5.3.29 @@ -47,14 +47,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 -ImageMagick_version=6.9.6-6 +ImageMagick_version=6.9.7-0 imagick_version=3.4.3RC1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 -curl_version=7.51.0 +curl_version=7.52.0 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 @@ -64,8 +64,8 @@ eaccelerator_version=0.9.6.1 pureftpd_version=1.0.43 # Redis -redis_version=3.2.5 -redis_pecl_for_php7_version=3.0.0 +redis_version=3.2.6 +redis_pecl_for_php7_version=3.1.0 redis_pecl_version=2.2.8 # Memcached @@ -78,16 +78,16 @@ memcache_pecl_version=3.0.8 phpMyAdmin_version=4.4.15.9 # jemalloc -jemalloc_version=4.3.1 +jemalloc_version=4.4.0 # boost boost_version=1.59.0 # Others libevent_version=2.0.22-stable -tmux_version=2.2 +tmux_version=2.3 htop_version=2.0.2 bison_version=2.7.1 -python_version=2.7.12 -setuptools_version=30.0.0 +python_version=2.7.13 +setuptools_version=32.0.0 pip_version=9.0.1 diff --git a/vhost.sh b/vhost.sh index b2c2dbde..c1026cfc 100755 --- a/vhost.sh +++ b/vhost.sh @@ -168,8 +168,6 @@ If you enter '.', the field will be left blank. [ -z "${SELFSIGNEDSSL_O}U" ] && SELFSIGNEDSSL_OU="IT Dept." openssl req -new -newkey rsa:2048 -sha256 -nodes -out ${PATH_SSL}/${domain}.csr -keyout ${PATH_SSL}/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1 - /bin/cp ${PATH_SSL}/${domain}.csr{,_bk.$(date +%Y-%m-%d_%H%M)} - /bin/cp ${PATH_SSL}/${domain}.key{,_bk.$(date +%Y-%m-%d_%H%M)} openssl x509 -req -days 36500 -sha256 -in ${PATH_SSL}/${domain}.csr -signkey ${PATH_SSL}/${domain}.key -out ${PATH_SSL}/${domain}.crt > /dev/null 2>&1 } @@ -364,7 +362,7 @@ Input_Add_domain() { break fi done - [ "${redirect_yn}" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n }") + [ "${redirect_yn}" == 'y' ] && Nginx_redirect="if (\$host != $domain) { return 301 \$scheme://${domain}\$request_uri; }" fi fi @@ -418,7 +416,7 @@ Nginx_anti_hotlinking() { else domain_allow_all=${domain_allow} fi - anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {\n valid_referers none blocked ${domain_allow_all};\n if (\$invalid_referer) {\n #rewrite ^/ http://www.example.com/403.html;\n return 403;\n }\n }") + anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {\n valid_referers none blocked ${domain_allow_all};\n if (\$invalid_referer) {\n rewrite ^/ http://www.linuxeye.com/403.html;\n return 403;\n }\n }") else anti_hotlinking= fi @@ -440,17 +438,19 @@ Nginx_rewrite() { else echo echo "Please input the rewrite of programme :" - echo "${CMSG}wordpress${CEND},${CMSG}discuz${CEND},${CMSG}opencart${CEND},${CMSG}thinkphp${CEND},${CMSG}laravel${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND} rewrite was exist." + echo "${CMSG}wordpress${CEND},${CMSG}opencart${CEND},${CMSG}magento2${CEND},${CMSG}drupal${CEND},${CMSG}joomla${CEND},${CMSG}laravel${CEND},${CMSG}thinkphp${CEND},${CMSG}discuz${CEND},${CMSG}typecho${CEND},${CMSG}ecshop${CEND} rewrite was exist." read -p "(Default rewrite: other): " rewrite if [ "${rewrite}" == "" ]; then rewrite="other" fi echo "You choose rewrite=${CMSG}$rewrite${CEND}" [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi_params;\n set \$real_script_name \$fastcgi_script_name;\n if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n set \$real_script_name \$1;\n #set \$path_info \$2;\n }\n fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n fastcgi_param SCRIPT_NAME \$real_script_name;\n #fastcgi_param PATH_INFO \$path_info;\n }") - if [ -e "config/${rewrite}.conf" ]; then - /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/rewrite/${rewrite}.conf - else - touch "${web_install_dir}/conf/rewrite/${rewrite}.conf" + if [ "${rewrite}" != 'magento2' ]; then + if [ -e "config/${rewrite}.conf" ]; then + /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/rewrite/${rewrite}.conf + else + touch "${web_install_dir}/conf/rewrite/${rewrite}.conf" + fi fi fi } @@ -481,9 +481,9 @@ server { ${N_log} index index.html index.htm index.jsp; root ${vhostdir}; + ${Nginx_redirect} #error_page 404 = /404.html; #error_page 502 = /502.html; - ${Nginx_redirect} ${anti_hotlinking} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; @@ -500,7 +500,7 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF ${Tomcat_Domain_alias} @@ -573,9 +573,9 @@ server { index index.html index.htm index.php; include ${web_install_dir}/conf/rewrite/${rewrite}.conf; root ${vhostdir}; + ${Nginx_redirect} #error_page 404 = /404.html; #error_page 502 = /502.html; - ${Nginx_redirect} ${anti_hotlinking} ${NGX_CONF} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { @@ -592,7 +592,41 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + if [ "${rewrite}" == 'magento2' -a -e "config/${rewrite}.conf" ]; then + /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ set \$MAGE_ROOT.*;@ set \$MAGE_ROOT ${vhostdir};@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@ server_name ${domain}${moredomainame};@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ${N_log}@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${NGX_FLAG}" == 'hhvm' ] && sed -i 's@fastcgi_pass unix:.*;@fastcgi_pass unix:/var/log/hhvm/sock;@g' ${web_install_dir}/conf/vhost/${domain}.conf + if [ "${anti_hotlinking_yn}" == 'y' ]; then + sed -i "s@^ root.*;@&\n }@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n }@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n return 403;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n rewrite ^/ http://www.linuxeye.com/403.html;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n if (\$invalid_referer) {@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n valid_referers none blocked ${domain_allow_all};@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ root.*;@&\n location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)\$ {@" ${web_install_dir}/conf/vhost/${domain}.conf + fi + + [ "${redirect_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$host != $domain) { return 301 \$scheme://${domain}\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + + if [ "${nginx_ssl_yn}" == 'y' ]; then + sed -i "s@^ listen 80;@&\n listen ${LISTENOPT};@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_stapling_verify on;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_stapling on;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n add_header Strict-Transport-Security max-age=15768000;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_buffer_size 1400;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_session_cache builtin:1000 shared:SSL:10m;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_session_timeout 10m;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_prefer_server_ciphers on;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:\!MD5;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_protocols TLSv1 TLSv1.1 TLSv1.2;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_certificate_key ${PATH_SSL}/${domain}.key;@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ssl_certificate ${PATH_SSL}/${domain}.crt;@" ${web_install_dir}/conf/vhost/${domain}.conf + fi + fi + + [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo ${web_install_dir}/sbin/nginx -t @@ -614,7 +648,7 @@ EOF echo "$(printf "%-30s" "Your domain:")${CMSG}${domain}${CEND}" echo "$(printf "%-30s" "Virtualhost conf:")${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND}" echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" - [ "${rewrite_yn}" == 'y' ] && echo "$(printf "%-30s" "Rewrite rule:")${CMSG}${web_install_dir}/conf/rewrite/${rewrite}.conf${CEND}" + [ "${rewrite_yn}" == 'y' -a "${rewrite}" != 'magento2' ] && echo "$(printf "%-30s" "Rewrite rule:")${CMSG}${web_install_dir}/conf/rewrite/${rewrite}.conf${CEND}" [ "${nginx_ssl_yn}" == 'y' ] && Print_ssl } @@ -739,7 +773,7 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo ${web_install_dir}/sbin/nginx -t @@ -795,7 +829,6 @@ EOF echo "$(printf "%-30s" "Nginx Virtualhost conf:")${CMSG}${web_install_dir}/conf/vhost/${domain}.conf${CEND}" echo "$(printf "%-30s" "Apache Virtualhost conf:")${CMSG}${apache_install_dir}/conf/vhost/${domain}.conf${CEND}" echo "$(printf "%-30s" "Directory of:")${CMSG}${vhostdir}${CEND}" - [ "${rewrite_yn}" == 'y' ] && echo "$(printf "%-28s" "Rewrite rule:")${CMSG}${web_install_dir}/conf/rewrite/${rewrite}.conf${CEND}" [ "${nginx_ssl_yn}" == 'y' ] && Print_ssl } @@ -872,7 +905,9 @@ Del_NGX_Vhost() { char=$(get_char) rm -rf ${Directory} fi - echo "${CSUCCESS}Domain: ${domain} has been deleted.${CEND}" + echo + echo "${CMSG}Domain: ${domain} has been deleted.${CEND}" + echo else echo "${CWARNING}Virtualhost: ${domain} was not exist! ${CEND}" fi From 77ebcde9cbd040c7c90bd0db756dc334a9a19aae Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 10 Jan 2017 10:34:44 +0800 Subject: [PATCH 608/617] Apache2.4 enable http2 --- README.md | 2 +- include/alisql-5.6.sh | 2 +- include/apache-2.2.sh | 64 ++++++++++----------- include/apache-2.4.sh | 113 +++++++++++++++++++++++--------------- include/check_download.sh | 3 + include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/php-5.3.sh | 8 +-- include/tomcat-6.sh | 29 ++++++++-- include/tomcat-7.sh | 29 ++++++++-- include/tomcat-8.sh | 29 ++++++++-- options.conf | 2 + upgrade.sh | 2 +- versions.txt | 17 +++--- vhost.sh | 2 +- 22 files changed, 202 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index 2bcf43da..e50aa758 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Script properties: - Install memcached, redis according to their needs - Jemalloc optimize MySQL, Nginx - Providing add a virtual host script, include Let's Encrypt SSL certificate -- Provide Nginx/Tengine, MySQL/MariaDB/Percona, PHP, Redis, phpMyAdmin upgrade script +- Provide Nginx/Tengine/OpenResty, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script - Provide local backup and remote backup (rsync between servers) script - Provided under HHVM install CentOS 6,7 diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh index 111a39a8..25c67660 100644 --- a/include/alisql-5.6.sh +++ b/include/alisql-5.6.sh @@ -158,7 +158,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index cf0e8838..c045489d 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -10,52 +10,52 @@ Install_Apache22() { pushd ${oneinstack_dir}/src - id -u $run_user >/dev/null 2>&1 - [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf httpd-$apache22_version.tar.gz - pushd httpd-$apache22_version - [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir + id -u ${run_user} >/dev/null 2>&1 + [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} + tar xzf httpd-${apache22_version}.tar.gz + pushd httpd-${apache22_version} + [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir} [ "${Ubuntu_version}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c - LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all make -j ${THREAD} && make install unset LDFLAGS - if [ -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd - rm -rf httpd-$apache22_version + rm -rf httpd-${apache22_version} else - rm -rf $apache_install_dir + rm -rf ${apache_install_dir} echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" kill -9 $$ fi - [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile - [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${apache_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${apache_install_dir}/bin:\1@" /etc/profile . /etc/profile - /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd + /bin/cp ${apache_install_dir}/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd chmod +x /etc/init.d/httpd [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults - sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf - sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf - if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then - sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf + sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^Group daemon@Group ${run_user}@" ${apache_install_dir}/conf/httpd.conf + if [ "${Nginx_version}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then + sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf TMP_PORT=80 - elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then - sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf - sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf + elif [[ ${Nginx_version} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then + sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf + sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf TMP_PORT=88 fi - sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf - sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf - sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf - sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf - sed -i "s@^@@" $apache_install_dir/conf/httpd.conf - sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" ${apache_install_dir}/conf/httpd.conf + sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' ${apache_install_dir}/conf/httpd.conf + sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^@@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf #logrotate apache log cat > /etc/logrotate.d/apache << EOF @@ -73,8 +73,8 @@ $wwwlogs_dir/*apache.log { } EOF - mkdir $apache_install_dir/conf/vhost - cat > $apache_install_dir/conf/vhost/0.conf << EOF + mkdir ${apache_install_dir}/conf/vhost + cat > ${apache_install_dir}/conf/vhost/0.conf << EOF NameVirtualHost *:$TMP_PORT ServerAdmin admin@linuxeye.com @@ -99,7 +99,7 @@ NameVirtualHost *:$TMP_PORT EOF - cat >> $apache_install_dir/conf/httpd.conf <> ${apache_install_dir}/conf/httpd.conf < AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript @@ -116,14 +116,14 @@ ServerSignature Off Include conf/vhost/*.conf EOF - if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then - $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c - cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF + if [ "${Nginx_version}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then + ${apache_install_dir}/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c + cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy 127.0.0.1 EOF - sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf + sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" ${apache_install_dir}/conf/httpd.conf fi ldconfig service httpd start diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index a2e28935..79774b92 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -10,66 +10,91 @@ Install_Apache24() { pushd ${oneinstack_dir}/src - tar xzf pcre-$pcre_version.tar.gz - pushd pcre-$pcre_version + tar xzf pcre-${pcre_version}.tar.gz + pushd pcre-${pcre_version} ./configure make -j ${THREAD} && make install popd - id -u $run_user >/dev/null 2>&1 + id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - tar xzf httpd-$apache24_version.tar.gz - tar xzf apr-$apr_version.tar.gz - tar xzf apr-util-$apr_util_version.tar.gz - pushd httpd-$apache24_version - [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir - /bin/cp -R ../apr-$apr_version ./srclib/apr - /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util - LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + tar xzf httpd-${apache24_version}.tar.gz + tar xzf nghttp2-${nghttp2_version}.tar.gz + tar xzf apr-${apr_version}.tar.gz + tar xzf apr-util-${apr_util_version}.tar.gz + + # install openssl-1.0.2 + if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then + tar xzf ${openssl_version}.tar.gz + pushd ${openssl_version} + ./config --prefix=${openssl_install_dir} -fPIC shared zlib + make -j ${THREAD} && make install + popd + rm -rf ${openssl_version} + fi + + # install nghttp2 + if [ ! -e "/usr/local/lib/libnghttp2.so" ]; then + pushd nghttp2-${nghttp2_version} + ./configure + make -j ${THREAD} && make install + popd + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; ldconfig + rm -rf nghttp2-${nghttp2_version} + fi + + pushd httpd-${apache24_version} + [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir} + /bin/cp -R ../apr-${apr_version} ./srclib/apr + /bin/cp -R ../apr-util-${apr_util_version} ./srclib/apr-util + LDFLAGS=-ldl LD_LIBRARY_PATH=${openssl_install_dir}/lib ./configure --prefix=${apache_install_dir} --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all make -j ${THREAD} && make install unset LDFLAGS - if [ -e "$apache_install_dir/conf/httpd.conf" ]; then + if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" popd - rm -rf httpd-$apache24_version + rm -rf httpd-${apache24_version} else - rm -rf $apache_install_dir + rm -rf ${apache_install_dir} echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" kill -9 $$ fi - [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile - [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile + [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile + [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${apache_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${apache_install_dir}/bin:\1@" /etc/profile . /etc/profile - /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd + sed -i "s@^export LD_LIBRARY_PATH.*@export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${openssl_install_dir}/lib@" ${apache_install_dir}/bin/envvars + + /bin/cp ${apache_install_dir}/bin/apachectl /etc/init.d/httpd sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd chmod +x /etc/init.d/httpd [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; } [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d httpd defaults - sed -i "s@^User daemon@User $run_user@" $apache_install_dir/conf/httpd.conf - sed -i "s@^Group daemon@Group $run_user@" $apache_install_dir/conf/httpd.conf - if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then - sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf + sed -i "s@^User daemon@User $run_user@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^Group daemon@Group $run_user@" ${apache_install_dir}/conf/httpd.conf + if [ "${Nginx_version}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then + sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf TMP_PORT=80 - elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then - sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf - sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf + elif [[ ${Nginx_version} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then + sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf + sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf TMP_PORT=88 fi - sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" $apache_install_dir/conf/httpd.conf - sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_suexec.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_vhost_alias.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_rewrite.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_deflate.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_expires.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -ri 's@^#(.*mod_ssl.so)@\1@' $apache_install_dir/conf/httpd.conf - sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf - sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf - sed -i "s@^@@" $apache_install_dir/conf/httpd.conf - sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf + sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_suexec.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_vhost_alias.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_rewrite.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_deflate.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_expires.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_ssl.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_http2.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' ${apache_install_dir}/conf/httpd.conf + sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^@@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf #logrotate apache log cat > /etc/logrotate.d/apache << EOF @@ -87,8 +112,8 @@ $wwwlogs_dir/*apache.log { } EOF - mkdir $apache_install_dir/conf/vhost - cat > $apache_install_dir/conf/vhost/0.conf << EOF + mkdir ${apache_install_dir}/conf/vhost + cat > ${apache_install_dir}/conf/vhost/0.conf << EOF ServerAdmin admin@linuxeye.com DocumentRoot "$wwwroot_dir/default" @@ -113,7 +138,7 @@ EOF EOF - cat >> $apache_install_dir/conf/httpd.conf <> ${apache_install_dir}/conf/httpd.conf < AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript @@ -124,20 +149,22 @@ EOF SetOutputFilter DEFLATE +ProtocolsHonorOrder On +Protocols h2 http/1.1 PidFile /var/run/httpd.pid ServerTokens ProductOnly ServerSignature Off Include conf/vhost/*.conf EOF - if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then - cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF + if [ "${Nginx_version}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then + cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy 127.0.0.1 EOF - sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf - sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" $apache_install_dir/conf/httpd.conf + sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" ${apache_install_dir}/conf/httpd.conf + sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" ${apache_install_dir}/conf/httpd.conf fi ldconfig service httpd start diff --git a/include/check_download.sh b/include/check_download.sh index b1c6e2e4..e116bea3 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -40,6 +40,7 @@ checkDownload() { echo "Download apache 2.4..." src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_version}.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/apache/httpd/nghttp2-${nghttp2_version}.tar.gz && Download_src src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-${apache24_version}.tar.gz && Download_src fi if [ "${Apache_version}" == '2' ]; then @@ -84,6 +85,8 @@ checkDownload() { JDK_FILE="jdk-$(echo ${jdk16_version} | awk -F. '{print $2}')u$(echo ${jdk16_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin" ;; esac + echo "Download apr..." + src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src # start download... src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src fi diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index ecbecb69..cfb11af2 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -163,7 +163,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index c1faf10a..6ed420cc 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -163,7 +163,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index 941576c5..a30cc1d7 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -166,7 +166,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 9e63a656..6300e30e 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -169,7 +169,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index 366d1317..dfe415c2 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -168,7 +168,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 7bbd0178..88a588c1 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -169,7 +169,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 5efba056..67dea18e 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -170,7 +170,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index f6721ff2..350fd8ab 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -170,7 +170,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 20ff26d3..0ca7af39 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -170,7 +170,7 @@ read_buffer = 4M write_buffer = 4M EOF - sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf + sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /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 diff --git a/include/php-5.3.sh b/include/php-5.3.sh index fe77c936..a3af7556 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -21,15 +21,15 @@ Install_PHP53() { # Problem building php-5.3 with openssl if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then - if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ]; then + if [ ! -e '/usr/local/openssl100s/lib/libcrypto.a' ]; then tar xzf openssl-1.0.0s.tar.gz pushd openssl-1.0.0s - ./config --prefix=/usr/local/openssl -fPIC shared zlib + ./config --prefix=/usr/local/openssl100s -fPIC shared zlib make -j ${THREAD} && make install popd rm -rf openssl-1.0.0s fi - OpenSSL_args='--with-openssl=/usr/local/openssl' + OpenSSL_args='--with-openssl=/usr/local/openssl100s' else OpenSSL_args='--with-openssl' fi @@ -37,7 +37,7 @@ Install_PHP53() { if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then tar xzf curl-7.35.0.tar.gz pushd curl-7.35.0 - LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl + LDFLAGS="-Wl,-rpath=/usr/local/openssl100s/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl100s else tar xzf curl-$curl_version.tar.gz pushd curl-$curl_version diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 31c19701..92ed330e 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -15,6 +15,26 @@ Install_Tomcat6() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + # install openssl-1.0.2 + if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then + tar xzf openssl-${openssl_version}.tar.gz + pushd openssl-${openssl_version} + ./config --prefix=${openssl_install_dir} -fPIC shared zlib + make -j ${THREAD} && make install + popd + rm -rf openssl-${openssl_version} + fi + + # install apr + if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then + tar xzf apr-${apr_version}.tar.gz + pushd apr-${apr_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf apr-${apr_version} + fi + tar xzf apache-tomcat-${tomcat6_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} /bin/cp -R apache-tomcat-${tomcat6_version}/* ${tomcat_install_dir} @@ -37,17 +57,14 @@ Install_Tomcat6() { popd rm -rf ${tomcat_install_dir}/lib/catalina - [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel - [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev pushd ${tomcat_install_dir}/bin tar xzf tomcat-native.tar.gz - pushd tomcat-native-*-src/jni/native/ - rm -rf /usr/local/apr - ./configure --with-apr=/usr/bin/apr-1-config + pushd tomcat-native-*-src/native + ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install popd rm -rf tomcat-native-* - if [ -d "/usr/local/apr/lib" ]; then + if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 let XmxMem="${Mem}/2" cat > ${tomcat_install_dir}/bin/setenv.sh << EOF diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index dfae18d7..077c6d80 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -15,6 +15,26 @@ Install_Tomcat7() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + # install openssl-1.0.2 + if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then + tar xzf openssl-${openssl_version}.tar.gz + pushd openssl-${openssl_version} + ./config --prefix=${openssl_install_dir} -fPIC shared zlib + make -j ${THREAD} && make install + popd + rm -rf openssl-${openssl_version} + fi + + # install apr + if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then + tar xzf apr-${apr_version}.tar.gz + pushd apr-${apr_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf apr-${apr_version} + fi + tar xzf apache-tomcat-${tomcat7_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} /bin/cp -R apache-tomcat-${tomcat7_version}/* ${tomcat_install_dir} @@ -37,17 +57,14 @@ Install_Tomcat7() { popd rm -rf ${tomcat_install_dir}/lib/catalina - [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel - [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev pushd ${tomcat_install_dir}/bin tar xzf tomcat-native.tar.gz - pushd tomcat-native-*-src/jni/native/ - rm -rf /usr/local/apr - ./configure --with-apr=/usr/bin/apr-1-config + pushd tomcat-native-*-src/native + ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install popd rm -rf tomcat-native-* - if [ -d "/usr/local/apr/lib" ]; then + if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 let XmxMem="${Mem}/2" cat > ${tomcat_install_dir}/bin/setenv.sh << EOF diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 99242179..f1cf3045 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -15,6 +15,26 @@ Install_Tomcat8() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } + # install openssl-1.0.2 + if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then + tar xzf openssl-${openssl_version}.tar.gz + pushd openssl-${openssl_version} + ./config --prefix=${openssl_install_dir} -fPIC shared zlib + make -j ${THREAD} && make install + popd + rm -rf openssl-${openssl_version} + fi + + # install apr + if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then + tar xzf apr-${apr_version}.tar.gz + pushd apr-${apr_version} + ./configure + make -j ${THREAD} && make install + popd + rm -rf apr-${apr_version} + fi + tar xzf apache-tomcat-${tomcat8_version}.tar.gz [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir} /bin/cp -R apache-tomcat-${tomcat8_version}/* ${tomcat_install_dir} @@ -37,17 +57,14 @@ Install_Tomcat8() { popd rm -rf ${tomcat_install_dir}/lib/catalina - [ "${OS}" == "CentOS" ] && yum -y install apr apr-devel - [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev pushd ${tomcat_install_dir}/bin tar xzf tomcat-native.tar.gz - pushd tomcat-native-*-src/jni/native/ - rm -rf /usr/local/apr - ./configure --with-apr=/usr/bin/apr-1-config + pushd tomcat-native-*-src/native + ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install popd rm -rf tomcat-native-* - if [ -d "/usr/local/apr/lib" ]; then + if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256 let XmxMem="${Mem}/2" cat > ${tomcat_install_dir}/bin/setenv.sh << EOF diff --git a/options.conf b/options.conf index d2ba8f71..292a568b 100644 --- a/options.conf +++ b/options.conf @@ -26,6 +26,8 @@ redis_install_dir=/usr/local/redis python_install_dir=/usr/local/python +openssl_install_dir=/usr/local/openssl + # Add modules nginx_modules_options='' php_modules_options='' diff --git a/upgrade.sh b/upgrade.sh index 1e3c1562..5342d1ea 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -13,7 +13,7 @@ clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # -# upgrade Web,DB,PHP,Redis,Memcached,phpMyAdmin for OneinStack # +# Upgrade Software versions for OneinStack # # For more information please visit https://oneinstack.com # ####################################################################### " diff --git a/versions.txt b/versions.txt index b8046f52..2985a054 100644 --- a/versions.txt +++ b/versions.txt @@ -5,15 +5,16 @@ tengine_version=2.1.2 openresty_version=1.11.2.2 openssl_version=1.0.2j -tomcat8_version=8.0.30 -tomcat7_version=7.0.69 -tomcat6_version=6.0.45 +tomcat8_version=8.0.39 +tomcat7_version=7.0.73 +tomcat6_version=6.0.48 apache24_version=2.4.25 apache22_version=2.2.31 pcre_version=8.39 apr_version=1.5.2 apr_util_version=1.5.4 +nghttp2_version=1.18.1 # DB mysql57_version=5.7.17 @@ -22,13 +23,13 @@ mysql55_version=5.5.54 mariadb101_version=10.1.20 mariadb100_version=10.0.28 -mariadb55_version=5.5.53 +mariadb55_version=5.5.54 percona57_version=5.7.16-10 percona56_version=5.6.34-79.1 percona55_version=5.5.53-38.5 -alisql56_version=5.6.32-2 +alisql56_version=5.6.32-3 # JDK jdk18_version=1.8.0_112 @@ -47,14 +48,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 -ImageMagick_version=6.9.7-0 +ImageMagick_version=6.9.7-3 imagick_version=3.4.3RC1 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 -curl_version=7.52.0 +curl_version=7.52.1 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 @@ -69,7 +70,7 @@ redis_pecl_for_php7_version=3.1.0 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.33 +memcached_version=1.4.34 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 diff --git a/vhost.sh b/vhost.sh index c1026cfc..3174c33c 100755 --- a/vhost.sh +++ b/vhost.sh @@ -205,7 +205,7 @@ Create_SSL() { if [ "${nginx_ssl_yn}" == 'y' ]; then [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost echo "server { server_name ${domain}${moredomainame}; root ${vhostdir}; access_log off; }" > ${web_install_dir}/conf/vhost/${domain}.conf - /etc/init.d/nginx reload > /dev/null + ${web_install_dir}/sbin/nginx -s reload fi if [ "${apache_ssl_yn}" == 'y' ]; then From 73336084cdc3b0265672703218ad9d6a0219e00e Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 21 Jan 2017 10:33:16 +0800 Subject: [PATCH 609/617] Fix openssl dir --- include/GraphicsMagick.sh | 2 +- include/ImageMagick.sh | 2 +- include/apache-2.4.sh | 6 +++--- include/init_CentOS.sh | 2 -- include/init_Debian.sh | 1 - include/init_Ubuntu.sh | 1 - include/memcached.sh | 4 ++-- include/php-5.3.sh | 2 +- include/redis.sh | 2 +- include/tomcat-6.sh | 2 +- include/tomcat-7.sh | 2 +- include/tomcat-8.sh | 2 +- versions.txt | 8 ++++---- 13 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/GraphicsMagick.sh b/include/GraphicsMagick.sh index f7a666b6..36e0a66e 100644 --- a/include/GraphicsMagick.sh +++ b/include/GraphicsMagick.sh @@ -21,8 +21,8 @@ Install_GraphicsMagick() { Install_php-gmagick() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then tar xzf gmagick-${gmagick_for_php7_version}.tgz pushd gmagick-${gmagick_for_php7_version} diff --git a/include/ImageMagick.sh b/include/ImageMagick.sh index c1b0894c..fc7acbdf 100644 --- a/include/ImageMagick.sh +++ b/include/ImageMagick.sh @@ -21,8 +21,8 @@ Install_ImageMagick() { Install_php-imagick() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ]; then tar xzf imagick-${imagick_for_php53_version}.tgz pushd imagick-${imagick_for_php53_version} diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 79774b92..80fe4933 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -24,12 +24,12 @@ Install_Apache24() { # install openssl-1.0.2 if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then - tar xzf ${openssl_version}.tar.gz - pushd ${openssl_version} + tar xzf openssl-${openssl_version}.tar.gz + pushd openssl-${openssl_version} ./config --prefix=${openssl_install_dir} -fPIC shared zlib make -j ${THREAD} && make install popd - rm -rf ${openssl_version} + rm -rf openssl-${openssl_version} fi # install nghttp2 diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index 769fce33..a8dd0a6d 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -88,13 +88,11 @@ net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_fin_timeout = 20 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 2 -net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_syncookies = 1 #net.ipv4.tcp_tw_len = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_mem = 94500000 915000000 927000000 net.ipv4.tcp_max_orphans = 3276800 -net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.nf_conntrack_max = 6553500 net.netfilter.nf_conntrack_max = 6553500 diff --git a/include/init_Debian.sh b/include/init_Debian.sh index d6b7c838..4cd737d4 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -67,7 +67,6 @@ fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 -net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index f23f7b21..c5575412 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -69,7 +69,6 @@ fs.inotify.max_user_instances = 8192 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_tw_reuse = 1 -net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_max_syn_backlog = 65536 net.ipv4.tcp_max_tw_buckets = 6000 diff --git a/include/memcached.sh b/include/memcached.sh index ec03f70d..0959e6a8 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -43,8 +43,8 @@ Install_memcached() { Install_php-memcache() { pushd ${oneinstack_dir}/src - phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) # php memcache extension if [ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}')" == '7' ]; then #git clone https://github.com/websupport-sk/pecl-memcache.git @@ -72,8 +72,8 @@ Install_php-memcache() { Install_php-memcached() { pushd ${oneinstack_dir}/src - phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) # php memcached extension tar xzf libmemcached-${libmemcached_version}.tar.gz pushd libmemcached-${libmemcached_version} diff --git a/include/php-5.3.sh b/include/php-5.3.sh index a3af7556..58f71e8b 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -24,7 +24,7 @@ Install_PHP53() { if [ ! -e '/usr/local/openssl100s/lib/libcrypto.a' ]; then tar xzf openssl-1.0.0s.tar.gz pushd openssl-1.0.0s - ./config --prefix=/usr/local/openssl100s -fPIC shared zlib + CFLAGS=-fPIC ./config --prefix=/usr/local/openssl100s shared zlib make -j ${THREAD} && make install popd rm -rf openssl-1.0.0s diff --git a/include/redis.sh b/include/redis.sh index c557a923..c7b890bd 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -57,8 +57,8 @@ Install_redis-server() { Install_php-redis() { pushd ${oneinstack_dir}/src - phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ -e "${php_install_dir}/bin/phpize" ]; then + phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir` if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then tar xzf redis-${redis_pecl_for_php7_version}.tgz pushd redis-${redis_pecl_for_php7_version} diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 92ed330e..fab81e9b 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -19,7 +19,7 @@ Install_Tomcat6() { if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then tar xzf openssl-${openssl_version}.tar.gz pushd openssl-${openssl_version} - ./config --prefix=${openssl_install_dir} -fPIC shared zlib + CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib make -j ${THREAD} && make install popd rm -rf openssl-${openssl_version} diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 077c6d80..fa4e87f1 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -19,7 +19,7 @@ Install_Tomcat7() { if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then tar xzf openssl-${openssl_version}.tar.gz pushd openssl-${openssl_version} - ./config --prefix=${openssl_install_dir} -fPIC shared zlib + CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib make -j ${THREAD} && make install popd rm -rf openssl-${openssl_version} diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index f1cf3045..bf908d02 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -19,7 +19,7 @@ Install_Tomcat8() { if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then tar xzf openssl-${openssl_version}.tar.gz pushd openssl-${openssl_version} - ./config --prefix=${openssl_install_dir} -fPIC shared zlib + CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib make -j ${THREAD} && make install popd rm -rf openssl-${openssl_version} diff --git a/versions.txt b/versions.txt index 2985a054..f9a29f94 100644 --- a/versions.txt +++ b/versions.txt @@ -10,7 +10,7 @@ tomcat7_version=7.0.73 tomcat6_version=6.0.48 apache24_version=2.4.25 -apache22_version=2.2.31 +apache22_version=2.2.32 pcre_version=8.39 apr_version=1.5.2 apr_util_version=1.5.4 @@ -37,9 +37,9 @@ jdk17_version=1.7.0_80 jdk16_version=1.6.0_45 # PHP -php71_version=7.1.0 -php70_version=7.0.14 -php56_version=5.6.29 +php71_version=7.1.1 +php70_version=7.0.15 +php56_version=5.6.30 php55_version=5.5.38 php54_version=5.4.45 php53_version=5.3.29 From 4b8ba1037a7f126fab9bbb7854d60948d133f586 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Sat, 11 Feb 2017 09:36:07 +0800 Subject: [PATCH 610/617] Update versions.txt --- addons.sh | 4 ++-- config/index.html | 2 +- config/index_cn.html | 2 +- config/pure-ftpd.conf | 4 +--- include/apache-2.4.sh | 10 --------- include/check_download.sh | 4 ++-- include/check_sw.sh | 1 + include/jemalloc.sh | 39 ++++++++++++++++++--------------- include/openssl.sh | 46 +++++++++++++++++++++++++++++++++++++++ include/php-5.3.sh | 8 ------- include/pureftpd.sh | 3 --- include/tomcat-6.sh | 10 --------- include/tomcat-7.sh | 10 --------- include/tomcat-8.sh | 10 --------- init.d/Pureftpd-init | 4 ++-- install.sh | 18 ++++++++++----- uninstall.sh | 2 ++ versions.txt | 30 ++++++++++++------------- 18 files changed, 107 insertions(+), 100 deletions(-) create mode 100644 include/openssl.sh diff --git a/addons.sh b/addons.sh index 09cfe614..e35a10ef 100755 --- a/addons.sh +++ b/addons.sh @@ -145,8 +145,8 @@ EOF fi if [ ! -e "${python_install_dir}/bin/easy_install" ] ;then - src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.tar.gz && Download_src - tar xzf setuptools-${setuptools_version}.tar.gz + src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.zip && Download_src + unzip -q setuptools-${setuptools_version}.zip pushd setuptools-${setuptools_version} ${python_install_dir}/bin/python setup.py install popd diff --git a/config/index.html b/config/index.html index aa277da3..751a24d8 100644 --- a/config/index.html +++ b/config/index.html @@ -30,7 +30,7 @@

OneinStack Author email:  

Donate:    

          Paypal:  lj2007331@gmail.com   Alipay:  lj2007331@gmail.com

-
+

diff --git a/config/index_cn.html b/config/index_cn.html index 48cff8e4..e26a48af 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -31,7 +31,7 @@

OneinStack QQ 群:  558540514(付费千人群) 535783209(新)

赞助我们:    

          Paypal:  lj2007331@gmail.com   支付宝:  lj2007331@gmail.com

-
+
diff --git a/config/pure-ftpd.conf b/config/pure-ftpd.conf index 4758a0db..a9dd5573 100644 --- a/config/pure-ftpd.conf +++ b/config/pure-ftpd.conf @@ -123,7 +123,7 @@ MaxIdleTime 15 # PureDB user database (see README.Virtual-Users) -PureDB /usr/local/pureftpd/etc/pureftpd.pdb +PureDB /usr/local/pureftpd/etc/pureftpd.pdb # Path to pure-authd socket (see README.Authentication-Modules) @@ -442,5 +442,3 @@ CustomerProof yes # FileSystemCharset big5 # ClientCharset big5 -AllowOverwrite on -AllowStoreRestart on diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 80fe4933..d498f037 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -22,16 +22,6 @@ Install_Apache24() { tar xzf apr-${apr_version}.tar.gz tar xzf apr-util-${apr_util_version}.tar.gz - # install openssl-1.0.2 - if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then - tar xzf openssl-${openssl_version}.tar.gz - pushd openssl-${openssl_version} - ./config --prefix=${openssl_install_dir} -fPIC shared zlib - make -j ${THREAD} && make install - popd - rm -rf openssl-${openssl_version} - fi - # install nghttp2 if [ ! -e "/usr/local/lib/libnghttp2.so" ]; then pushd nghttp2-${nghttp2_version} diff --git a/include/check_download.sh b/include/check_download.sh index e116bea3..819b04a9 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -493,7 +493,7 @@ checkDownload() { src_url=${mirrorLink}/php5.3patch && Download_src # Use the special ssl for php5.3 if [ "${Debian_version}" == '8' -o "${Ubuntu_version}" == "16" ]; then - if [ ! -e "/usr/local/openssl/lib/libcrypto.a" ]; then + if [ ! -e "/usr/local/openssl100s/lib/libcrypto.a" ]; then src_url=${mirrorLink}/openssl-1.0.0s.tar.gz && Download_src src_url=${mirrorLink}/curl-7.35.0.tar.gz && Download_src fi @@ -647,7 +647,7 @@ checkDownload() { if [ "${FTP_yn}" == 'y' ]; then echo "Download pureftpd..." - src_url=http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src + src_url=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_version}.tar.gz && Download_src fi if [ "${phpMyAdmin_yn}" == 'y' ]; then diff --git a/include/check_sw.sh b/include/check_sw.sh index 6c5f31fa..48060aa2 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -141,6 +141,7 @@ installDepsBySrc() { pushd tmux-${tmux_version} CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure make -j ${THREAD} && make install + unset LDFLAGS popd rm -rf tmux-${tmux_version} diff --git a/include/jemalloc.sh b/include/jemalloc.sh index f2da201d..bdefab70 100644 --- a/include/jemalloc.sh +++ b/include/jemalloc.sh @@ -9,25 +9,28 @@ # https://github.com/lj2007331/oneinstack Install_Jemalloc() { - pushd ${oneinstack_dir}/src - tar xjf jemalloc-$jemalloc_version.tar.bz2 - pushd jemalloc-$jemalloc_version - LDFLAGS="${LDFLAGS} -lrt" ./configure - make -j ${THREAD} && make install - popd - if [ -f "/usr/local/lib/libjemalloc.so" ]; then - if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ]; then - ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 + if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then + pushd ${oneinstack_dir}/src + tar xjf jemalloc-$jemalloc_version.tar.bz2 + pushd jemalloc-$jemalloc_version + LDFLAGS="${LDFLAGS} -lrt" ./configure + make -j ${THREAD} && make install + unset LDFLAGS + popd + if [ -f "/usr/local/lib/libjemalloc.so" ]; then + if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ]; then + ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1 + else + ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1 + fi + echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf + ldconfig + echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}" + rm -rf jemalloc-${jemalloc_version} else - ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1 + echo "${CFAILURE}jemalloc install failed, Please contact the author! ${CEND}" + kill -9 $$ fi - echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf - ldconfig - echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}" - rm -rf jemalloc-${jemalloc_version} - else - echo "${CFAILURE}jemalloc install failed, Please contact the author! ${CEND}" - kill -9 $$ + popd fi - popd } diff --git a/include/openssl.sh b/include/openssl.sh new file mode 100644 index 00000000..e4744e7a --- /dev/null +++ b/include/openssl.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Author: yeho +# 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_openSSL102() { + if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then + # install openssl-1.0.2 + pushd ${oneinstack_dir}/src + tar xzf openssl-${openssl_version}.tar.gz + pushd openssl-${openssl_version} + ./config --prefix=${openssl_install_dir} -fPIC shared zlib-dynamic + make -j ${THREAD} && make install + popd;popd + if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then + echo "${CSUCCESS}openssl-1.0.2 module installed successfully! ${CEND}" + rm -rf openssl-${openssl_version} + else + echo "${CFAILURE}openssl-1.0.2 install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + fi +} + +Install_openSSL100() { + if [ ! -e '/usr/local/openssl100s/lib/libcrypto.a' ]; then + pushd ${oneinstack_dir}/src + tar xzf openssl-1.0.0s.tar.gz + pushd openssl-1.0.0s + ./config --prefix=/usr/local/openssl100s -fPIC shared zlib-dynamic + make -j ${THREAD} && make install + popd;popd + if [ -f "/usr/local/openssl100s/lib/libcrypto.a" ]; then + echo "${CSUCCESS}openssl-1.0.0s module installed successfully! ${CEND}" + rm -rf openssl-1.0.0s + else + echo "${CFAILURE}openssl-1.0.0s install failed, Please contact the author! ${CEND}" + kill -9 $$ + fi + fi +} diff --git a/include/php-5.3.sh b/include/php-5.3.sh index 58f71e8b..cfcc5722 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -21,14 +21,6 @@ Install_PHP53() { # Problem building php-5.3 with openssl if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then - if [ ! -e '/usr/local/openssl100s/lib/libcrypto.a' ]; then - tar xzf openssl-1.0.0s.tar.gz - pushd openssl-1.0.0s - CFLAGS=-fPIC ./config --prefix=/usr/local/openssl100s shared zlib - make -j ${THREAD} && make install - popd - rm -rf openssl-1.0.0s - fi OpenSSL_args='--with-openssl=/usr/local/openssl100s' else OpenSSL_args='--with-openssl' diff --git a/include/pureftpd.sh b/include/pureftpd.sh index 63415939..6777f89c 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -21,10 +21,7 @@ Install_PureFTPd() { make -j ${THREAD} && make install if [ -e "${pureftpd_install_dir}/sbin/pure-ftpwho" ]; then [ ! -e "${pureftpd_install_dir}/etc" ] && mkdir ${pureftpd_install_dir}/etc - /bin/cp configuration-file/pure-config.pl ${pureftpd_install_dir}/sbin popd - sed -i "s@/usr/local/pureftpd@${pureftpd_install_dir}@" ${pureftpd_install_dir}/sbin/pure-config.pl - chmod +x ${pureftpd_install_dir}/sbin/pure-config.pl /bin/cp ../init.d/Pureftpd-init /etc/init.d/pureftpd /bin/cp ../config/pure-ftpd.conf ${pureftpd_install_dir}/etc sed -i "s@/usr/local/pureftpd@${pureftpd_install_dir}@g" /etc/init.d/pureftpd diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index fab81e9b..60600cb7 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -15,16 +15,6 @@ Install_Tomcat6() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - # install openssl-1.0.2 - if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then - tar xzf openssl-${openssl_version}.tar.gz - pushd openssl-${openssl_version} - CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib - make -j ${THREAD} && make install - popd - rm -rf openssl-${openssl_version} - fi - # install apr if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then tar xzf apr-${apr_version}.tar.gz diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index fa4e87f1..f2c14264 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -15,16 +15,6 @@ Install_Tomcat7() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - # install openssl-1.0.2 - if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then - tar xzf openssl-${openssl_version}.tar.gz - pushd openssl-${openssl_version} - CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib - make -j ${THREAD} && make install - popd - rm -rf openssl-${openssl_version} - fi - # install apr if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then tar xzf apr-${apr_version}.tar.gz diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index bf908d02..56669696 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -15,16 +15,6 @@ Install_Tomcat8() { id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /bin/bash ${run_user} || { [ -z "$(grep ^${run_user} /etc/passwd | grep '/bin/bash')" ] && usermod -s /bin/bash ${run_user}; } - # install openssl-1.0.2 - if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then - tar xzf openssl-${openssl_version}.tar.gz - pushd openssl-${openssl_version} - CFLAGS=-fPIC ./config --prefix=${openssl_install_dir} shared zlib - make -j ${THREAD} && make install - popd - rm -rf openssl-${openssl_version} - fi - # install apr if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then tar xzf apr-${apr_version}.tar.gz diff --git a/init.d/Pureftpd-init b/init.d/Pureftpd-init index 863c21c2..6a3fc64a 100755 --- a/init.d/Pureftpd-init +++ b/init.d/Pureftpd-init @@ -25,12 +25,12 @@ RETVAL=0 # Path to the pure-ftp binaries. prog=pure-ftpd -fullpath=/usr/local/pureftpd/sbin/pure-config.pl +fullpath=/usr/local/pureftpd/sbin/$prog pure_config=/usr/local/pureftpd/etc/pure-ftpd.conf start() { echo -n $"Starting $prog: " - $fullpath $pure_config --daemonize + $fullpath $pure_config RETVAL=$? [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog echo diff --git a/install.sh b/install.sh index 6ddff473..241abbd0 100755 --- a/install.sh +++ b/install.sh @@ -486,12 +486,20 @@ checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log # Install dependencies from source package installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log -# jemalloc +# Jemalloc if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then - if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then - . include/jemalloc.sh - Install_Jemalloc | tee -a $oneinstack_dir/install.log - fi + . include/jemalloc.sh + Install_Jemalloc | tee -a $oneinstack_dir/install.log +fi + +# openSSL +. ./include/openssl.sh +if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ] && [ "$PHP_version" == '1' ]; then + # Problem building php-5.3 with openssl + Install_openSSL100 | tee -a $oneinstack_dir/install.log +fi +if [[ $Tomcat_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$Apache_version" == '1' ]; then + Install_openSSL102 | tee -a $oneinstack_dir/install.log fi # Database diff --git a/uninstall.sh b/uninstall.sh index 73d7a1eb..f8fd43a4 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -84,6 +84,7 @@ Uninstall_Web() { [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; } [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; } [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } + [ -d "${openssl_install_dir}" ] && rm -rf ${openssl_install_dir} [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} sed -i 's@^website_name=.*@website_name=@' ./options.conf sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf @@ -111,6 +112,7 @@ Print_PHP() { [ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm" [ -e "/usr/local/imagemagick" ] && echo "/usr/local/imagemagick" [ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick' + [ -d "/usr/local/openssl100s" ] && rm -rf /usr/local/openssl100s } Uninstall_PHP() { diff --git a/versions.txt b/versions.txt index f9a29f94..5e86adb2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,12 +1,12 @@ # newest software version # Web -nginx_version=1.10.2 +nginx_version=1.10.3 tengine_version=2.1.2 openresty_version=1.11.2.2 -openssl_version=1.0.2j +openssl_version=1.0.2k -tomcat8_version=8.0.39 -tomcat7_version=7.0.73 +tomcat8_version=8.0.41 +tomcat7_version=7.0.75 tomcat6_version=6.0.48 apache24_version=2.4.25 @@ -21,18 +21,18 @@ mysql57_version=5.7.17 mysql56_version=5.6.35 mysql55_version=5.5.54 -mariadb101_version=10.1.20 -mariadb100_version=10.0.28 +mariadb101_version=10.1.21 +mariadb100_version=10.0.29 mariadb55_version=5.5.54 -percona57_version=5.7.16-10 -percona56_version=5.6.34-79.1 -percona55_version=5.5.53-38.5 +percona57_version=5.7.17-11 +percona56_version=5.6.35-80.0 +percona55_version=5.5.54-38.6 alisql56_version=5.6.32-3 # JDK -jdk18_version=1.8.0_112 +jdk18_version=1.8.0_121 jdk17_version=1.7.0_80 jdk16_version=1.6.0_45 @@ -48,8 +48,8 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.7 -ImageMagick_version=6.9.7-3 -imagick_version=3.4.3RC1 +ImageMagick_version=6.9.7-6 +imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 @@ -62,11 +62,11 @@ mhash_version=0.9.9.9 eaccelerator_version=0.9.6.1 # Ftp -pureftpd_version=1.0.43 +pureftpd_version=1.0.45 # Redis redis_version=3.2.6 -redis_pecl_for_php7_version=3.1.0 +redis_pecl_for_php7_version=3.1.1 redis_pecl_version=2.2.8 # Memcached @@ -76,7 +76,7 @@ memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 # phpMyadmin -phpMyAdmin_version=4.4.15.9 +phpMyAdmin_version=4.4.15.10 # jemalloc jemalloc_version=4.4.0 From f0d85f085d2e0a49510af80ca8499b50456abbc4 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Wed, 15 Feb 2017 17:34:56 +0800 Subject: [PATCH 611/617] Update versions.txt --- include/check_sw.sh | 6 +++--- include/mysql-5.5.sh | 1 + include/mysql-5.6.sh | 1 + include/mysql-5.7.sh | 1 + include/upgrade_db.sh | 1 + uninstall.sh | 6 ++++-- versions.txt | 8 ++++---- vhost.sh | 2 +- 8 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/check_sw.sh b/include/check_sw.sh index 48060aa2..2b733456 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -26,10 +26,10 @@ installDepsDebian() { # Install needed packages case "${Debian_version}" in [6,7]) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; 8) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; *) echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}" @@ -95,7 +95,7 @@ installDepsUbuntu() { apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz ntpdate wget" for Package in ${pkgList}; do apt-get -y install ${Package} --force-yes done diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 6300e30e..a228301f 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -21,6 +21,7 @@ Install_MySQL55() { tar xvf mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}.tar.gz mv mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql55_version}.tar.gz pushd mysql-${mysql55_version} diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index dfe415c2..1a4ae82a 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -21,6 +21,7 @@ Install_MySQL56() { tar xvf mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql56_version}.tar.gz pushd mysql-${mysql56_version} diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index 88a588c1..6c3c1eeb 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -21,6 +21,7 @@ Install_MySQL57() { tar xvf mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz mv mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mysql-${mysql57_version}.tar.gz pushd mysql-${mysql57_version} diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index bb481493..7405f1d1 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -165,6 +165,7 @@ Upgrade_DB() { mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir mv $DB_name/* $mysql_install_dir/ sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' $mysql_install_dir/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" != '5.7' ] && $mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.7' ] && $mysql_install_dir/bin/mysqld --initialize-insecure --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir diff --git a/uninstall.sh b/uninstall.sh index f8fd43a4..a0c7377a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -75,6 +75,7 @@ Print_web() { [ -e "/etc/logrotate.d/tomcat" ] && echo "/etc/logrotate.d/tomcat" [ -d "/usr/java" ] && echo '/usr/java' [ -d "/usr/local/apr" ] && echo '/usr/local/apr' + [ -d "${openssl_install_dir}" ] && echo "${openssl_install_dir}" } Uninstall_Web() { @@ -84,7 +85,7 @@ Uninstall_Web() { [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; } [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; } [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; } - [ -d "${openssl_install_dir}" ] && rm -rf ${openssl_install_dir} + [ -d "${openssl_install_dir}" ] && rm -rf ${openssl_install_dir} [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)} sed -i 's@^website_name=.*@website_name=@' ./options.conf sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf @@ -112,7 +113,7 @@ Print_PHP() { [ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm" [ -e "/usr/local/imagemagick" ] && echo "/usr/local/imagemagick" [ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick' - [ -d "/usr/local/openssl100s" ] && rm -rf /usr/local/openssl100s + [ -e "/usr/local/openssl100s" ] && echo '/usr/local/openssl100s' } Uninstall_PHP() { @@ -120,6 +121,7 @@ Uninstall_PHP() { [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && rm -rf ${php_install_dir} [ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick [ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick + [ -e "/usr/local/openssl100s" ] && rm -rf /usr/local/openssl100s sed -i "s@${php_install_dir}/bin:@@" /etc/profile echo "${CMSG}PHP uninstall completed${CEND}" } diff --git a/versions.txt b/versions.txt index 5e86adb2..313c1ff4 100644 --- a/versions.txt +++ b/versions.txt @@ -37,8 +37,8 @@ jdk17_version=1.7.0_80 jdk16_version=1.6.0_45 # PHP -php71_version=7.1.1 -php70_version=7.0.15 +php71_version=7.1.2 +php70_version=7.0.16 php56_version=5.6.30 php55_version=5.5.38 php54_version=5.4.45 @@ -47,7 +47,7 @@ php53_version=5.3.29 zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 -apcu_for_php7_version=5.1.7 +apcu_for_php7_version=5.1.8 ImageMagick_version=6.9.7-6 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 @@ -65,7 +65,7 @@ eaccelerator_version=0.9.6.1 pureftpd_version=1.0.45 # Redis -redis_version=3.2.6 +redis_version=3.2.8 redis_pecl_for_php7_version=3.1.1 redis_pecl_version=2.2.8 diff --git a/vhost.sh b/vhost.sh index 3174c33c..91dc0f58 100755 --- a/vhost.sh +++ b/vhost.sh @@ -243,7 +243,7 @@ EOF Cron_Command="/etc/init.d/httpd graceful" fi [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root - [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * ${python_install_dir}/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file + [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "30 2 * * 1 ${python_install_dir}/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file else echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed! ${CEND}" exit 1 From d008ce9667c2612456c95b1d82b89ac490f6b1c3 Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Tue, 21 Feb 2017 18:52:26 +0800 Subject: [PATCH 612/617] Add fail2ban --- addons.sh | 143 +++++++++++++++++++---------------------- include/check_sw.sh | 8 +-- include/init_CentOS.sh | 1 + include/init_Debian.sh | 1 + include/init_Ubuntu.sh | 1 + include/openssl.sh | 6 +- include/python.sh | 87 +++++++++++++++++++++++++ versions.txt | 5 +- 8 files changed, 167 insertions(+), 85 deletions(-) create mode 100755 include/python.sh diff --git a/addons.sh b/addons.sh index e35a10ef..8c2e7a33 100755 --- a/addons.sh +++ b/addons.sh @@ -45,6 +45,8 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf . ./include/redis.sh +. ./include/python.sh + # Check if user is root [ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } @@ -98,82 +100,8 @@ Uninstall_succ() { } Install_letsencrypt() { - if [ "${CentOS_RHEL_version}" == '7' ]; then - [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF -[epel] -name=Extra Packages for Enterprise Linux 7 - \$basearch -#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch -failovermethod=priority -enabled=1 -gpgcheck=0 -EOF - elif [ "${CentOS_RHEL_version}" == '6' ]; then - [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF -[epel] -name=Extra Packages for Enterprise Linux 6 - \$basearch -#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch -failovermethod=priority -enabled=1 -gpgcheck=0 -EOF - fi - - pushd ${oneinstack_dir}/src - if [ "${OS}" == "CentOS" ]; then - pkgList="gcc dialog augeas-libs openssl openssl-devel libffi-devel redhat-rpm-config ca-certificates python python-devel python-virtualenv python-tools python-pip" - for Package in ${pkgList}; do - yum -y install ${Package} - done - elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then - pkgList="python python-dev virtualenv python-virtualenv gcc dialog libaugeas0 augeas-lenses libssl-dev libffi-dev ca-certificates" - for Package in ${pkgList}; do - apt-get -y install $Package - done - fi - # Install Python - if [ ! -e "${python_install_dir}/bin/python" -a ! -e "${python_install_dir}/bin/python3" ] ;then - src_url=http://mirrors.linuxeye.com/oneinstack/src/Python-${python_version}.tgz && Download_src - tar xzf Python-${python_version}.tgz - pushd Python-${python_version} - ./configure --prefix=${python_install_dir} - make && make install - [ ! -e "${python_install_dir}/bin/python" -a -e "${python_install_dir}/bin/python3" ] && ln -s ${python_install_dir}/bin/python{3,} - popd - rm -rf Python-${python_version} - fi - - if [ ! -e "${python_install_dir}/bin/easy_install" ] ;then - src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.zip && Download_src - unzip -q setuptools-${setuptools_version}.zip - pushd setuptools-${setuptools_version} - ${python_install_dir}/bin/python setup.py install - popd - rm -rf setuptools-${setuptools_version} - fi - - if [ ! -e "${python_install_dir}/bin/pip" ] ;then - src_url=http://mirrors.linuxeye.com/oneinstack/src/pip-${pip_version}.tar.gz && Download_src - tar xzf pip-${pip_version}.tar.gz - pushd pip-${pip_version} - ${python_install_dir}/bin/python setup.py install - popd - rm -rf pip-${pip_version} - fi - - if [ ! -e "/root/.pip/pip.conf" ] ;then - # get the IP information - PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) - IPADDR_COUNTRY=$(../include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}') - if [ "$IPADDR_COUNTRY"x != "CN"x ]; then - [ ! -d "/root/.pip" ] && mkdir /root/.pip - echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf - fi - fi - + [ ! -e "${python_install_dir}/bin/python" ] && Install_Python ${python_install_dir}/bin/pip install certbot - popd if [ -e "${python_install_dir}/bin/certbot" ]; then echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}" else @@ -189,6 +117,58 @@ Uninstall_letsencrypt() { echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}"; } +Install_fail2ban() { + [ ! -e "${python_install_dir}/bin/python" ] && Install_Python + pushd ${oneinstack_dir}/src + src_url=http://mirrors.linuxeye.com/oneinstack/src/fail2ban-${fail2ban_version}.tar.gz && Download_src + tar xzf fail2ban-${fail2ban_version}.tar.gz + pushd fail2ban-${fail2ban_version} + ${python_install_dir}/bin/python setup.py install + /bin/cp /etc/fail2ban/jail.{conf,local} + sed -i 's@^# \[sshd\]@[sshd]@' /etc/fail2ban/jail.local + sed -i 's@^# enabled = true@enabled = true@' /etc/fail2ban/jail.local + if [ "${OS}" == "CentOS" ]; then + sed -i 's@%(sshd_log)s@/var/log/secure@' /etc/fail2ban/jail.local + /bin/cp files/redhat-initd /etc/init.d/fail2ban + sed -i "s@^FAIL2BAN=.*@FAIL2BAN=${python_install_dir}/bin/fail2ban-client@" /etc/init.d/fail2ban + chmod +x /etc/init.d/fail2ban + chkconfig --add fail2ban + chkconfig fail2ban on + fi + if [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + /bin/cp files/debian-initd /etc/init.d/fail2ban + sed -i 's@2 3 4 5@3 4 5@' /etc/init.d/fail2ban + sed -i "s@^DAEMON=.*@DAEMON=${python_install_dir}/bin/\$NAME-client@" /etc/init.d/fail2ban + chmod +x /etc/init.d/fail2ban + update-rc.d fail2ban defaults + fi + cat > /etc/logrotate.d/fail2ban << EOF +/var/log/fail2ban.log { + missingok + notifempty + postrotate + ${python_install_dir}/bin/fail2ban-client flushlogs >/dev/null || true + endscript +} +EOF + kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` + /etc/init.d/fail2ban start + popd + if [ -e "${python_install_dir}/bin/fail2ban-python" ]; then + echo; echo "${CSUCCESS}fail2ban installed successfully! ${CEND}" + else + echo; echo "${CFAILURE}fail2ban install failed, Please try again! ${CEND}" + fi + popd +} + +Uninstall_fail2ban() { + /etc/init.d/fail2ban stop + ${python_install_dir}/bin/pip uninstall -y fail2ban > /dev/null 2>&1 + rm -rf /etc/init.d/fail2ban /etc/fail2ban /etc/logrotate.d/fail2ban /var/log/fail2ban.* /var/run/fail2ban + echo; echo "${CMSG}fail2ban uninstall completed${CEND}"; +} + ACTION_FUN() { while :; do echo @@ -215,11 +195,12 @@ What Are You Doing? \t${CMSG}5${CEND}. Install/Uninstall memcached/memcache \t${CMSG}6${CEND}. Install/Uninstall Redis \t${CMSG}7${CEND}. Install/Uninstall Let's Encrypt client +\t${CMSG}8${CEND}. Install/Uninstall fail2ban \t${CMSG}q${CEND}. Exit " read -p "Please input the correct option: " Number - if [[ ! "${Number}" =~ ^[1-7,q]$ ]]; then - echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}" + if [[ ! "${Number}" =~ ^[1-8,q]$ ]]; then + echo "${CFAILURE}input error! Please only input 1 ~ 8 and q${CEND}" else case "${Number}" in 1) @@ -472,6 +453,14 @@ What Are You Doing? Uninstall_letsencrypt fi ;; + 8) + ACTION_FUN + if [ "${ACTION}" = '1' ]; then + Install_fail2ban + else + Uninstall_fail2ban + fi + ;; q) exit ;; diff --git a/include/check_sw.sh b/include/check_sw.sh index 2b733456..cb1eec60 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -26,10 +26,10 @@ installDepsDebian() { # Install needed packages case "${Debian_version}" in [6,7]) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; 8) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget" ;; *) echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}" @@ -63,7 +63,7 @@ installDepsCentOS() { echo "${CMSG}Installing dependencies packages...${CEND}" yum check-update # Install needed packages - pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sqlite-devel sysstat patch bc expect rsync git lsof lrzsz wget" + pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ntpdate sqlite-devel sysstat patch bc expect rsync rsyslog git lsof lrzsz wget" for Package in ${pkgList}; do yum -y install ${Package} done @@ -95,7 +95,7 @@ installDepsUbuntu() { apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz ntpdate wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect iptables rsyslog rsync git lsof lrzsz ntpdate wget" for Package in ${pkgList}; do apt-get -y install ${Package} --force-yes done diff --git a/include/init_CentOS.sh b/include/init_CentOS.sh index a8dd0a6d..782643e8 100644 --- a/include/init_CentOS.sh +++ b/include/init_CentOS.sh @@ -153,6 +153,7 @@ fi FW_PORT_FLAG=$(grep -ow "dport ${SSH_PORT}" /etc/sysconfig/iptables) [ -z "${FW_PORT_FLAG}" -a "${SSH_PORT}" != "22" ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport ${SSH_PORT} -j ACCEPT@" /etc/sysconfig/iptables +service rsyslog restart service iptables restart service sshd restart diff --git a/include/init_Debian.sh b/include/init_Debian.sh index 4cd737d4..55db4fe1 100644 --- a/include/init_Debian.sh +++ b/include/init_Debian.sh @@ -128,6 +128,7 @@ cat > /etc/network/if-pre-up.d/iptables << EOF /sbin/iptables-restore < /etc/iptables.up.rules EOF chmod +x /etc/network/if-pre-up.d/iptables +service rsyslog restart service ssh restart . /etc/profile diff --git a/include/init_Ubuntu.sh b/include/init_Ubuntu.sh index c5575412..d8cdf1b3 100644 --- a/include/init_Ubuntu.sh +++ b/include/init_Ubuntu.sh @@ -131,6 +131,7 @@ cat > /etc/network/if-pre-up.d/iptables << EOF /sbin/iptables-restore < /etc/iptables.up.rules EOF chmod +x /etc/network/if-pre-up.d/iptables +service rsyslog restart service ssh restart . /etc/profile diff --git a/include/openssl.sh b/include/openssl.sh index e4744e7a..5d9666e3 100644 --- a/include/openssl.sh +++ b/include/openssl.sh @@ -16,7 +16,7 @@ Install_openSSL102() { pushd openssl-${openssl_version} ./config --prefix=${openssl_install_dir} -fPIC shared zlib-dynamic make -j ${THREAD} && make install - popd;popd + popd if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then echo "${CSUCCESS}openssl-1.0.2 module installed successfully! ${CEND}" rm -rf openssl-${openssl_version} @@ -24,6 +24,7 @@ Install_openSSL102() { echo "${CFAILURE}openssl-1.0.2 install failed, Please contact the author! ${CEND}" kill -9 $$ fi + popd fi } @@ -34,7 +35,7 @@ Install_openSSL100() { pushd openssl-1.0.0s ./config --prefix=/usr/local/openssl100s -fPIC shared zlib-dynamic make -j ${THREAD} && make install - popd;popd + popd if [ -f "/usr/local/openssl100s/lib/libcrypto.a" ]; then echo "${CSUCCESS}openssl-1.0.0s module installed successfully! ${CEND}" rm -rf openssl-1.0.0s @@ -42,5 +43,6 @@ Install_openSSL100() { echo "${CFAILURE}openssl-1.0.0s install failed, Please contact the author! ${CEND}" kill -9 $$ fi + popd fi } diff --git a/include/python.sh b/include/python.sh new file mode 100755 index 00000000..4f8006c7 --- /dev/null +++ b/include/python.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Author: yeho +# 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_Python() { + pushd ${oneinstack_dir}/src + if [ "${CentOS_RHEL_version}" == '7' ]; then + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 7 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF + elif [ "${CentOS_RHEL_version}" == '6' ]; then + [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF +[epel] +name=Extra Packages for Enterprise Linux 6 - \$basearch +#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +EOF + fi + + if [ "${OS}" == "CentOS" ]; then + pkgList="gcc dialog augeas-libs openssl openssl-devel libffi-devel redhat-rpm-config ca-certificates" + for Package in ${pkgList}; do + yum -y install ${Package} + done + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + pkgList="gcc dialog libaugeas0 augeas-lenses libssl-dev libffi-dev ca-certificates" + for Package in ${pkgList}; do + apt-get -y install $Package + done + fi + + # Install Python + if [ ! -e "${python_install_dir}/bin/python" -a ! -e "${python_install_dir}/bin/python3" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/Python-${python_version}.tgz && Download_src + tar xzf Python-${python_version}.tgz + pushd Python-${python_version} + ./configure --prefix=${python_install_dir} + make && make install + [ ! -e "${python_install_dir}/bin/python" -a -e "${python_install_dir}/bin/python3" ] && ln -s ${python_install_dir}/bin/python{3,} + popd + rm -rf Python-${python_version} + fi + + if [ ! -e "${python_install_dir}/bin/easy_install" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.zip && Download_src + unzip -q setuptools-${setuptools_version}.zip + pushd setuptools-${setuptools_version} + ${python_install_dir}/bin/python setup.py install + popd + rm -rf setuptools-${setuptools_version} + fi + + if [ ! -e "${python_install_dir}/bin/pip" ] ;then + src_url=http://mirrors.linuxeye.com/oneinstack/src/pip-${pip_version}.tar.gz && Download_src + tar xzf pip-${pip_version}.tar.gz + pushd pip-${pip_version} + ${python_install_dir}/bin/python setup.py install + popd + rm -rf pip-${pip_version} + fi + + if [ ! -e "/root/.pip/pip.conf" ] ;then + # get the IP information + PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) + IPADDR_COUNTRY=$(../include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}') + if [ "$IPADDR_COUNTRY"x != "CN"x ]; then + [ ! -d "/root/.pip" ] && mkdir /root/.pip + echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf + fi + fi + popd +} diff --git a/versions.txt b/versions.txt index 313c1ff4..a46fdac9 100644 --- a/versions.txt +++ b/versions.txt @@ -29,7 +29,7 @@ percona57_version=5.7.17-11 percona56_version=5.6.35-80.0 percona55_version=5.5.54-38.6 -alisql56_version=5.6.32-3 +alisql56_version=5.6.32-4 # JDK jdk18_version=1.8.0_121 @@ -48,7 +48,7 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.8 -ImageMagick_version=6.9.7-6 +ImageMagick_version=6.9.7-9 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 @@ -92,3 +92,4 @@ bison_version=2.7.1 python_version=2.7.13 setuptools_version=32.0.0 pip_version=9.0.1 +fail2ban_version=0.9.6 From ae5131ca51510032479a5428751054fa32841d0b Mon Sep 17 00:00:00 2001 From: lj2007331 Date: Fri, 3 Mar 2017 14:57:02 +0800 Subject: [PATCH 613/617] refine SS --- addons.sh | 21 +- config/index_cn.html | 2 +- .../{Shadowsocks-libev-init => SS-libev-init} | 8 +- init.d/SS-python-init | 99 ++++++ init.d/Shadowsocks-python-init | 99 ------ shadowsocks.sh | 293 ------------------ ss.sh | 279 +++++++++++++++++ versions.txt | 2 +- 8 files changed, 400 insertions(+), 403 deletions(-) rename init.d/{Shadowsocks-libev-init => SS-libev-init} (94%) create mode 100755 init.d/SS-python-init delete mode 100755 init.d/Shadowsocks-python-init delete mode 100755 shadowsocks.sh create mode 100755 ss.sh diff --git a/addons.sh b/addons.sh index 8c2e7a33..33a055ac 100755 --- a/addons.sh +++ b/addons.sh @@ -124,11 +124,8 @@ Install_fail2ban() { tar xzf fail2ban-${fail2ban_version}.tar.gz pushd fail2ban-${fail2ban_version} ${python_install_dir}/bin/python setup.py install - /bin/cp /etc/fail2ban/jail.{conf,local} - sed -i 's@^# \[sshd\]@[sshd]@' /etc/fail2ban/jail.local - sed -i 's@^# enabled = true@enabled = true@' /etc/fail2ban/jail.local if [ "${OS}" == "CentOS" ]; then - sed -i 's@%(sshd_log)s@/var/log/secure@' /etc/fail2ban/jail.local + LOGPATH=/var/log/secure /bin/cp files/redhat-initd /etc/init.d/fail2ban sed -i "s@^FAIL2BAN=.*@FAIL2BAN=${python_install_dir}/bin/fail2ban-client@" /etc/init.d/fail2ban chmod +x /etc/init.d/fail2ban @@ -136,12 +133,26 @@ Install_fail2ban() { chkconfig fail2ban on fi if [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + LOGPATH=/var/log/auth.log /bin/cp files/debian-initd /etc/init.d/fail2ban sed -i 's@2 3 4 5@3 4 5@' /etc/init.d/fail2ban sed -i "s@^DAEMON=.*@DAEMON=${python_install_dir}/bin/\$NAME-client@" /etc/init.d/fail2ban chmod +x /etc/init.d/fail2ban update-rc.d fail2ban defaults fi + [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && ssh_port=22 || ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'` + cat > /etc/fail2ban/jail.local << EOF +[DEFAULT] +ignoreip = 127.0.0.1/8 +bantime = 86400 +findtime = 600 +maxretry = 5 +[ssh-iptables] +enabled = true +filter = sshd +action = iptables[name=SSH, port=$ssh_port, protocol=tcp] +logpath = $LOGPATH +EOF cat > /etc/logrotate.d/fail2ban << EOF /var/log/fail2ban.log { missingok @@ -151,7 +162,7 @@ Install_fail2ban() { endscript } EOF - kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` + kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` > /dev/null 2>&1 /etc/init.d/fail2ban start popd if [ -e "${python_install_dir}/bin/fail2ban-python" ]; then diff --git a/config/index_cn.html b/config/index_cn.html index e26a48af..7dde0d4f 100644 --- a/config/index_cn.html +++ b/config/index_cn.html @@ -28,7 +28,7 @@

OneinStack 创建 FTP 虚拟账号执行脚本:  ./pureftpd_vhost.sh

Github 项目地址:  https://github.com/lj2007331/oneinstack

OneinStack 官网:  https://oneinstack.com

-

QQ 群:  558540514(付费千人群) 535783209(新)

+

QQ 群:  558540514(付费千人群) 262601796(新)

赞助我们:    

          Paypal:  lj2007331@gmail.com   支付宝:  lj2007331@gmail.com

diff --git a/init.d/Shadowsocks-libev-init b/init.d/SS-libev-init similarity index 94% rename from init.d/Shadowsocks-libev-init rename to init.d/SS-libev-init index 671bdfba..322fc028 100755 --- a/init.d/Shadowsocks-libev-init +++ b/init.d/SS-libev-init @@ -1,6 +1,6 @@ #!/bin/bash # -# Script to run Shadowsocks in daemon mode at boot time. +# Script to run SS in daemon mode at boot time. # ScriptAuthor: icyboy # Revision 1.0 - 14th Sep 2013 #==================================================================== @@ -23,7 +23,7 @@ [ ${NETWORKING} ="yes" ] || exit 0 # Daemon -NAME=shadowsocks-server +NAME=ss-server DAEMON=/usr/local/bin/ss-server # Path to the configuration file. @@ -60,7 +60,7 @@ PID=/var/run/$NAME/pid RETVAL=0 -# Start shadowsocks as daemon. +# Start SS as daemon. # start() { if [ -f $LOCK_FILE ]; then @@ -80,7 +80,7 @@ start() { } -# Stop shadowsocks. +# Stop SS. # stop() { echo -n $"Shutting down ${NAME}: " diff --git a/init.d/SS-python-init b/init.d/SS-python-init new file mode 100755 index 00000000..4473b863 --- /dev/null +++ b/init.d/SS-python-init @@ -0,0 +1,99 @@ +#!/bin/bash +# Author: yeho +# BLOG: https://blog.linuxeye.com +### BEGIN INIT INFO +# Provides: SS +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Start: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: SS - SS-python starts daemon +# Description: SS - lightweight secured scoks5 proxy +### END INIT INFO +# +# chkconfig: - 90 10 +# description: SS start/stop/status/restart script + +SS_bin=/usr/local/python/bin/ssserver +SS_conf=/etc/shadowsocks/config.json + +#SS_USAGE is the message if this script is called without any options +SS_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}" + +#SHUTDOWN_WAIT is wait time in seconds for SS proccess to stop +SHUTDOWN_WAIT=20 + +SS_pid(){ + echo `ps -ef | grep $SS_bin | grep -v grep | tr -s " "|cut -d" " -f2` +} + +start() { + pid=$(SS_pid) + if [ -n "$pid" ]; then + echo -e "\e[00;31mSS is already running (pid: $pid)\e[00m" + else + $SS_bin -c $SS_conf -d start + RETVAL=$? + if [ "$RETVAL" = "0" ]; then + echo -e "\e[00;32mStarting SS\e[00m" + else + echo -e "\e[00;32mSS start Failed\e[00m" + fi + status + fi + return 0 +} + +status(){ + pid=$(SS_pid) + if [ -n "$pid" ]; then + echo -e "\e[00;32mSS is running with pid: $pid\e[00m" + else + echo -e "\e[00;31mSS is not running\e[00m" + fi +} + +stop(){ + pid=$(SS_pid) + if [ -n "$pid" ]; then + echo -e "\e[00;31mStoping SS\e[00m" + $SS_bin -c $SS_conf -d stop + let kwait=$SHUTDOWN_WAIT + count=0; + until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ] + do + echo -n -e "\e[00;31mwaiting for processes to exit\e[00m\n"; + sleep 1 + let count=$count+1; + done + + if [ $count -gt $kwait ]; then + echo -n -e "\n\e[00;31mkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\e[00m" + kill -9 $pid + fi + else + echo -e "\e[00;31mSS is not running\e[00m" + fi + + return 0 +} + +case $1 in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + status + ;; + *) + echo -e $SS_USAGE + ;; +esac +exit 0 diff --git a/init.d/Shadowsocks-python-init b/init.d/Shadowsocks-python-init deleted file mode 100755 index 715735af..00000000 --- a/init.d/Shadowsocks-python-init +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# Author: yeho -# BLOG: https://blog.linuxeye.com -### BEGIN INIT INFO -# Provides: shadowsocks -# Required-Start: $local_fs $remote_fs $network $syslog -# Required-Start: $local_fs $remote_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: shadowsocks - Shadowsocks-python starts daemon -# Description: shadowsocks - lightweight secured scoks5 proxy -### END INIT INFO -# -# chkconfig: - 90 10 -# description: Shadowsocks start/stop/status/restart script - -Shadowsocks_bin=/usr/bin/ssserver -Shadowsocks_conf=/etc/shadowsocks/config.json - -#Shadowsocks_USAGE is the message if this script is called without any options -Shadowsocks_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}" - -#SHUTDOWN_WAIT is wait time in seconds for shadowsocks proccess to stop -SHUTDOWN_WAIT=20 - -Shadowsocks_pid(){ - echo `ps -ef | grep $Shadowsocks_bin | grep -v grep | tr -s " "|cut -d" " -f2` -} - -start() { - pid=$(Shadowsocks_pid) - if [ -n "$pid" ]; then - echo -e "\e[00;31mShadowsocks is already running (pid: $pid)\e[00m" - else - $Shadowsocks_bin -c $Shadowsocks_conf -d start - RETVAL=$? - if [ "$RETVAL" = "0" ]; then - echo -e "\e[00;32mStarting Shadowsocks\e[00m" - else - echo -e "\e[00;32mShadowsocks start Failed\e[00m" - fi - status - fi - return 0 -} - -status(){ - pid=$(Shadowsocks_pid) - if [ -n "$pid" ]; then - echo -e "\e[00;32mShadowsocks is running with pid: $pid\e[00m" - else - echo -e "\e[00;31mShadowsocks is not running\e[00m" - fi -} - -stop(){ - pid=$(Shadowsocks_pid) - if [ -n "$pid" ]; then - echo -e "\e[00;31mStoping Shadowsocks\e[00m" - $Shadowsocks_bin -c $Shadowsocks_conf -d stop - let kwait=$SHUTDOWN_WAIT - count=0; - until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ] - do - echo -n -e "\e[00;31mwaiting for processes to exit\e[00m\n"; - sleep 1 - let count=$count+1; - done - - if [ $count -gt $kwait ]; then - echo -n -e "\n\e[00;31mkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\e[00m" - kill -9 $pid - fi - else - echo -e "\e[00;31mShadowsocks is not running\e[00m" - fi - - return 0 -} - -case $1 in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status - ;; - *) - echo -e $Shadowsocks_USAGE - ;; -esac -exit 0 diff --git a/shadowsocks.sh b/shadowsocks.sh deleted file mode 100755 index 272fd5f4..00000000 --- a/shadowsocks.sh +++ /dev/null @@ -1,293 +0,0 @@ -#!/bin/bash -# Author: yeho -# BLOG: https://blog.linuxeye.com -# -# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# Install Shadowsocks Server -# -# Project home page: -# https://oneinstack.com -# https://github.com/lj2007331/oneinstack - -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -clear -printf " -####################################################################### -# OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+ # -# Install Shadowsocks Server # -# For more information please visit https://oneinstack.com # -####################################################################### -" - -pushd src > /dev/null -. ../options.conf -. ../include/color.sh -. ../include/check_os.sh -. ../include/download.sh - -# Check if user is root -[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } - -PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) - -[ "${CentOS_RHEL_version}" == '5' ] && { echo "${CWARNING}Shadowsocks only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } - -Check_shadowsocks() { - [ -f /usr/local/bin/ss-server ] && SS_version=1 - [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ] && SS_version=2 -} - -AddUser_shadowsocks() { - while :; do echo - read -p "Please input password for shadowsocks: " Shadowsocks_password - [ -n "$(echo ${Shadowsocks_password} | grep '[+|&]')" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } - (( ${#Shadowsocks_password} >= 5 )) && break || echo "${CWARNING}Shadowsocks password least 5 characters! ${CEND}" - done -} - -Iptables_set() { - if [ -e '/etc/sysconfig/iptables' ]; then - Shadowsocks_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1) - elif [ -e '/etc/iptables.up.rules' ]; then - Shadowsocks_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1) - fi - - if [ -n "${Shadowsocks_Already_port}" ]; then - let Shadowsocks_Default_port="${Shadowsocks_Already_port}+1" - else - Shadowsocks_Default_port=9001 - fi - - while :; do echo - read -p "Please input Shadowsocks port(Default: ${Shadowsocks_Default_port}): " Shadowsocks_port - [ -z "${Shadowsocks_port}" ] && Shadowsocks_port=${Shadowsocks_Default_port} - if [ ${Shadowsocks_port} -ge 1 >/dev/null 2>&1 -a ${Shadowsocks_port} -le 65535 >/dev/null 2>&1 ]; then - [ -z "$(netstat -tpln | grep :${Shadowsocks_port}$)" ] && break || echo "${CWARNING}This port is already used! ${CEND}" - else - echo "${CWARNING}input error! Input range: 1~65535${CEND}" - fi - done - - if [ "${OS}" == 'CentOS' ]; then - if [ -z "$(grep -E ${Shadowsocks_port} /etc/sysconfig/iptables)" ]; then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${Shadowsocks_port} -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${Shadowsocks_port} -j ACCEPT - service iptables save - fi - elif [[ ${OS} =~ ^Ubuntu$|^Debian$ ]]; then - if [ -z "$(grep -E ${Shadowsocks_port} /etc/iptables.up.rules)" ]; then - iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${Shadowsocks_port} -j ACCEPT - iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${Shadowsocks_port} -j ACCEPT - iptables-save > /etc/iptables.up.rules - fi - else - echo "${CWARNING}This port is already in iptables! ${CEND}" - fi - -} - -Def_parameter() { - if [ "${OS}" == "CentOS" ]; then - while :; do echo - echo "Please select Shadowsocks server version:" - echo -e "\t${CMSG}1${CEND}. Install Shadowsocks-libev" - echo -e "\t${CMSG}2${CEND}. Install Shadowsocks-python" - read -p "Please input a number:(Default 1 press Enter) " SS_version - [ -z "${SS_version}" ] && SS_version=1 - if [[ ! "${SS_version}" =~ ^[1-2]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2${CEND}" - else - break - fi - done - AddUser_shadowsocks - Iptables_set - pkgList="wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto pcre-devel" - for Package in ${pkgList}; do - yum -y install ${Package} - done - elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then - SS_version=2 - AddUser_shadowsocks - Iptables_set - apt-get -y update - pkgList="python-dev python-pip curl wget unzip gcc swig automake make perl cpio git" - for Package in ${pkgList}; do - apt-get -y install $Package - done - fi -} - -Install_shadowsocks-python() { - src_url=http://mirrors.linuxeye.com/oneinstack/src/ez_setup.py && Download_src - - which pip > /dev/null 2>&1 - [ $? -ne 0 ] && [ "${OS}" == "CentOS" ] && { python ez_setup.py install; sleep 1; easy_install pip; } - - if [ -f /usr/bin/pip ]; then - pip install M2Crypto - pip install greenlet - pip install gevent - pip install shadowsocks - if [ -f /usr/bin/ssserver -o -f /usr/local/bin/ssserver ]; then - /bin/cp ../init.d/Shadowsocks-python-init /etc/init.d/shadowsocks - chmod +x /etc/init.d/shadowsocks - [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } - [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults - [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks - else - echo - echo "${CQUESTION}Shadowsocks-python install failed! Please visit https://oneinstack.com${CEND}" - exit 1 - fi - fi -} - -Install_shadowsocks-libev() { - git clone https://github.com/shadowsocks/shadowsocks-libev.git - pushd shadowsocks-libev - ./configure - make -j ${THREAD} && make install - popd - if [ -f /usr/local/bin/ss-server ]; then - /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks - chmod +x /etc/init.d/shadowsocks - [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } - else - echo - echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}" - exit 1 - fi - -} - -Uninstall_shadowsocks(){ - while :; do echo - read -p "Do you want to uninstall Shadowsocks? [y/n]: " Shadowsocks_yn - if [[ ! "${Shadowsocks_yn}" =~ ^[y,n]$ ]]; then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" - else - break - fi - done - - if [ "${Shadowsocks_yn}" == 'y' ]; then - [ -n "$(ps -ef | grep -v grep | grep -iE "ssserver|ss-server")" ] && /etc/init.d/shadowsocks stop - [ "${OS}" == "CentOS" ] && chkconfig --del shadowsocks - [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove - rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks - if [ "${SS_version}" == '1' ]; then - rm -f /usr/local/bin/ss-local - rm -f /usr/local/bin/ss-tunnel - rm -f /usr/local/bin/ss-server - rm -f /usr/local/bin/ss-manager - rm -f /usr/local/bin/ss-redir - rm -f /usr/local/lib/libshadowsocks.a - rm -f /usr/local/lib/libshadowsocks.la - rm -f /usr/local/include/shadowsocks.h - rm -f /usr/local/lib/pkgconfig/shadowsocks-libev.pc - rm -f /usr/local/share/man/man1/ss-local.1 - rm -f /usr/local/share/man/man1/ss-tunnel.1 - rm -f /usr/local/share/man/man1/ss-server.1 - rm -f /usr/local/share/man/man1/ss-manager.1 - rm -f /usr/local/share/man/man1/ss-redir.1 - rm -f /usr/local/share/man/man8/shadowsocks.8 - if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-libev uninstall successful! ${CEND}" - else - echo "${CFAILURE}Shadowsocks-libev uninstall failed! ${CEND}" - fi - elif [ "${SS_version}" == '2' ]; then - pip uninstall -y shadowsocks - if [ $? -eq 0 ]; then - echo "${CSUCCESS}Shadowsocks-python uninstall successful! ${CEND}" - else - echo "${CFAILURE}Shadowsocks-python uninstall failed! ${CEND}" - fi - fi - else - echo "${CMSG}Unknown Shadowsocks version, uninstall failed! ${CEND}" - fi -} - -Config_shadowsocks(){ - [ ! -d "/etc/shadowsocks" ] && mkdir /etc/shadowsocks - [ "${SS_version}" == '1' ] && cat > /etc/shadowsocks/config.json << EOF -{ - "server":"0.0.0.0", - "server_port":${Shadowsocks_port}, - "local_address":"127.0.0.1", - "local_port":1080, - "password":"${Shadowsocks_password}", - "timeout":300, - "method":"aes-256-cfb", -} -EOF - - [ "${SS_version}" == '2' ] && cat > /etc/shadowsocks/config.json << EOF -{ - "server":"0.0.0.0", - "local_address":"127.0.0.1", - "local_port":1080, - "port_password":{ - "${Shadowsocks_port}":"${Shadowsocks_password}" - }, - "timeout":300, - "method":"aes-256-cfb", - "fast_open":false -} -EOF -} - -AddUser_Config_shadowsocks(){ - [ ! -e /etc/shadowsocks/config.json ] && { echo "${CFAILURE}Shadowsocks is not installed! ${CEND}"; exit 1; } - [ -z "$(grep \"${Shadowsocks_port}\" /etc/shadowsocks/config.json)" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"${Shadowsocks_port}\":\"${Shadowsocks_password}\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } -} - -Print_User_shadowsocks(){ - printf " -Your Server IP: ${CMSG}${PUBLIC_IPADDR}${CEND} -Your Server Port: ${CMSG}${Shadowsocks_port}${CEND} -Your Password: ${CMSG}${Shadowsocks_password}${CEND} -Your Local IP: ${CMSG}127.0.0.1${CEND} -Your Local Port: ${CMSG}1080${CEND} -Your Encryption Method: ${CMSG}aes-256-cfb${CEND} -" -} - -case "$1" in -install) - Def_parameter - [ "${SS_version}" == '1' ] && Install_shadowsocks-libev - [ "${SS_version}" == '2' ] && Install_shadowsocks-python - Config_shadowsocks - service shadowsocks start - Print_User_shadowsocks - ;; -adduser) - Check_shadowsocks - if [ "${SS_version}" == '2' ]; then - AddUser_shadowsocks - Iptables_set - AddUser_Config_shadowsocks - service shadowsocks restart - Print_User_shadowsocks - else - printf " - Sorry, we have no plan to support multi port configuration. Actually you can use multiple instances instead. For example: - ss-server -c /etc/shadowsocks/config1.json -f /var/run/shadowsocks-server/pid1 - ss-server -c /etc/shadowsocks/config2.json -f /var/run/shadowsocks-server/pid2 - ss-server -c /etc/shadowsocks/config3.json -f /var/run/shadowsocks-server/pid3 - " - fi - ;; -uninstall) - Check_shadowsocks - Uninstall_shadowsocks - ;; -*) - echo - echo "Usage: ${CMSG}$0${CEND} { ${CMSG}install${CEND} | ${CMSG}adduser${CEND} | ${CMSG}uninstall${CEND} }" - echo - exit 1 -esac diff --git a/ss.sh b/ss.sh new file mode 100755 index 00000000..056c3240 --- /dev/null +++ b/ss.sh @@ -0,0 +1,279 @@ +#!/bin/bash +# Author: yeho +# BLOG: https://blog.linuxeye.com +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# Install SS Server +# +# Project home page: +# https://oneinstack.com +# https://github.com/lj2007331/oneinstack + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +clear +printf " +####################################################################### +# OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+ # +# Install SS Server # +# For more information please visit https://oneinstack.com # +####################################################################### +" + +# get pwd +sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf + +pushd src > /dev/null +. ../options.conf +. ../versions.txt +. ../include/color.sh +. ../include/check_os.sh +. ../include/download.sh +. ../include/python.sh + +# Check if user is root +[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } + +PUBLIC_IPADDR=$(../include/get_public_ipaddr.py) + +[ "${CentOS_RHEL_version}" == '5' ] && { echo "${CWARNING}SS only support CentOS6,7 or Debian or Ubuntu! ${CEND}"; exit 1; } + +Check_SS() { + [ -f /usr/local/bin/ss-server ] && SS_version=1 + [ -f ${python_install_dir}/bin/ssserver ] && SS_version=2 +} + +AddUser_SS() { + while :; do echo + read -p "Please input password for SS: " SS_password + [ -n "$(echo ${SS_password} | grep '[+|&]')" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } + (( ${#SS_password} >= 5 )) && break || echo "${CWARNING}SS password least 5 characters! ${CEND}" + done +} + +Iptables_set() { + if [ -e '/etc/sysconfig/iptables' ]; then + SS_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/sysconfig/iptables | head -n 1) + elif [ -e '/etc/iptables.up.rules' ]; then + SS_Already_port=$(grep -oE '9[0-9][0-9][0-9]' /etc/iptables.up.rules | head -n 1) + fi + + if [ -n "${SS_Already_port}" ]; then + let SS_Default_port="${SS_Already_port}+1" + else + SS_Default_port=9001 + fi + + while :; do echo + read -p "Please input SS port(Default: ${SS_Default_port}): " SS_port + [ -z "${SS_port}" ] && SS_port=${SS_Default_port} + if [ ${SS_port} -ge 1 >/dev/null 2>&1 -a ${SS_port} -le 65535 >/dev/null 2>&1 ]; then + [ -z "$(netstat -tpln | grep :${SS_port}$)" ] && break || echo "${CWARNING}This port is already used! ${CEND}" + else + echo "${CWARNING}input error! Input range: 1~65535${CEND}" + fi + done + + if [ "${OS}" == 'CentOS' ]; then + if [ -z "$(grep -E ${SS_port} /etc/sysconfig/iptables)" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${SS_port} -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${SS_port} -j ACCEPT + service iptables save + fi + elif [[ ${OS} =~ ^Ubuntu$|^Debian$ ]]; then + if [ -z "$(grep -E ${SS_port} /etc/iptables.up.rules)" ]; then + iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${SS_port} -j ACCEPT + iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${SS_port} -j ACCEPT + iptables-save > /etc/iptables.up.rules + fi + else + echo "${CWARNING}This port is already in iptables! ${CEND}" + fi + +} + +Def_parameter() { + if [ "${OS}" == "CentOS" ]; then + while :; do echo + echo "Please select SS server version:" + echo -e "\t${CMSG}1${CEND}. Install SS-libev" + echo -e "\t${CMSG}2${CEND}. Install SS-python" + read -p "Please input a number:(Default 1 press Enter) " SS_version + [ -z "${SS_version}" ] && SS_version=1 + if [[ ! "${SS_version}" =~ ^[1-2]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2${CEND}" + else + break + fi + done + AddUser_SS + Iptables_set + pkgList="wget unzip openssl-devel gcc swig autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto pcre-devel" + for Package in ${pkgList}; do + yum -y install ${Package} + done + elif [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]]; then + SS_version=2 + AddUser_SS + Iptables_set + apt-get -y update + pkgList="curl wget unzip gcc swig automake make perl cpio git" + for Package in ${pkgList}; do + apt-get -y install $Package + done + fi +} + +Install_SS-python() { + [ ! -e "${python_install_dir}/bin/python" ] && Install_Python + ${python_install_dir}/bin/pip install M2Crypto + ${python_install_dir}/bin/pip install greenlet + ${python_install_dir}/bin/pip install gevent + ${python_install_dir}/bin/pip install shadowsocks + if [ -f ${python_install_dir}/bin/ssserver ]; then + /bin/cp ../init.d/SS-python-init /etc/init.d/shadowsocks + chmod +x /etc/init.d/shadowsocks + sed -i "s@SS_bin=.*@SS_bin=${python_install_dir}/bin/ssserver@" /etc/init.d/shadowsocks + [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d shadowsocks defaults + else + echo + echo "${CQUESTION}SS-python install failed! Please visit https://oneinstack.com${CEND}" + exit 1 + fi +} + +Install_SS-libev() { + git clone https://github.com/shadowsocks/shadowsocks-libev.git + pushd shadowsocks-libev + ./configure + make -j ${THREAD} && make install + popd + if [ -f /usr/local/bin/ss-server ]; then + /bin/cp ../init.d/SS-libev-init /etc/init.d/shadowsocks + chmod +x /etc/init.d/shadowsocks + [ "${OS}" == "CentOS" ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } + else + echo + echo "${CQUESTION}SS-libev install failed! Please visit https://oneinstack.com${CEND}" + exit 1 + fi + +} + +Uninstall_SS() { + while :; do echo + read -p "Do you want to uninstall SS? [y/n]: " SS_yn + if [[ ! "${SS_yn}" =~ ^[y,n]$ ]]; then + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + else + break + fi + done + + if [ "${SS_yn}" == 'y' ]; then + [ -n "$(ps -ef | grep -v grep | grep -iE "ssserver|ss-server")" ] && /etc/init.d/shadowsocks stop + [ "${OS}" == "CentOS" ] && chkconfig --del shadowsocks + [[ "${OS}" =~ ^Ubuntu$|^Debian$ ]] && update-rc.d -f shadowsocks remove + rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks + if [ "${SS_version}" == '1' ]; then + rm -f /usr/local/bin/{ss-local,ss-tunnel,ss-server,ss-manager,ss-redir} + rm -f /usr/local/lib/libshadowsocks.* + rm -f /usr/local/include/shadowsocks.h + rm -f /usr/local/lib/pkgconfig/shadowsocks-libev.pc + rm -f /usr/local/share/man/man1/{ss-local.1,ss-tunnel.1,ss-server.1,ss-manager.1,ss-redir.1,shadowsocks.8} + if [ $? -eq 0 ]; then + echo "${CSUCCESS}SS-libev uninstall successful! ${CEND}" + else + echo "${CFAILURE}SS-libev uninstall failed! ${CEND}" + fi + elif [ "${SS_version}" == '2' ]; then + pip uninstall -y shadowsocks + if [ $? -eq 0 ]; then + echo "${CSUCCESS}SS-python uninstall successful! ${CEND}" + else + echo "${CFAILURE}SS-python uninstall failed! ${CEND}" + fi + fi + fi +} + +Config_SS() { + [ ! -d "/etc/shadowsocks" ] && mkdir /etc/shadowsocks + [ "${SS_version}" == '1' ] && cat > /etc/shadowsocks/config.json << EOF +{ + "server":"0.0.0.0", + "server_port":${SS_port}, + "local_address":"127.0.0.1", + "local_port":1080, + "password":"${SS_password}", + "timeout":300, + "method":"aes-256-cfb", +} +EOF + + [ "${SS_version}" == '2' ] && cat > /etc/shadowsocks/config.json << EOF +{ + "server":"0.0.0.0", + "local_address":"127.0.0.1", + "local_port":1080, + "port_password":{ + "${SS_port}":"${SS_password}" + }, + "timeout":300, + "method":"aes-256-cfb", + "fast_open":false +} +EOF +} + +AddUser_Config_SS() { + [ ! -e /etc/shadowsocks/config.json ] && { echo "${CFAILURE}SS is not installed! ${CEND}"; exit 1; } + [ -z "$(grep \"${SS_port}\" /etc/shadowsocks/config.json)" ] && sed -i "s@\"port_password\":{@\"port_password\":{\n\t\"${SS_port}\":\"${SS_password}\",@" /etc/shadowsocks/config.json || { echo "${CWARNING}This port is already in /etc/shadowsocks/config.json${CEND}"; exit 1; } +} + +Print_User_SS() { + printf " +Your Server IP: ${CMSG}${PUBLIC_IPADDR}${CEND} +Your Server Port: ${CMSG}${SS_port}${CEND} +Your Password: ${CMSG}${SS_password}${CEND} +Your Local IP: ${CMSG}127.0.0.1${CEND} +Your Local Port: ${CMSG}1080${CEND} +Your Encryption Method: ${CMSG}aes-256-cfb${CEND} +" +} + +case "$1" in +install) + Def_parameter + [ "${SS_version}" == '1' ] && Install_SS-libev + [ "${SS_version}" == '2' ] && Install_SS-python + Config_SS + service shadowsocks start + Print_User_SS + ;; +adduser) + Check_SS + if [ "${SS_version}" == '2' ]; then + AddUser_SS + Iptables_set + AddUser_Config_SS + service shadowsocks restart + Print_User_SS + else + printf " + Sorry, we have no plan to support multi port configuration. Actually you can use multiple instances instead. For example: + ss-server -c /etc/shadowsocks/config1.json -f /var/run/shadowsocks-server/pid1 + ss-server -c /etc/shadowsocks/config2.json -f /var/run/shadowsocks-server/pid2 + " + fi + ;; +uninstall) + Check_SS + Uninstall_SS + ;; +*) + echo + echo "Usage: ${CMSG}$0${CEND} { ${CMSG}install${CEND} | ${CMSG}adduser${CEND} | ${CMSG}uninstall${CEND} }" + echo + exit 1 +esac diff --git a/versions.txt b/versions.txt index a46fdac9..bbdc964a 100644 --- a/versions.txt +++ b/versions.txt @@ -70,7 +70,7 @@ redis_pecl_for_php7_version=3.1.1 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.34 +memcached_version=1.4.35 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcache_pecl_version=3.0.8 From 81c8ec4175cd9c6ba98ce004d93ffc529a442af5 Mon Sep 17 00:00:00 2001 From: "lj2007331@gmail.com" Date: Thu, 9 Mar 2017 20:32:11 +0800 Subject: [PATCH 614/617] Fix percona install --- include/check_download.sh | 8 ++++---- include/mariadb-10.0.sh | 1 + include/mariadb-10.1.sh | 1 + include/mariadb-5.5.sh | 1 + include/memcached.sh | 10 ++++------ include/percona-5.5.sh | 1 + include/percona-5.6.sh | 1 + include/percona-5.7.sh | 1 + install.sh | 5 ++++- versions.txt | 7 ++++--- 10 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/check_download.sh b/include/check_download.sh index 819b04a9..8940e4df 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -679,13 +679,13 @@ checkDownload() { echo "Download pecl memcache for php 7.x..." # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src - echo "Download php-memcached for php 7.x..." - src_url=${mirrorLink}/php-memcached-php7.tgz && Download_src + echo "Download pecl memcached for php 7.x..." + src_url=https://pecl.php.net/get/memcached-${memcached_pecl_php7_version}.tgz && Download_src else echo "Download pecl memcache for php..." src_url=http://pecl.php.net/get/memcache-${memcache_pecl_version}.tgz && Download_src - echo "Download php-memcached for php..." - src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src + echo "Download pecl memcached for php..." + src_url=http://pecl.php.net/get/memcached-${memcached_pecl_version}.tgz && Download_src fi echo "Download libmemcached..." diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index cfb11af2..3ebf8cfe 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -21,6 +21,7 @@ Install_MariaDB100() { tar zxf mariadb-${mariadb100_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb100_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb100_version}.tar.gz pushd mariadb-${mariadb100_version} diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 6ed420cc..07db957d 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -21,6 +21,7 @@ Install_MariaDB101() { tar zxf mariadb-${mariadb101_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb101_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb101_version}.tar.gz pushd mariadb-${mariadb101_version} diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index a30cc1d7..9ccace2a 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -21,6 +21,7 @@ Install_MariaDB55() { tar zxf mariadb-${mariadb55_version}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz mv mariadb-${mariadb55_version}-*-${SYS_BIT_b}/* ${mariadb_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf mariadb-${mariadb55_version}.tar.gz pushd mariadb-${mariadb55_version} diff --git a/include/memcached.sh b/include/memcached.sh index 0959e6a8..2fb13c9f 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -85,10 +85,8 @@ Install_php-memcached() { rm -rf libmemcached-${libmemcached_version} if [ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}')" == '7' ]; then - #git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git - #cd php-memcached - tar xzf php-memcached-php7.tgz - pushd php-memcached-php7 + tar xzf memcached-${memcached_pecl_php7_version}.tgz + pushd memcached-${memcached_pecl_php7_version} else tar xzf memcached-${memcached_pecl_version}.tgz pushd memcached-${memcached_pecl_version} @@ -98,12 +96,12 @@ Install_php-memcached() { make -j ${THREAD} && make install popd if [ -f "${phpExtensionDir}/memcached.so" ]; then - cat > ${php_install_dir}/etc/php.d/ext-memcached.ini << EOF + cat > ${php_install_dir}/etc/php.d/ext-memcached.ini << EOF extension=memcached.so memcached.use_sasl=1 EOF echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}" - rm -rf php-memcached-php7 memcached-${memcached_pecl_version} + rm -rf memcached-${memcached_pecl_version} memcached-${memcached_pecl_php7_version} else echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" fi diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 67dea18e..493e8eda 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -22,6 +22,7 @@ Install_Percona55() { tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${percona56_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona55_version}.tar.gz pushd percona-server-${percona55_version} diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 350fd8ab..6424d331 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -22,6 +22,7 @@ Install_Percona56() { tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${percona56_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona56_version}.tar.gz pushd percona-server-${percona56_version} diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index 0ca7af39..ffdfd37c 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -21,6 +21,7 @@ Install_Percona57() { tar xvf Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${percona57_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona57_version}.tar.gz pushd percona-server-${percona57_version} diff --git a/install.sh b/install.sh index 241abbd0..6d4857c5 100755 --- a/install.sh +++ b/install.sh @@ -464,6 +464,7 @@ case "${OS}" in esac # init +startTime=`date +%s` . ./include/memory.sh case "${OS}" in "CentOS") @@ -734,8 +735,10 @@ fi # Starting DB [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk} [ -d "${db_install_dir}/support-files" -a -z "$(ps -ef | grep -v grep | grep mysql)" ] && /etc/init.d/mysqld start - +endTime=`date +%s` +((installTime=($endTime-$startTime)/60)) echo "####################Congratulations########################" +echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes" [ "${Web_yn}" == 'y' -a "${Nginx_version}" != '4' -a "${Apache_version}" == '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}" [ "${Web_yn}" == 'y' -a "${Nginx_version}" != '4' -a "${Apache_version}" != '3' ] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}" [ "${Web_yn}" == 'y' -a "${Nginx_version}" == '4' -a "${Apache_version}" != '3' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}" diff --git a/versions.txt b/versions.txt index bbdc964a..d677268b 100644 --- a/versions.txt +++ b/versions.txt @@ -22,7 +22,7 @@ mysql56_version=5.6.35 mysql55_version=5.5.54 mariadb101_version=10.1.21 -mariadb100_version=10.0.29 +mariadb100_version=10.0.30 mariadb55_version=5.5.54 percona57_version=5.7.17-11 @@ -48,7 +48,7 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.8 -ImageMagick_version=6.9.7-9 +ImageMagick_version=6.9.7-10 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 @@ -73,13 +73,14 @@ redis_pecl_version=2.2.8 memcached_version=1.4.35 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 +memcached_pecl_php7_version=3.0.3 memcache_pecl_version=3.0.8 # phpMyadmin phpMyAdmin_version=4.4.15.10 # jemalloc -jemalloc_version=4.4.0 +jemalloc_version=4.5.0 # boost boost_version=1.59.0 From 855a4f958993c86f2000fb83cedea11aa9f396dc Mon Sep 17 00:00:00 2001 From: "lj2007331@gmail.com" Date: Mon, 20 Mar 2017 11:43:54 +0800 Subject: [PATCH 615/617] Fix SS --- include/alisql-5.6.sh | 22 +++++++++++----------- include/check_download.sh | 6 +++--- include/percona-5.5.sh | 2 +- init.d/Redis-server-init | 14 +++++++++++++- install.sh | 2 +- ss.sh | 17 ++++++++++++----- versions.txt | 16 ++++++++-------- 7 files changed, 49 insertions(+), 30 deletions(-) diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh index 25c67660..87269097 100644 --- a/include/alisql-5.6.sh +++ b/include/alisql-5.6.sh @@ -20,24 +20,24 @@ Install_AliSQL56() { tar xvf alisql-${alisql56_version}.tar.gz pushd alisql-${alisql56_version} cmake . -DCMAKE_INSTALL_PREFIX=${alisql_install_dir} \ - -DMYSQL_DATADIR=${alisql_data_dir} \ - -DSYSCONFDIR=/etc \ + -DCMAKE_BUILD_TYPE="Release" \ + -DWITH_EMBEDDED_SERVER=0 \ + -DWITH_EXTRA_CHARSETS=all \ + -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ - -DWITH_FEDERATED_STORAGE_ENGINE=1 \ + -DWITH_CSV_STORAGE_ENGINE=1 \ + -DWITH_ARCHIVE_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 + -DWITH_FEDERATED_STORAGE_ENGINE=1 \ + -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ + -DWITH_TOKUDB_STORAGE_ENGINE=1 make -j ${THREAD} make install popd if [ -d "${alisql_install_dir}/support-files" ]; then + echo never > /sys/kernel/mm/transparent_hugepage/enabled echo "${CSUCCESS}AliSQL installed successfully! ${CEND}" rm -rf alisql-${alisql56_version} else @@ -46,8 +46,8 @@ Install_AliSQL56() { 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 + [ -z "`grep transparent_hugepage /etc/init.d/mysqld`" ] && sed -i "s@^basedir=.*@echo never > /sys/kernel/mm/transparent_hugepage/enabled\n&@" /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 diff --git a/include/check_download.sh b/include/check_download.sh index 8940e4df..d227ae1a 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -110,7 +110,7 @@ checkDownload() { if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.7 + DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7 DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} fi else @@ -157,7 +157,7 @@ checkDownload() { if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.6 + DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6 DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} fi else @@ -202,7 +202,7 @@ checkDownload() { if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 else - DOWN_ADDR_MYSQL=http://mirrors.sohu.com/mysql/MySQL-5.5 + DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.5 DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} fi else diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 493e8eda..a23c8b26 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -22,7 +22,7 @@ Install_Percona55() { tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - sed -i "s@/usr/local/Percona-Server-${percona56_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${percona55_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona55_version}.tar.gz pushd percona-server-${percona55_version} diff --git a/init.d/Redis-server-init b/init.d/Redis-server-init index c1e2cea8..9b3fbcac 100755 --- a/init.d/Redis-server-init +++ b/init.d/Redis-server-init @@ -45,13 +45,25 @@ case "$1" in fi rm -f $PIDFILE ;; + status) + if [ ! -r $PIDFILE ] ; then + echo "redis-server is stopped" + exit 0 + fi + PID=`cat $PIDFILE` + if ps -p $PID | grep -q $PID; then + echo "redis-server (pid $PID) is running..." + else + echo "redis-server dead but pid file exists" + fi + ;; restart|force-reload) ${0} stop ${0} start ;; *) - echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 + echo "Usage: /etc/init.d/$NAME {start|stop|restart|status|force-reload}" >&2 exit 1 ;; esac diff --git a/install.sh b/install.sh index 6d4857c5..95344309 100755 --- a/install.sh +++ b/install.sh @@ -488,7 +488,7 @@ checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log # Jemalloc -if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' -a "$DB_version" != '10' ]; then +if [[ $Nginx_version =~ ^[1-3]$ ]] || [ "$DB_yn" == 'y' ]; then . include/jemalloc.sh Install_Jemalloc | tee -a $oneinstack_dir/install.log fi diff --git a/ss.sh b/ss.sh index 056c3240..46306b38 100755 --- a/ss.sh +++ b/ss.sh @@ -107,7 +107,7 @@ Def_parameter() { done AddUser_SS Iptables_set - pkgList="wget unzip openssl-devel gcc swig autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto pcre-devel" + pkgList="wget unzip openssl-devel gcc swig autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel git asciidoc xmlto pcre-devel mbedtls-devel udns-devel libev-devel" for Package in ${pkgList}; do yum -y install ${Package} done @@ -116,7 +116,7 @@ Def_parameter() { AddUser_SS Iptables_set apt-get -y update - pkgList="curl wget unzip gcc swig automake make perl cpio git" + pkgList="curl wget unzip gcc swig automake make perl cpio git libmbedtls-dev libudns-dev libev-dev" for Package in ${pkgList}; do apt-get -y install $Package done @@ -143,8 +143,15 @@ Install_SS-python() { } Install_SS-libev() { - git clone https://github.com/shadowsocks/shadowsocks-libev.git - pushd shadowsocks-libev + src_url=http://mirrors.linuxeye.com/oneinstack/src/shadowsocks-libev-3.0.4.tar.gz && Download_src + src_url=http://mirrors.linuxeye.com/oneinstack/src/libsodium-1.0.12.tar.gz && Download_src + tar xzf shadowsocks-libev-3.0.4.tar.gz + tar xzf libsodium-1.0.12.tar.gz + pushd libsodium-1.0.12 + ./configure + make -j ${THREAD} && make install + popd + pushd shadowsocks-libev-3.0.4 ./configure make -j ${THREAD} && make install popd @@ -187,7 +194,7 @@ Uninstall_SS() { echo "${CFAILURE}SS-libev uninstall failed! ${CEND}" fi elif [ "${SS_version}" == '2' ]; then - pip uninstall -y shadowsocks + ${python_install_dir}/bin/pip uninstall -y shadowsocks if [ $? -eq 0 ]; then echo "${CSUCCESS}SS-python uninstall successful! ${CEND}" else diff --git a/versions.txt b/versions.txt index d677268b..c4d2e399 100644 --- a/versions.txt +++ b/versions.txt @@ -5,9 +5,9 @@ tengine_version=2.1.2 openresty_version=1.11.2.2 openssl_version=1.0.2k -tomcat8_version=8.0.41 -tomcat7_version=7.0.75 -tomcat6_version=6.0.48 +tomcat8_version=8.0.42 +tomcat7_version=7.0.76 +tomcat6_version=6.0.51 apache24_version=2.4.25 apache22_version=2.2.32 @@ -21,7 +21,7 @@ mysql57_version=5.7.17 mysql56_version=5.6.35 mysql55_version=5.5.54 -mariadb101_version=10.1.21 +mariadb101_version=10.1.22 mariadb100_version=10.0.30 mariadb55_version=5.5.54 @@ -37,8 +37,8 @@ jdk17_version=1.7.0_80 jdk16_version=1.6.0_45 # PHP -php71_version=7.1.2 -php70_version=7.0.16 +php71_version=7.1.3 +php70_version=7.0.17 php56_version=5.6.30 php55_version=5.5.38 php54_version=5.4.45 @@ -48,14 +48,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.8 -ImageMagick_version=6.9.7-10 +ImageMagick_version=6.9.8-2 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.14 -curl_version=7.52.1 +curl_version=7.53.1 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 From 4ef4ae60fd72ef71669bbb9dcf9af6e7ecd39b26 Mon Sep 17 00:00:00 2001 From: "lj2007331@gmail.com" Date: Sun, 9 Apr 2017 09:49:38 +0800 Subject: [PATCH 616/617] Add Qcloud COS backup --- addons.sh | 7 +- backup.sh | 58 +- backup_setup.sh | 90 ++- config/discuz.conf | 2 +- config/drupal.conf | 4 +- config/ecshop.conf | 61 +- config/joomla.conf | 2 +- config/laravel.conf | 2 +- config/opencart.conf | 21 +- config/thinkphp.conf | 8 +- config/typecho.conf | 12 +- config/wordpress.conf | 4 +- include/alisql-5.6.sh | 2 +- include/check_sw.sh | 6 +- include/get_char.sh | 14 +- include/openssl.sh | 2 + include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- init.d/Nginx-init-CentOS | 43 +- init.d/Nginx-init-Ubuntu | 340 ++--------- install.sh | 4 + reset_db_root_password.sh | 3 - tools/cos/__init__.py | 10 + tools/cos/qcloud_cos/__init__.py | 31 + tools/cos/qcloud_cos/cos_auth.py | 70 +++ tools/cos/qcloud_cos/cos_client.py | 176 ++++++ tools/cos/qcloud_cos/cos_common.py | 225 ++++++++ tools/cos/qcloud_cos/cos_config.py | 125 ++++ tools/cos/qcloud_cos/cos_cred.py | 36 ++ tools/cos/qcloud_cos/cos_err.py | 14 + tools/cos/qcloud_cos/cos_op.py | 703 +++++++++++++++++++++++ tools/cos/qcloud_cos/cos_params_check.py | 225 ++++++++ tools/cos/qcloud_cos/cos_request.py | 626 ++++++++++++++++++++ tools/cos/threadpool.py | 423 ++++++++++++++ tools/coscmd | 501 ++++++++++++++++ versions.txt | 24 +- vhost.sh | 4 +- 37 files changed, 3436 insertions(+), 446 deletions(-) create mode 100644 tools/cos/__init__.py create mode 100644 tools/cos/qcloud_cos/__init__.py create mode 100644 tools/cos/qcloud_cos/cos_auth.py create mode 100644 tools/cos/qcloud_cos/cos_client.py create mode 100644 tools/cos/qcloud_cos/cos_common.py create mode 100644 tools/cos/qcloud_cos/cos_config.py create mode 100644 tools/cos/qcloud_cos/cos_cred.py create mode 100644 tools/cos/qcloud_cos/cos_err.py create mode 100644 tools/cos/qcloud_cos/cos_op.py create mode 100644 tools/cos/qcloud_cos/cos_params_check.py create mode 100644 tools/cos/qcloud_cos/cos_request.py create mode 100644 tools/cos/threadpool.py create mode 100755 tools/coscmd diff --git a/addons.sh b/addons.sh index 33a055ac..7083150e 100755 --- a/addons.sh +++ b/addons.sh @@ -18,6 +18,9 @@ printf " ####################################################################### " +# Check if user is root +[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } + # get pwd sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf @@ -47,9 +50,6 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf . ./include/python.sh -# Check if user is root -[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } - # Check PHP if [ -e "${php_install_dir}/bin/phpize" ]; then phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) @@ -162,6 +162,7 @@ EOF endscript } EOF + sed -i 's@^iptables = iptables.*@iptables = iptables@' /etc/fail2ban/action.d/iptables-common.conf kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` > /dev/null 2>&1 /etc/init.d/fail2ban start popd diff --git a/backup.sh b/backup.sh index ba5f34a9..30b65a59 100755 --- a/backup.sh +++ b/backup.sh @@ -8,6 +8,9 @@ # https://oneinstack.com # https://github.com/lj2007331/oneinstack +# Check if user is root +[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } + pushd tools > /dev/null . ../options.conf @@ -29,6 +32,17 @@ DB_Remote_BK() { done } +DB_COS_BK() { + for D in `echo $db_name | tr ',' ' '` + do + ./db_bk.sh $D + DB_GREP="DB_${D}_`date +%Y`" + DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'` + ${python_install_dir}/bin/python ./coscmd put $backup_dir/$DB_FILE /`date +%F`/$DB_FILE + [ $? -eq 0 ] && ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1 + done +} + WEB_Local_BK() { for W in `echo $website_name | tr ',' ' '` do @@ -39,7 +53,7 @@ WEB_Local_BK() { WEB_Remote_BK() { for W in `echo $website_name | tr ',' ' '` do - if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then + if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ];then ./website_bk.sh $W Web_GREP="Web_${W}_`date +%Y`" Web_FILE=`ls -lrt $backup_dir | grep ${Web_GREP} | tail -1 | awk '{print $NF}'` @@ -51,19 +65,53 @@ WEB_Remote_BK() { done } -if [ "$backup_destination" == 'local' ]; then +WEB_COS_BK() { + for W in `echo $website_name | tr ',' ' '` + do + [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist"; break; } + Web_FILE="Web_${W}_$(date +%Y%m%d_%H).tgz" + if [ ! -e "$backup_dir/$Web_FILE" ];then + pushd $wwwroot_dir + tar czf $Web_FILE ./$W + popd + PUSH_FILE="$wwwroot_dir/$Web_FILE" + else + PUSH_FILE="$backup_dir/$Web_FILE" + fi + + ${python_install_dir}/bin/python ./coscmd put $PUSH_FILE /`date +%F`/$Web_FILE + [ $? -eq 0 ] && { [ -e "$wwwroot_dir/$Web_FILE" ] && rm -rf $wwwroot_dir/$Web_FILE; ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1; } + done +} + +if [ "$backup_destination" == 'local' ];then [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK -elif [ "$backup_destination" == 'remote' ]; then +elif [ "$backup_destination" == 'remote' ];then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log -elif [ "$backup_destination" == 'local,remote' ]; then +elif [ "$backup_destination" == 'cos' ];then + [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK +elif [ "$backup_destination" == 'local,remote' ];then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK - ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log + ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log +elif [ "$backup_destination" == 'local,cos' ];then + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK + [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK +elif [ "$backup_destination" == 'remote,cos' ];then + echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt + [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK + [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK + [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK + ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log fi diff --git a/backup_setup.sh b/backup_setup.sh index 25df68c6..c3ff061d 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -21,6 +21,7 @@ printf " . ./options.conf . ./include/color.sh . ./include/check_dir.sh +. ./include/python.sh # Check if user is root [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } @@ -29,11 +30,14 @@ while :; do echo echo 'Please select your backup destination:' echo -e "\t${CMSG}1${CEND}. Only Localhost" echo -e "\t${CMSG}2${CEND}. Only Remote host" - echo -e "\t${CMSG}3${CEND}. Localhost and Remote host" + echo -e "\t${CMSG}3${CEND}. Only Qcloud COS" + echo -e "\t${CMSG}4${CEND}. Localhost and Remote host" + echo -e "\t${CMSG}5${CEND}. Localhost and Qcloud COS" + echo -e "\t${CMSG}6${CEND}. Remote host and Qcloud COS" read -p "Please input a number:(Default 1 press Enter) " DESC_BK [ -z "$DESC_BK" ] && DESC_BK=1 - if [[ ! $DESC_BK =~ ^[1-3]$ ]]; then - echo "${CWARNING}input error! Please only input number 1,2,3${CEND}" + if [[ ! $DESC_BK =~ ^[1-6]$ ]]; then + echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6${CEND}" else break fi @@ -41,7 +45,10 @@ done [ "$DESC_BK" == '1' ] && sed -i 's@^backup_destination=.*@backup_destination=local@' ./options.conf [ "$DESC_BK" == '2' ] && sed -i 's@^backup_destination=.*@backup_destination=remote@' ./options.conf -[ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf +[ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=cos@' ./options.conf +[ "$DESC_BK" == '4' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf +[ "$DESC_BK" == '5' ] && sed -i 's@^backup_destination=.*@backup_destination=local,cos@' ./options.conf +[ "$DESC_BK" == '6' ] && sed -i 's@^backup_destination=.*@backup_destination=Remote,cos@' ./options.conf while :; do echo echo 'Please select your backup content:' @@ -61,17 +68,19 @@ done [ "$CONTENT_BK" == '2' ] && sed -i 's@^backup_content=.*@backup_content=web@' ./options.conf [ "$CONTENT_BK" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf -while :; do echo - echo "Please enter the directory for save the backup file: " - read -p "(Default directory: $backup_dir): " NEW_backup_dir - [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" - if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then - echo "${CWARNING}input error! ${CEND}" - else - break - fi -done -sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf +if [ "$DESC_BK" != '3' ]; then + while :; do echo + echo "Please enter the directory for save the backup file: " + read -p "(Default directory: $backup_dir): " NEW_backup_dir + [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir" + if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then + echo "${CWARNING}input error! ${CEND}" + else + break + fi + done + sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf +fi while :; do echo echo "Pleas enter a valid backup number of days: " @@ -98,11 +107,11 @@ if [ "$CONTENT_BK" != '2' ]; then sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf fi -if [ "$CONTENT_BK" != '1' ]; then +if [ "$CONTENT_BK" != '1' ];then websites=`ls $wwwroot_dir | grep -vw default` while :; do echo echo "Please enter one or more name for website, separate multiple website names with commas: " - read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name + read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name website_name=`echo $website_name | tr -d ' '` [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`" W_tmp=0 @@ -120,7 +129,7 @@ echo "You have to backup the content:" [ "$CONTENT_BK" != '2' ] && echo "Database: ${CMSG}$db_name${CEND}" [ "$CONTENT_BK" != '1' ] && echo "Website: ${CMSG}$website_name${CEND}" -if [[ "$DESC_BK" =~ ^[2,3]$ ]]; then +if [[ "$DESC_BK" =~ ^[2,4,6]$ ]]; then > tools/iplist.txt while :; do echo read -p "Please enter the remote host ip: " remote_ip @@ -142,7 +151,7 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]]; then [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}" while :; do read -p "Do you want to add more host ? [y/n]: " more_host_yn - if [[ ! "$more_host_yn" =~ ^[y,n]$ ]]; then + if [ "$more_host_yn" != 'y' -a "$more_host_yn" != 'n' ]; then echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else break @@ -152,3 +161,46 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]]; then fi done fi + +if [[ "$DESC_BK" =~ ^[3,5,6]$ ]]; then + [ ! -e "${python_install_dir}/bin/python" ] && Install_Python + [ ! -e "${python_install_dir}/lib/python2.7/site-packages/requests" ] && ${python_install_dir}/bin/pip install requests + while :; do echo + echo 'Please select your backup datacenter:' + echo -e "\t ${CMSG}1${CEND}. 华南(广州) ${CMSG}2${CEND}. 华北(天津)" + echo -e "\t ${CMSG}3${CEND}. 华东(上海) ${CMSG}4${CEND}. 新加坡" + read -p "Please input a number:(Default 1 press Enter) " Location + [ -z "$Location" ] && Location=1 + if [ ${Location} -ge 1 >/dev/null 2>&1 -a ${Location} -le 4 >/dev/null 2>&1 ]; then + break + else + echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}" + fi + done + [ "$Location" == '1' ] && region=gz + [ "$Location" == '2' ] && region=tj + [ "$Location" == '3' ] && region=sh + [ "$Location" == '4' ] && region=sgp + while :; do echo + read -p "Please enter the Qcloud COS appid: " appid + [ -z "$appid" ] && continue + echo + read -p "Please enter the Qcloud COS secret id: " secret_id + [ -z "$secret_id" ] && continue + echo + read -p "Please enter the Qcloud COS secret key: " secret_key + [ -z "$secret_key" ] && continue + echo + read -p "Please enter the Qcloud COS bucket: " bucket + [ -z "$bucket" ] && continue + echo + $python_install_dir/bin/python ./tools/coscmd config --appid=$appid --id=$secret_id --key=$secret_key --region=$region --bucket=$bucket >/dev/null 2>&1 + if [ "`$python_install_dir/bin/python ./tools/coscmd ls /`" == 'True' ];then + echo "${CMSG}appid/secret_id/secret_key/region/bucket OK${CEND}" + echo + break + else + echo "${CWARNING}input error! appid/secret_id/secret_key/region/bucket invalid${CEND}" + fi + done +fi diff --git a/config/discuz.conf b/config/discuz.conf index b2e7a19e..d3166e9c 100644 --- a/config/discuz.conf +++ b/config/discuz.conf @@ -8,5 +8,5 @@ rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do= rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last; rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last; #if (!-e $request_filename) { -# return 404; +# return 404; #} diff --git a/config/drupal.conf b/config/drupal.conf index 9cdde155..0bba6612 100644 --- a/config/drupal.conf +++ b/config/drupal.conf @@ -1,3 +1,3 @@ if (!-e $request_filename) { - rewrite ^/(.*)$ /index.php?q=$1 last; - } + rewrite ^/(.*)$ /index.php?q=$1 last; +} diff --git a/config/ecshop.conf b/config/ecshop.conf index e11a7cdb..25bc858d 100644 --- a/config/ecshop.conf +++ b/config/ecshop.conf @@ -1,32 +1,31 @@ -if (!-e $request_filename) -{ - rewrite "^/index\.html" /index.php last; - rewrite "^/category$" /index.php last; - rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last; - rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last; - rewrite "^/feed\.xml$" /feed.php last; - rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last; - rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last; - rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last; - rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last; - rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last; - rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last; - rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last; - rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last; - rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last; - rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last; - rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last; - rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last; - rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last; - rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last; - rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last; - rewrite "^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last; - rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last; - rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last; +if (!-e $request_filename) { + rewrite "^/index\.html" /index.php last; + rewrite "^/category$" /index.php last; + rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last; + rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last; + rewrite "^/feed\.xml$" /feed.php last; + rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last; + rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last; + rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last; + rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last; + rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last; + rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last; + rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last; + rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last; + rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last; + rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last; + rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last; + rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last; + rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last; + rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last; + rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last; + rewrite "^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last; + rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last; + rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last; } diff --git a/config/joomla.conf b/config/joomla.conf index 202785b4..2af92c0c 100644 --- a/config/joomla.conf +++ b/config/joomla.conf @@ -1,3 +1,3 @@ location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php?$args; } diff --git a/config/laravel.conf b/config/laravel.conf index d5b60a69..4b488fdc 100644 --- a/config/laravel.conf +++ b/config/laravel.conf @@ -1,3 +1,3 @@ location / { - try_files $uri $uri/ /index.php?$query_string; + try_files $uri $uri/ /index.php?$query_string; } diff --git a/config/opencart.conf b/config/opencart.conf index 855b4042..d52b2198 100644 --- a/config/opencart.conf +++ b/config/opencart.conf @@ -1,16 +1,13 @@ location = /sitemap.xml { - rewrite ^(.*)$ /index.php?route=feed/google_sitemap break; - } - + rewrite ^(.*)$ /index.php?route=feed/google_sitemap break; +} location = /googlebase.xml { - rewrite ^(.*)$ /index.php?route=feed/google_base break; - } - + rewrite ^(.*)$ /index.php?route=feed/google_base break; +} location / { - # This try_files directive is used to enable SEO-friendly URLs for OpenCart - try_files $uri $uri/ @opencart; - } - + # This try_files directive is used to enable SEO-friendly URLs for OpenCart + try_files $uri $uri/ @opencart; +} location @opencart { - rewrite ^/(.+)$ /index.php?_route_=$1 last; - } + rewrite ^/(.+)$ /index.php?_route_=$1 last; +} diff --git a/config/thinkphp.conf b/config/thinkphp.conf index 47b8f283..47d387e5 100644 --- a/config/thinkphp.conf +++ b/config/thinkphp.conf @@ -1,6 +1,6 @@ location / { - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?s=$1 last; - break; - } + if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?s=$1 last; + break; + } } diff --git a/config/typecho.conf b/config/typecho.conf index 979fec9f..7d1ab8c0 100644 --- a/config/typecho.conf +++ b/config/typecho.conf @@ -1,9 +1,3 @@ -if (-f $request_filename/index.html){ - rewrite (.*) $1/index.html break; - } -if (-f $request_filename/index.php){ - rewrite (.*) $1/index.php; - } -if (!-e $request_filename){ - rewrite (.*) /index.php; - } +if (!-e $request_filename) { + rewrite ^(.*)$ /index.php$1 last; +} diff --git a/config/wordpress.conf b/config/wordpress.conf index 3986b5a5..4845bc8e 100644 --- a/config/wordpress.conf +++ b/config/wordpress.conf @@ -1,4 +1,4 @@ location / { - try_files $uri $uri/ /index.php?$args; - } + try_files $uri $uri/ /index.php?$args; +} rewrite /wp-admin$ $scheme://$host$uri/ permanent; diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh index 87269097..17ba3c67 100644 --- a/include/alisql-5.6.sh +++ b/include/alisql-5.6.sh @@ -31,7 +31,7 @@ Install_AliSQL56() { -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ - -DWITH_TOKUDB_STORAGE_ENGINE=1 + -DWITH_TOKUDB_STORAGE_ENGINE=0 make -j ${THREAD} make install popd diff --git a/include/check_sw.sh b/include/check_sw.sh index cb1eec60..08ca0b25 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -26,10 +26,10 @@ installDepsDebian() { # Install needed packages case "${Debian_version}" in [6,7]) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc" ;; 8) - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc" ;; *) echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}" @@ -95,7 +95,7 @@ installDepsUbuntu() { apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list # Install needed packages - pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect iptables rsyslog rsync git lsof lrzsz ntpdate wget" + pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect iptables rsyslog rsync git lsof lrzsz ntpdate wget sysv-rc" for Package in ${pkgList}; do apt-get -y install ${Package} --force-yes done diff --git a/include/get_char.sh b/include/get_char.sh index 49d28996..229059de 100644 --- a/include/get_char.sh +++ b/include/get_char.sh @@ -9,11 +9,11 @@ # https://github.com/lj2007331/oneinstack get_char() { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY + SAVEDSTTY=`stty -g` + stty -echo + stty cbreak + dd if=/dev/tty bs=1 count=1 2> /dev/null + stty -raw + stty echo + stty $SAVEDSTTY } diff --git a/include/openssl.sh b/include/openssl.sh index 5d9666e3..f5eed84a 100644 --- a/include/openssl.sh +++ b/include/openssl.sh @@ -14,6 +14,7 @@ Install_openSSL102() { pushd ${oneinstack_dir}/src tar xzf openssl-${openssl_version}.tar.gz pushd openssl-${openssl_version} + make clean ./config --prefix=${openssl_install_dir} -fPIC shared zlib-dynamic make -j ${THREAD} && make install popd @@ -33,6 +34,7 @@ Install_openSSL100() { pushd ${oneinstack_dir}/src tar xzf openssl-1.0.0s.tar.gz pushd openssl-1.0.0s + make clean ./config --prefix=/usr/local/openssl100s -fPIC shared zlib-dynamic make -j ${THREAD} && make install popd diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index a23c8b26..986032f9 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -22,7 +22,7 @@ Install_Percona55() { tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - sed -i "s@/usr/local/Percona-Server-${percona55_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona55_version}.tar.gz pushd percona-server-${percona55_version} diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index 6424d331..d387ee53 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -22,7 +22,7 @@ Install_Percona56() { tar xvf Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}.tar.gz mv Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}/* ${percona_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe - sed -i "s@/usr/local/Percona-Server-${percona56_version}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe + sed -i "s@/usr/local/Percona-Server-${perconaVerStr1}-Linux.${SYS_BIT_b}.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then tar xvf percona-server-${percona56_version}.tar.gz pushd percona-server-${percona56_version} diff --git a/init.d/Nginx-init-CentOS b/init.d/Nginx-init-CentOS index 5d61cb4c..1ed372fc 100755 --- a/init.d/Nginx-init-CentOS +++ b/init.d/Nginx-init-CentOS @@ -1,12 +1,13 @@ -#!/bin/sh +#!/bin/bash # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 -# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# description: NGINX is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx -# config: /usr/local/nginx/conf/nginx.conf +# config: /etc/nginx/nginx.conf +# config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. @@ -29,20 +30,22 @@ lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories - user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` - if [ -z "`grep $user /etc/passwd`" ]; then - useradd -M -s /bin/nologin $user - fi - options=`$nginx -V 2>&1 | grep 'configure arguments:'` - for opt in $options; do - if [ `echo $opt | grep '.*-temp-path'` ]; then - value=`echo $opt | cut -d "=" -f 2` - if [ ! -d "$value" ]; then - # echo "creating" $value - mkdir -p $value && chown -R $user $value - fi + user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` + if [ -n "$user" ]; then + if [ -z "`grep $user /etc/passwd`" ]; then + useradd -M -s /bin/nologin $user fi - done + options=`$nginx -V 2>&1 | grep 'configure arguments:'` + for opt in $options; do + if [ `echo $opt | grep '.*-temp-path'` ]; then + value=`echo $opt | cut -d "=" -f 2` + if [ ! -d "$value" ]; then + # echo "creating" $value + mkdir -p $value && chown -R $user $value + fi + fi + done + fi } start() { @@ -59,7 +62,7 @@ start() { stop() { echo -n $"Stopping $prog: " - $nginx -s stop + killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile @@ -69,14 +72,14 @@ stop() { restart() { configtest || return $? stop - sleep 3 + sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " - $nginx -s reload + killproc $nginx -HUP RETVAL=$? echo } @@ -123,6 +126,6 @@ case "$1" in rh_status_q || exit 0 ;; *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + echo $"Usage: $0 {start|stop|status|restart|reload|configtest}" exit 2 esac diff --git a/init.d/Nginx-init-Ubuntu b/init.d/Nginx-init-Ubuntu index f411c880..15a3cd90 100755 --- a/init.d/Nginx-init-Ubuntu +++ b/init.d/Nginx-init-Ubuntu @@ -1,334 +1,62 @@ #! /bin/sh + ### BEGIN INIT INFO # Provides: nginx -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog +# Required-Start: $all +# Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: nginx init.d dash script for Ubuntu <=9.10. -# Description: nginx init.d dash script for Ubuntu <=9.10. +# Short-Description: starts the nginx web server +# Description: starts nginx using start-stop-daemon ### END INIT INFO -#------------------------------------------------------------------------------ -# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx -# daemon for ubuntu 9.10 and lesser version numbered releases. -# -# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ -# proxy and IMAP/POP3 proxy server. This \ -# script will manage the initiation of the \ -# server and it's process state. -# -# processname: nginx -# config: /usr/local/nginx/conf/nginx.conf -# pidfile: /var/run/nginx.pid -# Provides: nginx -# -# Author: Jason Giedymin -# . -# -# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com -# Notes: nginx init.d dash script for Ubuntu <=9.10. -# -# This script's project home is: -# http://code.google.com/p/nginx-init-ubuntu/ -# -#------------------------------------------------------------------------------ -# Functions -#------------------------------------------------------------------------------ -. /lib/lsb/init-functions - -#------------------------------------------------------------------------------ -# Consts -#------------------------------------------------------------------------------ -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DAEMON=/usr/local/nginx/sbin/nginx - -PS="nginx" -PIDNAME="nginx" #lets you do $PS-slave -PIDFILE=$PIDNAME.pid #pid file -PIDSPATH=/var/run - -DESCRIPTION="Nginx Server..." - -RUNAS=root #user to run as - -SCRIPT_OK=0 #ala error codes -SCRIPT_ERROR=1 #ala error codes -TRUE=1 #boolean -FALSE=0 #boolean - -lockfile=/var/lock/subsys/nginx -NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" - -#------------------------------------------------------------------------------ -# Simple Tests -#------------------------------------------------------------------------------ - -#test if nginx is a file and executable +DAEMON_OPTS='-c /usr/local/nginx/conf/nginx.conf' +NAME=nginx +DESC=nginx + test -x $DAEMON || exit 0 - + # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi - -#set exit condition -#set -e - -#------------------------------------------------------------------------------ -# Functions -#------------------------------------------------------------------------------ - -setFilePerms(){ - - if [ -f $PIDSPATH/$PIDFILE ]; then - chmod 400 $PIDSPATH/$PIDFILE - fi -} - -configtest() { - $DAEMON -t -c $NGINX_CONF_FILE -} - -getPSCount() { - return `pgrep -f $PS | wc -l` -} - -isRunning() { - if [ $1 ]; then - pidof_daemon $1 - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - else - pidof_daemon - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - fi -} - -#courtesy of php-fpm -wait_for_pid () { - try=0 - - while test $try -lt 35 ; do - - case "$1" in - 'created') - if [ -f "$2" ] ; then - try='' - break - fi - ;; - - 'removed') - if [ ! -f "$2" ] ; then - try='' - break - fi - ;; - esac - - #echo -n . - try=`expr $try + 1` - sleep 1 - done -} - -status(){ - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then - echo "$PIDNAME found running with processes: `pidof $PS`" - else - echo "$PIDNAME is NOT running." - fi -} - -removePIDFile(){ - if [ $1 ]; then - if [ -f $1 ]; then - rm -f $1 - fi - else - #Do default removal - if [ -f $PIDSPATH/$PIDFILE ]; then - rm -f $PIDSPATH/$PIDFILE - fi - fi -} - -start() { - log_daemon_msg "Starting $DESCRIPTION" - - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then - log_end_msg $SCRIPT_ERROR - else - start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ - -- -c $NGINX_CONF_FILE - setFilePerms - log_end_msg $SCRIPT_OK - fi -} - -stop() { - log_daemon_msg "Stopping $DESCRIPTION" - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - - if [ -n "$try" ] ; then - log_end_msg $SCRIPT_ERROR - else - removePIDFile - log_end_msg $SCRIPT_OK - fi - - else - log_end_msg $SCRIPT_ERROR - fi -} - -reload() { - configtest || return $? - - log_daemon_msg "Reloading (via HUP) $DESCRIPTION" - - isRunning - if [ $? -eq $TRUE ]; then - `killall -HUP $PS` #to be safe - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - fi -} - -quietupgrade() { - log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -USR2 `cat $PIDSPATH/$PIDFILE` - kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - - log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" - - kill -HUP `cat $PIDSPATH/$PIDFILE` - kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_ok - fi - else - log_end_msg $SCRIPT_ERROR - fi -} - -terminate() { - log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" - - PIDS=`pidof $PS` || true - - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - kill $i - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - removePIDFile - fi - done - - log_end_msg $SCRIPT_OK -} - -destroy() { - log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" - killall $PS -q >> /dev/null 2>&1 - log_end_msg $SCRIPT_OK -} - -pidof_daemon() { - PIDS=`pidof $PS` || true - - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - return 1 - fi - done - return 0 -} - + +set -e + case "$1" in start) - start + echo -n "Starting $DESC: " + start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." ;; stop) - stop + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --pidfile /var/run/nginx.pid --exec $DAEMON + echo "$NAME." ;; restart|force-reload) - stop - sleep 3 - start + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --pidfile /var/run/nginx.pid --exec $DAEMON + sleep 1 + start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." ;; reload) - $1 - ;; - status) - status + echo -n "Reloading $DESC configuration: " + start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/nginx.pid \ + --exec $DAEMON + echo "$NAME." ;; configtest) - $1 - ;; - quietupgrade) - $1 - ;; - terminate) - $1 - ;; - destroy) - $1 + $DAEMON -t $DAEMON_OPTS ;; *) - FULLPATH=/etc/init.d/$PS - echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" - echo " The 'destroy' command should only be used as a last resort." + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|configtest|force-reload}" >&2 exit 1 ;; esac - + exit 0 diff --git a/install.sh b/install.sh index 95344309..c429103a 100755 --- a/install.sh +++ b/install.sh @@ -449,6 +449,10 @@ IPADDR_COUNTRY_ISP=`./include/get_ipaddr_state.py $PUBLIC_IPADDR` IPADDR_COUNTRY=`echo $IPADDR_COUNTRY_ISP | awk '{print $1}'` [ "`echo $IPADDR_COUNTRY_ISP | awk '{print $2}'`"x == '1000323'x ] && IPADDR_ISP=aliyun +# del openssl for jcloud +[ -e "/usr/local/bin/openssl" ] && rm -rf /usr/local/bin/openssl +[ -e "/usr/local/include/openssl" ] && rm -rf /usr/local/include/openssl + # Check binary dependencies packages . ./include/check_sw.sh case "${OS}" in diff --git a/reset_db_root_password.sh b/reset_db_root_password.sh index b537c4ca..18ea9500 100755 --- a/reset_db_root_password.sh +++ b/reset_db_root_password.sh @@ -22,9 +22,6 @@ printf " . ./include/color.sh . ./include/check_dir.sh -# Check if user is root -[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } - Reset_db_root_password() { [ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; } diff --git a/tools/cos/__init__.py b/tools/cos/__init__.py new file mode 100644 index 00000000..6a073e94 --- /dev/null +++ b/tools/cos/__init__.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# coding=utf-8 + +from qcloud_cos import CosClient +from qcloud_cos import UploadFileRequest +from qcloud_cos import CreateFolderRequest +from qcloud_cos import DelFileRequest +from qcloud_cos import DelFolderRequest +from qcloud_cos import ListFolderRequest +import threadpool diff --git a/tools/cos/qcloud_cos/__init__.py b/tools/cos/qcloud_cos/__init__.py new file mode 100644 index 00000000..ef1a0f01 --- /dev/null +++ b/tools/cos/qcloud_cos/__init__.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from .cos_client import CosClient +from .cos_client import CosConfig +from .cos_client import CredInfo +from .cos_request import UploadFileRequest +from .cos_request import UploadSliceFileRequest +from .cos_request import UpdateFileRequest +from .cos_request import UpdateFolderRequest +from .cos_request import DelFolderRequest +from .cos_request import DelFileRequest +from .cos_request import CreateFolderRequest +from .cos_request import StatFileRequest +from .cos_request import StatFolderRequest +from .cos_request import ListFolderRequest +from .cos_request import DownloadFileRequest +from .cos_request import MoveFileRequest +from .cos_auth import Auth +from .cos_cred import CredInfo + + +import logging + +try: + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + +logging.getLogger(__name__).addHandler(NullHandler()) diff --git a/tools/cos/qcloud_cos/cos_auth.py b/tools/cos/qcloud_cos/cos_auth.py new file mode 100644 index 00000000..8b0d0918 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_auth.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import random +import time +import urllib +import hmac +import hashlib +import binascii +import base64 + + +class Auth(object): + def __init__(self, cred): + self.cred = cred + + def app_sign(self, bucket, cos_path, expired, upload_sign=True): + appid = self.cred.get_appid() + bucket = bucket.encode('utf8') + secret_id = self.cred.get_secret_id().encode('utf8') + now = int(time.time()) + rdm = random.randint(0, 999999999) + cos_path = urllib.quote(cos_path.encode('utf8'), '~/') + if upload_sign: + fileid = '/%s/%s%s' % (appid, bucket, cos_path) + else: + fileid = cos_path + + if expired != 0 and expired < now: + expired = now + expired + + sign_tuple = (appid, secret_id, expired, now, rdm, fileid, bucket) + + plain_text = 'a=%s&k=%s&e=%d&t=%d&r=%d&f=%s&b=%s' % sign_tuple + secret_key = self.cred.get_secret_key().encode('utf8') + sha1_hmac = hmac.new(secret_key, plain_text, hashlib.sha1) + hmac_digest = sha1_hmac.hexdigest() + hmac_digest = binascii.unhexlify(hmac_digest) + sign_hex = hmac_digest + plain_text + sign_base64 = base64.b64encode(sign_hex) + return sign_base64 + + def sign_once(self, bucket, cos_path): + """单次签名(针对删除和更新操作) + + :param bucket: bucket名称 + :param cos_path: 要操作的cos路径, 以'/'开始 + :return: 签名字符串 + """ + return self.app_sign(bucket, cos_path, 0) + + def sign_more(self, bucket, cos_path, expired): + """多次签名(针对上传文件,创建目录, 获取文件目录属性, 拉取目录列表) + + :param bucket: bucket名称 + :param cos_path: 要操作的cos路径, 以'/'开始 + :param expired: 签名过期时间, UNIX时间戳, 如想让签名在30秒后过期, 即可将expired设成当前时间加上30秒 + :return: 签名字符串 + """ + return self.app_sign(bucket, cos_path, expired) + + def sign_download(self, bucket, cos_path, expired): + """下载签名(用于获取后拼接成下载链接,下载私有bucket的文件) + + :param bucket: bucket名称 + :param cos_path: 要下载的cos文件路径, 以'/'开始 + :param expired: 签名过期时间, UNIX时间戳, 如想让签名在30秒后过期, 即可将expired设成当前时间加上30秒 + :return: 签名字符串 + """ + return self.app_sign(bucket, cos_path, expired, False) diff --git a/tools/cos/qcloud_cos/cos_client.py b/tools/cos/qcloud_cos/cos_client.py new file mode 100644 index 00000000..0777ea58 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_client.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import requests +from cos_cred import CredInfo +from cos_config import CosConfig +from cos_op import FileOp +from cos_op import FolderOp +from cos_request import UploadFileRequest +from cos_request import UploadSliceFileRequest +from cos_request import UpdateFileRequest +from cos_request import UpdateFolderRequest +from cos_request import DelFileRequest +from cos_request import DelFolderRequest +from cos_request import CreateFolderRequest +from cos_request import StatFolderRequest +from cos_request import StatFileRequest +from cos_request import ListFolderRequest +from cos_request import DownloadFileRequest +try: + from requests.packages.urllib3.exceptions import InsecureRequestWarning + requests.packages.urllib3.disable_warnings(InsecureRequestWarning) +except ImportError: + pass + + +class CosClient(object): + """Cos客户端类""" + + def __init__(self, appid, secret_id, secret_key, region="shanghai"): + """ 设置用户的相关信息 + + :param appid: appid + :param secret_id: secret_id + :param secret_key: secret_key + """ + self._cred = CredInfo(appid, secret_id, secret_key) + self._config = CosConfig(region=region) + self._http_session = requests.session() + self._file_op = FileOp(self._cred, self._config, self._http_session) + self._folder_op = FolderOp(self._cred, self._config, self._http_session) + + def set_config(self, config): + """设置config""" + assert isinstance(config, CosConfig) + self._config = config + self._file_op.set_config(config) + self._folder_op.set_config(config) + + def get_config(self): + """获取config""" + return self._config + + def set_cred(self, cred): + """设置用户的身份信息 + + :param cred: + :return: + """ + assert isinstance(cred, CredInfo) + self._cred = cred + self._file_op.set_cred(cred) + self._folder_op.set_cred(cred) + + def get_cred(self): + """获取用户的相关信息 + + :return: + """ + return self._cred + + def upload_file(self, request): + """ 上传文件(自动根据文件大小,选择上传策略, 强烈推荐使用),上传策略: 8MB以下适用单文件上传, 8MB(含)适用分片上传 + + :param request: + :return: + """ + assert isinstance(request, UploadFileRequest) + return self._file_op.upload_file(request) + + def upload_single_file(self, request): + """单文件上传接口, 适用用小文件8MB以下, 最大不得超过20MB, 否则会返回参数错误 + + :param request: + :return: + """ + assert isinstance(request, UploadFileRequest) + return self._file_op.upload_single_file(request) + + def upload_slice_file(self, request): + """ 分片上传接口, 适用于大文件8MB及以上 + + :param request: + :return: + """ + assert isinstance(request, UploadSliceFileRequest) + return self._file_op.upload_slice_file(request) + + def del_file(self, request): + """ 删除文件 + + :param request: + :return: + """ + assert isinstance(request, DelFileRequest) + return self._file_op.del_file(request) + + def move_file(self, request): + return self._file_op.move_file(request) + + def stat_file(self, request): + """获取文件属性 + + :param request: + :return: + """ + assert isinstance(request, StatFileRequest) + return self._file_op.stat_file(request) + + def update_file(self, request): + """更新文件属性 + + :param request: + :return: + """ + assert isinstance(request, UpdateFileRequest) + return self._file_op.update_file(request) + + def download_file(self, request): + assert isinstance(request, DownloadFileRequest) + return self._file_op.download_file(request) + + def create_folder(self, request): + """创建目录 + + :param request: + :return: + """ + assert isinstance(request, CreateFolderRequest) + return self._folder_op.create_folder(request) + + def del_folder(self, request): + """删除目录 + + :param request: + :return: + """ + assert isinstance(request, DelFolderRequest) + return self._folder_op.del_folder(request) + + def stat_folder(self, request): + """获取folder属性请求 + + :param request: + :return: + """ + assert isinstance(request, StatFolderRequest) + return self._folder_op.stat_folder(request) + + def update_folder(self, request): + """更新目录属性 + + :param request: + :return: + """ + assert isinstance(request, UpdateFolderRequest) + return self._folder_op.update_folder(request) + + def list_folder(self, request): + """获取目录下的文件和目录列表 + + :param request: + :return: + """ + assert isinstance(request, ListFolderRequest) + return self._folder_op.list_folder(request) diff --git a/tools/cos/qcloud_cos/cos_common.py b/tools/cos/qcloud_cos/cos_common.py new file mode 100644 index 00000000..b0e0f9de --- /dev/null +++ b/tools/cos/qcloud_cos/cos_common.py @@ -0,0 +1,225 @@ +# -*- coding: utf-8 -*- + +from __future__ import print_function +import struct +import io + +try: + range = xrange +except NameError: + pass + + +def _left_rotate(n, b): + """Left rotate a 32-bit integer n by b bits.""" + return ((n << b) | (n >> (32 - b))) & 0xffffffff + + +def _process_chunk(chunk, h0, h1, h2, h3, h4): + """Process a chunk of data and return the new digest variables.""" + assert len(chunk) == 64 + + w = [0] * 80 + + # Break chunk into sixteen 4-byte big-endian words w[i] + for i in range(16): + w[i] = struct.unpack(b'>I', chunk[i * 4:i * 4 + 4])[0] + + # Extend the sixteen 4-byte words into eighty 4-byte words + for i in range(16, 80): + w[i] = _left_rotate(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1) + + # Initialize hash value for this chunk + a = h0 + b = h1 + c = h2 + d = h3 + e = h4 + + for i in range(80): + if 0 <= i <= 19: + # Use alternative 1 for f from FIPS PB 180-1 to avoid bitwise not + f = d ^ (b & (c ^ d)) + k = 0x5A827999 + elif 20 <= i <= 39: + f = b ^ c ^ d + k = 0x6ED9EBA1 + elif 40 <= i <= 59: + f = (b & c) | (b & d) | (c & d) + k = 0x8F1BBCDC + elif 60 <= i <= 79: + f = b ^ c ^ d + k = 0xCA62C1D6 + + a, b, c, d, e = ((_left_rotate(a, 5) + f + e + k + w[i]) & 0xffffffff, + a, _left_rotate(b, 30), c, d) + + # Add this chunk's hash to result so far + h0 = (h0 + a) & 0xffffffff + h1 = (h1 + b) & 0xffffffff + h2 = (h2 + c) & 0xffffffff + h3 = (h3 + d) & 0xffffffff + h4 = (h4 + e) & 0xffffffff + + return h0, h1, h2, h3, h4 + + +class Sha1Hash(object): + """A class that mimics that hashlib api and implements the SHA-1 algorithm.""" + + name = 'python-sha1' + digest_size = 20 + block_size = 64 + + def __init__(self): + # Initial digest variables + self._h = ( + 0x67452301, + 0xEFCDAB89, + 0x98BADCFE, + 0x10325476, + 0xC3D2E1F0, + ) + + # bytes object with 0 <= len < 64 used to store the end of the message + # if the message length is not congruent to 64 + self._unprocessed = b'' + # Length in bytes of all data that has been processed so far + self._message_byte_length = 0 + + def update(self, arg): + """Update the current digest. + This may be called repeatedly, even after calling digest or hexdigest. + + Arguments: + arg: bytes, bytearray, or BytesIO object to read from. + """ + if isinstance(arg, (bytes, bytearray)): + arg = io.BytesIO(arg) + + # Try to build a chunk out of the unprocessed data, if any + chunk = self._unprocessed + arg.read(64 - len(self._unprocessed)) + + # Read the rest of the data, 64 bytes at a time + while len(chunk) == 64: + self._h = _process_chunk(chunk, *self._h) + self._message_byte_length += 64 + chunk = arg.read(64) + + self._unprocessed = chunk + return self + + def digest(self): + """Produce the final hash value (big-endian) as a bytes object""" + return b''.join(struct.pack(b'>I', h) for h in self._produce_digest()) + + def hexdigest(self): + """Produce the final hash value (big-endian) as a hex string""" + return '%08x%08x%08x%08x%08x' % self._produce_digest() + + def inner_digest(self): + + tmp = struct.unpack(">5I", struct.pack("<5I", *self._h)) + return '%08x%08x%08x%08x%08x' % tmp + + def _produce_digest(self): + """Return finalized digest variables for the data processed so far.""" + # Pre-processing: + message = self._unprocessed + message_byte_length = self._message_byte_length + len(message) + + # append the bit '1' to the message + message += b'\x80' + + # append 0 <= k < 512 bits '0', so that the resulting message length (in bytes) + # is congruent to 56 (mod 64) + message += b'\x00' * ((56 - (message_byte_length + 1) % 64) % 64) + + # append length of message (before pre-processing), in bits, as 64-bit big-endian integer + message_bit_length = message_byte_length * 8 + message += struct.pack(b'>Q', message_bit_length) + + # Process the final chunk + # At this point, the length of the message is either 64 or 128 bytes. + h = _process_chunk(message[:64], *self._h) + if len(message) == 64: + return h + return _process_chunk(message[64:], *h) + + +def sha1(data): + """SHA-1 Hashing Function + A custom SHA-1 hashing function implemented entirely in Python. + Arguments: + data: A bytes or BytesIO object containing the input message to hash. + Returns: + A hex SHA-1 digest of the input message. + """ + return Sha1Hash().update(data).hexdigest() + + +class Sha1Util(object): + + @staticmethod + def get_sha1_by_slice(file_name, slice_size): + """ Get SHA array based on Qcloud Slice Upload Interface + + :param file_name: local file path + :param slice_size: slice size in bit + :return: sha array like [{“offset”:0, “datalen”:1024,”datasha”:”aaa”}, {}, {}] + """ + from os import path + + with open(file_name, 'rb') as f: + + result = [] + file_size = path.getsize(file_name) + sha1_obj = Sha1Hash() + for current_offset in range(0, file_size, slice_size): + + data_length = min(slice_size, file_size - current_offset) + sha1_obj.update(f.read(data_length)) + sha1_val = sha1_obj.inner_digest() + result.append({"offset": current_offset, "datalen": data_length, "datasha": sha1_val}) + + result[-1]['datasha'] = sha1_obj.hexdigest() + return result + + +if __name__ == '__main__': + # Imports required for command line parsing. No need for these elsewhere + import argparse + import sys + import os + + # Parse the incoming arguments + parser = argparse.ArgumentParser() + parser.add_argument('input', nargs='?', + help='input file or message to hash') + args = parser.parse_args() + + data = None + + if args.input is None: + # No argument given, assume message comes from standard input + try: + # sys.stdin is opened in text mode, which can change line endings, + # leading to incorrect results. Detach fixes this issue, but it's + # new in Python 3.1 + data = sys.stdin.detach() + except AttributeError: + # Linux ans OSX both use \n line endings, so only windows is a + # problem. + if sys.platform == "win32": + import msvcrt + + msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) + data = sys.stdin + elif os.path.isfile(args.input): + # An argument is given and it's a valid file. Read it + data = open(args.input, 'rb') + else: + data = args.input + + # Show the final digest + print('sha1-digest:', sha1(data)) diff --git a/tools/cos/qcloud_cos/cos_config.py b/tools/cos/qcloud_cos/cos_config.py new file mode 100644 index 00000000..12a24f79 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_config.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +class CosRegionInfo(object): + + def __init__(self, region=None, hostname=None, download_hostname=None, *args, **kwargs): + self._hostname = None + self._download_hostname = None + + if region in ['sh', 'shanghai']: + self._hostname = 'sh.file.myqcloud.com' + self._download_hostname = 'cossh.myqcloud.com' + + elif region in ['gz', 'guangzhou']: + self._hostname = 'gz.file.myqcloud.com' + self._download_hostname = 'cosgz.myqcloud.com' + + elif region in ['tj', 'tianjin', 'tianjing']: # bug: for compact previous release + self._hostname = 'tj.file.myqcloud.com' + self._download_hostname = 'costj.myqcloud.com' + + elif region in ['sgp', 'singapore']: + self._hostname = 'sgp.file.myqcloud.com' + self._download_hostname = 'cosspg.myqcloud.com' + + elif region is not None: + self._hostname = '{region}.file.myqcloud.com'.format(region=region) + self._download_hostname = 'cos{region}.myqcloud.com'.format(region=region) + else: + if hostname and download_hostname: + self._hostname = hostname + self._download_hostname = download_hostname + else: + raise ValueError("region or [hostname, download_hostname] must be set, and region should be sh/gz/tj/sgp") + + @property + def hostname(self): + assert self._hostname is not None + return self._hostname + + @property + def download_hostname(self): + assert self._download_hostname is not None + return self._download_hostname + + +class CosConfig(object): + """CosConfig 有关cos的配置""" + + def __init__(self, timeout=300, sign_expired=300, enable_https=False, *args, **kwargs): + self._region = CosRegionInfo(*args, **kwargs) + self._user_agent = 'cos-python-sdk-v4' + self._timeout = timeout + self._sign_expired = sign_expired + self._enable_https = enable_https + if self._enable_https: + self._protocol = "https" + else: + self._protocol = "http" + + def get_endpoint(self): + """获取域名地址 + + :return: + """ + # tmpl = "%s://%s/files/v2" + return self._protocol + "://" + self._region.hostname + "/files/v2" + + def get_download_hostname(self): + return self._region.download_hostname + + def get_user_agent(self): + """获取HTTP头中的user_agent + + :return: + """ + return self._user_agent + + def set_timeout(self, time_out): + """设置连接超时, 单位秒 + + :param time_out: + :return: + """ + assert isinstance(time_out, int) + self._timeout = time_out + + def get_timeout(self): + """获取连接超时,单位秒 + + :return: + """ + return self._timeout + + def set_sign_expired(self, expired): + """设置签名过期时间, 单位秒 + + :param expired: + :return: + """ + assert isinstance(expired, int) + self._sign_expired = expired + + def get_sign_expired(self): + """获取签名过期时间, 单位秒 + + :return: + """ + return self._sign_expired + + @property + def enable_https(self): + assert self._enable_https is not None + return self._enable_https + + @enable_https.setter + def enable_https(self, val): + if val != self._enable_https: + if val: + self._enable_https = val + self._protocol = "https" + else: + self._enable_https = val + self._protocol = "http" diff --git a/tools/cos/qcloud_cos/cos_cred.py b/tools/cos/qcloud_cos/cos_cred.py new file mode 100644 index 00000000..7d7220d2 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_cred.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +from cos_params_check import ParamCheck + + +class CredInfo(object): + """CredInfo用户的身份信息""" + def __init__(self, appid, secret_id, secret_key): + self._appid = appid + self._secret_id = secret_id + self._secret_key = secret_key + self._param_check = ParamCheck() + + def get_appid(self): + return self._appid + + def get_secret_id(self): + return self._secret_id + + def get_secret_key(self): + return self._secret_key + + def check_params_valid(self): + if not self._param_check.check_param_int('appid', self._appid): + return False + if not self._param_check.check_param_unicode('secret_id', self._secret_id): + return False + return self._param_check.check_param_unicode('secret_key', self._secret_key) + + def get_err_tips(self): + """获取错误信息 + + :return: + """ + return self._param_check.get_err_tips() diff --git a/tools/cos/qcloud_cos/cos_err.py b/tools/cos/qcloud_cos/cos_err.py new file mode 100644 index 00000000..acf326ab --- /dev/null +++ b/tools/cos/qcloud_cos/cos_err.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +class CosErr(object): + """sdk错误码""" + PARAMS_ERROR = -1 # 参数错误 + NETWORK_ERROR = -2 # 网络错误 + SERVER_ERROR = -3 # server端返回错误 + UNKNOWN_ERROR = -4 # 未知错误 + + @staticmethod + def get_err_msg(errcode, err_info): + return {u'code': errcode, u'message': err_info} diff --git a/tools/cos/qcloud_cos/cos_op.py b/tools/cos/qcloud_cos/cos_op.py new file mode 100644 index 00000000..f80da8a3 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_op.py @@ -0,0 +1,703 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import time +import json +import hashlib +import urllib +from contextlib import closing +import cos_auth +from cos_err import CosErr +from cos_request import UploadFileRequest +from cos_request import UploadSliceFileRequest +from cos_request import UpdateFileRequest +from cos_request import DelFileRequest +from cos_request import StatFileRequest +from cos_request import CreateFolderRequest +from cos_request import UpdateFolderRequest +from cos_request import StatFolderRequest +from cos_request import DelFolderRequest +from cos_request import ListFolderRequest, DownloadFileRequest, MoveFileRequest +from cos_common import Sha1Util + +from logging import getLogger +from traceback import format_exc + +logger = getLogger(__name__) + + +class BaseOp(object): + """ + BaseOp基本操作类型 + """ + + def __init__(self, cred, config, http_session): + """ 初始化类 + + :param cred: 用户的身份信息 + :param config: cos_config配置类 + :param http_session: http 会话 + """ + self._cred = cred + self._config = config + self._http_session = http_session + self._expired_period = self._config.get_sign_expired() + + def set_cred(self, cred): + """设置用户的身份信息 + + :param cred: + :return: + """ + self._cred = cred + + def set_config(self, config): + """ 设置config + + :param config: + :return: + """ + self._config = config + self._expired_period = self._config.get_sign_expired() + + def _build_url(self, bucket, cos_path): + """生成url + + :param bucket: + :param cos_path: + :return: + """ + bucket = bucket.encode('utf8') + end_point = self._config.get_endpoint().rstrip('/').encode('utf8') + appid = self._cred.get_appid() + cos_path = urllib.quote(cos_path.encode('utf8'), '~/') + url = '%s/%s/%s%s' % (end_point, appid, bucket, cos_path) + return url + + def build_download_url(self, bucket, cos_path, sign): + # Only support http now + appid = self._cred.get_appid() + hostname = self._config.get_download_hostname() + cos_path = urllib.quote(cos_path) + url_tmpl = 'http://{bucket}-{appid}.{hostname}{cos_path}?sign={sign}' + + return url_tmpl.format(bucket=bucket, appid=appid, hostname=hostname, cos_path=cos_path, sign=sign) + + def send_request(self, method, bucket, cos_path, **kwargs): + """ 发送http请求 + + :param method: + :param bucket: + :param cos_path: + :param args: + :return: + """ + url = self._build_url(bucket, cos_path) + logger.debug("sending request, method: %s, bucket: %s, cos_path: %s" % (method, bucket, cos_path)) + + try: + if method == 'POST': + http_resp = self._http_session.post(url, verify=False, **kwargs) + else: + http_resp = self._http_session.get(url, verify=False, **kwargs) + + status_code = http_resp.status_code + if status_code == 200 or status_code == 400: + return http_resp.json() + else: + logger.warning("request failed, response message: %s" % http_resp.text) + err_detail = 'url:%s, status_code:%d' % (url, status_code) + return CosErr.get_err_msg(CosErr.NETWORK_ERROR, err_detail) + except Exception as e: + logger.exception("request failed, return SERVER_ERROR") + err_detail = 'url:%s, exception:%s traceback:%s' % (url, str(e), format_exc()) + return CosErr.get_err_msg(CosErr.SERVER_ERROR, err_detail) + + def _check_params(self, request): + """检查用户输入参数, 检查通过返回None, 否则返回一个代表错误原因的dict + + :param request: + :return: + """ + if not self._cred.check_params_valid(): + return CosErr.get_err_msg(CosErr.PARAMS_ERROR, self._cred.get_err_tips()) + if not request.check_params_valid(): + return CosErr.get_err_msg(CosErr.PARAMS_ERROR, request.get_err_tips()) + return None + + def del_base(self, request): + """删除文件或者目录, is_file_op为True表示是文件操作 + + :param request: + :return: + """ + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + sign = auth.sign_once(bucket, cos_path) + + http_header = dict() + http_header['Authorization'] = sign + http_header['Content-Type'] = 'application/json' + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = {'op': 'delete'} + + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, data=json.dumps(http_body), timeout=timeout) + + def stat_base(self, request): + """获取文件和目录的属性 + + :param request: + :return: + """ + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'stat' + + timeout = self._config.get_timeout() + return self.send_request('GET', bucket, cos_path, headers=http_header, params=http_body, timeout=timeout) + + +class FileOp(BaseOp): + """FileOp 文件相关操作""" + + def __init__(self, cred, config, http_session): + """ 初始化类 + + :param cred: 用户的身份信息 + :param config: cos_config配置类 + :param http_session: http 会话 + """ + BaseOp.__init__(self, cred, config, http_session) + # 单文件上传的最大上限是20MB + self.max_single_file = 20 * 1024 * 1024 + + @staticmethod + def _sha1_content(content): + """获取content的sha1 + + :param content: + :return: + """ + sha1_obj = hashlib.sha1() + sha1_obj.update(content) + return sha1_obj.hexdigest() + + def update_file(self, request): + """更新文件 + + :param request: + :return: + """ + assert isinstance(request, UpdateFileRequest) + logger.debug("request: " + str(request.get_custom_headers())) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + logger.debug("params verify successfully") + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + sign = auth.sign_once(bucket, cos_path) + + http_header = dict() + http_header['Authorization'] = sign + http_header['Content-Type'] = 'application/json' + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'update' + + if request.get_biz_attr() is not None: + http_body['biz_attr'] = request.get_biz_attr() + + if request.get_authority() is not None: + http_body['authority'] = request.get_authority() + + if request.get_custom_headers() is not None and len(request.get_custom_headers()) is not 0: + http_body['custom_headers'] = request.get_custom_headers() + logger.debug("Update Request Header: " + json.dumps(http_body)) + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, data=json.dumps(http_body), timeout=timeout) + + def del_file(self, request): + """删除文件 + + :param request: + :return: + """ + assert isinstance(request, DelFileRequest) + return self.del_base(request) + + def stat_file(self, request): + """获取文件的属性 + + :param request: + :return: + """ + assert isinstance(request, StatFileRequest) + return self.stat_base(request) + + def upload_file(self, request): + """上传文件, 根据用户的文件大小,选择单文件上传和分片上传策略 + + :param request: + :return: + """ + assert isinstance(request, UploadFileRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + local_path = request.get_local_path() + file_size = os.path.getsize(local_path) + + suit_single_file_zie = 8 * 1024 * 1024 + if file_size < suit_single_file_zie: + return self.upload_single_file(request) + else: + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + local_path = request.get_local_path() + slice_size = 1024 * 1024 + biz_attr = request.get_biz_attr() + upload_slice_request = UploadSliceFileRequest(bucket, cos_path, local_path, slice_size, biz_attr) + upload_slice_request.set_insert_only(request.get_insert_only()) + return self.upload_slice_file(upload_slice_request) + + def upload_single_file(self, request): + """ 单文件上传 + + :param request: + :return: + """ + assert isinstance(request, UploadFileRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + local_path = request.get_local_path() + file_size = os.path.getsize(local_path) + # 判断文件是否超过单文件最大上限, 如果超过则返回错误 + # 并提示用户使用别的接口 + if file_size > self.max_single_file: + return CosErr.get_err_msg(CosErr.NETWORK_ERROR, 'file is too big, please use upload_file interface') + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + with open(local_path, 'rb') as f: + file_content = f.read() + + http_body = dict() + http_body['op'] = 'upload' + http_body['filecontent'] = file_content + http_body['sha'] = FileOp._sha1_content(file_content) + http_body['biz_attr'] = request.get_biz_attr() + http_body['insertOnly'] = str(request.get_insert_only()) + + timeout = self._config.get_timeout() + ret = self.send_request('POST', bucket, cos_path, headers=http_header, files=http_body, timeout=timeout) + + if request.get_insert_only() != 0: + return ret + + if ret[u'code'] == 0: + return ret + + # try to delete object, and re-post request + del_request = DelFileRequest(bucket_name=request.get_bucket_name(), cos_path=request.get_cos_path()) + ret = self.del_file(del_request) + if ret[u'code'] == 0: + return self.send_request('POST', bucket, cos_path, headers=http_header, files=http_body, timeout=timeout) + else: + return ret + + def _upload_slice_file(self, request): + assert isinstance(request, UploadSliceFileRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + local_path = request.get_local_path() + slice_size = request.get_slice_size() + enable_sha1 = request.enable_sha1 + + if enable_sha1 is True: + sha1_by_slice_list = Sha1Util.get_sha1_by_slice(local_path, slice_size) + request.sha1_list = sha1_by_slice_list + request.sha1_content = sha1_by_slice_list[-1]["datasha"] + else: + request.sha1_list = None + request.sha1_content = None + + control_ret = self._upload_slice_control(request) + + # 表示控制分片已经产生错误信息 + if control_ret[u'code'] != 0: + return control_ret + + # 命中秒传 + if u'access_url' in control_ret[u'data']: + return control_ret + + local_path = request.get_local_path() + file_size = os.path.getsize(local_path) + slice_size = control_ret[u'data'][u'slice_size'] + offset = 0 + session = control_ret[u'data'][u'session'] + # ?concurrency + if request._max_con <= 1 or ( + u'serial_upload' in control_ret[u'data'] and control_ret[u'data'][u'serial_upload'] == 1): + + logger.info("upload file serially") + slice_idx = 0 + with open(local_path, 'rb') as local_file: + + while offset < file_size: + file_content = local_file.read(slice_size) + + data_ret = self._upload_slice_data(request, file_content, session, offset) + + if data_ret[u'code'] == 0: + if u'access_url' in data_ret[u'data']: + return data_ret + else: + return data_ret + + offset += slice_size + slice_idx += 1 + else: + logger.info('upload file concurrently') + from threadpool import SimpleThreadPool + pool = SimpleThreadPool(request._max_con) + + slice_idx = 0 + with open(local_path, 'rb') as local_file: + + while offset < file_size: + file_content = local_file.read(slice_size) + + pool.add_task(self._upload_slice_data, request, file_content, session, offset) + + offset += slice_size + slice_idx += 1 + + pool.wait_completion() + result = pool.get_result() + if not result['success_all']: + return {u'code': 1, u'message': str(result)} + + data_ret = self._upload_slice_finish(request, session, file_size) + return data_ret + + def upload_slice_file(self, request): + """分片文件上传(串行) + + :param request: + :return: + """ + ret = self._upload_slice_file(request) + + if ret[u'code'] == 0: + return ret + + if request.get_insert_only() == 0: + del_request = DelFileRequest(request.get_bucket_name(), request.get_cos_path()) + ret = self.del_file(del_request) + if ret[u'code'] == 0: + return self._upload_slice_file(request) + else: + return ret + else: + return ret + + def _upload_slice_finish(self, request, session, filesize): + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = "upload_slice_finish" + http_body['session'] = session + http_body['filesize'] = str(filesize) + if request.sha1_list is not None: + http_body['sha'] = request.sha1_list[-1]["datasha"] + timeout = self._config.get_timeout() + + return self.send_request('POST', bucket, cos_path, headers=http_header, files=http_body, timeout=timeout) + + def _upload_slice_control(self, request): + """串行分片第一步, 上传控制分片 + + :param request: + :return: + """ + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + local_path = request.get_local_path() + file_size = os.path.getsize(local_path) + slice_size = request.get_slice_size() + biz_atrr = request.get_biz_attr() + + http_body = dict() + http_body['op'] = 'upload_slice_init' + if request.enable_sha1: + http_body['sha'] = request.sha1_list[-1]["datasha"] + http_body['uploadparts'] = json.dumps(request.sha1_list) + http_body['filesize'] = str(file_size) + http_body['slice_size'] = str(slice_size) + http_body['biz_attr'] = biz_atrr + http_body['insertOnly'] = str(request.get_insert_only()) + + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, files=http_body, timeout=timeout) + + def _upload_slice_data(self, request, file_content, session, offset, retry=3): + """串行分片第二步, 上传数据分片 + + :param request: + :param file_content: + :param session: + :param offset: + :return: + """ + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + auth = cos_auth.Auth(self._cred) + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'upload_slice_data' + http_body['filecontent'] = file_content + http_body['session'] = session + http_body['offset'] = str(offset) + if request.sha1_content is not None: + http_body['sha'] = request.sha1_content + + timeout = self._config.get_timeout() + + for _ in range(retry): + ret = self.send_request('POST', bucket, cos_path, headers=http_header, files=http_body, timeout=timeout) + if ret['code'] == 0: + return ret + else: + return ret + + def __download_url(self, uri, filename): + session = self._http_session + + with closing(session.get(uri, stream=True, timeout=150)) as ret: + if ret.status_code in [200, 206]: + + if 'Content-Length' in ret.headers: + content_len = int(ret.headers['Content-Length']) + else: + raise IOError("download failed without Content-Length header") + + file_len = 0 + with open(filename, 'wb') as f: + for chunk in ret.iter_content(chunk_size=1024): + if chunk: + file_len += len(chunk) + f.write(chunk) + f.flush() + if file_len != content_len: + raise IOError("download failed with incomplete file") + else: + raise IOError("download failed with status code:" + str(ret.status_code)) + + def download_file(self, request): + assert isinstance(request, DownloadFileRequest) + + auth = cos_auth.Auth(self._cred) + sign = auth.sign_download(request.get_bucket_name(), request.get_cos_path(), self._config.get_sign_expired()) + url = self.build_download_url(request.get_bucket_name(), request.get_cos_path(), sign) + logger.info("Uri is %s" % url) + try: + self.__download_url(url, request._local_filename) + return {u'code': 0, u'message': "download successfully"} + except Exception as e: + return {u'code': 1, u'message': "download failed, exception: " + str(e)} + + def __move_file(self, request): + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + sign = auth.sign_once(bucket, cos_path) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'move' + http_body['dest_fileid'] = request.dest_path + http_body['to_over_write'] = str(1 if request.overwrite else 0) + + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, params=http_body, timeout=timeout) + + def move_file(self, request): + + assert isinstance(request, MoveFileRequest) + return self.__move_file(request) + + +class FolderOp(BaseOp): + """FolderOp 目录相关操作""" + def __init__(self, cred, config, http_session): + BaseOp.__init__(self, cred, config, http_session) + + def update_folder(self, request): + """更新目录 + + :param request: + :return: + """ + assert isinstance(request, UpdateFolderRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + sign = auth.sign_once(bucket, cos_path) + + http_header = dict() + http_header['Authorization'] = sign + http_header['Content-Type'] = 'application/json' + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'update' + http_body['biz_attr'] = request.get_biz_attr() + + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, data=json.dumps(http_body), timeout=timeout) + + def del_folder(self, request): + """删除目录 + + :param request: + :return: + """ + assert isinstance(request, DelFolderRequest) + return self.del_base(request) + + def stat_folder(self, request): + """获取目录属性 + + :param request: + :return: + """ + assert isinstance(request, StatFolderRequest) + return self.stat_base(request) + + def create_folder(self, request): + """创建目录 + + :param request: + :return: + """ + assert isinstance(request, CreateFolderRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + cos_path = request.get_cos_path() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, cos_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['Content-Type'] = 'application/json' + http_header['User-Agent'] = self._config.get_user_agent() + + http_body = dict() + http_body['op'] = 'create' + http_body['biz_attr'] = request.get_biz_attr() + + timeout = self._config.get_timeout() + return self.send_request('POST', bucket, cos_path, headers=http_header, data=json.dumps(http_body), timeout=timeout) + + def list_folder(self, request): + """list目录 + + :param request: + :return: + """ + assert isinstance(request, ListFolderRequest) + check_params_ret = self._check_params(request) + if check_params_ret is not None: + return check_params_ret + + http_body = dict() + http_body['op'] = 'list' + http_body['num'] = request.get_num() + + http_body['context'] = request.get_context() + + auth = cos_auth.Auth(self._cred) + bucket = request.get_bucket_name() + list_path = request.get_cos_path() + request.get_prefix() + expired = int(time.time()) + self._expired_period + sign = auth.sign_more(bucket, list_path, expired) + + http_header = dict() + http_header['Authorization'] = sign + http_header['User-Agent'] = self._config.get_user_agent() + + timeout = self._config.get_timeout() + return self.send_request('GET', bucket, list_path, headers=http_header, params=http_body, timeout=timeout) diff --git a/tools/cos/qcloud_cos/cos_params_check.py b/tools/cos/qcloud_cos/cos_params_check.py new file mode 100644 index 00000000..4d1a4061 --- /dev/null +++ b/tools/cos/qcloud_cos/cos_params_check.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import os +import re + + +class ParamCheck(object): + """BaseRequest基本类型的请求""" + def __init__(self): + self._err_tips = u'' + + def get_err_tips(self): + """获取错误信息 + + :return: + """ + return self._err_tips + + def check_param_unicode(self, param_name, param_value): + """检查参数是否是unicode + + :param param_name: param_name 参数名 + :param param_value: param_value 参数值 + :return: + """ + if param_value is None: + self._err_tips = param_name + ' is None!' + return False + if not isinstance(param_value, unicode): + self._err_tips = param_name + ' is not unicode!' + return False + return True + + def check_param_int(self, param_name, param_value): + """检查参数是否是int + + :param param_name: param_name 参数名 + :param param_value: param_value 参数值 + :return: + """ + if param_value is None: + self._err_tips = param_name + ' is None!' + return False + if not isinstance(param_value, int): + self._err_tips = param_name + ' is not int!' + return False + return True + + def check_cos_path_valid(self, cos_path, is_file_path): + """检查cos_path是否合法 + + 路径必须以/开始,文件路径则不能以/结束, 目录路径必须以/结束 + + :param cos_path: + :param is_file_path: + :return: True for valid path, other False + """ + if cos_path[0] != u'/': + self._err_tips = 'cos path must start with /' + return False + + last_letter = cos_path[len(cos_path) - 1] + if is_file_path and last_letter == u'/': + self._err_tips = 'for file operation, cos_path must not end with /' + return False + elif not is_file_path and last_letter != u'/': + self._err_tips = 'for folder operation, cos_path must end with /' + return False + else: + pass + + illegal_letters = ['?', '*', ':', '|', '\\', '<', '>', '"'] + for illegal_letter in illegal_letters: + if cos_path.find(illegal_letter) != -1: + self._err_tips = 'cos path contain illegal letter %s' % illegal_letter + return False + + pattern = re.compile(r'/(\s*)/') + if pattern.search(cos_path): + self._err_tips = 'cos path contain illegal letter / /' + return False + return True + + def check_not_cos_root(self, cos_path): + """检查不是cos的根路径 + + 不能对根路径操作的有 1 update 2 create 3 delete + :param cos_path: + :return: + """ + if cos_path == u'/': + self._err_tips = 'bucket operation is not supported by sdk,' + ' please use cos console: https://console.qcloud.com/cos' + return False + else: + return True + + def check_local_file_valid(self, local_path): + """检查本地文件有效(存在并且可读) + + :param local_path: + :return: + """ + if not os.path.exists(local_path): + self._err_tips = 'local_file %s not exist!' % local_path + return False + if not os.path.isfile(local_path): + self._err_tips = 'local_file %s is not regular file!' % local_path + return False + if not os.access(local_path, os.R_OK): + self._err_tips = 'local_file %s is not readable!' % local_path + return False + return True + + def check_slice_size(self, slice_size): + """检查分片大小有效 + + :param slice_size: + :return: + """ + min_size = 64 * 1024 # 512KB + max_size = 3 * 1024 * 1024 # 20MB + + if max_size >= slice_size >= min_size: + return True + else: + self._err_tips = 'slice_size is invalid, only accept [%d, %d]' \ + % (min_size, max_size) + return False + + def check_insert_only(self, insert_only): + """检查文件上传的insert_only参数 + + :param insert_only: + :return: + """ + if insert_only != 1 and insert_only != 0: + self._err_tips = 'insert_only only support 0 and 1' + return False + else: + return True + + def check_move_over_write(self, to_over_write): + """检查move的over write标志 + + :param to_over_write: + :return: + """ + if to_over_write != 1 and to_over_write != 0: + self._err_tips = 'to_over_write only support 0 and 1' + return False + else: + return True + + def check_file_authority(self, authority): + """检查文件的authority属性 + + 合法的取值只有eInvalid, eWRPrivate, eWPrivateRPublic和空值 + :param authority: + :return: + """ + if authority != u''and authority != u'eInvalid' and authority != u'eWRPrivate' and authority != u'eWPrivateRPublic': + self._err_tips = 'file authority valid value is: eInvalid, eWRPrivate, eWPrivateRPublic' + return False + else: + return True + + def check_x_cos_meta_dict(self, x_cos_meta_dict): + """检查x_cos_meta_dict, key和value都必须是UTF8编码 + + :param x_cos_meta_dict: + :return: + """ + prefix_len = len('x-cos-meta-') + for key in x_cos_meta_dict.keys(): + if not self.check_param_unicode('x-cos-meta-key', key): + return False + if not self.check_param_unicode('x-cos-meta-value', x_cos_meta_dict[key]): + return False + if key[0:prefix_len] != u'x-cos-meta-': + self._err_tips = 'x-cos-meta key must start with x-cos-meta-' + return False + if len(key) == prefix_len: + self._err_tips = 'x-cos-meta key must not just be x-cos-meta-' + return False + if len(x_cos_meta_dict[key]) == 0: + self._err_tips = 'x-cos-meta value must not be empty' + return False + return True + + def check_update_flag(self, flag): + """检查更新文件的flag + + :param flag: + :return: + """ + if flag == 0: + self._err_tips = 'no any attribute to be updated!' + return False + else: + return True + + def check_list_order(self, list_order): + """ 检查list folder的order + + :param list_order: 合法取值0(正序), 1(逆序) + :return: + """ + if list_order != 0 and list_order != 1: + self._err_tips = 'list order is invalid, please use 0(positive) or 1(reverse)!' + return False + else: + return True + + def check_list_pattern(self, list_pattern): + """检查list folder的pattern + + :param list_pattern: 合法取值eListBoth, eListDirOnly, eListFileOnly + :return: + """ + if list_pattern != u'eListBoth' and list_pattern != u'eListDirOnly' and list_pattern != u'eListFileOnly': + self._err_tips = 'list pattern is invalid, please use eListBoth or eListDirOnly or eListFileOnly' + return False + else: + return True diff --git a/tools/cos/qcloud_cos/cos_request.py b/tools/cos/qcloud_cos/cos_request.py new file mode 100644 index 00000000..d2394f9a --- /dev/null +++ b/tools/cos/qcloud_cos/cos_request.py @@ -0,0 +1,626 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""the request type in tencent qcloud cos""" + +from cos_params_check import ParamCheck +import collections + + +class BaseRequest(object): + """BaseRequest基本类型的请求""" + + def __init__(self, bucket_name, cos_path): + """ 类初始化 + + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径, 即从bucket下的根/开始 + """ + self._bucket_name = bucket_name.strip() + self._cos_path = cos_path.strip() + self._param_check = ParamCheck() + + def set_bucket_name(self, bucket_name=u''): + """设置bucket_name + + :param bucket_name: + :return: + """ + self._bucket_name = bucket_name.strip() + + def get_bucket_name(self): + """获取bucket_name + + :return: + """ + return self._bucket_name + + def set_cos_path(self, cos_path=u''): + """设置cos_path + + :param cos_path: + :return: + """ + self._cos_path = cos_path.strip() + + def get_cos_path(self): + """获取cos_path + + :return: + """ + return self._cos_path + + def get_err_tips(self): + """获取错误信息 + + :return: + """ + return self._param_check.get_err_tips() + + def check_params_valid(self): + """检查参数是否合法 + + :return: + """ + if not self._param_check.check_param_unicode('bucket', self._bucket_name): + return False + return self._param_check.check_param_unicode('cos_path', self._cos_path) + + +class CreateFolderRequest(BaseRequest): + """CreateFolderRequest 创建目录类型的请求""" + + def __init__(self, bucket_name, cos_path, biz_attr=u''): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径, 从bucket根/开始 + :param biz_attr: 目录的属性 + """ + super(CreateFolderRequest, self).__init__(bucket_name, cos_path) + self._biz_attr = biz_attr + + def set_biz_attr(self, biz_attr): + """设置biz_attr + + :param biz_attr: + :return: + """ + self._biz_attr = biz_attr + + def get_biz_attr(self): + """ 获取biz_attr + + :return: + """ + return self._biz_attr + + def check_params_valid(self): + """检查参数是否合法 + + :return: + """ + if not super(CreateFolderRequest, self).check_params_valid(): + return False + if not self._param_check.check_param_unicode('biz_attr', self._biz_attr): + return False + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=False): + return False + return self._param_check.check_not_cos_root(self._cos_path) + + +class UploadFileRequest(BaseRequest): + """ + UploadFileRequest 单文件上传请求 + """ + + def __init__(self, bucket_name, cos_path, local_path, biz_attr=u'', insert_only=1): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径(目的路径), 从bucket根/开始 + :param local_path: 上传的本地文件路径(源路径) + :param biz_attr: 文件的属性 + :param insert_only: 是否覆盖写, 0覆盖, 1不覆盖,返回错误 + """ + super(UploadFileRequest, self).__init__(bucket_name, cos_path) + self._local_path = local_path.strip() + self._biz_attr = biz_attr + self._insert_only = insert_only + + def set_local_path(self, local_path): + """设置local_path + + :param local_path: + :return: + """ + self._local_path = local_path.strip() + + def get_local_path(self): + """获取local_path + + :return: + """ + return self._local_path + + def set_biz_attr(self, biz_attr): + """设置biz_attr + + :param biz_attr: + :return: + """ + self._biz_attr = biz_attr + + def get_biz_attr(self): + """获取biz_attr + + :return: + """ + return self._biz_attr + + def set_insert_only(self, insert_only): + """设置insert_only,0表示如果文件存在, 则覆盖 + + :param insert_only: + :return: + """ + self._insert_only = insert_only + + def get_insert_only(self): + """获取insert_only + + :return: + """ + return self._insert_only + + def check_params_valid(self): + """检查参数是否有效 + + :return: + """ + if not super(UploadFileRequest, self).check_params_valid(): + return False + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=True): + return False + if not self._param_check.check_param_unicode('biz_attr', self._biz_attr): + return False + if not self._param_check.check_param_unicode('local_path', self._local_path): + return False + if not self._param_check.check_local_file_valid(self._local_path): + return False + if not self._param_check.check_param_int('insert_only', self._insert_only): + return False + return self._param_check.check_insert_only(self._insert_only) + + +class UploadSliceFileRequest(UploadFileRequest): + """ + UploadSliceFileRequest 分片文件上传请求 + """ + + def __init__(self, bucket_name, cos_path, local_path, slice_size=1024*1024, biz_attr=u'', enable_sha1=False, max_con=1): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径(目的路径), 从bucket根/开始 + :param local_path: 上传的本地文件路径(源路径) + :param slice_size: 文件的属性 + :param biz_attr: 分片大小(字节, 默认1MB) + :param enable_sha1: 是否启用sha1校验 + """ + super(UploadSliceFileRequest, self).__init__(bucket_name, cos_path, local_path, biz_attr) + self._slice_size = slice_size + self._enable_sha1 = enable_sha1 + self._max_con = max_con + + @property + def enable_sha1(self): + return self._enable_sha1 + + @enable_sha1.setter + def enable_sha1(self, val): + if val in (True, False): + self._enable_sha1 = val + else: + raise ValueError("enable_sha1 should be True/False") + + def set_slice_size(self, slice_size): + """设置分片大小 + + :param slice_size: + :return: + """ + self._slice_size = slice_size + + def get_slice_size(self): + """获取分片大小 + + :return: + """ + return self._slice_size + + def check_params_valid(self): + """检查参数是否有效 + + :return: + """ + if not super(UploadSliceFileRequest, self).check_params_valid(): + return False + + if self._enable_sha1 and self._slice_size != 1024*1024: + self._param_check._err_tips = 'slice_size is invalid, slice must be 1MB with enable_sha1' + return False + + return self._param_check.check_slice_size(self._slice_size) + + +class UpdateFolderRequest(BaseRequest): + """UpdateFolderRequest 更新目录请求""" + + def __init__(self, bucket_name, cos_path, biz_attr=u''): + """ + + :param bucket_name: bucket name + :param cos_path: the path on cos + :param biz_attr: biz attributes + """ + super(UpdateFolderRequest, self).__init__(bucket_name, cos_path) + self._biz_attr = biz_attr + + def set_biz_attr(self, biz_attr): + """设置biz_attr + + :param biz_attr: + :return: + """ + self._biz_attr = biz_attr + + def get_biz_attr(self): + """获取biz_attr + + :return: + """ + return self._biz_attr + + def check_params_valid(self): + """检查参数是否有效 + + :return: + """ + if not super(UpdateFolderRequest, self).check_params_valid(): + return False + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=False): + return False + if not self._param_check.check_not_cos_root(self._cos_path): + return False + return self._param_check.check_param_unicode('biz_attr', self._biz_attr) + + +class UpdateFileRequest(BaseRequest): + """UpdateFileRequest 更新文件请求 """ + + def __init__(self, bucket_name, cos_path): + """ 初始化类 + + biz_attr: 要更新的文件的属性 + authority: 文件权限: + eInvalid(继承bucket), + eWRPrivate(私有读写), + eWPrivateRPublic(私有写, 公有读) + customer_header: 用户自定义的HTTP请求头,包括以下成员 + cache_control: 文件的缓存机制,参见HTTP的Cache-Control + content_type: 文件的MIME信息,参见HTTP的Content-Type + content_disposition: MIME协议的扩展,参见HTTP的Content-Disposition + content_language: 文件的语言, 参见HTTP的Content-Language + content_encoding: body的编码, 参见HTTP的Content-Encoding + _x_cos_meta_dict: 用户自定义的属性, key是以x-cos-meta-开头,value为属性值 + + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径, 从bucket根/开始 + """ + super(UpdateFileRequest, self).__init__(bucket_name, cos_path) + self._biz_attr = None + self._custom_headers = {} + self._authority = None + self._cache_control = None + self._content_type = None + self._content_disposition = None + self._content_language = None + self._content_encoding = None + self._x_cos_meta_dict = dict() + + def set_biz_attr(self, biz_attr): + """设置biz_attr""" + self._biz_attr = biz_attr + + def get_biz_attr(self): + """获取biz_attr""" + return self._biz_attr + + # 设置authority, 合法取值如下所示 + # eInvalid(继承bucket), + # eWRPrivate(私有读写), + # eWPrivateRPublic(私有写, 公有读) + def set_authority(self, authority): + """设置authority, + + 合法取值:eInvalid(继承bucket),eWRPrivate(私有读写),eWPrivateRPublic(私有写, 公有读) + :param authority: + :return: + """ + self._authority = authority + + def get_authority(self): + """获取authority""" + return self._authority + + def set_cache_control(self, cache_control): + """设置缓存机制Cache-Control""" + self._cache_control = cache_control + self._custom_headers[u'Cache-Control'] = cache_control + + def set_content_type(self, content_type): + """设置Content-Type""" + self._content_type = content_type + self._custom_headers['Content-Type'] = content_type + + def set_content_disposition(self, content_disposition): + """设置Content-Disposition""" + self._content_disposition = content_disposition + self._custom_headers['Content-Disposition'] = content_disposition + + def set_content_language(self, content_language): + """设置Content-Language""" + self._content_language = content_language + self._custom_headers['Content-Language'] = content_language + + def set_content_encoding(self, content_encoding): + """设置Content-Encoding""" + self._content_encoding = content_encoding + self._custom_headers['Content-Encoding'] = content_encoding + + def set_x_cos_meta(self, key, value): + """设置自定义的x-cos-meta + + key以x-cos-meta-开头,例如自定义key为u'x-cos-meta-len', value为u'1024' + :param key: + :param value: + :return: + """ + self._x_cos_meta_dict[key] = value + self._custom_headers[key] = value + + def _convert_dict(self, data): + """convert a dict's keys & values from `unicode` to `str` + + :param data: + :return: + """ + if isinstance(data, basestring): + return str(data) + elif isinstance(data, collections.Mapping): + return dict(map(self._convert_dict, data.iteritems())) + elif isinstance(data, collections.Iterable): + return type(data)(map(self._convert_dict, data)) + else: + return data + + def get_custom_headers(self): + """ 获取自定义的HTTP头""" + return self._convert_dict(self._custom_headers) + + def check_params_valid(self): + """ 检查参数是否合法""" + if not super(UpdateFileRequest, self).check_params_valid(): + return False + + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=True): + return False + + if self._biz_attr is not None: + if not self._param_check.check_param_unicode('biz_attr', self._biz_attr): + return False + + if self._authority is not None: + if not self._param_check.check_param_unicode('authority', self._authority): + return False + + if self._authority is not None: + if not self._param_check.check_file_authority(self._authority): + return False + + if self._cache_control is not None: + if not self._param_check.check_param_unicode('cache_control', self._cache_control): + return False + + if self._content_type is not None: + if not self._param_check.check_param_unicode('content_type', self._content_type): + return False + + if self._content_disposition is not None: + if not self._param_check.check_param_unicode('content_disposition', self._content_disposition): + return False + + if self._content_language is not None: + if not self._param_check.check_param_unicode('content_language', self._content_language): + return False + + if self._content_encoding is not None: + if not self._param_check.check_param_unicode('content_encoding', self._content_encoding): + return False + + return self._param_check.check_x_cos_meta_dict(self._x_cos_meta_dict) + + +class StatFileRequest(BaseRequest): + """StatRequest 获取文件属性请求""" + + def __init__(self, bucket_name, cos_path): + """ + :param bucket_name: bucket的名称 + :param cos_path: cos的文件路径, 从bucket根/开始, 不以/结束 + """ + super(StatFileRequest, self).__init__(bucket_name, cos_path) + + def check_params_valid(self): + """检查参数是否合法""" + if not super(StatFileRequest, self).check_params_valid(): + return False + return self._param_check.check_cos_path_valid(self._cos_path, is_file_path=True) + + +class StatFolderRequest(BaseRequest): + """StatRequest 获取目录属性请求 """ + + def __init__(self, bucket_name, cos_path): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的目录路径, 从bucket根/开始, 以/结束 + """ + super(StatFolderRequest, self).__init__(bucket_name, cos_path) + + def check_params_valid(self): + """检查参数是否合法""" + if not super(StatFolderRequest, self).check_params_valid(): + return False + return self._param_check.check_cos_path_valid(self._cos_path, is_file_path=False) + + +class DelFileRequest(BaseRequest): + """ DelFileRequest 删除文件请求 """ + + def __init__(self, bucket_name, cos_path): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的文件路径, 从bucket根/开始, 不以/结束 + """ + super(DelFileRequest, self).__init__(bucket_name, cos_path) + + def check_params_valid(self): + """检查参数是否合法""" + if not super(DelFileRequest, self).check_params_valid(): + return False + return self._param_check.check_cos_path_valid(self._cos_path, is_file_path=True) + + +class DelFolderRequest(BaseRequest): + """DelFolderRequest 删除目录请求""" + + def __init__(self, bucket_name, cos_path): + """ + + :param bucket_name: bucket的名称 + :param cos_path: cos的目录路径, 从bucket根/开始, 以/结束 + """ + super(DelFolderRequest, self).__init__(bucket_name, cos_path) + + def check_params_valid(self): + """ 检查参数合法""" + if not super(DelFolderRequest, self).check_params_valid(): + return False + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=False): + return False + return self._param_check.check_not_cos_root(self._cos_path) + + +class ListFolderRequest(BaseRequest): + """ListFolderRequest 获取目录列表的请求""" + + def __init__(self, bucket_name, cos_path, num=199, prefix=u'', context=u''): + """ + :param bucket_name: bucket的名称 + :param cos_path: cos的绝对路径, 从bucket根/开始 + :param num: 搜索数量 + :param prefix: 搜索前缀 + :param context: 搜索上下文 + """ + super(ListFolderRequest, self).__init__(bucket_name, cos_path) + self._num = num + self._prefix = prefix + self._context = context + + def set_num(self, num): + """设置List数量 + + :param num: + :return: + """ + self._num = num + + def get_num(self): + """获取List数量 + + :return: + """ + """ + + :return: + """ + return self._num + + def set_prefix(self, prefix): + """设置前缀""" + self._prefix = prefix + + def get_prefix(self): + """获取前缀""" + return self._prefix + + def set_context(self, context): + """设置搜索上下文""" + self._context = context + + def get_context(self): + """获取搜索上下文""" + return self._context + + def check_params_valid(self): + """检查参数是否有效""" + if not super(ListFolderRequest, self).check_params_valid(): + return False + if not self._param_check.check_cos_path_valid(self._cos_path, is_file_path=False): + return False + if not self._param_check.check_param_unicode('prefix', self._prefix): + return False + return self._param_check.check_param_unicode('context', self._context) + + +class DownloadFileRequest(BaseRequest): + def __init__(self, bucket_name, cos_path, local_filename, range_start=None, range_end=None, *args, **kwargs): + super(DownloadFileRequest, self).__init__(bucket_name, cos_path) + + self._local_filename = local_filename + self._range_start = range_start + self._range_end = range_end + + def check_params_valid(self): + if not super(DownloadFileRequest, self).check_params_valid(): + return False + + from os import path + if path.exists(self._local_filename): + return False + + +class MoveFileRequest(BaseRequest): + + def __init__(self, bucket_name, cos_path, dest_path, overwrite=False): + super(MoveFileRequest, self).__init__(bucket_name, cos_path) + self._dest_path = dest_path + if isinstance(overwrite, bool): + if overwrite: + self._overwrite = 1 + else: + self._overwrite = 0 + else: + raise ValueError("overwrite must be an instance of Boolean") + + @property + def dest_path(self): + return self._dest_path + + @property + def overwrite(self): + return self._overwrite diff --git a/tools/cos/threadpool.py b/tools/cos/threadpool.py new file mode 100644 index 00000000..6bb3e283 --- /dev/null +++ b/tools/cos/threadpool.py @@ -0,0 +1,423 @@ +# -*- coding: UTF-8 -*- +"""Easy to use object-oriented thread pool framework. + +A thread pool is an object that maintains a pool of worker threads to perform +time consuming operations in parallel. It assigns jobs to the threads +by putting them in a work request queue, where they are picked up by the +next available thread. This then performs the requested operation in the +background and puts the results in another queue. + +The thread pool object can then collect the results from all threads from +this queue as soon as they become available or after all threads have +finished their work. It's also possible, to define callbacks to handle +each result as it comes in. + +The basic concept and some code was taken from the book "Python in a Nutshell, +2nd edition" by Alex Martelli, O'Reilly 2006, ISBN 0-596-10046-9, from section +14.5 "Threaded Program Architecture". I wrapped the main program logic in the +ThreadPool class, added the WorkRequest class and the callback system and +tweaked the code here and there. Kudos also to Florent Aide for the exception +handling mechanism. + +Basic usage:: + + >>> pool = ThreadPool(poolsize) + >>> requests = makeRequests(some_callable, list_of_args, callback) + >>> [pool.putRequest(req) for req in requests] + >>> pool.wait() + +See the end of the module code for a brief, annotated usage example. + +Website : http://chrisarndt.de/projects/threadpool/ + +""" +__docformat__ = "restructuredtext en" + +__all__ = [ + 'makeRequests', + 'NoResultsPending', + 'NoWorkersAvailable', + 'ThreadPool', + 'WorkRequest', + 'WorkerThread' +] + +__author__ = "Christopher Arndt" +__version__ = '1.3.2' +__license__ = "MIT license" + + +# standard library modules +import sys +import threading +import traceback + +try: + import Queue # Python 2 +except ImportError: + import queue as Queue # Python 3 + + +# exceptions +class NoResultsPending(Exception): + """All work requests have been processed.""" + pass + +class NoWorkersAvailable(Exception): + """No worker threads available to process remaining requests.""" + pass + + +# internal module helper functions +def _handle_thread_exception(request, exc_info): + """Default exception handler callback function. + + This just prints the exception info via ``traceback.print_exception``. + + """ + traceback.print_exception(*exc_info) + + +# utility functions +def makeRequests(callable_, args_list, callback=None, + exc_callback=_handle_thread_exception): + """Create several work requests for same callable with different arguments. + + Convenience function for creating several work requests for the same + callable where each invocation of the callable receives different values + for its arguments. + + ``args_list`` contains the parameters for each invocation of callable. + Each item in ``args_list`` should be either a 2-item tuple of the list of + positional arguments and a dictionary of keyword arguments or a single, + non-tuple argument. + + See docstring for ``WorkRequest`` for info on ``callback`` and + ``exc_callback``. + + """ + requests = [] + for item in args_list: + if isinstance(item, tuple): + requests.append( + WorkRequest(callable_, item[0], item[1], callback=callback, + exc_callback=exc_callback) + ) + else: + requests.append( + WorkRequest(callable_, [item], None, callback=callback, + exc_callback=exc_callback) + ) + return requests + + +# classes +class WorkerThread(threading.Thread): + """Background thread connected to the requests/results queues. + + A worker thread sits in the background and picks up work requests from + one queue and puts the results in another until it is dismissed. + + """ + + def __init__(self, requests_queue, results_queue, poll_timeout=5, **kwds): + """Set up thread in daemonic mode and start it immediatedly. + + ``requests_queue`` and ``results_queue`` are instances of + ``Queue.Queue`` passed by the ``ThreadPool`` class when it creates a + new worker thread. + + """ + threading.Thread.__init__(self, **kwds) + self.setDaemon(1) + self._requests_queue = requests_queue + self._results_queue = results_queue + self._poll_timeout = poll_timeout + self._dismissed = threading.Event() + self.start() + + def run(self): + """Repeatedly process the job queue until told to exit.""" + while True: + if self._dismissed.isSet(): + # we are dismissed, break out of loop + break + # get next work request. If we don't get a new request from the + # queue after self._poll_timout seconds, we jump to the start of + # the while loop again, to give the thread a chance to exit. + try: + request = self._requests_queue.get(True, self._poll_timeout) + #except Queue.Empty: + except: + continue + else: + if self._dismissed.isSet(): + # we are dismissed, put back request in queue and exit loop + self._requests_queue.put(request) + break + try: + result = request.callable(*request.args, **request.kwds) + self._results_queue.put((request, result)) + except: + request.exception = True + self._results_queue.put((request, sys.exc_info())) + + def dismiss(self): + """Sets a flag to tell the thread to exit when done with current job. + """ + self._dismissed.set() + + +class WorkRequest: + """A request to execute a callable for putting in the request queue later. + + See the module function ``makeRequests`` for the common case + where you want to build several ``WorkRequest`` objects for the same + callable but with different arguments for each call. + + """ + + def __init__(self, callable_, args=None, kwds=None, requestID=None, + callback=None, exc_callback=_handle_thread_exception): + """Create a work request for a callable and attach callbacks. + + A work request consists of the a callable to be executed by a + worker thread, a list of positional arguments, a dictionary + of keyword arguments. + + A ``callback`` function can be specified, that is called when the + results of the request are picked up from the result queue. It must + accept two anonymous arguments, the ``WorkRequest`` object and the + results of the callable, in that order. If you want to pass additional + information to the callback, just stick it on the request object. + + You can also give custom callback for when an exception occurs with + the ``exc_callback`` keyword parameter. It should also accept two + anonymous arguments, the ``WorkRequest`` and a tuple with the exception + details as returned by ``sys.exc_info()``. The default implementation + of this callback just prints the exception info via + ``traceback.print_exception``. If you want no exception handler + callback, just pass in ``None``. + + ``requestID``, if given, must be hashable since it is used by + ``ThreadPool`` object to store the results of that work request in a + dictionary. It defaults to the return value of ``id(self)``. + + """ + if requestID is None: + self.requestID = id(self) + else: + try: + self.requestID = hash(requestID) + except TypeError: + raise TypeError("requestID must be hashable.") + self.exception = False + self.callback = callback + self.exc_callback = exc_callback + self.callable = callable_ + self.args = args or [] + self.kwds = kwds or {} + + def __str__(self): + return "" % \ + (self.requestID, self.args, self.kwds, self.exception) + +class ThreadPool: + """A thread pool, distributing work requests and collecting results. + + See the module docstring for more information. + + """ + + def __init__(self, num_workers, q_size=0, resq_size=0, poll_timeout=5): + """Set up the thread pool and start num_workers worker threads. + + ``num_workers`` is the number of worker threads to start initially. + + If ``q_size > 0`` the size of the work *request queue* is limited and + the thread pool blocks when the queue is full and it tries to put + more work requests in it (see ``putRequest`` method), unless you also + use a positive ``timeout`` value for ``putRequest``. + + If ``resq_size > 0`` the size of the *results queue* is limited and the + worker threads will block when the queue is full and they try to put + new results in it. + + .. warning: + If you set both ``q_size`` and ``resq_size`` to ``!= 0`` there is + the possibilty of a deadlock, when the results queue is not pulled + regularly and too many jobs are put in the work requests queue. + To prevent this, always set ``timeout > 0`` when calling + ``ThreadPool.putRequest()`` and catch ``Queue.Full`` exceptions. + + """ + self._requests_queue = Queue.Queue(q_size) + self._results_queue = Queue.Queue(resq_size) + self.workers = [] + self.dismissedWorkers = [] + self.workRequests = {} + self.createWorkers(num_workers, poll_timeout) + + def createWorkers(self, num_workers, poll_timeout=5): + """Add num_workers worker threads to the pool. + + ``poll_timout`` sets the interval in seconds (int or float) for how + ofte threads should check whether they are dismissed, while waiting for + requests. + + """ + for i in range(num_workers): + self.workers.append(WorkerThread(self._requests_queue, + self._results_queue, poll_timeout=poll_timeout)) + + def dismissWorkers(self, num_workers, do_join=False): + """Tell num_workers worker threads to quit after their current task.""" + dismiss_list = [] + for i in range(min(num_workers, len(self.workers))): + worker = self.workers.pop() + worker.dismiss() + dismiss_list.append(worker) + + if do_join: + for worker in dismiss_list: + worker.join() + else: + self.dismissedWorkers.extend(dismiss_list) + + def joinAllDismissedWorkers(self): + """Perform Thread.join() on all worker threads that have been dismissed. + """ + for worker in self.dismissedWorkers: + worker.join() + self.dismissedWorkers = [] + + def putRequest(self, request, block=True, timeout=None): + """Put work request into work queue and save its id for later.""" + assert isinstance(request, WorkRequest) + # don't reuse old work requests + assert not getattr(request, 'exception', None) + self._requests_queue.put(request, block, timeout) + self.workRequests[request.requestID] = request + + def poll(self, block=False): + """Process any new results in the queue.""" + while True: + # still results pending? + if not self.workRequests: + raise NoResultsPending + # are there still workers to process remaining requests? + elif block and not self.workers: + raise NoWorkersAvailable + try: + # get back next results + request, result = self._results_queue.get(block=block) + # has an exception occured? + if request.exception and request.exc_callback: + request.exc_callback(request, result) + # hand results to callback, if any + if request.callback and not \ + (request.exception and request.exc_callback): + request.callback(request, result) + del self.workRequests[request.requestID] + #except Queue.Empty: + except: + break + + def wait(self): + """Wait for results, blocking until all have arrived.""" + while 1: + try: + self.poll(True) + except NoResultsPending: + break + + +################ +# USAGE EXAMPLE +################ + +if __name__ == '__main__': + import random + import time + + # the work the threads will have to do (rather trivial in our example) + def do_something(data): + time.sleep(random.randint(1,5)) + result = round(random.random() * data, 5) + # just to show off, we throw an exception once in a while + if result > 5: + raise RuntimeError("Something extraordinary happened!") + return result + + # this will be called each time a result is available + def print_result(request, result): + print("**** Result from request #%s: %r" % (request.requestID, result)) + + # this will be called when an exception occurs within a thread + # this example exception handler does little more than the default handler + def handle_exception(request, exc_info): + if not isinstance(exc_info, tuple): + # Something is seriously wrong... + print(request) + print(exc_info) + raise SystemExit + print("**** Exception occured in request #%s: %s" % \ + (request.requestID, exc_info)) + + # assemble the arguments for each job to a list... + data = [random.randint(1,10) for i in range(20)] + # ... and build a WorkRequest object for each item in data + requests = makeRequests(do_something, data, print_result, handle_exception) + # to use the default exception handler, uncomment next line and comment out + # the preceding one. + #requests = makeRequests(do_something, data, print_result) + + # or the other form of args_lists accepted by makeRequests: ((,), {}) + data = [((random.randint(1,10),), {}) for i in range(20)] + requests.extend( + makeRequests(do_something, data, print_result, handle_exception) + #makeRequests(do_something, data, print_result) + # to use the default exception handler, uncomment next line and comment + # out the preceding one. + ) + + # we create a pool of 3 worker threads + print("Creating thread pool with 3 worker threads.") + main = ThreadPool(3) + + # then we put the work requests in the queue... + for req in requests: + main.putRequest(req) + print("Work request #%s added." % req.requestID) + # or shorter: + # [main.putRequest(req) for req in requests] + + # ...and wait for the results to arrive in the result queue + # by using ThreadPool.wait(). This would block until results for + # all work requests have arrived: + # main.wait() + + # instead we can poll for results while doing something else: + i = 0 + while True: + try: + time.sleep(0.5) + main.poll() + print("Main thread working...") + print("(active worker threads: %i)" % (threading.activeCount()-1, )) + if i == 10: + print("**** Adding 3 more worker threads...") + main.createWorkers(3) + if i == 20: + print("**** Dismissing 2 worker threads...") + main.dismissWorkers(2) + i += 1 + except KeyboardInterrupt: + print("**** Interrupted!") + break + except NoResultsPending: + print("**** No pending results.") + break + if main.dismissedWorkers: + print("Joining all dismissed worker threads...") + main.joinAllDismissedWorkers() diff --git a/tools/coscmd b/tools/coscmd new file mode 100755 index 00000000..bd0a814c --- /dev/null +++ b/tools/coscmd @@ -0,0 +1,501 @@ +#!/usr/bin/env python +#coding:utf-8 + +import sys,os +import datetime +import random +import threading +import time +import datetime +import logging +import ConfigParser +from optparse import OptionParser +from logging.handlers import RotatingFileHandler +from time import strftime, localtime +from time import sleep +from datetime import date +from datetime import timedelta +from cos import CosClient +from cos import UploadFileRequest +from cos import CreateFolderRequest +from cos import DelFileRequest +from cos import DelFolderRequest +from cos import ListFolderRequest +from cos import threadpool + +MAX_RETRY_TIMES = 3 +LOG_SAVE_EVERY_NUM = 1024 +ONE_TASK_DEL_FILE_NUMS = 50 +log_level = 1 +log_file_name = "del_file.log" +dir_thread_num = 2 +file_thread_num = 5 +log_out_to_screen = 1 +delete_folder_fail_exist = 0 + +CONFIGFILE = "%s/.coscredentials" % os.path.expanduser('~') +CONFIGSECTION = 'COSCredentials' + +HAS_FORK = hasattr(os, 'fork') + +HELP = \ +'''coscmd: + config --appid=[appid] --id=[secret_id] --key=[secret_key] --region=[region] --bucket=[bucket] + ls cosdir + mkdir dirname + put localfile cosdir + rm(delete,del) object + ''' + +CMD_LIST = {} +def cmd_configure(args, options): + if options.appid is None or options.secret_id is None or options.secret_key is None or options.region is None or options.bucket is None: + print("%s miss parameters, use --appid=[appid] --id=[secret_id] --key=[secret_key] --region=[region] --bucket=[bucket] to specify appid/id/key/region/bucket pair" % args[0]) + sys.exit(-1) + config = ConfigParser.RawConfigParser() + config.add_section(CONFIGSECTION) + config.set(CONFIGSECTION, 'appid', options.appid) + config.set(CONFIGSECTION, 'secret_id', options.secret_id) + config.set(CONFIGSECTION, 'secret_key', options.secret_key) + if options.region in ['sh','gz','tj','sgp']: + config.set(CONFIGSECTION, 'region', options.region) + else: + print("input region error, setup use : --region={sh,gz,tj,sgp}") + sys.exit(-1) + config.set(CONFIGSECTION, 'bucket', options.bucket) + cfgfile = open(CONFIGFILE, 'w+') + config.write(cfgfile) + print("Your configuration is saved into %s ." % CONFIGFILE) + cfgfile.close() + import stat + os.chmod(CONFIGFILE, stat.S_IREAD | stat.S_IWRITE) + +def cmd_loadconfigure(): + config = ConfigParser.ConfigParser() + config.read(CONFIGFILE) + global appid + global secret_id + global secret_key + global region + global bucket + appid = int(config.get(CONFIGSECTION, 'appid')) + secret_id = config.get(CONFIGSECTION, 'secret_id').decode('utf-8') + secret_key = config.get(CONFIGSECTION, 'secret_key').decode('utf-8') + region = config.get(CONFIGSECTION, 'region') + bucket = config.get(CONFIGSECTION, 'bucket').decode('utf-8') + if len(secret_id) == 0 or len(secret_key) == 0 or len(region) == 0 or len(bucket) == 0: + print("can't get appid/secret_id/secret_key/region/bucket, setup use : config --appid=[appid] --id=[secret_id] --key=[secret_key] --region=[region] --bucket=[bucket]") + sys.exit(1) + +def cmd_lsdir(COSDIR): + cosdir = COSDIR.decode('utf-8') + request = ListFolderRequest(bucket, cosdir) + list_folder_ret = cos_client.list_folder(request) + if list_folder_ret[u'code'] == 0: + print(True) + else: + print("%s, appid/secret_id/secret_key/region/bucket invalid"% list_folder_ret[u'message']) + +def cmd_mkdir(COSDIR): + cosdir = COSDIR.decode('utf-8') + request = CreateFolderRequest(bucket, cosdir) + create_folder_ret = cos_client.create_folder(request) + if create_folder_ret[u'code'] == 0: + print("mkdir cos://%s%s OK" % (bucket,COSDIR)) + else: + print(create_folder_ret[u'message']) + +def cmd_put(LOCALFILE,COSFILE): + localfile = LOCALFILE.decode('utf-8') + cosfile = COSFILE.decode('utf-8') + request = UploadFileRequest(bucket, cosfile, localfile) + request.set_insert_only(0) + upload_file_ret = cos_client.upload_file(request) + if upload_file_ret[u'code'] == 0: + print("put cos://%s%s OK" % (bucket,COSFILE)) + else: + print(upload_file_ret[u'message']) + +def loginit(): + global config + if (log_file_name == ""): + return + log_level = logging.ERROR + if log_level == 0: + log_level = logging.DEBUG + if log_level == 1: + log_level = logging.INFO + if log_level == 2: + log_level = logging.WARNING + + #定义一个RotatingFileHandler,最多备份5个日志文件,每个日志文件最大20M + logger = logging.getLogger("") + Rthandler = RotatingFileHandler(log_file_name, maxBytes= 20*1024*1024,backupCount=5) + Rthandler.setLevel(log_level) + formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + Rthandler.setFormatter(formatter) + logger.addHandler(Rthandler) + #输出日志到屏幕 + console = logging.StreamHandler() + console.setFormatter(formatter) + if (log_out_to_screen == 1): + logger.addHandler(console) + + logger.setLevel(log_level) + return logger + +#日期相关操作 +class Dateop(): + @staticmethod + def isValidDate(str): + try: + time.strptime(str, "%Y""%m""%d") + return True + except: + return False + + @staticmethod + def getdaystr(n=0): + dt = date.today()-timedelta(days=n) + tt = dt.timetuple() + daystr = strftime("%Y""%m""%d",tt) + return daystr + + @staticmethod + def cmpDateAgo(t1,t2): + if (Dateop.isValidDate(t1)==False or Dateop.isValidDate(t2)==False): + return False + if (int(t1) <= int (t2)): + return True + return False + + @staticmethod + def isNeedDeleteDir(dirname, n=0): + if (len(dirname) != 8): + return False + if Dateop.isValidDate(dirname) == False: + return False + d2 = Dateop.getdaystr(n); + if Dateop.cmpDateAgo(dirname, d2): + return True + return False +#删除文件统计 +class FileStat(): + global cos_log + def __init__(self): + self.delfilesuccnum = 0 + self.deldirsuccnum = 0 + self.delfilefailnum = 0 + self.deldirfailnum = 0 + self.lock = threading.Lock() + + def addDelFileFailNum(self,num=1): + self.lock.acquire(1) + self.delfilefailnum += num + self.lock.release() + def addDelDirFailNum(self,num=1): + self.lock.acquire(1) + self.deldirfailnum += num + self.lock.release() + def addDelDirSuccNum(self, num=1): + self.lock.acquire(1) + self.deldirsuccnum += num + self.lock.release() + def addDelFileSuccNum(self, num=1): + self.lock.acquire(1) + self.delfilesuccnum += num + self.lock.release() + def printStat(self): + msg ="".join(["delfilesuccnum=",str(self.delfilesuccnum), + ",delfilefailnum=",str(self.delfilefailnum), + ",deldirsuccnum=",str(self.deldirsuccnum), + ",deldirfailnum=",str(self.deldirfailnum)]) + print(msg) + def logStat(self): + curtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + log = ''.join(["delfilenum=",str(self.delfilesuccnum), + ",deldirnum=",str(self.deldirsuccnum),",delfilefailnum=", + str(self.delfilefailnum),",deldirfailnum=",str(self.deldirfailnum)]) + cos_log.info(log) + +#执行时间统计 +class TimeStat(object): + global cos_log + def __init__(self): + self.start() + def start(self): + self.start = datetime.datetime.now() + self.t1 = time.time() + msg = "delete task started ..........." + cos_log.info(msg) + def end(self): + self.end = datetime.datetime.now() + self.t2 = time.time() + msg = "delete task ended\n\nrm task finished,\ntimecost:"+str(self.t2-self.t1) + " (s)" + cos_log.info(msg) + +#删除文件列表中的文件 +def delfiles(cos_client, bucket, filelist): + for f in filelist: + delfile(cos_client, bucket, f) + +def delfolders(cos_client, bucket, folderlist): + for f in folderlist: + delfolder(cos_client, bucket, f) +#文件夹删除 +def delfolder(cos_client, bucket, folder): + global stat + global cos_log + if not folder: + return 0 + delfolderreq = DelFolderRequest(bucket, folder) + retry = 0 + while (retry < MAX_RETRY_TIMES): + ret = cos_client.del_folder(delfolderreq) + msg = "delfolder fail, bucket="+bucket+",folder="+folder+ret['message'] + if (ret['code'] == 0): + break + elif (ret['code'] == -166): + cos_log.warning(msg) + break + #操作太频繁,频控 + elif (ret['code'] == -71): + sleep(random.randint(1,5)) + cos_log.warning(msg) + retry += 1 + continue + #文件夹非空 + elif (ret['code'] == -173): + break + else: + cos_log.warning(msg) + retry += 1 + if (ret['code'] != 0 and ret['code'] != -166): + stat.addDelDirFailNum() + cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+ret['message']) + return ret['code'] + if (ret['code'] == 0): + stat.addDelDirSuccNum() + msg = "delfolder success, bucket="+bucket+",folder="+folder + cos_log.info(msg) + return 0 + +#文件删除 +def delfile(cos_client, bucket, filepath): + global stat + global cos_log + delfilereq = DelFileRequest(bucket, filepath) + retry = 0 + while (retry < MAX_RETRY_TIMES): + ret = cos_client.del_file(delfilereq) + msg = "delfile fail bucket="+bucket+",file="+filepath+ret['message'] + if (ret['code'] == 0): + break + #文件不存在 + elif (ret['code'] == -166): + cos_log.warning(msg) + break + #单目录写操作过快 + elif (ret['code'] == -143): + sleep(random.randint(1,5)) + cos_log.warning(msg) + retry += 1 + continue + #操作太频繁,频控 + elif (ret['code'] == -71): + sleep(random.randint(1,5)) + cos_log.warning(msg) + retry += 1 + continue + else: + cos_log.warning(msg) + retry += 1 + continue + if (ret['code'] != 0 and ret['code'] != -166): + stat.addDelFileFailNum() + cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+ret['message']) + return ret['code'] + if (ret['code'] == 0): + stat.addDelFileSuccNum() + msg = "delfile success, bucket="+bucket+",file="+filepath + cos_log.info(msg) + return 0 + +#递归文件夹进行文件删除 +def delete_r(cos_client, bucket, path, thread_pool_file): + global stat + global config + global cos_log + cos_log.debug("delete_r bucket:"+bucket+",path:"+path) + context = u"" + #递归文件夹 + while True: + listfolderreq = ListFolderRequest(bucket, path, 1000, u'', context) + retry = 0 + while (retry < MAX_RETRY_TIMES): + listret = cos_client.list_folder(listfolderreq) + if listret['code'] != 0 : + retry += 1 + sleep(random.randint(1,3)) + continue + else: + break + if (listret['code'] != 0): + cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ listret['message']) + return listret['code'] + if (len(listret['data']['infos']) == 0): + break; + filelist = [] + dirlist = [] + for info in listret['data']['infos']: + fullname = path + info['name'] + #list出来的文件列表中文件夹和文件本身是混杂一起的 + if info.has_key('filesize'): + filelist.append(fullname) + if (len(filelist) >= ONE_TASK_DEL_FILE_NUMS): + args = [cos_client, bucket, filelist] + args_tuple = (args,None) + args_list = [args_tuple] + requests = threadpool.makeRequests(delfiles, args_list) + for req in requests: + thread_pool_file.putRequest(req) + filelist = [] + continue + else: + pass + else: + dirlist.append(fullname) + if (len(dirlist) >= ONE_TASK_DEL_FILE_NUMS): + args = [cos_client, bucket, dirlist] + args_tuple = (args,None) + args_list = [args_tuple] + requests = threadpool.makeRequests(delfolders, args_list) + for req in requests: + thread_pool_file.putRequest(req) + dirlist = [] + continue + else: + pass + pass + + if (len(filelist) > 0): + args = [cos_client, bucket, filelist] + args_tuple = (args,None) + args_list = [args_tuple] + requests = threadpool.makeRequests(delfiles, args_list) + for req in requests: + thread_pool_file.putRequest(req) + filelist = [] + else: + pass + + if (len(dirlist) > 0): + args = [cos_client, bucket, dirlist] + args_tuple = (args,None) + args_list = [args_tuple] + requests = threadpool.makeRequests(delfolders, args_list) + for req in requests: + thread_pool_file.putRequest(req) + filelist = [] + else: + pass + + cos_log.debug("delete_r thread pool file waiting\n") + thread_pool_file.wait() + cos_log.debug("delete_r thread pool file waiting end\n") + + if (listret['data']['listover'] == False): + context = listret['data']['context'] + continue + else: + break + + stat.logStat() + return 0 +#支持Ctrl+C终止程序 +class Watcher(): + + def __init__(self): + self.child = os.fork() + if self.child == 0: + return + else: + self.watch() + + def watch(self): + global cos_log + try: + os.wait() + except KeyboardInterrupt: + cos_log.ERROR("ctrl+c terminated rm_recursive.py, exiting...") + self.kill() + sys.exit() + def kill(self): + try: + os.kill(self.child, signal.SIGKILL) + except OSError: + pass +def cmd_rm(COSDIR): + global thread_pool + global cos_log + global stat + cos_log = loginit() + stat = FileStat() + timestat = TimeStat() + if HAS_FORK: + Watcher() + path = COSDIR.decode('utf-8') + thread_pool_dir = threadpool.ThreadPool(dir_thread_num) + thread_pool_file = threadpool.ThreadPool(file_thread_num) + cos_log.debug("bucket:"+bucket +",path:"+path) + args = [cos_client, bucket, path, thread_pool_file] + args_tuple = (args, None) + args_list = [args_tuple] + requests = threadpool.makeRequests(delete_r, args_list) + for req in requests: + thread_pool_dir.putRequest(req) + + cos_log.debug("thread_pool_dir waiting.....\n") + thread_pool_dir.wait() + thread_pool_dir.dismissWorkers(dir_thread_num, True) + cos_log.debug("thread_pool_dir wait end.....\n") + + timestat.end() + stat.logStat() + +if sys.argv[1] in ['config','ls','mkdir','put','rm','delete','del'] and len(sys.argv) >= 3: + if sys.argv[1] == 'config': + parser = OptionParser() + parser.add_option("-a", "--appid", dest="appid", help="specify appid") + parser.add_option("-i", "--id", dest="secret_id", help="specify secret id") + parser.add_option("-k", "--key", dest="secret_key", help="specify secret key") + parser.add_option("-r", "--region", dest="region", help="specify region") + parser.add_option("-b", "--bucket", dest="bucket", help="specify bucket") + (options, args) = parser.parse_args() + CMD_LIST['config'] = cmd_configure + CMD_LIST['config'](args, options) + if sys.argv[1] == 'ls': + cmd_loadconfigure() + cos_client = CosClient(appid, secret_id, secret_key, region) + COSDIR = sys.argv[2] + cmd_lsdir(COSDIR) + if sys.argv[1] == 'mkdir': + cmd_loadconfigure() + cos_client = CosClient(appid, secret_id, secret_key, region) + COSDIR = sys.argv[2] + cmd_mkdir(COSDIR) + if sys.argv[1] == 'put' and len(sys.argv) == 4: + cmd_loadconfigure() + cos_client = CosClient(appid, secret_id, secret_key, region) + LOCALFILE = sys.argv[2] + COSFILE = sys.argv[3] + cmd_put(LOCALFILE,COSFILE) + if sys.argv[1] in ('rm','delete','del'): + cmd_loadconfigure() + cos_client = CosClient(appid, secret_id, secret_key, region) + COSDIR = sys.argv[2] + path = COSDIR.decode('utf-8') + cmd_rm(path) +else: + print(HELP) + exit() diff --git a/versions.txt b/versions.txt index c4d2e399..c4f0e559 100644 --- a/versions.txt +++ b/versions.txt @@ -5,16 +5,16 @@ tengine_version=2.1.2 openresty_version=1.11.2.2 openssl_version=1.0.2k -tomcat8_version=8.0.42 -tomcat7_version=7.0.76 +tomcat8_version=8.0.43 +tomcat7_version=7.0.77 tomcat6_version=6.0.51 apache24_version=2.4.25 apache22_version=2.2.32 -pcre_version=8.39 +pcre_version=8.40 apr_version=1.5.2 apr_util_version=1.5.4 -nghttp2_version=1.18.1 +nghttp2_version=1.21.0 # DB mysql57_version=5.7.17 @@ -25,9 +25,9 @@ mariadb101_version=10.1.22 mariadb100_version=10.0.30 mariadb55_version=5.5.54 -percona57_version=5.7.17-11 -percona56_version=5.6.35-80.0 -percona55_version=5.5.54-38.6 +percona57_version=5.7.17-12 +percona56_version=5.6.35-81.0 +percona55_version=5.5.54-38.7 alisql56_version=5.6.32-4 @@ -48,13 +48,13 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.8 -ImageMagick_version=6.9.8-2 +ImageMagick_version=6.9.8-3 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 -libiconv_version=1.14 +libiconv_version=1.15 curl_version=7.53.1 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 @@ -66,11 +66,11 @@ pureftpd_version=1.0.45 # Redis redis_version=3.2.8 -redis_pecl_for_php7_version=3.1.1 +redis_pecl_for_php7_version=3.1.2 redis_pecl_version=2.2.8 # Memcached -memcached_version=1.4.35 +memcached_version=1.4.36 libmemcached_version=1.0.18 memcached_pecl_version=2.2.0 memcached_pecl_php7_version=3.0.3 @@ -86,7 +86,7 @@ jemalloc_version=4.5.0 boost_version=1.59.0 # Others -libevent_version=2.0.22-stable +libevent_version=2.1.8-stable tmux_version=2.3 htop_version=2.0.2 bison_version=2.7.1 diff --git a/vhost.sh b/vhost.sh index 91dc0f58..ee371364 100755 --- a/vhost.sh +++ b/vhost.sh @@ -186,7 +186,7 @@ Create_SSL() { for D in ${domain} ${moredomainame} do Domain_IPADDR=$(ping ${D} -c1 | sed '1{s/[^(]*(//;s/).*//;q}') - [ "${PUBLIC_IPADDR}" != "${Domain_IPADDR}" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for ${D}${CEND}"; echo; exit 1; } + [ "${PUBLIC_IPADDR%.*}" != "${Domain_IPADDR%.*}" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for ${D}${CEND}"; echo; exit 1; } done #add Email @@ -571,9 +571,9 @@ server { server_name ${domain}${moredomainame}; ${N_log} index index.html index.htm index.php; - include ${web_install_dir}/conf/rewrite/${rewrite}.conf; root ${vhostdir}; ${Nginx_redirect} + include ${web_install_dir}/conf/rewrite/${rewrite}.conf; #error_page 404 = /404.html; #error_page 502 = /502.html; ${anti_hotlinking} From 1924d02f761015c0b49d371a023ce451781c2d2e Mon Sep 17 00:00:00 2001 From: "lj2007331@gmail.com" Date: Mon, 15 May 2017 12:04:01 +0800 Subject: [PATCH 617/617] Update MySQL5.5 --- addons.sh | 1 + backup.sh | 26 ++++++++---------- backup_setup.sh | 6 +++- config/magento2.conf | 2 +- config/nginx.conf | 49 +++++++++++++++++---------------- config/nginx_apache.conf | 55 +++++++++++++++++++------------------ config/nginx_tomcat.conf | 45 +++++++++++++++--------------- config/server.xml | 1 - include/apache-2.4.sh | 3 +- include/check_download.sh | 58 ++++++++++++++++++++++----------------- include/check_os.sh | 6 ++-- include/check_sw.sh | 2 +- include/mysql-5.5.sh | 4 +-- include/redis.sh | 2 +- include/tomcat-6.sh | 4 +-- include/tomcat-7.sh | 4 +-- include/tomcat-8.sh | 4 +-- include/upgrade_db.sh | 2 -- tools/coscmd | 29 ++++++++++++-------- versions.txt | 36 ++++++++++++------------ vhost.sh | 22 +++++++-------- 21 files changed, 188 insertions(+), 173 deletions(-) diff --git a/addons.sh b/addons.sh index 7083150e..d1ece37a 100755 --- a/addons.sh +++ b/addons.sh @@ -128,6 +128,7 @@ Install_fail2ban() { LOGPATH=/var/log/secure /bin/cp files/redhat-initd /etc/init.d/fail2ban sed -i "s@^FAIL2BAN=.*@FAIL2BAN=${python_install_dir}/bin/fail2ban-client@" /etc/init.d/fail2ban + sed -i 's@Starting fail2ban.*@&\n [ ! -e "/var/run/fail2ban" ] \&\& mkdir /var/run/fail2ban@' /etc/init.d/fail2ban chmod +x /etc/init.d/fail2ban chkconfig --add fail2ban chkconfig fail2ban on diff --git a/backup.sh b/backup.sh index 30b65a59..3a89cc15 100755 --- a/backup.sh +++ b/backup.sh @@ -69,45 +69,41 @@ WEB_COS_BK() { for W in `echo $website_name | tr ',' ' '` do [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist"; break; } - Web_FILE="Web_${W}_$(date +%Y%m%d_%H).tgz" - if [ ! -e "$backup_dir/$Web_FILE" ];then + PUSH_FILE="$backup_dir/Web_${W}_$(date +%Y%m%d_%H).tgz" + if [ ! -e "$PUSH_FILE" ]; then pushd $wwwroot_dir - tar czf $Web_FILE ./$W + tar czf $PUSH_FILE ./$W popd - PUSH_FILE="$wwwroot_dir/$Web_FILE" - else - PUSH_FILE="$backup_dir/$Web_FILE" fi - - ${python_install_dir}/bin/python ./coscmd put $PUSH_FILE /`date +%F`/$Web_FILE - [ $? -eq 0 ] && { [ -e "$wwwroot_dir/$Web_FILE" ] && rm -rf $wwwroot_dir/$Web_FILE; ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1; } + ${python_install_dir}/bin/python ./coscmd put $PUSH_FILE /`date +%F`/Web_${W}_$(date +%Y%m%d_%H).tgz + [ $? -eq 0 ] && { [ -e "$PUSH_FILE" ] && rm -rf $PUSH_FILE; ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1; } done } -if [ "$backup_destination" == 'local' ];then +if [ "$backup_destination" == 'local' ]; then [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK -elif [ "$backup_destination" == 'remote' ];then +elif [ "$backup_destination" == 'remote' ]; then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log -elif [ "$backup_destination" == 'cos' ];then +elif [ "$backup_destination" == 'cos' ]; then [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK -elif [ "$backup_destination" == 'local,remote' ];then +elif [ "$backup_destination" == 'local,remote' ]; then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log -elif [ "$backup_destination" == 'local,cos' ];then +elif [ "$backup_destination" == 'local,cos' ]; then [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK -elif [ "$backup_destination" == 'remote,cos' ];then +elif [ "$backup_destination" == 'remote,cos' ]; then echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK diff --git a/backup_setup.sh b/backup_setup.sh index c3ff061d..94fba0bd 100755 --- a/backup_setup.sh +++ b/backup_setup.sh @@ -17,10 +17,14 @@ printf " # For more information please visit https://oneinstack.com # ####################################################################### " +# get pwd +sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf . ./options.conf +. ./versions.txt . ./include/color.sh . ./include/check_dir.sh +. ./include/download.sh . ./include/python.sh # Check if user is root @@ -107,7 +111,7 @@ if [ "$CONTENT_BK" != '2' ]; then sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf fi -if [ "$CONTENT_BK" != '1' ];then +if [ "$CONTENT_BK" != '1' ]; then websites=`ls $wwwroot_dir | grep -vw default` while :; do echo echo "Please enter one or more name for website, separate multiple website names with commas: " diff --git a/config/magento2.conf b/config/magento2.conf index 5474a712..5b3708bb 100644 --- a/config/magento2.conf +++ b/config/magento2.conf @@ -6,7 +6,7 @@ server { index index.php; autoindex off; charset UTF-8; - error_page 404 403 = /errors/404.php; + error_page 404 403 /errors/404.php; #add_header "X-UA-Compatible" "IE=Edge"; # PHP entry point for setup application diff --git a/config/nginx.conf b/config/nginx.conf index 38550cb3..c0af2d92 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -59,36 +59,37 @@ http { ######################## default ############################ server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.php; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.php; + #error_page 404 /404.html; + #error_page 502 /502.html; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; } - location ~ [^/]\.php(/|$) { - #fastcgi_pass remote_php_ip:9000; - fastcgi_pass unix:/dev/shm/php-cgi.sock; - fastcgi_index index.php; - include fastcgi.conf; + location ~ [^/]\.php(/|$) { + #fastcgi_pass remote_php_ip:9000; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_index index.php; + include fastcgi.conf; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; } - location ~ /\.ht { - deny all; + location ~ /\.ht { + deny all; } } - ########################## vhost ############################# include vhost/*.conf; } diff --git a/config/nginx_apache.conf b/config/nginx_apache.conf index ece8deaf..8ae472f0 100644 --- a/config/nginx_apache.conf +++ b/config/nginx_apache.conf @@ -59,41 +59,42 @@ http { ######################## default ############################ server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.php; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.php; + #error_page 404 /404.html; + #error_page 502 /502.html; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; } - location / { - try_files $uri @apache; + location / { + try_files $uri @apache; } - location @apache { - proxy_pass http://127.0.0.1:88; - include proxy.conf; + location @apache { + proxy_pass http://127.0.0.1:88; + include proxy.conf; } - location ~ [^/]\.php(/|$) { - proxy_pass http://127.0.0.1:88; - include proxy.conf; + location ~ [^/]\.php(/|$) { + proxy_pass http://127.0.0.1:88; + include proxy.conf; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; } - location ~ /\.ht { - deny all; + location ~ /\.ht { + deny all; } } - ########################## vhost ############################# include vhost/*.conf; } diff --git a/config/nginx_tomcat.conf b/config/nginx_tomcat.conf index da082c79..090acaa9 100644 --- a/config/nginx_tomcat.conf +++ b/config/nginx_tomcat.conf @@ -59,34 +59,35 @@ http { ######################## default ############################ server { - listen 80; - server_name _; - access_log /data/wwwlogs/access_nginx.log combined; - root /data/wwwroot/default; - index index.html index.htm index.jsp; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; + listen 80; + server_name _; + access_log /data/wwwlogs/access_nginx.log combined; + root /data/wwwroot/default; + index index.html index.htm index.jsp; + #error_page 404 /404.html; + #error_page 502 /502.html; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { - expires 30d; - access_log off; + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { + expires 30d; + access_log off; } - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; } - location ~ { - proxy_pass http://127.0.0.1:8080; - include proxy.conf; + location ~ { + proxy_pass http://127.0.0.1:8080; + include proxy.conf; } - location ~ /\.ht { - deny all; + location ~ /\.ht { + deny all; } } - ########################## vhost ############################# include vhost/*.conf; } diff --git a/config/server.xml b/config/server.xml index 64ec73a1..1ba0a989 100644 --- a/config/server.xml +++ b/config/server.xml @@ -27,7 +27,6 @@ minSpareThreads="20" acceptCount="1000" maxHttpHeaderSize="65536" - debug="0" disableUploadTimeout="true" useBodyEncodingForURI="true" enableLookups="false" diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index d498f037..d6926d21 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -140,13 +140,12 @@ EOF ProtocolsHonorOrder On -Protocols h2 http/1.1 PidFile /var/run/httpd.pid ServerTokens ProductOnly ServerSignature Off Include conf/vhost/*.conf EOF - + [ "${Nginx_version}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ] && echo 'Protocols h2 http/1.1' >> ${apache_install_dir}/conf/httpd.conf if [ "${Nginx_version}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF LoadModule remoteip_module modules/mod_remoteip.so diff --git a/include/check_download.sh b/include/check_download.sh index d227ae1a..0d08056c 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -109,16 +109,18 @@ checkDownload() { if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7 else DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7 fi else if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.7 + DOWN_ADDR_MYSQL_BK=http://mysql.he.net/Downloads/MySQL-5.7 else DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.7 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=http://cdn.mysql.com/Downloads/MySQL-5.7 fi fi fi @@ -131,9 +133,9 @@ checkDownload() { fi # start download wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME} - wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) # verifying download + MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 @@ -156,16 +158,18 @@ checkDownload() { if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6 else DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6 fi else if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.6 + DOWN_ADDR_MYSQL_BK=http://mysql.he.net/Downloads/MySQL-5.6 else DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.6 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=http://cdn.mysql.com/Downloads/MySQL-5.6 fi fi fi @@ -177,8 +181,9 @@ checkDownload() { FILE_NAME=mysql-${mysql56_version}.tar.gz 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + # verifying download + MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 @@ -201,30 +206,33 @@ checkDownload() { if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then if [ "$(../include/check_port.py mirrors.tuna.tsinghua.edu.cn 443)" == "True" ]; then DOWN_ADDR_MYSQL=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.5 else DOWN_ADDR_MYSQL=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5 fi else if [ "$(../include/check_port.py cdn.mysql.com 80)" == "True" ]; then DOWN_ADDR_MYSQL=http://cdn.mysql.com/Downloads/MySQL-5.5 + DOWN_ADDR_MYSQL_BK=http://mysql.he.net/Downloads/MySQL-5.5 else DOWN_ADDR_MYSQL=http://mysql.he.net/Downloads/MySQL-5.5 - DOWN_ADDR_MYSQL_BK=${DOWN_ADDR_MYSQL} + DOWN_ADDR_MYSQL_BK=http://cdn.mysql.com/Downloads/MySQL-5.5 fi fi fi if [ "${dbInstallMethods}" == '1' ]; then echo "Download MySQL 5.5 binary package..." - FILE_NAME=mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}.tar.gz + FILE_NAME=mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz elif [ "${dbInstallMethods}" == '2' ]; then echo "Download MySQL 5.5 source package..." FILE_NAME=mysql-${mysql55_version}.tar.gz src_url=${mirrorLink}/mysql-5.5-fix-arm-client_plugin.patch && Download_src 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}.md5 - MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5) + # verifying download + MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -Lk ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}') tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1 @@ -368,9 +376,9 @@ checkDownload() { FILE_NAME=percona-server-${percona57_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.7/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + DOWN_ADDR_PERCONA_BK=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${DOWN_ADDR_PERCONA_BK}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_BK}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') @@ -378,7 +386,7 @@ checkDownload() { fi tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1 let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue done @@ -403,9 +411,9 @@ checkDownload() { FILE_NAME=percona-server-${percona56_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + DOWN_ADDR_PERCONA_BK=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${DOWN_ADDR_PERCONA_BK}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_BK}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') @@ -413,7 +421,7 @@ checkDownload() { fi tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1 let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue done @@ -438,9 +446,9 @@ checkDownload() { FILE_NAME=percona-server-${percona55_version}.tar.gz if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then DOWN_ADDR_PERCONA=${mirrorLink} - DOWN_ADDR_PERCONA_2=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/source/tarball - PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') - [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${mirrorLink}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_2}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } + DOWN_ADDR_PERCONA_BK=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/source/tarball + PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') + [ -z "${PERCONA_TAR_MD5}" ] && { DOWN_ADDR_PERCONA=${DOWN_ADDR_PERCONA_BK}; PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA_BK}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}'); } else DOWN_ADDR_PERCONA=https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_version}/source/tarball PERCONA_TAR_MD5=$(curl -Lk ${DOWN_ADDR_PERCONA}/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}') @@ -448,7 +456,7 @@ checkDownload() { fi tryDlCount=0 while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do - wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME};sleep 1 + wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1 let "tryDlCount++" [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue done diff --git a/include/check_os.sh b/include/check_os.sh index d0772120..dea1e0e6 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -10,9 +10,9 @@ if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ]; then OS=CentOS - [ -n "$(grep ' 7\.' /etc/redhat-release)" ] && CentOS_RHEL_version=7 - [ -n "$(grep ' 6\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6 - [ -n "$(grep ' 5\.' /etc/redhat-release)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5 + [ -n "$(grep ' 7\.' /etc/redhat-release 2> /dev/null)" ] && CentOS_RHEL_version=7 + [ -n "$(grep ' 6\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release6 15' /etc/issue)" ] && CentOS_RHEL_version=6 + [ -n "$(grep ' 5\.' /etc/redhat-release 2> /dev/null)" -o -n "$(grep 'Aliyun Linux release5' /etc/issue)" ] && CentOS_RHEL_version=5 elif [ -n "$(grep 'Amazon Linux AMI release' /etc/issue)" -o -e /etc/system-release ]; then OS=CentOS CentOS_RHEL_version=6 diff --git a/include/check_sw.sh b/include/check_sw.sh index 08ca0b25..2db26dbe 100644 --- a/include/check_sw.sh +++ b/include/check_sw.sh @@ -139,7 +139,7 @@ installDepsBySrc() { tar xzf tmux-${tmux_version}.tar.gz pushd tmux-${tmux_version} - CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure + CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure make -j ${THREAD} && make install unset LDFLAGS popd diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index a228301f..9d113a11 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -18,8 +18,8 @@ Install_MySQL55() { mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir} if [ "${dbInstallMethods}" == "1" ]; then - tar xvf mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}.tar.gz - mv mysql-${mysql55_version}-linux2.6-${SYS_BIT_b}/* ${mysql_install_dir} + tar xvf mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz + mv mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir} sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe elif [ "${dbInstallMethods}" == "2" ]; then diff --git a/include/redis.sh b/include/redis.sh index c7b890bd..10f59ab3 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -34,7 +34,7 @@ Install_redis-server() { rm -rf redis-${redis_version} id -u redis >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin redis - chown -R redis:redis ${redis_install_dir}/var + chown -R redis:redis ${redis_install_dir}/{var,etc} /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server if [ "$OS" == 'CentOS' ]; then cc start-stop-daemon.c -o /sbin/start-stop-daemon diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 60600cb7..b81ee4bb 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -89,9 +89,9 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF # logrotate tomcat catalina.out diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index f2c14264..097a5fb8 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -89,9 +89,9 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF # logrotate tomcat catalina.out diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 56669696..22cf7a4b 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -89,9 +89,9 @@ EOF [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF - + + prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF # logrotate tomcat catalina.out diff --git a/include/upgrade_db.sh b/include/upgrade_db.sh index 7405f1d1..192200f2 100644 --- a/include/upgrade_db.sh +++ b/include/upgrade_db.sh @@ -63,11 +63,9 @@ Upgrade_DB() { DB_name=percona-server-$NEW_DB_version DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz elif [ "$DB" == 'MySQL' ]; then - [ `echo $NEW_DB_version | awk -F. '{print $1"."$2}'` != '5.5' ] && DB_name=mysql-${NEW_DB_version}-linux-glibc2.5-${SYS_BIT_b} || DB_name=mysql-${NEW_DB_version}-linux2.6-${SYS_BIT_b} DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz fi [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1 - if [ -e "$DB_name.tar.gz" ]; then echo "Download [${CMSG}$DB_name.tar.gz${CEND}] successfully! " else diff --git a/tools/coscmd b/tools/coscmd index bd0a814c..790b293c 100755 --- a/tools/coscmd +++ b/tools/coscmd @@ -128,14 +128,14 @@ def loginit(): if log_level == 2: log_level = logging.WARNING - #定义一个RotatingFileHandler,最多备份5个日志文件,每个日志文件最大20M + #定义一个RotatingFileHandler,最多备份5个日志文件,每个日志文件最大20M logger = logging.getLogger("") Rthandler = RotatingFileHandler(log_file_name, maxBytes= 20*1024*1024,backupCount=5) Rthandler.setLevel(log_level) formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') Rthandler.setFormatter(formatter) logger.addHandler(Rthandler) - #输出日志到屏幕 + #输出日志到屏幕 console = logging.StreamHandler() console.setFormatter(formatter) if (log_out_to_screen == 1): @@ -222,7 +222,7 @@ class FileStat(): class TimeStat(object): global cos_log def __init__(self): - self.start() + self.start() def start(self): self.start = datetime.datetime.now() self.t1 = time.time() @@ -242,6 +242,7 @@ def delfiles(cos_client, bucket, filelist): def delfolders(cos_client, bucket, folderlist): for f in folderlist: delfolder(cos_client, bucket, f) + #文件夹删除 def delfolder(cos_client, bucket, folder): global stat @@ -252,7 +253,8 @@ def delfolder(cos_client, bucket, folder): retry = 0 while (retry < MAX_RETRY_TIMES): ret = cos_client.del_folder(delfolderreq) - msg = "delfolder fail, bucket="+bucket+",folder="+folder+ret['message'] + #msg = "delfolder fail, bucket="+bucket+",folder="+folder+ret['message'] + msg = "delfolder fail, bucket="+bucket+",folder="+folder+str(ret.get('message')) if (ret['code'] == 0): break elif (ret['code'] == -166): @@ -272,7 +274,8 @@ def delfolder(cos_client, bucket, folder): retry += 1 if (ret['code'] != 0 and ret['code'] != -166): stat.addDelDirFailNum() - cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+ret['message']) + #cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+ret['message']) + cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+str(ret.get('message'))) return ret['code'] if (ret['code'] == 0): stat.addDelDirSuccNum() @@ -288,7 +291,8 @@ def delfile(cos_client, bucket, filepath): retry = 0 while (retry < MAX_RETRY_TIMES): ret = cos_client.del_file(delfilereq) - msg = "delfile fail bucket="+bucket+",file="+filepath+ret['message'] + #msg = "delfile fail bucket="+bucket+",file="+filepath+ret['message'] + msg = "delfile fail bucket="+bucket+",file="+filepath+str(ret.get('message')) if (ret['code'] == 0): break #文件不存在 @@ -313,7 +317,8 @@ def delfile(cos_client, bucket, filepath): continue if (ret['code'] != 0 and ret['code'] != -166): stat.addDelFileFailNum() - cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+ret['message']) + #cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+ret['message']) + cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+str(ret.get('message'))) return ret['code'] if (ret['code'] == 0): stat.addDelFileSuccNum() @@ -341,7 +346,8 @@ def delete_r(cos_client, bucket, path, thread_pool_file): else: break if (listret['code'] != 0): - cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ listret['message']) + #cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ listret['message']) + cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ str(listret.get('message'))) return listret['code'] if (len(listret['data']['infos']) == 0): break; @@ -388,7 +394,7 @@ def delete_r(cos_client, bucket, path, thread_pool_file): filelist = [] else: pass - + if (len(dirlist) > 0): args = [cos_client, bucket, dirlist] args_tuple = (args,None) @@ -412,9 +418,9 @@ def delete_r(cos_client, bucket, path, thread_pool_file): stat.logStat() return 0 + #支持Ctrl+C终止程序 class Watcher(): - def __init__(self): self.child = os.fork() if self.child == 0: @@ -427,7 +433,7 @@ class Watcher(): try: os.wait() except KeyboardInterrupt: - cos_log.ERROR("ctrl+c terminated rm_recursive.py, exiting...") + cos_log.ERROR("ctrl+c terminated coscmd, exiting...") self.kill() sys.exit() def kill(self): @@ -435,6 +441,7 @@ class Watcher(): os.kill(self.child, signal.SIGKILL) except OSError: pass + def cmd_rm(COSDIR): global thread_pool global cos_log diff --git a/versions.txt b/versions.txt index c4f0e559..b2e8f8da 100644 --- a/versions.txt +++ b/versions.txt @@ -1,33 +1,33 @@ # newest software version # Web -nginx_version=1.10.3 +nginx_version=1.12.0 tengine_version=2.1.2 -openresty_version=1.11.2.2 +openresty_version=1.11.2.3 openssl_version=1.0.2k -tomcat8_version=8.0.43 +tomcat8_version=8.5.14 tomcat7_version=7.0.77 -tomcat6_version=6.0.51 +tomcat6_version=6.0.53 apache24_version=2.4.25 apache22_version=2.2.32 pcre_version=8.40 apr_version=1.5.2 apr_util_version=1.5.4 -nghttp2_version=1.21.0 +nghttp2_version=1.21.1 # DB -mysql57_version=5.7.17 -mysql56_version=5.6.35 -mysql55_version=5.5.54 +mysql57_version=5.7.18 +mysql56_version=5.6.36 +mysql55_version=5.5.56 -mariadb101_version=10.1.22 +mariadb101_version=10.1.23 mariadb100_version=10.0.30 -mariadb55_version=5.5.54 +mariadb55_version=5.5.56 -percona57_version=5.7.17-12 -percona56_version=5.6.35-81.0 -percona55_version=5.5.54-38.7 +percona57_version=5.7.18-14 +percona56_version=5.6.36-82.0 +percona55_version=5.5.58-38.8 alisql56_version=5.6.32-4 @@ -37,8 +37,8 @@ jdk17_version=1.7.0_80 jdk16_version=1.6.0_45 # PHP -php71_version=7.1.3 -php70_version=7.0.17 +php71_version=7.1.5 +php70_version=7.0.19 php56_version=5.6.30 php55_version=5.5.38 php54_version=5.4.45 @@ -48,14 +48,14 @@ zendopcache_version=7.0.5 xcache_version=3.2.0 apcu_version=4.0.11 apcu_for_php7_version=5.1.8 -ImageMagick_version=6.9.8-3 +ImageMagick_version=6.9.8-5 imagick_version=3.4.3 imagick_for_php53_version=3.3.0 GraphicsMagick_version=1.3.25 gmagick_for_php7_version=2.0.4RC1 gmagick_version=1.1.7RC3 libiconv_version=1.15 -curl_version=7.53.1 +curl_version=7.54.0 libmcrypt_version=2.5.8 mcrypt_version=2.6.8 mhash_version=0.9.9.9 @@ -86,7 +86,7 @@ jemalloc_version=4.5.0 boost_version=1.59.0 # Others -libevent_version=2.1.8-stable +libevent_version=2.0.22-stable tmux_version=2.3 htop_version=2.0.2 bison_version=2.7.1 diff --git a/vhost.sh b/vhost.sh index ee371364..cb35ef64 100755 --- a/vhost.sh +++ b/vhost.sh @@ -482,8 +482,8 @@ server { index index.html index.htm index.jsp; root ${vhostdir}; ${Nginx_redirect} - #error_page 404 = /404.html; - #error_page 502 = /502.html; + #error_page 404 /404.html; + #error_page 502 /502.html; ${anti_hotlinking} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; @@ -500,13 +500,13 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^root.*;@&\nif (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF ${Tomcat_Domain_alias} - + + prefix="${domain}_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF [ -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 @@ -540,9 +540,9 @@ EOF Create_tomcat_conf() { cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF ${Tomcat_Domain_alias} - + + prefix="${domain}_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> EOF [ -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 @@ -574,8 +574,8 @@ server { root ${vhostdir}; ${Nginx_redirect} include ${web_install_dir}/conf/rewrite/${rewrite}.conf; - #error_page 404 = /404.html; - #error_page 502 = /502.html; + #error_page 404 /404.html; + #error_page 502 /502.html; ${anti_hotlinking} ${NGX_CONF} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { @@ -626,7 +626,7 @@ EOF fi fi - [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo ${web_install_dir}/sbin/nginx -t @@ -773,7 +773,7 @@ server { } EOF - [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$server_name\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf + [ "${https_yn}" == 'y' ] && sed -i "s@^ root.*;@&\n if (\$ssl_protocol = \"\") { return 301 https://\$host\$request_uri; }@" ${web_install_dir}/conf/vhost/${domain}.conf echo ${web_install_dir}/sbin/nginx -t