Lamp deployment Script--Installation Chapter

Source: Internet
Author: User
Tags mcrypt

#!/bin/bash# by stranded 2015-08-20cma_v=cmake-2.8.6apa_v=httpd-2.2.15mys_v=mysql-5.5.22lib_v= Libmcrypt-2.5.8mha_v=mhash-0.9.9.9mcr_v=mcrypt-2.6.8php_v=php-5.3.28apache () {#  Determine if there is a RPM-style installation of httpd, Httpd-manual software package, uninstall if [ $ (RPM&NBSP;-QA&NBSP;|&NBSP;GREP&NBSP;HTTPD)  ] | if available |  [ $ (rpm -qa | grep httpd-manual)  ]thenrpm -e httpd -- nodepsrpm -e httpd-manual --nodepselseecho  "httpd is not rpm" fi#  HTTPD Package Decompression, configuration, compilation, installation tar -zxvf /root/$APA _v\.tar.gz -c /usr/src/cd /usr/src/$APA _v/./ configure --prefix=/usr/local/httpd --enable-so --enable-charset-lite --enable-cgi -- enable-rewrite --disable-accessmake && make install#  determine if Apache is installed successfully if [  -e /usr/local/httpd ]thenecho  "Apache install successfull" Cd -fi}mysql () {#   Determine if there is a RPM-mode installation of MySQL, Mysql-server software package, if any, uninstallif [ $ (rpm -qa | grep mysql)  ] | |  [ $ (Rpm -qa | grep mysql-server)  ]thenrpm -e mysqlrpm -e  mysql-serverelseecho  "mysql is not rpm" fi#  determine if the local Yum source is configured and the disc is already mounted if [  ! -z /mnt ]thenmount /dev/cdrom /mntelseecho  "/mnt is exitis" fiif [ ! -e /etc/yum.repos.d/local.repo ]thencat <<end >/etc/ yum.repo.s/local.repo[local]name=localbaseurl=file:///mntgpgcheck=0enabled=1endfi#  Installing Ncurses-devel, Bison (dependent package), solve the error problem Yum -y install ncurses-devel bison# cmake (Basic environment, similar to vc++ 2005), unzip , configure, compile, install tar -zxvf /root/$CMA _v\.tar.gz -c /usr/src/cd /usr/src/$CMA _v/./configure  && gmake && gmake install# mysql Package Decompression, configuration, compilation, installation TAR&NBSP;-ZXVF  /root/$MYS _v\.tar.gz -c /usr/src/cd /usr/src/$MYS _v/rm -rf cmakecache.txtcmake -dcmake_install_prefix=/usr/local/mysql -dsyconfdir=/etc/ - ddefault_charset=utf8 -ddefault_collation=utf8_general_ci -dwith_extra_charsets=allmake & & make install#  determine if MySQL installation is complete if [ -e /usr/local/mysql ]thenecho  " Mysql install successfull "cd -fi}php () {#  Determine if there is a RPM-style installation of PHP and its associated dependencies, and if so, uninstall ear_p=$ (cat / root/earse_php) rpm -qa | grep php | awk  ' {print $1} '  >/root/ earse_phpif [ ! -z /root/earse_php ]thenfor i in  $EAR _PDORPM&NBSP;-E   $idoneelseecho   "php is not rpm" fi#  determine if the local Yum source is configured and the disc is already mounted if [ !  -z /mnt ]thenmount /dev/cdrom /mntelseecho  "/mnt is exitis" fiif  [ ! -e /etc/yum.repos.d/local.repo ]thencat <<end >/etc/yum.repo.s/ Local.repo[local]name=localbaseurl=file:///mntgpgcheck=0enabled=1endfi#  installs the dependency package Libxml2-devel, solves the error problem yum -y install  libxml2-devel#  Install Libmcrypt software package and do a soft link tar -zxvf /root/$LIB _v\.tar.gz -c /usr/src/cd  /usr/src/$LIB _v/./configure && make && make installln -s  /usr/local/lib/libmcrypt.* /usr/lib/#  Install Mhash software package and make soft link tar -zxvf /root/$MHA _v\.tar.gz  -c /usr/src/cd /usr/src/$MHA _v/./configure && make && make  installln -s /usr/local/lib/mhash* /usr/lib/#  Install the MCrypt software package and set the Ld_library_ Path variable (solve environment problem) tar -zxvf /root/$MCR _v\.tar.gz -c /usr/src/cd /usr/src/$MCR _v/export  ld_library_path=/usr/local/lib: $LD _library_path./configure && make &&  make install# php Package Decompression, configuration, compilation, installation tar -zxvf /root/$PHP _v\.tar.gz -c /usr/src/ cd /usr/src/$PHP _v/./configure --prefix=/usr/local/php/ --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr /local/mysql/ --with-config-file-path=/usr/local/php/ --enable-mbstringmake &&  make install#  Verify that PHP is successfully installed if [ -e /usr/local/php ]thenecho  "PHP install  successfull "cd -fi}case " $ " inapache" Apache;; MySQL) MySQL; php) PHP;; lamp) apachemysqlphp;; *) echo  "" $ " is install { lamp | apache | mysql | php  } ";; Esac


This article is from the "Painting" blog, make sure to keep this source http://painting.blog.51cto.com/10476797/1688028

Lamp deployment Script--Installation Chapter

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.