[root@server6 ~]# yum install -y gcc gcc-c++ ncurses-devel bison openssl-devel zlib-devel
[root@server6 ~]# yum install -y cmake-2.8.12.2-4.el6.x86_64.rpm
[root@server6 ~]# cd mysql-5.7.17/
[root@server6 mysql-5.7.17]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql -DMYSQL_DATADIR=/usr/local/lnmp/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_BOOST=/root/mysql-5.7.17/boost/boost_1_59_0/

[root@server6 mysql-5.7.17]# make && make install
[root@server6 mysql-5.7.17]# groupadd -g 27 mysql
[root@server6 mysql-5.7.17]# useradd -u 27 -g 27 -M -d /usr/local/lnmp/mysql/ mysql
[root@server6 mysql-5.7.17]# usermod -s /sbin/nologin mysql
[root@server6 mysql-5.7.17]# cd /usr/local/lnmp/mysql/
[root@server6 mysql]# chown mysql.mysql . -R
[root@server6 mysql]# ll
总用量 56
drwxr-xr-x 2 mysql mysql 4096 10月 13 15:30 bin
-rw-r--r-- 1 mysql mysql 17987 11月 28 2016 COPYING
drwxr-xr-x 2 mysql mysql 4096 10月 13 15:30 docs
drwxr-xr-x 3 mysql mysql 4096 10月 13 15:30 include
drwxr-xr-x 4 mysql mysql 4096 10月 13 15:30 lib
drwxr-xr-x 4 mysql mysql 4096 10月 13 15:30 man
drwxr-xr-x 10 mysql mysql 4096 10月 13 15:30 mysql-test
-rw-r--r-- 1 mysql mysql 2478 11月 28 2016 README
drwxr-xr-x 28 mysql mysql 4096 10月 13 15:30 share
drwxr-xr-x 2 mysql mysql 4096 10月 13 15:30 support-files
[root@server6 ~]# vim .bash_profile

基于lnmp的论坛
[root@server6 ~]# source .bash_profile
[root@server6 ~]# which mysql
/usr/local/lnmp/mysql/bin/mysql
[root@server6 mysql]# chown root . -R
[root@server6 mysql]# ll
总用量 56
drwxr-xr-x 2 root mysql 4096 10月 13 15:30 bin
-rw-r--r-- 1 root mysql 17987 11月 28 2016 COPYING
drwxr-xr-x 2 root mysql 4096 10月 13 15:30 docs
drwxr-xr-x 3 root mysql 4096 10月 13 15:30 include
drwxr-xr-x 4 root mysql 4096 10月 13 15:30 lib
drwxr-xr-x 4 root mysql 4096 10月 13 15:30 man
drwxr-xr-x 10 root mysql 4096 10月 13 15:30 mysql-test
-rw-r--r-- 1 root mysql 2478 11月 28 2016 README
drwxr-xr-x 28 root mysql 4096 10月 13 15:30 share
drwxr-xr-x 2 root mysql 4096 10月 13 15:30 support-files
[root@server6 mysql]# vim /etc/my.cnf
基于lnmp的论坛
[root@server6 mysql]# cd support-files/
[root@server6 support-files]# cp mysql.server /etc/init.d/mysqld
[root@server6 mysql]# mysqld --initialize --user=mysql
基于lnmp的论坛
[root@server6 mysql]# chown mysql data -R
[root@server6 mysql]# /etc/init.d/mysqld start
Starting MySQL. [确定]
[root@server6 mysql]# mysql_secure_installation #根据初始化修改密码
二、Php 安装

1.解决安装所需依赖性
[root@server6 ~]# yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64
[root@server6 php-5.6.35]# yum install -y libxml2-devel
[root@server6 php-5.6.35]# yum install -y openssl-devel
[root@server6 php-5.6.35]# yum install -y curl-devel
[root@server6~]# yum install -y gmp-devel
[root@server6 ~]# yum install libmcrypt-devel-2.5.8-9.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm -y
[root@server6 ~]# yum install -y net-snmp-devel
[root@server6 ~]# yum install re2c-0.13.5-1.el6.x86_64.rpm -y
执行编译(有报错根据报错安装软件一般是软件-devel)
[root@server6 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-pear --with-gettext --with-gmp --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
基于lnmp的论坛
出现这个即为完成php
[root@server6 php-5.6.35]# make && make install
[root@server6 php-5.6.35]# cd /usr/local/lnmp/php/
[root@server6 php]# cd etc/
[root@server6 etc]# ls
pear.conf php-fpm.conf.default
[root@server6 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server6 lnmp]# cd
[root@server6 ~]# cd php-5.6.35
[root@server6 php-5.6.35]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini
[root@server6 php-5.6.35]# cd sapi/fpm/
[root@server6 fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@server6 fpm]# chmod +x /etc/init.d/php-fpm
[root@server6 etc]# pwd
/usr/local/lnmp/php/etc
[root@server6 etc]# vim php.ini
基于lnmp的论坛
[root@server6 ~]# useradd -u 800 -M -d /usr/local/lnmp/nginx nginx
[root@server6 ~]# /etc/init.d/php-fpm start
三、Nginx 安装
[root@server6 ~]# tar zxf nginx-1.10.1.tar.gz
[root@server6 ~]# cd nginx-1.10.1
[root@server6 nginx-1.10.1]# cd src/core/
[root@server6 core]# vim nginx.h
基于lnmp的论坛
[root@server6 nginx-1.10.1]# vim auto/cc/gcc
#CFLAGS=”$CFLAGS -g” (注释掉这行,去掉 debug 模式编译,编译以后程序只有几百 k)
[root@server6 nginx-1.10.1]# yum install -y pcre-devel
[root@server6 nginx-1.10.1]# ./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-threads --user=nginx --group=nginx
[root@server6 nginx-1.10.1]# make && make install
[root@server6 nginx-1.10.1]# ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/
[root@server6 ~]# vim /usr/local/lnmp/nginx/conf/nginx.conf
基于lnmp的论坛
基于lnmp的论坛
[root@server6 ~]# nginx -t
nginx: the configuration file /usr/local/lnmp/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/lnmp/nginx/conf/nginx.conf test is successful
[root@server6 ~]# nginx -s reload
[root@server6 ~]# cd /usr/local/lnmp/nginx/html/
[root@server6 html]# vim index.php
<?php
phpinfo()
?>
[root@server6 nginx]# vim conf/nginx.conf
基于lnmp的论坛
解决php和mysql的依赖关系
[root@server6 nginx]# cd /usr/local/lnmp/php/etc/
基于lnmp的论坛
基于lnmp的论坛
[root@server6 etc]# /etc/init.d/php-fpm reload
[root@server6 ~]# yum install -y unzip
[root@server6 ~]# unzip Discuz_X3.2_SC_UTF8.zip 解压
[root@server6 ~]# mv upload/ /bbs
[root@server6 ~]# vim /usr/local/lnmp/nginx/conf/nginx.conf
基于lnmp的论坛
基于lnmp的论坛
[root@server6 ~]# cd /bbs/
[root@server6 bbs]# chmod 777 config/ data/ -R
[root@server6 bbs]# chmod 777 uc_client/ uc_server/ -R
[root@server6 bbs]# chmod 755 data/
[root@server6 bbs]# /etc/init.d/mysqld restart