CentOS 6.3编译安装LNMP环境,安装必要的依赖关系:
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel gd gd-devel libmcrypt libmcrypt-devel pcre pcre-devel libaio
安装必要的工具:
yum -y install gcc gcc-c++ make
编译安装mcrypt:
1.首先安装Libmcrypt:
下载地址:
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
2.安装mhash
下载地址:
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
3.安装mcrypt
下载地址:
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
export LD_LIBRARY_PATH=/usr/local/lib
./configure
make
make install
编译安装Nginx
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module
make && make install
编译安装MySQL
下载MYSQL源码,按照INSTALL-BINARY文档里面的说明部署即可~
编译安装PHP
PHP编译参数:
./configure --prefix=/usr/local/php \
--with-libxml-dir \
--with-zlib \
--with-curl \
--enable-exif \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--with-openssl \
--with-mcrypt \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--enable-soap \
--with-iconv \
--with-pear \
--enable-sockets \
--enable-fpm \
--enable-pcntl \
--enable-mbstring \
--enable-fileinfo \
make && make install
将/usr/local/php/etc/下的php-fpm.conf.default 改为 php-fpm.conf
PS:
1.一个小技巧,安装完成之后把php目录改成php+版本号,然后再做一个链接到这个目录,方便以后多个版本的替换
lrwxrwxrwx. 1 root root 9 6月 22 07:03 php -> php5.6.9/
drwxr-xr-x. 9 root root 4096 6月 21 11:03 php5.6.9
drwxr-xr-x. 9 root root 4096 6月 21 10:38 php7.0.0
2.如果安装的是php7,还要把/usr/local/php/etc/php-fpm.d 目录的改成
Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置
LNMP 全功能编译安装 for CentOS 6.3笔记
CentOS 6.3 安装LNMP (PHP 5.4,MyySQL5.6)