1.安装apache

yum install httpd

启动apache

/etc/init.d/httpd start 

2.安装mysql

yum install mysql mysql-server 

启动mysql

/etc/init.d/mysqld start

3.安装php

yum install php

重启apache

/etc/init.d/httpd restart 

4.安装php的mysql模块

yum install php-mysql 

重启apache
/etc/init.d/httpd restart 

5.把LAMP组件设置为自动启动
chkconfig --levels 2345 httpd on
chkconfig --levels 2345 mysqld on