CentOS 5.X Installation Lamp Maximum version environment

Source: Internet
Author: User
Tags add time php mysql



#------------CentOS 5.X installation lamp Highest version environment------------------
#! /bin/sh



#install Apache
Yum Install Httpd-y
#1. Turn off SELinux
Cp-rp/etc/selinux/config/etc/selinux/config.bak
Setenforce 0
Sed-i ' 7s/enforcing/disabled/'/etc/selinux/config
#2. Show SELinux status permissive to Off
Getenforce


#3. Determine the version of the system
If ["$ (uname-i)" = i386]; Then
# If the server is 32-bit, run the following command
echo "Start downloading third-party Remi Library i386"
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
RPM-UVH remi-release-5*.rpm epel-release-5*.rpm
Else
# # If it's 64-bit then run the following command
echo "Download third-party Remi Library X64"
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
RPM-UVH remi-release-5*.rpm epel-release-5*.rpm
Fi
#4. Modify the Remi.repo configuration file if you want to upgrade to php5.4.x only, change the [Remi] section to 1
#If you want to upgrade to php5.5.x, then change the [Remi] and [remi-php55] parts of enabled to 1
Cp-rp/etc/yum.repos.d/remi.repo/etc/yum.repos.d/remi.repo.bak
Sed-i ' 9s/enabled=0/enabled=1/'/etc/yum.repos.d/remi.repo
Sed-i ' 18s/enabled=0/enabled=1/'/etc/yum.repos.d/remi.repo
Sed-i ' 7s/^#//'/etc/yum.repos.d/remi.repo
Sed-i ' 8s/^/#&/'/etc/yum.repos.d/remi.repo
Sed-i ' 15s/^#//'/etc/yum.repos.d/remi.repo
Sed-i ' 16s/^/#&/'/etc/yum.repos.d/remi.repo
#correct epel. Repo profile Information Otherwise it will be an error.
Cp-rp/etc/yum.repos.d/epel.repo/etc/yum.repos.d/epel.repo.bak
Sed-i ' 3s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 12s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 21s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 4s/^/#&/'/etc/yum.repos.d/epel.repo
Sed-i ' 13s/^/#&/'/etc/yum.repos.d/epel.repo
Sed-i ' 22s/^/#&/'/etc/yum.repos.d/epel.repo


#5. Check if the PHP version was installed before PHP uninstall
Yum list php
Yum Remove php*-y
#Check if the system is installed mysql the MySQL version before uninstalling
Yum list MySQL
Yum Remove MySQL mysql-server-y


#6. Install the latest PHP and MySQL
echo "Installing new version of PHP and mysql please wait"
Yum--enablerepo=remi install php mysql mysql-server php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml Php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt--skip-broken-y
#7. Modifying the Apache configuration file add index.php Home
Sed-i ' 402s/directoryindex index.html index.html.var/directoryindex index.html index.php index.html.var/'/etc/httpd/ Conf/httpd.conf
#8. Modifying configuration information for MySQL
Sed-i ' 3a Default-character-set = UTF8 '/etc/my.cnf
#9. Modify the configuration of the PHP.ini add time below line 946
Sed-i ' 946a date.timezone = PRC '/etc/php.ini
#10. Add test page Test PHP version
Echo-e "<?php\nphpinfo ();\n?>" >/var/www/html/phpinfo.php
#11. Restart Apache Service
Service httpd Restart
#12restart Mysql
Chkconfig--add mysqld
mysql_install_db
Service mysqld Restart
#13. Firewall Open 80 3306 ports
Sed-i ' 10a-a input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT '/etc/sysconfig/iptables
Sed-i ' 11a-a input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT '/etc/sysconfig/iptables
#12. Restart the firewall
Service Iptables Restart
Echo----------------------------------------
echo "Lamp Installation Success php5.5+mysql5.5+apache2.4"
Echo----------------------------------------


CentOS 5.X Installation Lamp Maximum version environment


Related Article

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.