CentOS6.x 下 LNMP環境搭建(準備篇)

CentOS6.x 下 LNMP環境搭建(準備篇)php

CentOS6.x 下 LNMP環境搭建(1、安裝 MySQL)mysql

CentOS6.x 下 LNMP環境搭建(2、安裝 Nginx)linux

CentOS6.x 下 LNMP環境搭建(3、安裝 PHP)nginx


LNMP 服務安裝目錄

# 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

追加防火牆規則,開放80/3306端口

# /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  <------- 重啓防火牆

關閉 SELinux

# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# shutdown -r now

安裝編譯所需軟件包

# yum -y install gcc gcc-c++ kernel-devel

附錄:

MySQL

Apache

Nginx

PHP

相關文章
相關標籤/搜索