?
总结一下今天的LNMP环境搭建(Linux+Nginx+Mysql+Php)
Linux : centos6.3-x64
Nginx: 1.6.2
Mysql: 5.6.21
Php: ? ?5.3.29
?
依赖库
?
class="shell" name="code">[root@jiaomai software]# yum install wget [root@jiaomai software]# yum install pcre [root@jiaomai software]#yum install openssl* [root@jiaomai software]# 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 make [root@jiaomai software]# yum -y install gd gd2 gd-devel gd2-devel [root@jiaomai software]# wget?ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz [root@jiaomai software]# tar zxvf pcre-8.36.tar.gz [root@jiaomai software]# cd pcre-8.36 [root@jiaomai software]# ./configure --prefix=/usr/local/pcre [root@jiaomai software]# make && make install
?
?
nginx 安装
?
[root@jiaomai software]# /usr/sbin/groupadd fdwww [root@jiaomai software]# /usr/sbin/useradd -g fdwww fdwww [root@jiaomai software]# wget? http://nginx.org/download/nginx-1.6.2.tar.gz [root@jiaomai software]# tar zxvf nginx-1.6.2.tar.gz [root@jiaomai software]# cd nginx-1.6.2 [root@jiaomai nginx-1.6.2]]# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/software/pcre-8.36 --with-http_realip_module --with-http_image_filter_module [root@jiaomai nginx-1.6.2]]# make [root@jiaomai nginx-1.6.2]]# make install [root@jiaomai nginx-1.6.2]]# cd ../
?
?
mysql 安装
?
[root@jiaomai software]# wget ftp://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.6/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz [root@jiaomai software]# tar zxvf mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz [root@jiaomai software]# mv mysql-5.6.21-linux-glibc2.5-x86_64 /usr/local/mysql [root@jiaomai software]# /usr/sbin/groupadd mysql [root@jiaomai software]# /usr/sbin/useradd -g mysql mysql [root@jiaomai software]# mkdir -p /sql/mysql [root@jiaomai software]# yum install libaio [root@jiaomai software]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/sql/mysql/data/ --user=mysql [root@jiaomai software]# wget ftp://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm [root@jiaomai software]# rpm -ivh MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm
?
?
?
php? 依赖库安装
?
[root@jiaomai software]# wget http://www.ijg.org/files/jpegsrc.v9.tar.gz [root@jiaomai software]# tar zxvf jpegsrc.v9.tar.gz [root@jiaomai software]# cd jpeg-9/ [root@jiaomai jpeg-9]# ./configure --prefix=/usr/local/phpLib --enable-shared --enable-static [root@jiaomai jpeg-9]# make && make install [root@jiaomai jpeg-9]# cd .. [root@jiaomai software]# wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz [root@jiaomai software]# tar zxvf libpng-1.6.2.tar.gz [root@jiaomai software]# cd libpng-1.6.2 [root@jiaomai libpng-1.6.2]# ./configure --prefix=/usr/local/phpLib [root@jiaomai libpng-1.6.2]# make && make install [root@jiaomai libpng-1.6.2]# cd .. [root@jiaomai software]# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz [root@jiaomai software]# tar zxvf freetype-2.4.12.tar.gz [root@jiaomai software]# cd freetype-2.4.12 [root@jiaomai freetype-2.4.12]# ./configure --prefix=/usr/local/phpLib [root@jiaomai freetype-2.4.12]# make && make install [root@jiaomai freetype-2.4.12]# cd .. [root@jiaomai software]# wget ?"http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?big_mirror=0" [root@jiaomai software]# tar zxvf mhash-0.9.9.9.tar.gz [root@jiaomai software]# cd mhash-0.9.9.9 [root@jiaomai mhash-0.9.9.9]# ./configure --prefix=/usr/local/phpLib [root@jiaomai mhash-0.9.9.9]# make && make install [root@jiaomai mhash-0.9.9.9]# cd .. [root@jiaomai software]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0" [root@jiaomai software]# tar zxvf libmcrypt-2.5.8.tar.gz [root@jiaomai software]# cd libmcrypt-2.5.8 [root@jiaomai libmcrypt-2.5.8]# ./configure --prefix=/usr/local/phpLib [root@jiaomai libmcrypt-2.5.8]# make && make install [root@jiaomai libmcrypt-2.5.8]# cd libltdl/ [root@jiaomai libltdl]# ./configure --prefix=/usr/local/phpLib --enable-ltdl-install [root@jiaomai libltdl]# make && make install [root@jiaomai libmcrypt-2.5.8]# cd ..
?
?
?
把php扩展库加入系统
?
[root@jiaomai software]# vim /etc/ld.so.conf.d/phpLibs.conf
添加这一行
/usr/local/phpLib/lib
?
然后
?
[root@jiaomai software]# ldconfig
?
?
添加php扩展
[root@jiaomai software]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0" [root@jiaomai software]# tar zxvf mcrypt-2.6.8.tar.gz [root@jiaomai software]# cd mcrypt-2.6.8 [root@jiaomai mcrypt-2.6.8]# export LDFLAGS="-L/usr/local/phpLib/lib -L/usr/lib" [root@jiaomai mcrypt-2.6.8]# export CFLAGS="-I/usr/local/phpLib/include -I/usr/include" [root@jiaomai mcrypt-2.6.8]# touch malloc.h [root@jiaomai mcrypt-2.6.8]# ./configure --prefix=/usr/local/phpLib/ --with-libmcrypt-prefix=/usr/local/phpLib [root@jiaomai mcrypt-2.6.8]# make && make install [root@jiaomai mcrypt-2.6.8]# cd ..
?
php安装
?
[root@jiaomai software]# wget http://cn2.php.net/get/php-5.3.29.tar.gz/from/this/mirror [root@jiaomai software]# tar zxvf php-5.3.29.tar.gz [root@jiaomai software]# cd php-5.3.29 [root@jiaomai php-5.3.29]# export LIBS="-lm -ltermcap -lresolv" [root@jiaomai php-5.3.29]# export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64" [root@jiaomai php-5.3.29]# export LD_LIBRARY_PATH="/usr/local/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64" [root@jiaomai php-5.3.29]# ./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-iconv-dir --with-freetype-dir=/usr/local/phpLib --with-jpeg-dir=/usr/local/phpLib --with-png-dir=/usr/local/phpLib --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/usr/local/phpLib --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts [root@jiaomai php-5.3.29]# make [root@jiaomai php-5.3.29]# make test [root@jiaomai php-5.3.29]# make install
?