1 安装Apache服务器
yum -y install httpd httpd-devel
如何查看服务:
systemctl | grep httpd
启动apache:
service httpd start
2 安装mysql
yum -y install mysql mysql-server mysql-devel
如果yum源上没有mysql-server
阿里云上没有mysql
安装mariadb
1 yum -y install mariadb
2 yum -y install mariadb-server
如何查看服务是否安装
yum -y installed |grep mariadb
3 安装php以及其扩展
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
4 启动mysql
service mysqld start
连接mysql
mysql -uroot -p
登录以后查看mysql
show databases;
5 修改防火墙规则
[root@localhost ~]# iptables -F
[root@localhost ~]# service iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables:[确定]
[root@localhost ~]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则:[确定]
iptables:正在卸载模块:[确定]
注意:selinux一定要关闭,不然会带来很多的问题
[root@localhost ~]# vi /etc/selinux/config
设置
SELINUX=disabled
6 启动APACHE
apche启动,提示错误
[root@localhost ~]# apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd (pid 18265) already running
修改配置文件
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf
设置行号:set nu 大概276行
ServerName www.example.com:80取消注释
[root@localhost ~]# apachectl restart
测试地址:192.168.214.42 ,OK
7 测试php
[root@localhost ~]# cd /var/www/html
[root@localhost html]# vi index.php
<?php
phpinfo();
?>
测试地址:192.168.214.42 ,OK
大功告成!
提升性能,安装zend
[root@localhost yum.repos.d]# wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh 注意:是大O
[root@localhost yum.repos.d]# yum install php-zend-optimizer,安装失败