|
Under CentOS yum install LAMP
#! / Bin / bash
#
#Time: 2013/07 / 23-13: 37: 03
#
#OS: Centos_6.4
#This Is through the method of yum to install the LAMP!
#yum update -y #If this is the first time to update, that will take you for a long time.So Please choose carefully !!!
echo -e "\ 033 [31m Now, we start install LAMP! \ 033 [0m"
echo -e "\ 033 [32m` date` \ 033 [0m "
yum install -y gcc gcc-c ++ libtool lib ntp libtool libtool-ltdl libtool libtool-ltdl make httpd httpd-devel mysql mysql-server mysql-devel php php-devel php-mysql
echo -e "\ 033 [35m Yum install LAMP is Ok! \ 033 [0m"
sed -i 's / DirectoryIndex index.html / DirectoryIndex index.html index.htm index.php /' /etc/httpd/conf/httpd.conf
cd / var / www / html
cat> index.php << EOF
< ? Php
phpinfo ();
?>
EOF
netstat -tnlp | grep 80
if [? $ = 0]; then
kill `netstat -tnlp | grep 80 | awk '{print $ 7}' | cut -d" / "-f1`
service httpd restart
else
service httpd start
fi
netstat -tnlp | grep 3306
if [? $ = 0]; then
kill `netstat -tnlp | grep 80 | awk '{print $ 7}' | cut -d" / "-f1`
service mysqld restart
else
service mysqld start
fi
echo -e "\ 033 [32m Over! \ 033 [0m"
The above script in my Centos6.4_x86_64 test success! In the browser, enter http: // ip normal access php page! |
|
|
|