编辑脚本

#!/bin/bash

#安装repoforge的yum包

rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

#清空yum源的数据

yum clean all

#检查yum源的数据

yum check-update

#安装LAMP服务的相关包

yum install httpd* mysql mysql-server php*

#启动httpd服务

service httpd restart

#启动mysql数据库的服务

service mysqld restart

#创建phpinfo.php文件

echo '<?php phpinfo(); ?>' > /var/www/html/phpinfo.php

#创建index.html文件

echo '<meta http-equiv="fresh" content='0;url=phpinfo.php'>' > /var/www/html/index.html

#查看本地的网站首页,并跳转到phpinfo.php

links http://localhost