shell 脚本auto安装LAMP环境
#!/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—————–############”
上一篇: 什么是创业?你可能只是给自己换了老板
推荐阅读
-
ubuntu LAMP下PHP的开发环境zend studio的安装及相关问题
-
在Windows系统上安装PHP运行环境文字教程_php基础_脚本之家
-
Ubuntu14下LAMP环境的安装以及yaf扩展的安装,ubuntu14yaf_PHP教程
-
MySQL5.7安装过程并重置root密码的方法(shell 脚本)
-
Linux操作系统安装LAMP环境
-
MySQL5.7安装过程并重置root密码的方法(shell 脚本)
-
Centos7安装 mysql5.6.29 shell脚本
-
用Shell脚本快速搭建Ubuntu下的Nodejs开发环境
-
阿里云主机一键安装lamp、lnmp环境的shell脚本分享
-
Linux操作系统安装LAMP环境