CentOS6.x 下 LNMP環境搭建(準備篇)php
CentOS6.x 下 LNMP環境搭建(1、安裝 MySQL)mysql
CentOS6.x 下 LNMP環境搭建(2、安裝 Nginx)linux
CentOS6.x 下 LNMP環境搭建(3、安裝 PHP)nginx
# mkdir -p /lnmp/server /lnmp/www /lnmp/log/mysql /lnmp/log/nginx /lnmp/log/php
注:安裝好的目錄結構相似以下c++
/lnmp/ ├── log │ ├── mysql │ ├── nginx │ └── php ├── server │ ├── mysql -> /lnmp/server/mysql-5.x.xx │ ├── mysql-5.x.xx │ ├── nginx -> /lnmp/server/nginx-1.4.4 │ ├── nginx-1.4.4 │ ├── php -> /lnmp/server/php-5.x.xx │ └── php-5.x.xx ├── info.log └── www
# chown -R www:www /lnmp/log # chmod -R 755 /lnmp/log # chown -R www:www /lnmp/www # chmod -R 755 /lnmp/www
# mkdir -p /root/src && cd /root/src <------- 源碼包下載存放目錄 # wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.50-linux2.6-x86_64.tar.gz # wget http://nginx.org/download/nginx-1.6.3.tar.gz # wget http://cn2.php.net/distributions/php-5.5.36.tar.gz
注:其它版本及備用下載地址參見附錄sql
# /etc/init.d/iptables status <------- 查看當前防火牆狀態 # vim /etc/sysconfig/iptables ..... -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT <------- 開放80 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT <------- 開放3306 -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT # /etc/init.d/iptables restart <------- 重啓防火牆
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config # shutdown -r now
# yum -y install gcc gcc-c++ kernel-devel