nginx php5.3 mysql_centos5.6+nginx1.04+mysql5.5.14+php5.3.6(LNMP)一键安装脚本

#!/bin/bash

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 gli

b2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-

devel nss_ldap openldap-clients openldap-servers

tar zxf lnmp.tar.gz ###软件包放在目录/usr/local/src

cd lnmp

tar zxf libiconv-1.13.tar.gz

cd libiconv-1.13

./configure --prefix=/usr/local

make

make install

cd ../

tar zxvf 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 zxvf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9/

./configure && make && make install

cd ../

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

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

/sbin/ldconfig

./configure && make && make install

cd ../

tar zxf cmake-2.8.4.tar.gz

cd cmake-2.8.4

./bootstrap

gmake

gmake install

cd ../

tar zxvf bison-2.5.tar.gz

cd bison-2.5

./configure && make && make install

cd ../

/usr/sbin/groupadd mysql

/usr/sbin/useradd -g mysql mysql

tar zxf mysql-5.5.14.tar.gz

cd mysql-5.5.14

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING

=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1

make && make install

cd /usr/local/mysql

chown -R mysql:mysql /usr/local/mysql

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

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

scripts/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

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

/etc/init.d/mysqld start

/etc/init.d/mysqld stop

cd /usr/local/src/lnmp

tar zxf php-5.3.6.tar.gz

cd php-5.3.6

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-ico

nv-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-bcmat

h --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex  --enable-fpm  --enable-mbstring --with-mcrypt --with-g

d --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl

make ZEND_EXTRA_LIBS='-liconv'

make install

cp php.ini-production /usr/local/php/etc/php.ini

cd ../

tar zxf memcache-2.2.6.tgz

cd memcache-2.2.6

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make && make install

cd ../

unzip eaccelerator-0.9.6.1.zip

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 zxf 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 zxf ImageMagick-6.7.0-10.tar.gz

cd ImageMagick-6.7.0-10

./configure

make && make install

cd ../

tar zxf 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 ../

sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"nextension = "memcache.so"nextension = "pdo_mysql.so"ne

xtension = "imagick.so"n#' /usr/local/php/etc/php.ini

sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini

mkdir -p  /var/cache/eaccelerator_cache

chmod 777 /var/cache/eaccelerator_cache

cat >>/usr/local/php/etc/php.ini<

[eaccelerator]

zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"

eaccelerator.shm_size="128"

eaccelerator.cache_dir="/var/cache/eaccelerator_cache"

eaccelerator.enable="1"

eaccelerator.optimizer="1"

eaccelerator.check_mtime="1"

eaccelerator.debug="0"

eaccelerator.filter=""

eaccelerator.shm_max="0"

eaccelerator.shm_ttl="300"

eaccelerator.shm_prune_period="120"

eaccelerator.shm_only="0"

eaccelerator.compress="1"

eaccelerator.compress_level="9"

EOF

mv  /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

sed -i 's/user = nobody/user = www/g' /usr/local/php/etc/php-fpm.conf

sed -i 's/group = nobody/group = www/g' /usr/local/php/etc/php-fpm.conf

sed -i 's/;pm.start_servers/pm.start_servers/g' /usr/local/php/etc/php-fpm.conf

sed -i 's/;pm.min_spare_servers/pm.min_spare_servers/g' /usr/local/php/etc/php-fpm.conf

sed -i 's/;pm.max_spare_servers/pm.max_spare_servers/g' /usr/local/php/etc/php-fpm.conf

/usr/sbin/groupadd www

/usr/sbin/useradd -g www www

unzip pcre-8.12.zip

cd pcre-8.12

./configure

make

make install

cd ../

tar zxf nginx-1.0.4.tar.gz

cd nginx-1.0.4

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

make

make install

mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

cp /usr/local/src/software/nginx.conf /usr/local/nginx/conf

cd ../

/usr/local/nginx/sbin/nginx

/usr/local/php/sbin/php-fpm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值