手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS下yum安装LAMP

[日期:2015-12-10] 来源:Linux社区  作者:Linux [字体:大 中 小]

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<<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"

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

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

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

LAMP平台安装Xcache和Memcached加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7下搭建LAMP平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP结合NFS构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126058.htm

linux
相关资讯       lamp 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款