LNMP环境编译安装备忘-centos6.2

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 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
yum -y install perl-CPAN
   
   
#1、安装php所需要的库
set -e
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./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
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
   
   
#2、安装mysql-5.5.3
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.5.3-m3.tar.gz
cd mysql-5.5.3-m3/
./configure --prefix=/www/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make && make install
chmod +w /www/webserver/mysql/
chown -R mysql:mysql /www/webserver/mysql/
cd ../
   
   
#3、安装php-5.3.20
cp -frp /usr/lib64/libldap* /usr/lib/
cd /www/webserver/mysql/include/mysql
mkdir psi
cp  psi.h psi/
echo "/www/webserver/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
ln -s /www/webserver/mysql/lib/mysql /usr/lib/mysql
ln -s /www/webserver/mysql/include/mysql /usr/include/mysql
cd /root/lnmp/
tar zxvf php-5.3.20.tar.gz
patch -d php-5.3.20  -p0 < fpm-race-condition.patch
cd php-5.3.20/
'./configure' '--prefix=/www/webserver/php' '--with-config-file-path=/www/webserver/php/etc' '--with-mysql=/www/webserver/mysql' '--with-mysqli=/www/webserver/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-ftp' '--enable-safe-mode' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--with-curlwrappers' '--enable-mbregex' '--enable-session' '--enable-fpm' '--with-gettext' '--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-zip' '--enable-soap' '--without-pear'
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /www/webserver/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp sapi/fpm/php-fpm.conf /www/webserver/php/etc/php-fpm.conf
chmod  777 /etc/init.d/php-fpm
cd ../
   
   
#4、安装php扩展模块
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/www/webserver/php/bin/phpize
./configure --with-php-config=/www/webserver/php/bin/php-config --with-pdo-mysql=/www/webserver/mysql
make
make install
cd ../
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../
tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/www/webserver/php/bin/phpize
./configure --with-php-config=/www/webserver/php/bin/php-config
make
make install
cd ../
tar zxvf APC-3.1.9.tgz
cd APC-3.1.9
/www/webserver/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/www/webserver/php/bin/php-config
make
make install
cd ../
tar zxvf phpredis-2.1.0.tar.gz
cd phpredis-2.1.0
/www/webserver/php/bin/phpize
./configure --with-php-config=/www/webserver/php/bin/php-config
make
make install
cd ../
   
   
#5安装nginx(tengine)服务
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
tar zxvf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/usr/local/pcre8
make && make install
cd ../
tar zxvf tengine-1.5.1.tar.gz
cd tengine-1.5.1
./configure --prefix=/www/webserver/nginx --with-syslog --with-http_concat_module --with-http_stub_status_module   --with-pcre=/root/lnmp/pcre-8.32
make && make install
cd ../
   
#6.安装pear
wget http://pear.php.net/go-pear.phar
php go-pear.phar


你可能感兴趣的:(Web,LNMP,环境安装)