#!/bin/bash
#
#测试环境LAMP用YUM快速部署。
##注释##
#LAMP配置文件路径:
#1、/etc/httpd/conf/httpd.conf
#2、/etc/my.cnf
#3、/etc/php.ini
#php网站目录:/var/www/html/
#1、安装LAMP依赖环境
yum -y install gcc gcc-c++ make authconf automake libtool libevent libevent-devel ncurse nucrse-devel gd gd-deevel freetype freetype-devel fontconfig fontconfig-devel libjpeg libjpeg-devel zlib zlib-devel pcre pcre-devel libmcrypt mhash
#2、安装httpd
yum -y install httpd httpd-devel
sed -i '276a ServerName localhost:80' /etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
chkconfig httpd on
#3、安装mysql
yum -y install mysql mysql-server mysql-devel
/etc/init.d/mysqld start
chkconfig mysqld on
/usr/bin/mysqladmin -uroot password 'kundylee'
#4、安装php
yum -y install php*
sed -i '402c DirectoryIndex index.html index.html.var index.php' /etc/httpd/conf/httpd.conf
/etc/init.d/httpd restart
#5、创建测试php页面
cat >/var/www/html/info.php <<EOF
<?php
phpinfo();
?>
EOF
#6、关闭防火墙
service iptables stop
#7、测试info.php页面
#http://ip/info.php