CentOS6.5 Compile installation LNMP environment _php skills

Source: Internet
Author: User
Tags bz2 curl fpm ldap mcrypt openssl set time openldap

Online Search for the following tutorial

Copy Code code as follows:

Yum-y install gcc gcc-c++ automake autoconf libtool make
Libmcrypt Installation
Mkdir/usr/local/source && Cd/usr/local/source #创建并进入源文件目录
[Root@localhost source]# wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460 &big_mirror=0 #下载libmcrypt
[root@localhost source]# MV Libmcrypt-2.5.7.tar.gz\?modtime\=1171868460\&\;big_mirror\=0 Libmcrypt-2.5.7.tar.gz #重命名
TAR––ZXVF libmcrypt-2.5.7.tar.gz #解压
CD libmcrypt-2.5.7 #进入解压目录
./configure--prefix=/usr/local/libmcrypt && make && make install #安装

Because the compile installation Libmcrypt has been faulted, running Rpm–q libmcrypt View the installed RPM package found failed

So I've referenced another article that installs LNMP.

Copy Code code as follows:

Yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-deve L zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs E2 Fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap openldap-devel Nss_ldap Openldap-clients openldap-servers libxpm* #下载安装编译工具和依赖包
Yum-y Update #更新yum
Download installation package
Mkdir/tmp/source
Cd/tmp/source
wget http://nginx.org/download/nginx-1.7.8.tar.gz #最新
wget http://cn2.php.net/distributions/php-5.4.35.tar.bz2 stable version because the php5.5 does not support MySQL extensions, temporarily use the latest
Wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz #mysql5.6
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F% 2fsourceforge.net%2fprojects%2fmcrypt%2ffiles%2flibmcrypt%2f2.5.8%2f&ts=1418528625&use_mirror=tcpdiag
MV libmcrypt-2.5.8.tar.gz\?r\=http\:%2f%2fsourceforge.net%2fprojects%2fmcrypt%2ffiles%2flibmcrypt%2f2.5.8%2f Libmcrypt-2.5.8.tar.gz #删除多余参数的文件名
wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz?r=http%3A%2F% 2fsourceforge.net%2fprojects%2fmhash%2ffiles%2fmhash%2f0.9.9.9%2f&ts=1418530194&use_mirror=hivelocity
MV mhash-0.9.9.9.tar.gz\?r\=http\:%2f%2fsourceforge.net%2fprojects%2fmhash%2ffiles%2fmhash%2f0.9.9.9%2f Mhash-0.9.9.9.tar.gz #删除多余参数的文件名
wget http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=http%3A%2F% 2fsourceforge.net%2fprojects%2fmcrypt%2ffiles%2fmcrypt%2f2.6.8%2f&ts=1418531968&use_mirror= Softlayer-dal
MV mcrypt-2.6.8.tar.gz\?r\=http\:%2f%2fsourceforge.net%2fprojects%2fmcrypt%2ffiles%2fmcrypt%2f2.6.8%2f Mcrypt-2.6.8.tar.gz #删除多余参数的文件名
wget http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
# # #暂没有下载 Memcache pcre eaccelerator

Install Libiconv, Libmcrypt, (#没安装libltdl), Mhash, (#安装make没效果mcrypt), bison

Copy Code code as follows:

845 Tar zxvf libmcrypt-2.5.8.tar.gz
846 CD libmcrypt-2.5.8
847./configure--prefix=/usr/local/libmcrypt
848 make && make install
836 Tar zxvf libiconv-1.14.tar.gz
837 CD libiconv-1.14
838./configure--prefix=/usr/local
839 make && make install
850 tar zxvf mhash-0.9.9.9.tar.gz
851 CD mhash-0.9.9.9
854./configure--prefix=/usr/mhash
855 Make && make install

Install CMake

Copy Code code as follows:

cd/tmp/
Tar zxvf cmake-2.8.3.tar.gz
CD cmake-2.8.3/
./configure--PREFIX=/USR
Gmake
Gmake Install

Preparing users, directories

Copy Code code as follows:

Groupadd MySQL
useradd-g MySQL MySQL
Groupadd www
Useradd-g www www
Mkdir-p/data/mysql
Chown-r Mysql:mysql/data/mysql
Mkdir-p/data/www
Chown-r www:www/data/www

installing MySQL

Compile:

Copy Code code as follows:

Tar zxvf mysql-5.6.22.tar.gz
CD mysql-5.6.22
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dwith_innobase_storage_engine=1-dwith_ memory_storage_engine=1-dwith_myisam_storage_engine=1-dsysconfdir=/usr/local/mysql/etc/-dwith_ssl=yes-ddefault _charset=utf8-ddefault_collation=utf8_general_ci-dwith_readline=on
Make && make install
Ln-s/usr/local/mysql/lib/lib*/usr/lib/

Configuration:

Copy Code code as follows:

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/data/mysql/--user=mysql

From start

Copy Code code as follows:

Cp/opt/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Chkconfig mysqld on
/etc/rc.d/init.d/mysqld start
cd/opt/mysql/
Bin/mysql_secure_installation #设置mysql账号密码

Installing PHP

Compile:

Copy Code code as follows:

mkdir/usr/local/php
Cd/usr/local/src
Tar zxvf php-5.3.5.tar.gz
CD php-5.3.5
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/opt/mysql-- With-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--disable-safe-mode-- Enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex-- ENABLE-FPM--enable-mbstring (--with-mcrypt)--with-gd--enable-gd-native-ttf--with-openssl--with-mhash-- Enable-pcntl--enable-sockets (--with-ldap--with-ldap-sasl)--with-xmlrpc--enable-zip
./configure--prefix=/usr/local/php--enable-fpm--with-iconv=/usr/local/bin/libiconv \--with-mcrypt=/usr/local/ Bin/libmcrypt \--enable-mbstring--disable-pdo--with-curl--disable-debug--disable-rpath Enable-inline-optimization--with-bz2--with-zlib--enable-sockets \--enable-sysvsem--ENABLE-SYSVSHM --enable-mbregex \--with-mhash--enable-zip--with-pcre-regex--with-mysql--with-mysqli \--with-gd--with-jpeg-dir
Make && make install
CP Php.ini-development/usr/local/php/etc/php.ini #复制配置文件

Configure PHP-FPM

Copy Code code as follows:

cd/usr/local/php
CP Etc/php-fpm.conf.default etc/php-fpm.conf
VI etc/php-fpm.conf
PID = Run/php-fpm.pid
Emergency_restart_threshold = 10
Emergency_restart_interval = 1m
Process_control_timeout = 5s

148 149 Lines

Copy Code code as follows:

user = www
Group = www

3 Copy php config file to php default profile path

4) Change the configuration file (set time zone)

Copy Code code as follows:

Vim/usr/local/php/lib/php.ini

919 lines, time zone changed to PRC, is the People's Republic of China.

Date.timezone = PRC

Install Nginx
Install Pcre

Copy Code code as follows:

wget http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net% 2fprojects%2fpcre%2ffiles%2fpcre%2f8.36%2f&ts=1418696677&use_mirror=iwebhttp:// downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3a%2f%2fsourceforge.net%2fprojects% 2fpcre%2ffiles%2fpcre%2f8.36%2f&ts=1418696677&use_mirror=iweb
MV pcre-8.36.tar.gz\?r\=http\:%2f%2fsourceforge.net%2fprojects%2fpcre%2ffiles%2fpcre%2f8.36%2f pcre-8.36.tar.gz
Tar zxvf pcre-8.36.tar.gz
CD pcre-8.36 &&/configure && make && make install

Install Zlib

Copy Code code as follows:

wget http://zlib.net/zlib-1.2.8.tar.gz
Tar zxvf zlib-1.2.8.tar.gz && cd zlib-1.2.8 &&./configure && make && make install

Installing SSL

Copy Code code as follows:

wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
Tar zxvf openssl-1.0.1j.tar.gz

Install Nginx

Copy Code code as follows:

Mkdir/usr/local/nginx
Tar zxvf nginx-1.7.8.tar.gz
./configure--user=www--group=www--prefix=/usr/local/nginx--with-http_stub_status_module \--pid-path=/usr/local/ Nginx/nginx.pid--with-http_ssl_module \--with-pcre=/usr/local/src/pcre-8.36 \--with-zlib=/usr/local/src/ zlib-1.2.8 \--with-openssl=/usr/local/src/openssl-1.0.1j && make && make install

Configure Nginx

Copy Code code as follows:

Vim/usr/local/nginx/conf/nginx.conf

Start the server

Copy Code code as follows:

/opt/nginx/sbin/nginx
/OPT/PHP/SBIN/PHP-FPM.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.