CentOS6.x 下 LNMP环境搭建(准备篇)
CentOS6.x 下 LNMP环境搭建(一、安装 MySQL)
CentOS6.x 下 LNMP环境搭建(二、安装 Nginx)
CentOS6.x 下 LNMP环境搭建(三、安装 PHP)
LNMP 服务安装目录
# mkdir -p /lnmp/server /lnmp/www /lnmp/log/mysql /lnmp/log/nginx /lnmp/log/php
注:安装好的目录结构类似如下
/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
注:其它版本及备用下载地址参见附录
追加防火墙规则,开放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
- 5.1:
- 5.5:
- 5.6:
Apache
- 2.2.x:
- 2.4.x:
Nginx
- 1.4.x
- 1.6.x
- 1.8.x
PHP
- 5.4.x
- 5.5.x
- 5.6.x
来源:oschina
链接:https://my.oschina.net/u/2276973/blog/712000