安裝apache
1:關(guān)閉firewall
停止firewall服務(wù)
systemctl stop firewalld.service
禁止firewall開(kāi)機(jī)啟動(dòng)
systemctl disable firewalld.service
2:安裝iptables防火墻
安裝
yum install iptables-services
編輯防火墻配置文件
vi /etc/sysconfig/iptables
修改 內(nèi)容如下:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is 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! #保存退出
3:關(guān)閉SELINUX
修改配置文件
vi /etc/selinux/config
修改內(nèi)容如下:
#SELINUX=enforcing #注釋掉
#SELINUXTYPE=targeted #注釋掉
SELINUX=disabled #增加
:wq! #保存退出
是配置立即生效
setenforce 0
安裝apache
yum install httpd
基本指令如下:
systemctl start httpd.service #啟動(dòng)apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重啟apache
systemctl enable httpd.service #設(shè)置apache開(kāi)機(jī)啟動(dòng)
安裝mysql
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
重啟mysql服務(wù)
service mysqld restart
設(shè)置密碼方法
# mysql -uroot
mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
mysql> exit
安裝php
yum install php
安裝php組件蹋偏,使php支持mysql
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
重啟對(duì)應(yīng)服務(wù)
systemctl restart mysqld.service
systemctl restart httpd.service