LNMP Compiling and installing

Source: Internet
Author: User
Tags chmod curl fpm install php ini php and
One, install MySQL 5.1.73
1. Download the MySQL 5.1.73 free of compile
[Root@www ~]# CD/USR/LOCAL/SRC
[Root@www src]# wget http://cdn.mysql.com/Downloads/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz # #64位
[Root@www src]# wget http://cdn.mysql.com/Downloads/MySQL-5.1/mysql-5.1.73-linux-i686-glibc23.tar.gz # #32位
2. Build MySQL account
First log on to the Linux system as root, and then execute the following command to create the MySQL group and the user:
[Root@www ~]# useradd-s/sbin/nologin-m MySQL

After extracting the free-build binary package, move to/usr/local and rename to MySQL, which is now the path in/usr/local/mysql/.
[Root@www ~]# Mv/usr/local/src/mysql-5.1.73-linux-i686-glibc23/usr/local/mysql

3. Create a directory/data/mysql to change the owner group of this directory to MySQL. copy my-huge.cnf to/etc/my.cnf
[Root@www mysql]# chown-r Mysql.mysql/data/mysql

[Root@www mysql]# CP support-files/my-huge.cnf/etc/my.cnf

4. Copy the Mysql.server to INIT.D and rename it to Mysqld. And give him 755 permissions.
[Root@www mysql]# CP Support-files/mysql.server/etc/init.d/mysqld
[Root@www mysql]# chmod 755/etc/init.d/mysqld
[Root@www mysql]# Vim!$

Basedir=/usr/local/mysql
Datadir=/data/mysql


5. Initialize
[Root@www mysql]#./scripts/mysql_install_db--user=mysql--datadir=/data/mysql

[Root@www mysql]# Ls/data/mysql
MySQLmysql-bin.000001 mysql-bin.000002 Mysql-bin.index Test

6. Start MySQL
[Root@www mysql]#/etc/init.d/mysqld start
Starting MySQL. success!
[Root@www mysql]# PS aux |grep mysql
Root 1889 0.0 0.0 106060 1484 pts/0 S 00:34 0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/ MySQL--pid-file=/data/mysql/www.pid
MySQL 0.0 1.7 543920 68288 pts/0 Sl 00:34 0:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql-- Datadir=/data/mysql--user=mysql--log-error=/data/mysql/www.err--pid-file=/data/mysql/www.pid--socket=/tmp/ Mysql.sock--port=3306
Root 2028 0.0 0.0 103248 876 pts/0 s+ 00:35 0:00 grep mysql

#chkconfig--add mysqld
#chkconfig mysqld on


two, compile and install PHP 5.3.29

1. Download the PHP5.2.29 source package
[Root@www ~]# cd/usr/local/src [root@kevinlinux src]# wget http://mirrors.sohu.com/php/php-5.3.29.tar.gz
[Root@kevinlinux src]# Tar XF php-5.3.29.tar.gz

2. Create a PHP user
[Root@kevinlinux ~]# useradd-s/sbin/nologin-m MySQL

3. Preparation Before installing PHP:[Root@www ~]# rpm-qa zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel pcre-devel
[Root@www ~]# yum install-y zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel pcre-d Evel

Epel Yum Source issue [Root@kevinlinux/]# Rpm-ivh ' http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64. noarch.rpm ' # #CentOS6 64-bit
[root@kevinlinux/]# RPM-IVH ' http//www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm ' # #Cen TOS6 32-bit
4. Compile and install PHP 5.3.29[Root@kevinlinux src]# cd/usr/local/src/php-5.3.29

[Root@kevinlinux php-5.3.29]#./configure \
--prefix=/usr/local/php \
--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP/ETC \
--ENABLE-FPM \
--WITH-FPM-GROUP=PHP-FPM \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-libxml-dir \
--WITH-GD \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-mcrypt \
--ENABLE-SOAP \
--ENABLE-GD-NATIVE-TTF \
--ENABLE-FTP \
--enable-mbstring \
--ENABLE-EXIF \
--enable-zend-multibyte \
--disable-ipv6 \
--with-pear \
--with-curl

#make && make Install

4. Copy the PHP and PHP-FPM configuration files
[Root@kevinlinux ~]# cd/usr/local/src/php-5.3.29
[Root@kevinlinux php-5.3.29]# CP Php.ini-production/usr/local/php/etc/php.ini
[Root@kevinlinux php-5.3.29]# Cd/usr/local/php/etc
[Root@kevinlinux etc]# CP Php-fpm.conf.default php-fpm.conf
5. Copy the startup script
[Root@kevinlinux etc] #cp/USR/LOCAL/SRC/PHP-5.3.29/SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM
6. Launch script 755 permissions to PHP
[Root@kevinlinux etc]# chmod 755/etc/init.d/php-fpm #chkconfig--add php-fpm
#chkconfig PHP-FPM on

third, compile and install Nginx
1. Download the Nginx 1.6.2 Source package
[Root@www ~]# CD/USR/LOCAL/SRC
[Root@kevinlinux src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[Root@kevinlinux src]# Tar XF nginx-1.6.2.tar.gz

2. Compile and install Nginx 1.6.2[root@kevinlinux src] #cd nginx-1.6.2
[Root@kevinlinux nginx-1.6.2]#./configure \
--prefix-/usr/local/nginx \
--with-pcre

3. Start Nginx:[Root@kevinlinux ~]#/usr/local/nginx/sbin/nginx

4. Reload Nginx:[Root@kevinlinux ~]#/usr/local/nginx/sbin/nginx-s Reload


[Root@kevinlinux ~]#/usr/local/nginx/sbin/nginx-t # #检查nginx. conf file is correct, you can specify config file with-c
[Root@kevinlinux ~]#/usr/local/nginx/sbin/nginx-v # #查看nginx版本
[Root@kevinlinux ~]#/usr/local/nginx/sbin/nginx-v # #查看nginx版本及编译参数
[Root@kevinlinux ~]# Cat/usr/local/nginx/logs/nginx.pid # #查看nginx的pid


Nginx is very powerful in process control and can control the process through signal instruction.
QUIT: Indicates that the process is closed after the current request has been processed
HUP: Indicates a reload of the configuration, which closes the original process and opens a new worker process. This operation does not interrupt user access requests (smooth restart Nginx)
USR1: Used for Nginx log switching, that is, to reopen a log file, such as the daily generation of a new log file, you can use this signal control
USR2: For smooth upgrade executable program

[Root@localhost ~]# kill 1269 # off Nginx
[Root@localhost ~]# kill-quit 1269 # off Nginx
[Root@localhost ~]# kill-hup ' cat/usr/local/nginx/logs/nginx.pid ' # smooth restart Nginx

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.