Install LAMP on yum in CentOS

Source: Internet
Author: User

Install LAMP on yum in CentOS

Install LAMP on yum in CentOS

#! /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 [31 m Now, we start install LAMP! \ 033 [0 m"
Echo-e "\ 033 [32 m'date' \ 033 [0 m"
Yum install-y gcc-c ++ libtool lib ntp libtool-ltdl make httpd-devel mysql-server mysql-devel php-mysql
Echo-e "\ 033 [35 m Yum install LAMP is OK! \ 033 [0 m"
Sed-I's/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 [32 m Over! \ 033 [0 m"

The above script is successfully tested in my Centos6.4 _ x86_64! Enter http: // ip in the browser to access the php page!

I have limited capabilities. If you have any shortcomings, please kindly advise !!!

You may also like the following LAMP-related content:

Install Xcache and Memcached on the LAMP platform to accelerate website operation

Build a LAMP platform environment in CentOS 7

CentOS 6.5 system installation and configuration LAMP (Apache + PHP5 + MySQL) server environment

Configure the LAMP + phpMyAdmin PHP (5.5.9) development environment in Ubuntu 14.04

Install LAMP in Ubuntu 14.10

LAMP combines NFS to build a small blog site

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.