shell 脚本auto安装LAMP环境

WBOY
发布: 2016-05-19 14:04:57
原创
926 人浏览过

#!/bin/bash
_APACHEPATH=/usr/local/apache
_MySQLPATH=/usr/local
_phpPATH=/usr/local/php
path=`pwd`
cd $path
sleep 3
echo “##########———- Mysql install———–#############”
     echo “Installing Mysql,Please waiting…”
     cp my.cnf /etc/
     tar zxvf mysql-5.1.32-linux-i686-icc-glibc23.tar.gz -C $_MYSQLPATH
     cd $_MYSQLPATH
     mv mysql-5.1.32-linux-i686-icc-glibc23 mysql
     cd mysql
     groupadd mysql
     useradd -g mysql mysql
     chown -R mysql .
     chgrp -R mysql .
     scripts/mysql_install_db –user=mysql
     chown -R root .
     chown -R mysql:mysql data
     #$_MYSQLPATH/mysql/bin/mysqld_safe –user=mysql &
     echo “$_MYSQLPATH/bin/mysqld_safe –user=mysql &” >> /etc/rc.d/rc.local
     echo “Mysql Install Done.”
     cd $path
sleep 3
echo “##########———- Apache install———–#############”
     echo “Installing Apache,Please waiting…”
     tar jxvf httpd-2.2.9.tar.bz2
     cd httpd-2.2.9
     ./configure –PRefix=$_APACHEPATH –enable-so
     make
     make install
     echo “$_APACHEPATH/bin/apachectl start” >> /etc/rc.d/rc.local
     echo “Apache Install Done.”
     cd $path
     if [ -d /usr/local/apache/ ]
     then
     $_APACHEPATH/bin/apxs -c -i -a $path/httpd-2.2.9/modules/mappers/mod_rewrite.c
     echo “###—-Rewrite.so Install Done.—-###”
     else
     exit
     fi
sleep 3
echo “##########———- PHP_extension install———–#############”
     echo “Installing libxml,Please waiting…”
     tar zxvf libxml2-2.6.30.tar.gz
     cd libxml2-2.6.30
     ./configure –prefix=/usr/local/libxml
     make
     make install
     echo “libxml Install Done.”
     cd $path
     echo “Installing libiconv,Please waiting…”
     tar zxvf libiconv-1.12.tar.gz
     cd libiconv-1.12
     ./configure –prefix=/usr/local/libiconv
     make
     make install
     echo “libiconv Install Done.”
     cd $path
     echo “Installing zlib,Please waiting…”
     tar zxvf zlib-1.2.3.tar.gz
     cd zlib-1.2.3
     ./configure –prefix=/usr/local/zlib
     make
     make install
     echo “zlib Install Done.”
     cd $path
     echo “Installing Freetype,Please waiting…”
     tar zxvf freetype-2.2.1.tar.gz
     cd freetype-2.2.1
     ./configure –disable-shared
     make
     make install
     echo “Freetype Install Done.”
     cd $path
     echo “Install Jpeg,Please waiting…”
     tar zxvf jpegsrc.v6b.tar.gz
     cd jpeg-6b
     ./configure –enable-shared –enable-static
     make
     mkdir -p /usr/local/man/man1
     make install
     make install-lib
     echo “Jpeg Install Done.”
     cd $path
     echo “Install libpng,Please waiting…”
     tar zxvf libpng-1.2.10.tar.gz
     cd libpng-1.2.10
     ./configure –disable-shared
     make
     make install
     echo “libpng Install Done.”
     cd $path
     echo “Install Gd,Please waiting…”
     tar zxvf gd-2.0.35.tar.gz
     cd gd-2.0.35
     ./configure –with-freetype –with-jpeg –with-png
     make
     make install
     echo “Gd Install Done.”
     echo “PHP_extension Install Done.”
     cd $path
sleep 3
echo “##########———- PHP_extension install———–#############”
     echo “Installing PHP,Please waiting…”
     tar jxvf php-5.2.6.tar.bz2
     cd php-5.2.6
     \cp $_APACHEPATH/build/libtool .
     ./configure –prefix=$_PHPPATH –with-apxs2=/usr/local/apache/bin/apxs \
           –with-mysql=/usr/local/mysql –with-libxml-dir=/usr/local/libxml \
           –with-iconv=/usr/local/libiconv –with-config-file-path=/usr/local/php/etc \
           –with-gd –with-freetype-dir –with-jpeg-dir –with-png-dir \
           –with-zlib=/usr/local/zlib –enable-mbstring  –enable-sockets
     make
     make install
     cd ../
     cp php.ini $_PHPPATH/etc/
     \cp httpd.conf $_APACHEPATH/conf/
     $_APACHEPATH/bin/apachectl start
     echo “PHP Install Done.”
     $_MYSQLPATH/mysql/bin/mysqld_safe –user=mysql &
echo “###########—————-Finish—————–############”

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板