yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel
cd /usr/lib
ln -sf libjpeg.so.62.0.0 libjpeg.so
ln -sf libpng12.so.0.1.2.7 libpng.so
cd /usr/local/src
wget http://sysoev.ru/nginx/nginx-0.6.32.tar.gz
wget http://www.php.net/get/php-5.2.6.tar.gz/from/this/mirror
wget http://php-fpm.anight.org/downloads/head/php-5.2.6-fpm-0.5.8.diff.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.26-rc.tar.gz/from/http://mysql.ntu.edu.tw/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
wget http://pecl.php.net/get/memcache-2.2.3.tgz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz
wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.6.32.tar.gz
wget ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.22.tar.bz2
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
./configure --prefix=/usr/local/mysql --without-debug --with-unix-socket-path=/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=utf8,gbk,gb2312 --with-pthread --enable-thread-safe-client
tar zxvf php-5.2.6.tar.gz -C dir
gzip -cd php-5.2.6-fpm-0.5.8.diff.gz | patch -d php-5.2.6/ -p1
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-xml \
--enable-fastcgi \
--enable-force-cgi-redirect \
--disable-rpath --enable-discard-path \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-curl \
--with-curlwrappers \
--with-bz2 \
--enable-mbstring \
--with-zlib \
--with-xsl \
--enable-calendar \
--with-gettext \
--with-gd \
--enable-exif \
--with-jpeg-dir=/usr/local \
--with-freetype-dir \
--with-png-dir \
--enable-gd-native-ttf \
--enable-sysvmsg \
--enable-sockets \
--with-ttf=/usr/lib \
--enable-bcmath \
--enable-safe-mode \
--without-iconv \
--enable-wddx \
--disable-debug \
--enable-discard-path \
--with-iconv-dir=/usr/local \
--disable-short-tags \
--disable-ctype \
--enable-fpm \
--enable-inline-optimization \
--enable-mbregex \
--enable-shmop \
--with-libxml-dir=/usr
sed -i 's#-lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt#& -liconv#' Makefile
make
make install
cp php.ini-recommended /usr/local/php/etc/php.ini
cd ../
tar zxvf pcre-7.7.tar.gz
cd pcre-7.7/
./configure
make && make install
cd ../
tar zxvf nginx-0.6.31.tar.gz
cd nginx-0.6.31/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
chkconfig --add mysqld
chkconfig --add nginx
chkconfig --level 2345 mysqld on
chkconfig --level 2345 nginx on