1、安装Apache
[root@localhost ~]# yum -y install httpd
# 开机自启动
[root@localhost ~]# chkconfig httpd on
# 启动httpd 服务
[root@localhost ~]# service httpd start
### 安装apache 一些扩展,如果业务不需要可以不添加
[root@localhost ~]# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
现在直接在浏览器键入http://localhost 或 http://本机IP ,应该会看到Apache的测试页面,这里需要注意iptables的设置。
2、安装配置MySQL
# mysql 客户端程序
# mysql-server 服务端程序
# mysql-devel 开发设计的库
[root@localhost ~]# yum -y install mysql mysql-server mysql-devel
# 开机启动
[root@localhost ~]# chkconfig mysqld on
# 启动mysqld服务
[root@localhost ~]# service mysqld start
# 进行一些安全性配置,删除匿名用户设置mysql管理密码之类的。
[root@localhost ~]# /usr/bin/mysql_secure_installation
root@localhost ~]# netstat -tulpn | grep -i mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1723/mysqld
OK, 我们看到mysqld已经启动,监听在3306端口上。
3、安装php
安装相关模块:为了让PHP支持MySQL,我们可以安装php-mysql软件包;也可使用以下命令搜索可用的php模块
[root@localhost ~]# yum -y install php php-mysql
# 安装php常用扩展
[root@localhost ~]# yum search php
[root@localhost ~]# yum -y