First, configure the firewall, open 80 port, 3306 Port
CentOS 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed.
1. Close firewall:
#停止firewall服务
- systemctl Stop Firewalld.service
#禁止firewall开机启动
- systemctl Disable Firewalld.service
2. Install iptables firewall
#安装
- Yum Install iptables-services
#编辑防火墙配置文件
- Vi/etc/sysconfig/iptables
# Firewall configuration written by System-config-firewall
# Manual Customization of this file are not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A input-m State--state established,related-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-i lo-j ACCEPT
-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
-A input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
COMMIT
: wq! #保存退出
#最后重启防火墙使配置生效
- systemctl Restart Iptables.service
#设置防火墙开机启动
- Systemctl Enable Iptables.service
Second, to close SELinux
#修改配置文件
- Vi/etc/selinux/config
#SELINUX =enforcing #注释掉
#SELINUXTYPE =targeted #注释掉
selinux=disabled #增加
: wq! #保存退出
#使配置立即生效
- Setenforce 0
three. Installing Apache
- Yum Install httpd
may be used:
systemctl start Httpd.service #启动apache
systemctl Stop Httpd.service #停止apache
systemctl Restart Httpd.service #重启apache
systemctl Enable Httpd.service #设置apache开机启动
restart, then:
Enter the localhost
appears after the representation has been installed.
four. Install MySQL
method reference
http://blog.itpub.net/29773961/viewspace-1248176/
method is roughly the same
7 can be used :
- r PM-IVH mysql-community-release-el6-5.noarch.rpm
< Span style= "FONT-SIZE:16PX; Color: #000000 ">
for this step, most of the CENTOS7 configuration tutorials that are currently available are installed MARIADB, because CENTOS7 is treated as MySQL by default.
P.S. Since MySQL was acquired by Oracle, the original author was worried about MySQL's closed source, so he wrote a mariadb, which can be understood as a MySQL branch 。
I'm here to install MySQL
If you need to install MARIADB, just go through yum.
five. Install php
- yum install php
< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "FONT-SIZE:16PX; Color: #000000 "> install PHP components so that PHP supports MySQL
- yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring p Hp-bcmath php-mhash
< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "font-size:16px" > restart the corresponding service
- systemctl restart Mysqld.service
- systemctl restart Httpd.service
< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "FONT-SIZE:16PX; Color: #000000 ">< Span style= "font-size:16px" >
CentOS 7.0 Installation Configuration Lamp server method (APACHE+PHP+MARIADB)