CentOS7 + Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 Source compilation installation

Source: Internet
Author: User
Tags fpm install php openssl sapi openldap

First, install Nginx

1. Install dependent extensions

# yum-y Install wget openssl* gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libx ML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl Curl-de Vel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap openldap-devel nss_ldap o Penldap-clients openldap-servers make GD gd2 gd-devel gd2-devel Libaio

2. Download Nginx Source Package

# wget http://nginx.org/download/nginx-1.13.5.tar.gz

3. Create user names and user groups

-r-g www www

4. Unzip and install

# TAR-ZXVF nginx-1.13. 5 . tar.gz# CD nginx-1.13. 5 # . /configure--user=www--group=www--prefix=/usr/local/&& make install

5. Start Nginx Service

#/usr/local/nginx/sbin/nginx &

6. Shut down the firewall or open port 80

Turn off Firewall # Systemctl stop Firewalld.service Open 80 Port # Firewall-cmd --zone= public --add-port= /TCP--permanent# firewall-cmd--reload

7. Visit Page HTTP://IP

Second, installation MySQL-5.7.19

1. Download the installation package

# wget https://dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz 

2. Create MySQL users and user groups

-r-r MySQL MySQL

3. Unzip the installation package and create the data directory

# TAR-ZXF mysql-5.7. -LINUX-GLIBC2. -x86_64.tar.gz# mv MySQL-5.7. -LINUX-GLIBC2. -x86_64/usr/local//usr/local/mysql# mkdir data logs
# echo "" > Logs/error.log

4. Initialize MySQL

#./bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--port=3306 

After initialization, a random root password is generated, as follows (if the path of the specified Log-error is initialized, the password is viewed in log-error)

Or use--initialize-insecure to not generate random passwords

5. Authorization

# cd/usr/-R mysql:mysql MySQL

6. Start the MySQL service

#/usr/local/mysql/bin/mysqld_safe--user=mysql &

7. Database Configuration

# vim/etc/My.cnf[client]port=3306Socket=/tmp/Mysql.sockdefault-character-Set=Utf8[mysql]no-auto-Rehashdefault-character-Set=Utf8[mysqld]user=Mysqlport=3306Basedir=/usr/local/Mysqldatadir=/usr/local/mysql/Datasocket=/tmp/Mysql.sockpid-file =Mysql3306.pidlog-error=/usr/local/mysql/logs/Error.logskip_name_resolve=1Open_files_limit=65535Back_log=1024x768max_connections= themax_connect_errors=1000000Table_open_cache=1024x768Table_definition_cache=1024x768table_open_cache_instances= -Thread_stack=512Kexternal-locking =Falsemax_allowed_packet=32msort_buffer_size=16mjoin_buffer_size=16mthread_cache_size=2250query_cache_size=0Query_cache_type=0Interactive_timeout= -Wait_timeout= -tmp_table_size=96mmax_heap_table_size=96m###***Slowqueryparameterslong_query_time=0.1Slow_query_log=1Slow_query_log_file=/usr/local/mysql/logs/slow.log###***Binlogparameterslog-bin=mysql-binbinlog_cache_size=4mmax_binlog_cache_size=8mmax_binlog_size=1024mbinlog_format=mixedexpire_logs_days=7###master-Slavereplicationparametersserver-id=3306#slave-skip-errors=All[mysqldump]quickmax_allowed_packet=32m

8. Copy Service files

# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

9. Restart MySQL Service

#/etc/init.d/mysqld Restart

10. Configure Environment variables

# vi/etc/profile# Add the following two lines to the last line: Export mysql_home=/usr/local/mysqlexport PATH= $PATH: $MYSQL _home/  /etc/profile

11. Change the root password

- - p MySQL SET Password=password ("123456");

12. Set the boot start

-- Add mysqld  on

Third, install PHP

1. Download the PHP installation package

- O php-7.1. tar.gz http:///hk1.php.net/get/php-7.1. tar.gz/from/This/mirror

2. Unpack the installation package

# tar-ZXF PHP-7.1.Ten. tar.gz# CD php-7.1.10
#./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--enable-fpm--with-fpm-user=www-- With-fpm-group=www--with-mysqli--with-pdo-mysql--with-iconv-dir--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-bcmath--enable-shmop-- Enable-sysvsem--enable-inline-optimization--with-curl--enable-mbregex--enable-mbstring--enable-ftp--WITH-GD-- Enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip-- Enable-soap--without-pear--with-gettext--disable-fileinfo--enable-maintainer-zts--with-libdir=lib64
# Make && make install

3. Modify the configuration file

# CP php.ini-development/usr/local/php/etc/php.ini# CP. /sapi/fpm/php-fpm.conf/usr/local/php/etc/php-/usr/local/php/etc/php-fpm.d/www.conf. default /usr/local/php/etc/php-fpm.d/www.conf

4, PHP-FPM with the system self-starting

# CP./SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM

5. Start PHP

#/USR/LOCAL/PHP/SBIN/PHP-FPM

6. Set the environment variables of PHP

# vim/etc/profileexport php_home=/usr/local/phpexport PATH= $PATH: $PHP _home//etc/ Profile

CentOS7 + Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 Source compilation installation

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.