LNMP Architecture Introduction, mysql,php installation, Nginx introduction

Source: Internet
Author: User
Tags curl fpm soap mcrypt openssl pear sapi

LNMP Architecture Introduction

MySQL Installation


1. Download the package first

[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz--2018-02-26 21:12:00--  http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz正在解析主机 mirrors.sohu.com (mirrors.sohu.com)... 221.236.12.140正在连接 mirrors.sohu.com (mirrors.sohu.com)|221.236.12.140|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:316320366 (302M) [application/octet-stream]正在保存至: “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz”100%[====================================>] 316,320,366  525KB/s 用时 11m 2s 2018-02-26 21:23:02 (467 KB/s) - 已保存 “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz” [316320366/316320366])

2. Unzip

3. Move the directory and rename it

[[email protected] src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql

4. Go to MySQL Directory

[[email protected] src]# cd /usr/local/mysql/[[email protected] mysql]# lsbin      data  include  man         README   share      support-filesCOPYING  docs  lib      mysql-test  scripts  sql-bench

5. Create a user, directory, and initialize

[[email protected] mysql]# useradd mysql[[email protected] mysql]# mkdir /data/[[email protected] mysql]# ls /data/[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlFATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper

6. Initialize:

./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlInstalling MySQL system tables...2018-02-26 22:25:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-02-26 22:25:59 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2018-02-26 22:25:59 0 [Note] ./bin/mysqld (mysqld 5.6.36) starting as process 1622 ...2018-02-26 22:25:59 1622 [Note] InnoDB: Using atomics to ref count buffer pool pages2018-02-26 22:25:59 1622 [Note] InnoDB: The InnoDB memory heap is disabled2018-02-26 22:25:59 1622 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-02-26 22:25:59 1622 [Note] InnoDB: Memory barrier is not used2018-02-26 22:25:59 1622 [Note] InnoDB: Compressed tables use zlib 1.2.32018-02-26 22:25:59 1622 [Note] InnoDB: Using Linux native AIO

7. Execute immediately upon completion of execution

[[email protected] mysql]# echo $?0

Verify that the previous one is correct, 0 is correct
8. Copy the configuration file or change your own file

[[email protected] mysql]# cp support-files/my-default.cnf  /etc/my.cnf^C[[email protected] mysql]# ls /etc/my.cnf/etc/my.cnf[[email protected] mysql]# rpm -qf /etc/my.cnfmariadb-libs-5.5.56-2.el7.x86_64

[Email protected] mysql]# VIM/ETC/MY.CNF

[mysqld]datadir=/data/mysqlsocket=/tmp/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]#log-error=/var/log/mariadb/mariadb.log#pid-file=/var/run/mariadb/mariadb.pid## include all files from the config directory##!includedir /etc/my.cnf.d

9. Copy the startup script

[[email protected] mysql]# ls support-files/binary-configure  my-default.cnf       mysql-log-rotatemagic             mysqld_multi.server  mysql.server[[email protected] mysql]# cp support-files/mysql.server  /etc/init.d/mysqld

10. Change the startup script:
[Email protected] mysql]# Vi/etc/init.d/mysqld

basedir=/usr/local/mysqldatadir=/data/mysql

11. Set Boot up

[[email protected] mysql]# chkconfig --add mysqld[[email protected] mysql]# chkconfig --list注:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。       要列出 systemd 服务,请执行 ‘systemctl list-unit-files‘。      查看在具体 target 启用的服务请执行      ‘systemctl list-dependencies [target]‘。mysqld          0:关 1:关 2:开 3:开 4:开 5:开 6:关netconsole      0:关 1:关 2:关 3:关 4:关 5:关 6:关network         0:关 1:关 2:开 3:开 4:开 5:开 6:关
PHP Installation

1. First, empty the previous PHP configuration:

[[email protected] php-5.6.30]# make cleanfind . -name \*.gcno -o -name \*.gcda | xargs rm -ffind . -name \*.lo -o -name \*.o | xargs rm -ffind . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -ffind . -name .libs -a -type d|xargs rm -rfrm -f libphp5.la sapi/cli/php sapi/cgi/php-cgi    libphp5.la modules/* libs/*

2. Reconfigure:

 ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-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 --with-pear --with-curl  --with-openssl![](http://i2.51cto.com/102?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

Error

checking whether to enable calendar conversion support... nochecking whether to enable ctype functions... yeschecking for cURL support... yeschecking for cURL in default path... not foundconfigure: error: Please reinstall the libcurl distribution -    easy.h should be in <curl-dir>/include/curl/

To install a dependency package:

[[email protected] php-5.6.30]# yum install -y libcurl-devel已加载插件:fastestmirrorbase                                                                   | 3.6 kB  00:00:00     epel/x86_64/metalink                                                   | 5.8 kB  00:00:00     epel                                                                   | 4.7 kB  00:00:00     extras                                                                 | 3.4 kB  00:00:00     updates                                                                | 3.4 kB  00:00:00     (1/4): extras/7/x86_64/primary_db                                      | 181 kB  00:00:00

Configure again:

 ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-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 --with-pear --with-curl  --with-openssl![](http://i2.51cto.com/102?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

Complete
3. Installation

[[email protected] php-5.6.30]# make && make install/bin/sh /usr/local/src/php-5.6.30/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/opcache/ -I/usr/local/src/php-5.6.30/ext/opcache/ -DPHP_ATOM_INC -I/usr/local/src/php-5.6.30/include -I/usr/local/src/php-5.6.30/main -I/usr/local/src/php-5.6.30 -I/usr/local/src/php-5.6.30/ext/date/lib -I/usr/local/src/php-5.6.30/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/local/src/php-5.6.30/ext/mbstring/oniguruma -I/usr/local/src/php-5.6.30/ext/mbstring/libmbfl -I/usr/local/src/php-5.6.30/ext/mbstring/libmbfl/mbfl -I/usr/local/mysql/include -I/usr/local/src/php-5.6.30/ext/sqlite3/libsqlite -I/usr/local/src/php-5.6.30/TSRM -I/usr/local/src/php-5.6.30/Zend    -I/usr/include -g -O2 -fvisibility=hidden   

4. View the file structure:

[[email protected] php-5.6.30]# ls /usr/local/php-fpm/bin  etc  include  lib  php  sbin  var[[email protected] php-5.6.30]# ls /usr/local/phpbin  etc  include  lib  php[[email protected] php-5.6.30]# ls /usr/local/php-fpm/sbin/php-fpm[[email protected] php-5.6.30]# ls /usr/local/php-fpm/varlog  run

5. Check that the configuration is correct:

[[email protected] php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -t[12-Mar-2018 22:27:46] ERROR: failed to open configuration file ‘/usr/local/php-fpm/etc/php-fpm.conf‘: No such file or directory (2)[12-Mar-2018 22:27:46] ERROR: failed to load configuration file ‘/usr/local/php-fpm/etc/php-fpm.conf‘[12-Mar-2018 22:27:46] ERROR: FPM initialization failed


6. Modify the configuration file:

[[email protected] php-5.6.30]# cp php.ini-production /usr/local/php-fpm/php.ini[[email protected] php-5.6.30]# cd /usr/local/php-fpm/etc/[[email protected] etc]# lspear.conf  php-fpm.conf.default[[email protected] etc]# vim php-fpm.conf
[global]pid = /usr/local/php-fpm/var/run/php-fpm.piderror_log = /usr/local/php-fpm/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024

7. Open the service:

[[email protected] etc]# cd /usr/local/src/php-5.6.30[[email protected] php-5.6.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm[[email protected] php-5.6.30]# chmod 755 /etc/init.d/php-fpm [[email protected] php-5.6.30]# chkconfig --add php-fpm[[email protected] php-5.6.30]# chkconfig php-fpm on[[email protected] php-5.6.30]# service php-fpm startStarting php-fpm [12-Mar-2018 22:42:04] ERROR: [pool www] cannot get uid for user ‘php-fpm‘[12-Mar-2018 22:42:04] ERROR: FPM initialization failed failed

Error, need to add user php-fpm

[[email protected] php-5.6.30]# useradd php-fpm[[email protected] php-5.6.30]# service PHP-FPM  Startstarting php-fpm done[[email protected] php-5.6.30]# PS aux |grep php-fpmroot 117576 0.0 0.4 123656 4920        ?        Ss 22:43 0:00 php-fpm:master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 117577 0.0 0.4 123656 4676?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117578 0.0 0.4 123656 4676?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117579 0.0 0.4 123656 4676?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117580 0.0 0.4 123656 4676?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117581 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117582 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117583 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117584 0.0 0.4 123656 4680? S 22:43 0:00 php-fpm:pool wwwphp-fpm 117585 0.0  0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117586 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117587 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117588 0.0 0.4 123656 4680?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117589 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117590 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117591 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117592 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117593 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117594 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117595 0.0 0.4 123656 4684?        S 22:43 0:00 php-fpm:pool wwwphp-fpm 117596 0.0 0.4 123656 4684? S 22:43 0:00 php-fpm:pool wwwroot 117602 0.0 0.0 112676 984 pts/0 r+ 22:43 0:00 grep--color=auto  
Nginx Introduction

LNMP Architecture Introduction, mysql,php installation, Nginx introduction

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.