CentOS下yum安装LAMP

centos下yum安装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<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"

以上脚本在本人的Centos6.4_x86_64测试成功!在浏览器上输入http://ip可以正常的访问php页面!

本人能力有限,若有不足的地方请多多指教!!!

下面关于LAMP相关的内容你可能也喜欢

网页题目:CentOS下yum安装LAMP
网页网址:http://www.csdahua.cn/qtweb/news19/370969.html

网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网