LNMP Architecture Introduction
MySQL Installation
Start the installation first go to the/USR/LOCAL/SRC directory, put all the installation packages unified into this directory for easy search
[[email protected] src]# cd /usr/local/src ##进入/usr/local/src目录
Download the installation package HTTPS://CODING.NET/U/AMINGLINUX/P/RESOURCE/GIT/BLOB/MASTER/README.MD This site has a downloadable installation package
[[email protected] src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
Unzip after download is complete
[[email protected] src]# tar zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
After the decompression is done to move the directory to another path and then change the name, after the completion of the move to see if the results are the same
[[email protected] src]# mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql[[email protected] src]# ls /usr/local/mysql/ ##查看结果 bin COPYING data docs include lib man mysql-test README scripts share sql-bench support-files
Go to the directory where you just changed your name/usr/local/mysql/
[[email protected] src]# cd /usr/local/mysql/
Create a user of USR, create the data directory
[[email protected] mysql]# useradd mysql[[email protected] mysql]# mkdir /data/
And then initialize, the process of initializing is to put some MySQL to boot the directory that he needs to build, after the installation is completed two OK, if not trust echo $? Take a look is not 0
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql [[email protected] mysql]# echo $?
Copy the configuration file, and then edit the
[[email protected] mysql]# cp support-files/my-default.cnf /etc/my.cnf[[email protected] mysql]# vim /etc/my.cnf
Copy the startup script, and then edit it
[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld[[email protected] mysql]# vim /etc/init.d/mysqld
Start
[[email protected] mysql]# /etc/init.d/mysqld start
You can then add the mysqld to the service list and let him boot.
[[email protected] mysql]# chkconfig --add mysqld ##加入列表[[email protected] mysql]# chkconfig mysqld on ##开机启动
PHP Installation
Do a PHP experiment in the Lamp class to remove PHP,
Start installation
Skip a few steps before doing the following
Enter/usr/local/src/
Download wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
Unzip the tar zxf php-5.6.30.tar.gz
Create User useradd-s/sbin/nologin php-fpm
Enter the unpacked installation package
[[email protected] src]# cd php-5.6.32
Compile parameters
[[email protected] php-5.6.32]# ./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
Error less curl during installation, install Curl, continue running after installation
[[email protected] php-5.6.32]# yum install libcurl-devel ##安装curl
Installation Complete
Make && make install
[[email protected] php-5.6.32]# make && make install
[[email protected] php-5.6.32]# ls /usr/local/php-fpm/ ##lnmpbin etc include lib php sbin var[[email protected] php-5.6.32]# ls /usr/local/php/ ##lampbin etc include lib php[[email protected] php-5.6.32]# ls /usr/local/php-fpm/sbin/ php-fpm ##这个文件就是用来启动php-fpm的[[email protected] php-5.6.32]# ls /usr/local/php-fpm/var/log ##存放日志[[email protected] php-5.6.32]# ls /usr/local/php-fpm/var/run ##存放PID的
If you want to start the configuration service, copy Php.ini-production to/usr/local/php-fpm/etc/php.ini first.
[[email protected] php-5.6.32]# cp php.ini-production /usr/local/php-fpm/etc/php.ini
Edit php-fpm.conf
[[email protected] php-5.6.32]# cd /usr/local/php-fpm/etc/ ##到这个目录下来[[email protected] etc]# vim php-fpm.conf ##这个目录没有php-fpm.conf文件vim直接创建编辑,编辑这个配置文件到https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/php-fpm.conf里拷贝样例
Configuration file Content Explained
[global] ##全局的参数pid = /usr/local/php-fpm/var/run/php-fpm.pid ##PID定义路径error_log = /usr/local/php-fpm/var/log/php-fpm.log ##log路径[www] ##模块的名字listen = /tmp/php-fcgi.sock ##监听的地址listen.mode = 666 ##定义sock的权限user = php-fpm ##用户group = php-fpm ##组pm = dynamic ##以下都是进程的信息pm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024
Copy Startup scripts
[[email protected] etc]# cd /usr/local/src/php-5.6.32/ ##进入到源码包目录[[email protected] php-5.6.32]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm ##sapi/fpm/init.d.php-fpm启动脚本放到/etc/init.d/php-fpm下
Join the list of services change permissions first
[[email protected] php-5.6.32]# chmod 755 /etc/init.d/php-fpm
Start
[[email protected] php-5.6.32]# chkconfig --add php-fpm[[email protected] php-5.6.32]# chkconfig php-fpm on ##开机启动[[email protected] php-5.6.32]# service php-fpm start
Nginx Introduction
Nginx Russian development, Nginx static file processing ability is much stronger than Apache,
45 Lessons (LNMP architecture Introduction, MySQL installation, PHP installation, Nginx introduction)