First, the preparatory work:
Software default download under/USR/LOCAL/SRC, installed in the/app/local php, MySQL, nginx, the data directory, the installation sequence according to nginx->mysql->php
Compiling the toolset:
Yum install-y wget gcc gcc-c++ autoconf automake cmake Bison M4 libxml2 libxml2-devel libcurl-devel libjpeg-devel libpng- Devel libicu-devel pcre pcre-devel libtool
OpenSSL openssl-devel bzip2 bzip2-devel ncurses ncurses-devel freetype freetype-devel
Libxslt-devel
Update system: Yum install-y update
Download the required software:
Php:wget-c http://mirrors.sohu.com/php/php-7.0.10.tar.gz
Mysql:wget-c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.14.tar.gz
Nginx:wget-c http://nginx.org/download/nginx-1.10.1.tar.gz
Cmake:wget-c https://cmake.org/files/v3.1/cmake-3.1.3.tar.gz
Some library files required by PHP: Wget-c http://zlib.net/zlib-1.2.8.tar.gz
Wget-c http://blog.zyan.cc/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz
Wget-c http://blog.zyan.cc/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
Wget-c http://blog.zyan.cc/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
Second, install Nginx
New users and Groups: Useradd-u 500-g 500-g 500-s/sbin/nologin www
Groupadd-g www
Create a new directory: Mkdir-p/app/local/{nginx,mysql,php,data}
#tar ZXVF nginx-1.10.1.tar.gz
#cd nginx-1.10.1
#可以通过./configure--help View Help
#./configure--prefix=/app/local/nginx--with-http_realip_module--with-http_gzip_static_module--with-http_stub_ Status_module
#make && make Install
#cd: /
#systemctl stop firewalld.service# To turn off the firewall
#/app/local/nginx/sbin/nginx #开启nginx
#可以通过curl判断nginx是否正常访问或者在浏览器地址栏输入ip地址查看
Third, install MySQL
#tar ZXVF cmake-3.1.3.tar.gz
#cd cmake-3.1.3
#./configure
#make && make Install
#cd: /
#tar ZXVF mysql-boost-5.7.14.tar.gz
#cd mysql-5.7.14/
#cmake-dcmake_install_prefix=/app/local/mysql-dmysql_unix_addr=/app/local/mysql/mysql.sock-dsysconfdir=/app/ Local/mysql/etc-dsystemd_pid_dir=/app/local/mysql-ddefault_charset=utf8-ddefault_collation=utf8_general_ci- Dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_ Perfschema_storage_engine=1-dmysql_datadir=/app/local/data-dwith_boost=boost-dwith_systemd=1
#make && make Install
#cd: /
#chown-R mysql:mysql/app/local/mysql/
#chown-R mysql:mysql/app/local/data/
#cd/app/local/mysql/bin
#./mysqld--initialize--user=mysql--basedir=/app/local/mysql/--datadir=/app/local/data/#初始化数据库并且随机生成一个密码
#./mysqld--user=mysql# Open MySQL
#echo ' Export path= $PATH:/app/local/mysql/bin ' >>/etc/profile.d/mysql.sh
#source/etc/profile.d/mysql.sh
#mysql-uroot-p
Enter Password: #输入刚才随机生成的密码
Mysql>alter USER ' root ' @ ' localhost ' identified by ' new_password '; #通过这个重置密码
Iv. Installation of PHP
First, install some PHP package files
#cd/usr/local/src/
#tar ZXVF mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make && make Install
#cd: /
#tar ZXVF libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make && make Install
#cd: /
#tar ZXVF mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#./configure
Error occurred: configure:error: * * * Libmcrypt was not found
Solution: Ln-s/usr/local/bin/libmcrypt_config/usr/bin/libmcrypt_config again./configure still error, executive export LD_LIBRARY_PATH=/USR /local/lib:ld_library_path
Again./configure through
#make && make Install
#cd: /
#tar ZXVF zlib-1.2.8.tar.gz
#cd zlib-1.2.8
#./configure
#make && make Install
#cd: /
#tar ZXVF php-7.0.10.tar.gz
#cd php-7.0.10
#./configure--prefix=/app/local/php--with-config-file-path=/app/local/php/etc--with-pdo-sqlite--with-zlib-dir- -with-freetype-dir--enable-mbstring--with-libxml-dir=/usr--enable-xmlreader--enable-xmlwriter--enable-soap-- Enable-calendar--with-curl--with-mcrypt--with-gd--disable-rpath--enable-inline-optimization--with-bz2-- With-zlib--enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--enable-exif-- Enable-bcmath--with-mhash--enable-zip--with-pcre-regex--with-pdo-mysql--with-mysqli--with-mysql-sock-- Enable-mysqlnd--with-jpeg-dir=/usr--with-png-dir=/usr--enable-gd-native-ttf--with-openssl--enable-ftp-- With-imap-ssl--with-kerberos--with-gettext--with-xmlrpc--with-xsl--enable-opcache--enable-fpm--with-fpm-user= www--with-fpm-group=www--disable-fileinfo
#make && make Install
#cd: /
Five, configuration
#cp/usr/local/src/php-7.0.10/app/local/php/etc/php.ini
#cp/app/local/php/etc/php-fpm.conf.default/app/local/php/etc/php-fpm.conf
#cp/app/local/php/etc/php-fpm.d/www.conf.default/app/local/php/etc/php-fpm.d/www.conf
#vi www.conf #查找/static Change pm=dynamic to PM =static save exit
#vi/app/local/php/etc/php.ini# Find Date.timezone Remove the preceding semicolon and set it as PRC save exit
#vi/app/local/nginx/conf/nginx.conf
Revision changed to
User www www;
Worker_processes 4;
Error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;
#pid Logs/nginx.pid;
Events {
Use Epoll;
Worker_connections 51024;
}
Location ~ \.php${
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
#fastcgi_param script_filename $fastcgi _script_name;
Include fastcgi.conf;
}
Save exit
#/app/local/nginx/sbin/nginx-t# Test configuration file is incorrect if it appears as follows the error message will be indicated in how many lines
Nginx:the configuration file/app/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/app/local/nginx/conf/nginx.conf Test is successful
#vi/app/local/nginx/html/index.php
Enter <?php phpinfo?> save exit
#/app/local/nginx/sbin/nginx# start Nginx
#/app/local/php/sbin/php-fpm# Start PHP-FPM
#systemctl stop firewalld.service# To turn off the firewall
Enter ip/index.php in the browser address bar if the installation configuration is successful if the following appears
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/CB/wKiom1fK2r6BMFJhAADY18cfGME803.png-wh_500x0-wm_3 -wmp_4-s_3227652147.png "title=" Qq20160903221306.png "alt=" Wkiom1fk2r6bmfjhaady18cfgme803.png-wh_50 "/>
This article is from the "Selfim" blog, make sure to keep this source http://selfim.blog.51cto.com/11028663/1846009
centos7.2+php7.0.10+mysql5.7.14+nginx1.10.1 Build LNMP Environment