首页 > 学院 > 开发设计 > 正文

shell 脚本auto安装LAMP环境

2019-11-17 04:11:11
字体:
来源:转载
供稿:网友

#!/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—————–############”

 


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表