1 更新yum
yum update
2 安装依赖
yum -y install pcre* openssl*
yum -y install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurldevel curl curl-deve
3安装apache
#一键安装apache
yum install httpd
#启动apche
/etc/init.d/httpd start #方法1
service httpd start #方法2
#设置apache开机自动启动
chkconfig --levels 235 httpd on
4安装mysql
#安装mysql
yum -y install mysql mysql-server mysql-devel
#开启mysql
service mysqld start
#更改配置,设置root密码
/usr/bin/mysql_secure_installation
#将mysql设置为开机自动启动
chkconfig --levels 345 mysqld on
5安装php7
#更新yum源(默认yum源中无php7)
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
#安装php及常用的拓展模块(php70w-devel是phpize拓展安装的关健)
yum -y install php70w php70w-mysql php70w-mbstring php70w-gd php70w-imap php70w-ldap php70w-odbc php70w-pear php70w-xml php70w-xmlrpc php70w-pdo php70w-devel
#安装swoole
pecl install swoole
#找到php.ini 文件末尾追加
extension=swoole.so
#重启apache
service httpd restart
#查看php安装了那些拓展模块
php -m
访问的时候记得是否开启防火墙。