基於lnmp的論壇
[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]# 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
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
[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
[root@server6 mysql]# cd support-files/
[root@server6 support-files]# cp mysql.server /etc/init.d/mysqld
[root@server6 mysql]# mysqld --initialize --user=mysql
[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
出現這個即為完成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
[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
[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
[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
解決php和mysql的依賴關系
[root@server6 nginx]# cd /usr/local/lnmp/php/etc/
[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
[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
基於lnmp的論壇