Laptop Mount Centos7 php7.1.7 nginx1.13.2 mysql5.7 iptables

Source: Internet
Author: User
Tags fpm gmp install openssl mcrypt openssl iptables

First, installation Preparation

First, because some of the Nginx modules rely on some Lib library, so before installing Nginx, you must first install these Lib libraries, these dependent libraries mainly have g++, GCC, openssl-devel, pcre-devel and Zlib-devel so execute the following command installation

[HTML] View plaincopy
$ yum Install gcc-c++
$ yum Install pcre Pcre-devel
$ yum Install zlib Zlib-devel
$ yum Install OpenSSL Openssl--devel


Second, install Nginx

Before installing, it is advisable to check if Nginx is installed
[HTML] View plaincopy
$ find-name Nginx
If the system has Nginx installed, first uninstall the
[HTML] View plaincopy
$ yum Remove Nginx
First enter the/usr/local directory
[HTML] View plaincopy
$ cd/usr/local
Download the latest version of Nginx from official website
[HTML] View plaincopy
$ wget http://nginx.org/download/nginx-1.13.2.tar.gz
Unzip the Nginx compression pack
[HTML] View plaincopy
$ TAR-ZXVF nginx-1.13.2.tar.gz
will produce a nginx-1.13.2 directory, then enter the nginx-1.13.2 directory
[HTML] View plaincopy
$ CD nginx-1.13.2
Next install, use the--prefix parameter to specify the Nginx installation directory, make, make install installation
[HTML] View plaincopy
$./configure $ default installation in/usr/local/nginx
$ make
$ make Install

If there is no error, after the successful completion, it is best to look at the Nginx installation directory
[HTML] View plaincopy
$ Whereis Nginx


Third, installation PHP7

Download PHP7
Wget-o php7.tar.gz Http://cn2.php.net/get/php-7.1.7.tar.gz/from/this/mirror
Decompression PHP7
TAR-XVF php7.tar.gz
Go to PHP Directory
CD php-7.1.7
Install dependent packages
# Copy the following line directly (excluding the bank)
Yum install libxml2 libxml2-devel OpenSSL openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel LIBP ng libpng-devel freetype freetype-devel GMP gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-d Evel
Compile the configuration (if an error occurs, the underlying dependency file is not installed due to the previous step)

Error Description:
#yum Install Libmcrypt libmcrypt-devel mcrypt Mhash
Setting up Install Process
No Package Php-mcrypt available.
Error:nothing to do
We will see CentOS yum not finding these packages at all in the warehouse. But I do not want to use the source code compiled to use Yum installation, how to do?

Workaround:

Yum Install Epel-release//Expansion Pack update package
Yum Update//update Yum source
Yum install Libmcrypt libmcrypt-devel mcrypt Mhash is OK.


It's too much trouble. Refer to PHP official installation instructions from this step: http://php.net/manual/zh/install.unix.nginx.php
./configure \
--prefix=/usr/local/php \
--WITH-CONFIG-FILE-PATH=/ETC \
--ENABLE-FPM \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--ENABLE-SOAP \
--with-libxml-dir \
--WITH-XMLRPC \
--WITH-OPENSSL \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--WITH-BZ2 \
--enable-calendar \
--with-curl \
--WITH-CDB \
--enable-dom \
--ENABLE-EXIF \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--ENABLE-FTP \
--WITH-GD \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--ENABLE-GD-NATIVE-TTF \
--enable-gd-jis-conv \
--with-gettext \
--WITH-GMP \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--WITH-LIBMBFL \
--with-onig \
--ENABLE-PDO \
--WITH-MYSQLI=MYSQLND \
--WITH-PDO-MYSQL=MYSQLND \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--ENABLE-SHMOP \
--enable-simplexml \
--enable-sockets \
--ENABLE-SYSVMSG \
--enable-sysvsem \
--ENABLE-SYSVSHM \
--ENABLE-WDDX \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
Formal Installation
Make && make install
Configuring Environment variables
Vi/etc/profile
Append at end
Path= $PATH:/usr/local/php/bin
Export PATH
Execute commands to make changes effective immediately
Source/etc/profile
Configure PHP-FPM
CP Php.ini-production/etc/php.ini
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
Cp/usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.conf
CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM
chmod +x/etc/init.d/php-fpm
Start PHP-FPM
/ETC/INIT.D/PHP-FPM start

Hint cannot get UID for user ' nginx '
Resolve AddUser Nginx on OK

Installing mysql5.7

# download MySQL Source installation package
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# install MySQL source
shell> Yum Localinstall mysql57-community-release-el7-8.noarch.rpm

shell> Yum Install Mysql-community-server

Start the service
Shell> systemctl Start mysqld
Restart restart
View startup status
Systemctl Status Mysqld

Set boot up
Shell> Systemctl Enable mysqld
Shell> Systemctl Daemon-reload

To modify the root default password

After the MySQL installation is complete, a default password is generated for root in the/var/log/mysqld.log file. Locate the root default password in the following way, and then log in to MySQL to modify it:

shell> grep ' temporary password '/var/log/mysqld.log

mysql> set password for ' root ' @ ' localhost ' =password (' mynewpass4! ');
mysql> FLUSH privileges;
—————
Mysqld_safe--skip-grant-tables--skip-networking &

Closed lid does not sleep
Vim/etc/systemd/logind.conf

Handlelidswitch= suspend changed to lock
Restart Service Systemctl Restart Systemd-logind effective

To view the default target, execute:
Systemctl Get-default


Boot in command mode, execute:
Systemctl Set-default Multi-user.target
Boot up with graphical interface, execute:
Systemctl Set-default Graphical.target


Iptables
Restart
Systemctl Restart Iptables
Or
/etc/rc.d/init.d/iptables restart
1) effective after reboot
Open: Chkconfig iptables on
OFF: Chkconfig iptables off

2) immediate effect, failure after reboot
Open: Service iptables start
Close: Service iptables stop

2. Open 80 ports are required even if the iptables is installed.
----go down and install Iptables-servie.
Yum Install Iptables-services
Vi/etc/sysconfig/iptables
Add the following line
-A input-p tcp-m state--state new-m TCP--dport 80-j ACCEPT

Laptop Mount Centos7 php7.1.7 nginx1.13.2 mysql5.7 iptables

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.