LNMP环境安装

单调的低调 2014-10-20

LAMP环境搭建

linux centos.3_x64

nginx 1.6.2

mysql 5.6.21

php   5.3.29

安装依赖库

[root@test software]# yum install wget
[root@test software]# yum install pcre
[root@test software]#yum install openssl*

[root@test 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@test software]# yum -y install gd gd2 gd-devel gd2-devel

[root@test software]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
[root@test software]# tar zxvf pcre-8.36.tar.gz
[root@test software]# cd pcre-8.36
[root@test software]# ./configure --prefix=/usr/local/pcre
[root@test software]# make && make install

 nginx 安装

[root@test software]# /usr/sbin/groupadd fdwww
[root@test software]# /usr/sbin/useradd -g fdwww fdwww
[root@test software]# wget  http://nginx.org/download/nginx-1.6.2.tar.gz
[root@test software]# tar zxvf nginx-1.6.2.tar.gz
[root@test software]# cd nginx-1.6.2
[root@test nginx-1.6.2]]# ./configure --user=fdwww --group=fdwww --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@test nginx-1.6.2]# make
[root@test nginx-1.6.2]# make install
[root@test nginx-1.6.2]# cd ../
[root@test nginx-1.6.2]# mkdir /var/log/nginx
[root@test nginx-1.6.2]# chown -R fdwww:fdwww /var/log/nginx/

[root@test php]# vim /etc/sysconfig/iptables
加入一行 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
[root@test php]# service iptables restart

修改fascgi.conf/ 修改nginx.conf

 mysql 安装(mysql root初始密码密码为空)

[root@test 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@test software]# tar zxvf mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz
[root@test software]# mv mysql-5.6.21-linux-glibc2.5-x86_64 /usr/local/mysql
[root@test software]# /usr/sbin/groupadd mysql
[root@test software]# /usr/sbin/useradd -g mysql mysql
[root@test software]# mkdir -p /sql/mysql
[root@test software]# yum install libaio
[root@test software]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/sql/mysql/data/ --user=mysql
[root@test 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@test software]# rpm -ivh  MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm

[root@test software]# vim /etc/ld.so.conf.d/mysql-x86_64.conf
添加一行 /usr/local/mysql/lib

[root@test software]# vim /etc/sysconfig/iptables
加入一行 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

[root@test software]# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
[root@test software]# chkconfig --add mysql
[root@test software]# chkconfig --level 2345 mysql on
[root@test software]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@test software]# ln -s /sql/mysql/mysql.sock /tmp/mysql.sock
[root@test software]# /usr/local/mysql/bin/mysqladmin -u root -p password 123456
[root@test software]# /usr/local/mysql/bin/mysql -u root -p 

	CREATE USER 'admin'@'%' IDENTIFIED BY '123456';

php安装

[root@test software]# wget  http://cn2.php.net/get/php-5.3.29.tar.gz/from/this/mirror
[root@test software]# tar zxvf php-5.3.29.tar.gz
[root@test software]# cd php-5.3.29
[root@test php-5.3.29]# export LIBS="-lm -ltermcap -lresolv"
[root@test 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@test 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@test 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 --with-pdo-mysql --enable-maintainer-zts

[root@test php-5.3.29]# make
[root@test php-5.3.29]# make test
[root@test php-5.3.29]# make install
[root@test php-5.3.29]# cp php.ini-development /usr/local/php/etc/php.ini

  php  依赖库 安装

[root@test software]# wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
[root@test software]# tar zxvf jpegsrc.v9.tar.gz
[root@test software]# cd jpeg-9/
[root@test jpeg-9]# ./configure --prefix=/usr/local/phpLib --enable-shared --enable-static
[root@test jpeg-9]# make && make install       
[root@test jpeg-9]# cd ..

[root@test software]# wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz
[root@test software]# tar zxvf libpng-1.6.2.tar.gz
[root@test software]# cd libpng-1.6.2
[root@test libpng-1.6.2]# ./configure --prefix=/usr/local/phpLib
[root@test libpng-1.6.2]# make && make install
[root@test libpng-1.6.2]# cd ..

[root@test software]# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
[root@test software]# tar zxvf freetype-2.4.12.tar.gz
[root@test software]# cd freetype-2.4.12
[root@test freetype-2.4.12]# ./configure --prefix=/usr/local/phpLib
[root@test freetype-2.4.12]# make && make install
[root@test freetype-2.4.12]# cd ..

[root@test software]# wget  "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?big_mirror=0"
[root@test software]# tar zxvf mhash-0.9.9.9.tar.gz
[root@test software]# cd mhash-0.9.9.9
[root@test mhash-0.9.9.9]# ./configure --prefix=/usr/local/phpLib
[root@test mhash-0.9.9.9]# make && make install
[root@test mhash-0.9.9.9]# cd ..


[root@test software]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0"
[root@test software]# tar zxvf libmcrypt-2.5.8.tar.gz
[root@test software]# cd libmcrypt-2.5.8
[root@test libmcrypt-2.5.8]# ./configure --prefix=/usr/local/phpLib
[root@test libmcrypt-2.5.8]# make && make install
[root@test libmcrypt-2.5.8]# cd libltdl/
[root@test libltdl]# ./configure --prefix=/usr/local/phpLib --enable-ltdl-install
[root@test libltdl]# make && make install
[root@test  libmcrypt-2.5.8]# cd ..



[root@test ~]# cd /etc/ld.so.conf.d/
[root@test ld.so.conf.d]# vim phpLibs.conf
添加这一行
/usr/local/phpLib/lib
[root@test ld.so.conf.d]# ldconfig

[root@test software]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0"
[root@test software]# tar zxvf mcrypt-2.6.8.tar.gz
[root@test software]# cd mcrypt-2.6.8
[root@test mcrypt-2.6.8]# export LDFLAGS="-L/usr/local/phpLib/lib -L/usr/lib"
[root@test mcrypt-2.6.8]# export CFLAGS="-I/usr/local/phpLib/include -I/usr/include"
[root@test mcrypt-2.6.8]# touch malloc.h
[root@test mcrypt-2.6.8]# ./configure --prefix=/usr/local/phpLib/ --with-libmcrypt-prefix=/usr/local/phpLib
[root@test mcrypt-2.6.8]# make && make install
[root@test  mcrypt-2.6.8]# cd ..

 安装mssql扩展

[root@test php-5.3.29]# cd ext/mssql
[root@test mssql]# /usr/local/php/bin/phpize
[root@test mssql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetds/
[root@test mssql]# make
[root@test mssql]# make test
[root@test mssql]# make install
[root@test mssql]# cp /usr/local/php/lib/php/extensions/no-debug-zts-20090626/* /usr/local/php/ext/

相关推荐