一键lnmp脚本&&php扩展模块安装

#######################################################################################

#!bin/sh                                                                              #

#AUTHOR:yuhonggang                                                                    #

#TIME:2014/10/13 17:26                                                                #

#DESCRIBE:the script is used for create the lnmp just by one touch                    #

#VERSION:V1.0                                                                         #

#######################################################################################

TOOLS=/home/yuhonggang/tools

APP=/application

#######INSTALL NGINX#################################################################

echo -e "\033[32;45;5m#######INSTALL NGINX###################################\033[0m"

sleep 2

if  [ -d $TOOLS ];then

cd $TOOLS

else

mkdir -p $TOOLS && cd $TOOLS

fi

if  [ -d $APP ];then

echo "$APP is exsit"

else

mkdir $APP && echo "$APP has ben created"

fi

# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz

wget http://fossies.org/linux/misc/pcre-8.36.tar.gz

yum install gcc-c++ openssl* -y

tar zxf pcre-8.36.tar.gz

cd pcre-8.36

./configure

make && make install

if [ $? = 0 ]

then

echo "pcre install is successful"

else

echo "pcre install is fail" && exit 2

sleep 5

fi

cd $TOOLS

sleep 5

wget http://nginx.org/download/nginx-1.2.9.tar.gz

useradd nginx -s /sbin/nologin -M

tar xf nginx-1.2.9.tar.gz

cd nginx-1.2.9

./configure --user=nginx --group=nginx --prefix=$APP/nginx-1.2.9 --with-http_stub_status_module --with-http_ssl_module

make && make install

if [ $? = 0 ]

then

echo "nginx install is successful"

else

echo "nginx install is fail" && exit 2

sleep 5

fi

cd $TOOLS

ln -s $APP/nginx-1.2.9 $APP/nginx

echo "/usr/local/lib/" >> /etc/ld.so.conf

ldconfig

$APP/nginx/sbin/nginx -t

$APP/nginx/sbin/nginx

lsof -i tcp:80

if [ $? = 0 ]

then

echo "nginx install all is successful"

else

echo "nginx install all is fail" && exit 2

sleep 5

fi

cd $TOOLS

#######INSTALL MYSQL################################################################

echo -e "\033[32;45;5m#######INSTALL MYSQL###################################\033[0m"

sleep 5

cd $TOOLS

sleep 3

wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz

tar xf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake && gmake install

if [ $? = 0 ]

then

echo "nginx cmake is successful"

else

echo "nginx cmake is fail" && exit 2

sleep 5

fi

cd $TOOLS

useradd mysql -s /sbin/nologin -M

yum install ncurses-devel -y

sleep 2

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12.tar.gz

tar xf mysql-5.6.12.tar.gz

cd mysql-5.6.12

cmake . -DCMAKE_INSTALL_PREFIX=$APP/mysql-5.6.12 \

-DMYSQL_DATADIR=$APP/mysql-5.6.12/data \

-DMYSQL_UNIX_ADDR=$APP/mysql-5.6.12/tmp/mysql.sock \

-DDEFAULT_CHARSET=gbk \

-DDEFAULT_COLLATION=gbk_chinese_ci \

-DENABLED_LOCAL_INFILE=ON \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1

make && make install

if [ $? = 0 ]

then

echo "mysql install is successful"

else

echo "mysql install is fail" && exit 2

fi

sleep 5

ln -s $APP/mysql-5.6.12/ $APP/mysql

cp support-files/my-default.cnf /etc/my.cnf

echo ‘export PATH=/application/mysql/bin:$PATH‘ >>/etc/profile

sleep 2

. /etc/profile

mkdir -p $APP/mysql/data/

chown -R mysql.mysql $APP/mysql/*

chmod -R 1777 /tmp

sleep 2

$APP/mysql/scripts/mysql_install_db --basedir=$APP/mysql --datadir=$APP/mysql/data/ --user=mysql

cp support-files/mysql.server /etc/init.d/mysqld

chmod 700 /etc/init.d/mysqld

/etc/init.d/mysqld start

chkconfig mysqld on

if [ $? = 0 ]

then

echo "mysql install all is successful"

else

echo "mysql install all is fail" && exit 2

fi

sleep 5

#######INSTALL PHP##################################################################

echo -e "\033[32;45;5m#######INSTALL PHP###################################\033[0m"

sleep 5

cd $TOOLS

yum install zlib libxml libjpeg freetype libpng gd  curl libiconv  zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel -y

sleep 2

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar xf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make && make install

sleep 2

cd $TOOLS

wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz

tar zxf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make

make install

sleep 2

/sbin/ldconfig

cd libltdl/

./configure --enable-ltdl-install

make

make install

sleep 2

cd $TOOLS

wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz

tar zxf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9/

./configure

make

make install

sleep 2

cd $TOOLS

rm -f /usr/lib64/libmcrypt.*

rm -f /usr/lib64/libmhash*

ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la

ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so

ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4

ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8

ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a

ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la

ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so

ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2

ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

yum install libxslt libxslt-devel -y

sleep 2

wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz

tar zxf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

/sbin/ldconfig

./configure

make && make install

sleep 2

cd $TOOLS

ln -s $APP/mysql/lib/libmysqlclient.so.18 /usr/lib

ldconfig

wget http://cn2.php.net/distributions/php-5.3.29.tar.gz

tar xf php-5.3.29.tar.gz

cd php-5.3.29

./configure --prefix=$APP/php5.3.29 --with-mysql=$APP/mysql --with-iconv-dir=/usr/local/libiconv --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-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp

cp ext/phar/phar.php ext/phar/phar.phar

make && make install

sleep 2

ln -s $APP/php5.3.29/ $APP/php

cd $TOOLS/php-5.3.29

cp php.ini-production $APP/php/lib/php.ini

mv $APP/php5.3.29/etc/php-fpm.conf.default $APP/php5.3.29/etc/php-fpm.conf

$APP/php/sbin/php-fpm

if [ $? = 0 ]

then

echo "php install is successful"

else

echo "php install is fail" && exit 2

fi

sleep 5

#######INSTALL PhpCacheModule#################################################################

echo -e "\033[32;45;5m#######INSTALL PhpCacheModule###################################\033[0m"

sleep 5

echo ‘export LC_ALL=C‘ >>/etc/profile

tail -1 /etc/profile

. /etc/profile

yum install perl-devel -y

cd $TOOLS

#install eaccelerator

sleep 2

wget http://soft.kwx.gd/module/eaccelerator-0.9.6.tar.bz2

tar jxf eaccelerator-0.9.6.tar.bz2

cd eaccelerator-0.9.6

$APP/php/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=$APP/php/bin/php-config

make && make install

[  $? -ne 0 ] && {

echo "install eaccelerator failed!"

exit 2

}

cd ../

sleep 2

#install memcache

wget http://pecl.php.net/get/memcache-2.2.5.tgz

tar zxf memcache-2.2.5.tgz

cd memcache-2.2.5

$APP/php/bin/phpize

./configure --with-php-config=$APP/php/bin/php-config

make && make install

[ $? -ne 0 ] && {

echo "install memcache failed!"

exit 2

}

cd ../

sleep 2

#install PDO_MYSQL

wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

tar zxf PDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2

$APP/php/bin/phpize

./configure --with-php-config=$APP/php/bin/php-config --with-pdo-mysql=$APP/mysql

make && make install

[ $? -ne 0 ] && {

echo "install PDO_MYSQL failed!"

exit 2

}

cd ../

#install ImageMagick

sleep 5

wget http://down1.chinaunix.net/distfiles/ImageMagick-6.5.1-0.tar.bz2

tar jxf ImageMagick-6.5.1-0.tar.bz2

cd ImageMagick-6.5.1-0

./configure

make

make install

[ $? -ne 0 ] && {

echo "install ImageMagick failed!"

exit 2

}

cd ../

sleep 2

#install imagick php

wget http://pecl.php.net/get/imagick-2.3.0.tgz

tar zxf imagick-2.3.0.tgz

cd imagick-2.3.0

$APP/php/bin/phpize

./configure --with-php-config=$APP/php/bin/php-config

make

make install

[ $? -ne 0 ] && {

echo "install imagick php failed!"

exit 2

}

cd ../

sleep 2

cd $APP/php/lib/

cp php.ini php.ini_$(date +%F)

sed -i ‘s#; extension_dir = "./"#extension_dir = "/application/php/lib/php/extensions/no-debug-non-zts-20090626/"#g‘ php.ini

cat >> $APP/php/lib/php.ini<<EOF

extension = memcache.so

extension = pdo_mysql.so

extension = imagick.so

EOF

#config eaccelerator

mkdir -p /tmp/eaccelerator

chown -R nginx.nginx /tmp/eaccelerator

cat >>$APP/php/lib/php.ini<<EOF

[eaccelerator]

extension = 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="3600"

eaccelerator.shm_prune_period="3600"

eaccelerator.shm_only="0"

eaccelerator.compress="1"

eaccelerator.compress_level="9"

EOF

sleep 1

echo "====================================="

$APP/php/bin/php -v

[ $? -eq 0 ] && echo "Config php cache module sucessful" || exit 2

echo "====================================="

一键lnmp脚本&&php扩展模块安装

时间: 2024-10-06 17:26:41

一键lnmp脚本&&php扩展模块安装的相关文章

Lnmp一键部署脚本(包含模块安装,php7,openresty+缓存等)

Lnmp一键部署脚本 个人gitpage:https://owelinux.github.io/ #!/bin/bash ##DATE:2016-7-25 ##USER:owelinux ###install wallet #######install mysql################################################## yum -y install cmake ncurses-devel bison libaio make gcc gcc-c++ mk

CentOS 7 for ARM 安装一键Lnmp失败

背景 前面把树莓派装上了CentOS 7,趁着国庆放假回来赶紧把服务端环境搭起来,为了方便就准备用一键lnmp快速部署一个,结果死活安装不成功... 报错 按照以往的经验进行安装,在我的小树莓派上安装实在是慢,毕竟需要编译,CPU不给力只能慢慢的等待编译完成,吃个午饭回来发现似乎已经完成了,然而却失败了,报错信息如下 ============================== Check install ============================== Checking ... N

centos6:lnmp一键搭建脚本

1.把需要的脚本下载放到/root 目录下,然后运行本脚本即可自动化安装lnmp环境: #!/bin/bash #lnmp环境搭建自动化脚本 #date 2017/8/22 #author vaedityum install epel-release -y yum -y install pcre pcre-devel openssl openssl-devel gcc gcc-c++ cmake ncurses-devel libtool zlib-devel libxml2-devel lib

LNMP源码编译安装

系统环境为Centos6.5 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables  #编辑防火墙配置文件,将下面两条规则添加到22端口规则下面 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT(允许3306端口通过

linux iperf3 一键自动化测试脚本

iperf3 一键自动化测试脚本: 日    期:2015年09月01日联系邮箱:[email protected]Q Q  群:1851 1570151CTO博客首页:http://990487026.blog.51cto.com 准备: 1,已经安装iperf3 2,root权限 功能: 1,自动测试ping的数据: ping延时 与ping 丢包,30次 2,iperf3 自动测试TCP 上行带宽吞吐量,单位Kbits/sec 3,iperf3 自动测试TCP 下行带宽吞吐量,单位Kbit

一键调试脚本使用手册

调试个android程序太麻烦了,要敲那么多条命令,还得去看AndroidManifest文件,拿到包名和主Activity名,太麻烦了 我实在无法每次都进行这些繁琐的操作,于是写一个脚本,一键帮我完成这些事情 一.环境配置 github: https://github.com/bingghost/apk_repack python脚本需要预先安装python2.7环境 后期我可能会加入自动启动模拟器自动恢复快照,等功能 配置工具路径,在config.py文件  代码下载后,先配置工具路径路径(

linux服务器一键优化脚本

服务器一键优化脚本,高亮显示 内容:关闭selinux.时间同步设置.zabbix-agent安装.句柄数调优.常用软件安装.永久静态路由添加 #/bin/bash echo "####start shutdown selinux########" sed -i 's/SELINK=enforcing/SELINK=disabled/' /etc/selinux/config setenforce 0 value_selinux=`getenforce` if [ value_seli

linux tomcat一键维护脚本(值得收藏)

<span style="font-family: Arial, Helvetica, sans-serif;">#! /bin/sh</span> a="/usr/share/tomcat7/webapps/ROOT" b="/usr/share/tomcat7/webapps/ROOT.war" c="ROOT.war" tomcat_stop="/usr/share/tomcat7/bi

centos一键优化脚本

centos一键优化脚本:细节:http://oldboy.blog.51cto.com/2561410/1336488网络状态优化:http://oldboy.blog.51cto.com/2561410/1184228定时任务优化:http://oldboy.blog.51cto.com/2561410/1216730一键脚本:较简单: http://mofansheng.blog.51cto.com/8792265/1710247较健全: http://chocolee.blog.51ct