本文共 3345 字,大约阅读时间需要 11 分钟。
#!/bin/bashM_FILES=mysql-5.5.48.tar.gzM_DIR=mysql-5.5.48M_PRE=/usr/local/mysqlM_URL=http://download.softagency.net/MySQL/Downloads/MySQL-5.5/mysql-5.5.48.tar.gzP_FILES=php-5.4.22.tar.gzP_DIR=php-5.4.22P_PRE=/usr/local/phpP_URL=http://mirrors.sohu.com/php/php-5.4.22.tar.gzN_FILES=nginx-1.4.7.tar.gzN_DIR=nginx-1.4.7N_PRE=/usr/local/nginxN_URL=http://nginx.org/download/nginx-1.4.7.tar.gzMULU=`pwd`function mysql_install() {yum install gcc-c++ cmake ncurses-devel bison perl wget -ywget $M_URLuseradd -s /sbin/nologin mysql mkdir -p /data/mysqlchown -R mysql.mysql /data/mysqltar -zxvf $M_FILES;cd $M_DIRcmake -DCMAKE_INSTALL_PREFIX=$M_PRE -DMYSQL_DATADIR=/data/mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DMYSQL_USER=mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock make -j2 && make install if [ $? -eq 0 ];then echo "the mysql install is successful" else echo "the mysql install is failed" exit fi}function php_install() {yum install -y libxml2-devel libcurl-devel openjpeg-devel libjpeg-turbo-devel libpng-devel freetype-develwget $P_URLtar -zxvf $P_FILES ;cd $P_DIR./configure --prefix=/usr/local/php --enable-fpm --enable-debug --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-curl --with-mysql=/usr/local/mysqlmake && make install if [ $? -eq 0 ];then echo "the php install is successful" else echo "the php install is failed" exit fi}function nginx_install() {yum install pcre-devel openssl-devel -ywget $N_URLtar -zxvf $N_FILES ;cd $N_DIRuseradd -s /sbin/nologing -M www./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modulemake && make install if [ $? -eq 0 ];then echo "the nginx install is successful" else echo "the nginx install is failed" exit fi}function lnmp_zh() {cd $MULUcp $M_DIR/support-files/my-medium.cnf /etc/my.cnfcp $M_DIR/support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqld/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql/etc/init.d/mysqld startchkconfig --add mysqldecho "PATH=$PATH:/usr/local/mysql/bin">>/etc/profilesource /etc/profilecp $P_DIR/sapi/fpm/php-fpm /etc/init.d/php-fpmcp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp $P_DIR/php.ini-production /usr/local/php/lib/php.ini /etc/init.d/php-fpm sed -i 's@index index.html index.htm@index index.php index.html@' /usr/local/nginx/conf/nginx.confsed -i '55a location ~ \.php$ {' /usr/local/nginx/conf/nginx.confsed -i '56a root html;' /usr/local/nginx/conf/nginx.confsed -i '57a fastcgi_pass 127.0.0.1:9000;' /usr/local/nginx/conf/nginx.confsed -i '58a fastcgi_index index.php;' /usr/local/nginx/conf/nginx.confsed -i '59a fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;' /usr/local/nginx/conf/nginx.confsed -i '60a include fastcgi_params;' /usr/local/nginx/conf/nginx.confsed -i '61a }' /usr/local/nginx/conf/nginx.conf/usr/local/nginx/sbin/nginx}cat <
转载于:https://blog.51cto.com/pc1990/1747260