一.安装Apache
1.安装服务
yum -y install httpd
2.开启服务并设置开机启动
systemctl start httpd
systemctl enable httpd
3.设置防火墙开放端口
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
二.安装mysql
1.安装服务
yum -y install mariadb-server mariadb
2.启动服务并设置开机启动
systemctl start mariadb.service
systemctl enable mariadb.service
3.设置密码
#mysql_secure_installation
Enter current password for root (enter for none): <--ENTER
Set root password? [Y/n]
New password: <--yourmariadbpassword
Re-enter new password: <--yourmariadbpassword
Password updated successfully!
Remove anonymous users? [Y/n] <--ENTER
... Success!
Disallow root login remotely? [Y/n] <--ENTER
... Success!
Remove test database and access to it? [Y/n] <--ENTER
- Dropping test database...
... Success!
Reload privilege tables now? [Y/n] <--ENTER
... Success!
三.安装PHP
1.先安装epel-release
yum -y install epel-release
2.切换源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.安装PHP56及常用扩展
yum -y install php56w php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath
yum -y install httpd php-gd56w php-intl56w php-mysql56w mod_ssl openssl mcrypt php5-mcrypt56w
yum -y install php56w-mcrypt php56w-soap php56w-intl php56w-pdo
4.重启mysql 服务
systemctl restart mariadb.service
5.重启Apache服务
systemctl restart httpd.service