阿里云centos7.2 centos 超全lamp 环境搭建 ,各种拼接:

vmware 安装

修改dns

/etc/sysconfig/network-scripts 下面查找ifcfg-en33(可能会不同) 的文件,vi 编辑这个文件

BOOTPROTO=static #dhcp改为static(修改)
ONBOOT=yes #开机启用本配置,一般在最后一行(修改)

IPADDR=192.168.1.204 #静态IP(增加)
GATEWAY=192.168.1.2 #默认网关,虚拟机安装的话,通常是2,也就是VMnet8的网关设置(增加)
NETMASK=255.255.255.0 #子网掩码(增加)
DNS1=192.168.1.2 #DNS 配置,虚拟机安装的话,DNS就网关就行,多个DNS网址的话再增加(增加)

  编辑 /etc/resolv.conf

添加 nameserver 8.8.8.8
service network restart 重启服务

  

安装apache

1.安装

yum -y install httpd

2.开启apache服务

systemctl start httpd.service

3.设置apache服务开机启动

systemctl enable httpd.service

使用公网访问能看到apache就说明安装成功

安装php7

1.安装php7
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2. 通过云进行php和其他组件的安装
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
yum install php70w-fpm
安装mysql
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
查看
yum repolist enabled | grep "mysql.*-community.*"
安装mysql
yum -y install mysql-community-server
开机启动
systemctl enable mysqld
启动mysql服务
systemctl start mysqld
远程访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyPassword' WITH GRANT OPTION;

FLUSH PRIVILEGES;

防火墙

1、firewalld的基本使用

启动: systemctl start firewalld

查看状态: systemctl status firewalld

停止: systemctl disable firewalld

禁用: systemctl stop firewalld

添加

firewall-cmd --zone=public --add-port=80/tcp --permanent

删除

firewall-cmd --zone= public --remove-port=80/tcp --permanent

最后一定要在阿里云安全组里添加mysql规则

修改数据库密码 参考网址 http://blog.csdn.net/qq_28347599/article/details/71915209

隐藏index.php

在APACHE里面去配置 ,将里面的AllowOverride None都改为AllowOverride All

删除mysql,php

rpm -qa | grep php 查看php

rpm -qa|grep -i mysql 查看mysql

yum remove mysql 删除mysql

rpm -e php-fpm-5.3.3-22.el6.x86_64 删除php ,删除mysql一样

1、firewalld的基本使用

启动: systemctl start firewalld

查看状态: systemctl status firewalld

停止: systemctl disable firewalld

禁用: systemctl stop firewalld

添加

firewall-cmd --zone=public --add-port=80/tcp --permanent