本文介绍LNMP环境源码安装过程及其中可能遇到的问题。
PHP
1. wget http://am1.php.net/get/php-5.5.38.tar.gz/from/this/mirror&& mv mirror php-5.5.38.tar.gz
2. tar -zxvf php-5.5.38.tar.gz && cd php-5.5.38
3. ./configure --prefix=/usr/local/lnmp/php5.5.38--enable-fpm --enable-mysqlnd --with-mysql --with-mysqli --with-pdo-mysql
4. make && make install
5. 设置配置文件:复制源码php.ini-development 到 /usr/local/lnmp/php5.5.38/etc
6. 启动php-fpm /usr/local/lnmp/php5.5.38/sbin/php-fpm -c /usr/local/lnmp/php5.5.38/etc/php.ini
NGINX
1. wget http://nginx.org/download/nginx-1.10.2.tar.gz
2. tar -zxvf nginx-1.10.2.tar.gz && cd nginx-1.10.2
3. ./configure --prefix=/usr/local/lnmp/nginx1.10.3
4. make && make install
安装过程当中提示error:the HTTP rewrite module requires the PCRE library,用yum安装提示已经安装了pcre最新的,再次尝试无果,查询资料得知安装pcre-devel即可
yum -y install pcre-devel
MYSQL
1. wget https://github.com/mysql/mysql-server/archive/mysql-5.5.56.tar.gz
2. tar -zxvf mysql-5.5.56.tar.gz && cd mysql-server-mysql-5.5.56
3. cmake . \-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql5.6\-DMYSQL_DATADIR=/usr/local/lnmp/data/mysql \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DEXTRA_CHARSETS=all \-DENABLED_LOCAL_INFILE=1)
4. make && make install
5. 设置配置文件 cp /usr/local/lnmp/mysql5.6/suport_files/my-default.cnf ../my.cnf
6. 启动 /usr/local/lnmp/mysql5.6/bin/mysqld_safe --defaults-file=/usr/local/lnmp/mysql5.6/my.cnf &
需要安装依赖如下:
yum install ncurses-devel gcc gcc-c++ yum -y install bison