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 ssse2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gettext-devel libXpm-devel libtool libevent libevent-devel gd-devel gd libmcrypt libmcrypt-devel pcre pcre-devel
[root@lnmp software]# tar zxvf libiconv-1.14.tar.gz
[root@lnmp software]# cd libiconv-1.14
[root@lnmp libiconv-1.14]# ./configure --prefix=/service/libiconv
[root@lnmp libiconv-1.14]# make && make install
[root@lnmp software]# tar zxvf GD-2.50.tar.gz
[root@lnmp software]# cd GD-2.50
[root@lnmp GD-2.50]# perl Makefile.PL
[root@lnmp GD-2.50]# make && make install
安裝MySQL
[root@lnmp software]# tar zxvf mysql-5.5.34.tar.gz
[root@lnmp software]# cd mysql-5.5.34
[root@lnmp mysql-5.5.34]# groupadd mysql
[root@lnmp mysql-5.5.34]# useradd -g mysql -s /sbin/nologin mysql
[root@lnmp mysql-5.5.34]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/service/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=30307 -DCOMPILATION_COMMENT=ZWC -DWITH_DEBUG=0
[root@lnmp mysql-5.5.34]# make && make install
[root@lnmp mysql-5.5.34]# cp support-files/my-large.cnf /service/mysql/my.cnf
[root@lnmp mysql-5.5.34]# chown -R mysql:mysql /data/mysql /service/mysql
[root@lnmp mysql-5.5.34]# /service/mysql/bin/mysqld_safe --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql &
安裝PHP,PHP5.5中自帶了mysqlnd,MySQL不是必須安裝的
[root@lnmp software]# tar zxvf php-5.5.6.tar.gz
[root@lnmp software]# cd php-5.5.6
[root@lnmp php-5.5.6]# groupadd webroot
[root@lnmp php-5.5.6]# useradd -g webroot -s /sbin/nologin webroot
[root@lnmp php-5.5.6]# ./configure --prefix=/service/php --with-config-file-path=/service/php/etc --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt --with-zlib-dir --with-xpm-dir --enable-xml --with-curl --with-zlib --enable-exif --with-zlib-dir --with-bz2 --with-libxml-dir --enable-mbstring --enable-sockets --enable-zip --enable-ftp --with-iconv-dir=/service/libiconv --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --with-fpm-user=webroot --with-fpm-group=webroot --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --with-libdir=lib64
[root@lnmp php-5.5.6]# make && make install
Installing shared extensions: /service/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP CLI binary: /service/php/bin/
Installing PHP CLI man page: /service/php/php/man/man1/
Installing PHP FPM binary: /service/php/sbin/
Installing PHP FPM config: /service/php/etc/
Installing PHP FPM man page: /service/php/php/man/man8/
Installing PHP FPM status page: /service/php/php/fpm/
Installing PHP CGI binary: /service/php/bin/
Installing PHP CGI man page: /service/php/php/man/man1/
Installing build environment: /service/php/lib/php/build/
Installing header files: /service/php/include/php/
Installing helper programs: /service/php/bin/
program: phpize
program: php-config
Installing man pages: /service/php/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /service/php/lib/php/
[PEAR] Archive_Tar - installed: 1.3.11
[PEAR] Console_Getopt - installed: 1.3.1
warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.4)
warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1)
[PEAR] PEAR - installed: 1.9.4
Wrote PEAR system config file at: /service/php/etc/pear.conf
You may want to add: /service/php/lib/php to your php.ini include_path
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.1
/service/software/php-5.5.6/build/shtool install -c ext/phar/phar.phar /service/php/bin
ln -s -f /service/php/bin/phar.phar /service/php/bin/phar
Installing PDO headers: /service/php/include/php/ext/pdo/
[root@lnmp php-5.5.6]# cp php.ini-production /service/php/etc/php.ini
[root@lnmp php-5.5.6]# cp /service/php/etc/php-fpm.conf.default /service/php/etc/php-fpm.conf
[root@lnmp php-5.5.6]# /service/php/sbin/php-fpm
[root@lnmp php-5.5.6]# netstat -lanp|grep php-fpm
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 5483/php-fpm.conf)
unix 3 [ ] STREAM CONNECTED 459737 5483/php-fpm.conf)
unix 3 [ ] STREAM CONNECTED 459736 5483/php-fpm.conf)
[root@lnmp php-5.5.6]# ps -ef|grep php
root 5483 1 0 23:19 ? 00:00:00 php-fpm: master process (/service/php/etc/php-fpm.conf)
webroot 5484 5483 0 23:19 ? 00:00:00 php-fpm: pool www
webroot 5485 5483 0 23:19 ? 00:00:00 php-fpm: pool www
root 5497 24209 0 23:21 pts/0 00:00:00 grep php