博客来源
1.下载相关软件包
#下载nginx
http://nginx.org/download/nginx-1.5.13.tar.gz
#下载pcre
http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz
#下载MySQL
http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.37.tar.gz
#下载php
http://ar2.php.net/get/php-5.5.10.tar.gz/from/this/mirror
#下载cmake(MySQL编译工具)
http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
#下载libmcrypt(PHPlibmcrypt模块)
http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
2.安装相关编译工具及运行库
yum install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch freetype-devel
[ubuntu]:
sudo apt-get install libwrap0-dev libncurses5-dev libssl-dev libxml2-dev libsslcommon2-dev libcurl4-openssl-dev pkg-config libbz2-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmcrypt-dev libxslt1-dev libiconv-hook-dev libpcre3-dev gcc g++
3.安装cmake
tar zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
make
make install
4.安装mysql
tar zxvf mysql-5.5.37.tar.gz
cd mysql-5.5.37
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data
make
make install
cd /usr/local/mysql
#创建mysql用户
useradd mysql -M
#生成mysql系统数据库
./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
#把Mysql加入系统启动
cp ./support-files/mysql.server /etc/init.d/mysqld
#加入开机启动
chkconfig mysqld on
#删除系统默认配置文件/etc/my.cnf
rm /etc/my.cnf
#设置root密码
mysql -uroot
mysql> SET PASSWORD = PASSWORD('root');
#赋予mysql root用户权限
sudo /usr/local/mysql/bin/mysql_upgrade -uroot -proot
5.安装pcre
cd /usr/local/src
mkdir /usr/local/pcre
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make install
6.安装nginx
useradd nginx -M
tar zxvf nginx-1.5.13.tar.gz
cd nginx-1.5.13
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
7.安装libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
nake install
8.安装PHP
tar -zvxf php-5.5.10.tar.gz
cd php-5.5.10
mkdir -p /usr/local/php5
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session --with-mcrypt --with-curl
make
make instal