#!/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