12.一、LNMP架構介紹php
12.二、MySQL安裝css
[root@zgxlinux-01 src]# rm -rf /usr/local/mysql/mysql
[root@zgxlinux-01 src]# rm -rf /etc/init.d/mysqld linux
[root@zgxlinux-01 src]# tar mysql-5.6.39-linux-glibc2.12-x86_64.tar.gznginx
[root@zgxlinux-01 src]# mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysqlgit
[root@zgxlinux-01 src]# ls /usr/local/mysql/
bin docs man scripts support-files
COPYING include mysql-test share
data lib README sql-bench
[root@zgxlinux-01 src]# rm -rf /data/mysql*
[root@zgxlinux-01 src]# ls /data/
mariadb wwwroot
[root@zgxlinux-01 mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
[root@zgxlinux-01 mysql]# echo $?
0web
[root@zgxlinux-01 mysql]# vim /etc/my.cnf
sql
[root@zgxlinux-01 mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@zgxlinux-01 mysql]# vim /etc/init.d/mysql vim
[root@zgxlinux-01 mysql]# mv /etc/init.d/mysql /etc/init.d/mysqld
[root@zgxlinux-01 ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@zgxlinux-01 ~]# ps aux |grep mysql
root 1713 0.0 0.1 113308 1616 pts/0 S 16:45 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/zgxlinux-01.pid
mysql 1852 1.0 44.8 1302720 451564 pts/0 Sl 16:45 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=zgxlinux-01.err --pid-file=/data/mysql/zgxlinux-01.pid --socket=/tmp/mysql.sock
root 1878 0.0 0.0 112720 984 pts/0 R+ 16:46 0:00 grep --color=auto mysql
[root@zgxlinux-01 mysql]# chkconfig --add mysqld
[root@zgxlinux-01 mysql]# chkconfig mysqld on
[root@zgxlinux-01 mysql]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@zgxlinux-01 mysql]# service mysqld start
Starting MySQL. SUCCESS!
[root@zgxlinux-01 mysql]# ps aux |grep mysqld
root 1985 0.0 0.1 11816 1604 pts/0 S 16:48 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/zgxlinux-01.pid
mysql 2124 1.3 45.2 1302720 455144 pts/0 Sl 16:48 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=zgxlinux-01.err --pid-file=/data/mysql/zgxlinux-01.pid --socket=/tmp/mysql.sock
root 2148 0.0 0.0 112720 984 pts/0 R+ 16:48 0:00 grep --color=auto mysqldapi
12.三、PHP安裝
#安裝過程
[root@zgxlinux-01 src]# cd php-5.6.32/
[root@zgxlinux-01 php-5.6.32]# make clean
[root@zgxlinux-01 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
[root@zgxlinux-01 php-5.6.32]# echo $?
1
[root@zgxlinux-01 php-5.6.32]# yum install -y libcurl-devel
[root@zgxlinux-01 php-5.6.32]# echo $?
0
[root@zgxlinux-01 php-5.6.32]# make && make install
[root@zgxlinux-01 php-5.6.32]# echo $?
0
[root@zgxlinux-01 php-5.6.32]# ls /usr/local/php-fpm/
bin etc include lib php sbin var
[root@zgxlinux-01 php-5.6.32]# ls /usr/local/php/
bin etc include lib php
[root@zgxlinux-01 php-5.6.32]# ls /usr/local/php-fpm/sbin/
php-fpm
[root@zgxlinux-01 php-5.6.32]# cp php.ini-production /usr/local/php-fpm/etc/php.ini
[root@zgxlinux-01 php-5.6.32]# cd /usr/local/php-fpm/etc/
[root@zgxlinux-01 etc]# ls
pear.conf php-fpm.conf.default php.ini
[root@zgxlinux-01 etc]# vim php-fpm.conf
[root@zgxlinux-01 etc]# cd /usr/local/src/php-5.6.32
[root@zgxlinux-01 php-5.6.32]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@zgxlinux-01 php-5.6.32]# chmod 755 /etc/init.d/php-fpm
[root@zgxlinux-01 php-5.6.32]# chkconfig --add php-fpm
[root@zgxlinux-01 php-5.6.32]# chkconfig php-fpm on
[root@zgxlinux-01 php-5.6.32]# service php-fpm start
Starting php-fpm [25-Nov-2018 18:35:02] ERROR: [pool www] cannot get uid for user 'php-fpm'
[25-Nov-2018 18:35:02] ERROR: FPM initialization failed
failed
[root@zgxlinux-01 php-5.6.32]# useradd php-fpm
[root@zgxlinux-01 php-5.6.32]# service php-fpm start
Starting php-fpm done
[root@zgxlinux-01 php-5.6.32]# ps aux |grep php-fpm
root 53532 0.1 0.4 123672 4936 ? Ss 18:37 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm 53533 0.0 0.4 123672 4696 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53534 0.0 0.4 123672 4696 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53535 0.0 0.4 123672 4696 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53536 0.0 0.4 123672 4696 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53537 0.0 0.4 123672 4700 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53538 0.0 0.4 123672 4700 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53539 0.0 0.4 123672 4700 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53540 0.0 0.4 123672 4700 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53541 0.0 0.4 123672 4700 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53542 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53543 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53544 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53545 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53546 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53547 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53548 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53549 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53550 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53551 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
php-fpm 53552 0.0 0.4 123672 4704 ? S 18:37 0:00 php-fpm: pool www
root 53554 0.0 0.0 112720 980 pts/0 R+ 18:37 0:00 grep --color=auto php-fpm
12.五、Nginx介紹