标签:.gz string echo tar passwd 3.5 9.1 sys pytho
#/bin/bash
TAR_DIR=/usr/src
LOCAL_DIR=/usr/local
XML2_DIR=/usr/local/libxml2/
XML2_TAR_DIR=/usr/src/libxml2-2.9.1
LIBMCRYPT_DIR=/usr/local/libmcrypt/
LIBMCRYPT_TAR_DIR=/usr/src/libmcrypt-2.5.8
MCRYPT_DIR=/usr/local/libmcrypt/
MCRYPT_TAR_DIR=/usr/src/libmcrypt-2.5.8
LTDL_TAR_DIR=/usr/src/libmcrypt-2.5.8/libltdl/
MHASH_TAR_DIR=/usr/src/mhash-0.9.9.9
MCRYPT_DIR=/usr/local/libmcrypt
MCRYPT_TAR_DIR=/usr/src/mcrypt-2.6.8
ZLIB_TAR_DIR=/usr/src/zlib-1.2.3
PNG_DIR=/usr/local/libpng/
PNG_TAR_DIR=/usr/src/libpng-1.2.31
JPEG_DIR=/usr/local/jpeg6
JPEG_ZIP_DIR=/usr/src/jpeg-6b
SUB_FILE=/usr/share/libtool/config/config.sub
GUESS_FILE=/usr/share/libtool/config/config.guess
FREETYPE_DIR=/usr/local/freetype/
FREETYPE_TAR_DIR=/usr/src/freetype-2.3.5
GD2_DIR=/usr/local/gd2/
GD2_TAR_DIR=/usr/src/gd-2.0.35
APACHE_DIR=/usr/local/apache2
APACHE_TAR_DIR=/usr/src/httpd-2.4.7
NCURSES_TAR_DIR=/usr/src/ncurses-5.9
MYSQL_DIR=/usr/local/mysql
MYSQL_TAR_DIR=/usr/src/mysql-5.5.23
PHP_DIR=/usr/local/php
PHP_TAR_DIR=/usr/src/php-5.4.25
#安装环境
yum install -y gcc* python-devel libtool* cmake bison libtool-ltdl* ncurses-devel
[ $? -ne 0 ] && echo yum install FAIL && exit || echo yum install SUCCESS
function XML2()
{
tar -zxf $XML2_TAR_DIR.tar.gz -C $TAR_DIR
cd $XML2_TAR_DIR && ./configure --prefix=$XML2_DIR && make && make install
[ $? -ne 0 ] && echo LIBXML2 INSTALL FAIL && exit || echo LIBXML2 INSTALL SUCCESS
}
function LIBMCRYPT()
{
tar -zxf $LIBMCRYPT_TAR_DIR.tar.gz -C $TAR_DIR
cd $LIBMCRYPT_TAR_DIR && ./configure --prefix=$LIBMCRYPT_DIR && make && make install
[ $? -ne 0 ] && echo LIBMCRYPT INSTALL FAIL && exit || echo LIBMCRYPT INSTALL SUCCESS
cd $LTDL_TAR_DIR && ./configure --enable-ltdl-install && make && make install
[ $? -ne 0 ] && echo LIBLTDL INSTALL FAIL && exit || echo LIBLTDL INSTALL SUCCESS
}
function MHASH()
{
tar -zxf $MHASH_TAR_DIR.tar.gz -C $TAR_DIR
cd $MHASH_TAR_DIR && ./configure && make && make install
[ $? -ne 0 ] && echo MHASH INSTALL FAIL && exit || echo MHASH INSTALL SUCCESS
}
function MCRYPT()
{
tar -zxf $MCRYPT_TAR_DIR.tar.gz -C $TAR_DIR
cd $MCRYPT_TAR_DIR && LD_LIBRARY_PATH=$MCRYPT_DIR/lib/:$LOCAL_DIR/lib/ ./configure --with-libmcrypt-prefix=$LIBMCRYPT_DIR && make && make install
[ $? -ne 0 ] && echo MCRYPT INSTALL FAIL && exit || echo MCRYPT INSTALL SUCCESS
}
function ZLIB()
{
tar -zxf $ZLIB_TAR_DIR.tar.gz -C $TAR_DIR
cd $ZLIB_TAR_DIR && ./configure && sed -i ‘s/MMAP$/& -fPIC/‘ $ZLIB_TAR_DIR/Makefile && make && make install
[ $? -ne 0 ] && echo ZLIB INSTALL FAIL && exit || echo ZLIB INSTALL SUCCESS
}
function LIBPNG()
{
tar -zxf $PNG_TAR_DIR.gz -C $TAR_DIR
cd $PNG_TAR_DIR && ./configure --prefix=$PNG_DIR && make && make install
[ $? -ne 0 ] && echo LIBPNG INSTALL FAIL && exit || echo LIBPNG INSTALL SUCCESS
}
function JPEG()
{
mkdir $JPEG_DIR && mkdir $JPEG_DIR/bin && mkdir $JPEG_DIR/lib && mkdir $JPEG_DIR/include && mkdir -p $JPEG_DIR/man/man1
cd $TAR_DIR && unzip $JPEG_ZIP_DIR.zip
/bin/cp $SUB_FILE $JPEG_ZIP_DIR
/bin/cp $GUESS_FILE $JPEG_ZIP_DIR
chmod -R 777 $JPEG_ZIP_DIR/*
cd $JPEG_ZIP_DIR && ./configure --prefix=$JPEG_DIR --enable-shared --enable-static && make && make install
[ $? -ne 0 ] && echo JPEG INSTALL FAIL && exit || echo JPEG INSTALL SUCCESS
}
function FREETYPE()
{
tar -zxf $FREETYPE_TAR_DIR.tar -C $TAR_DIR
cd $FREETYPE_TAR_DIR && ./configure --prefix=$FREETYPE_DIR && make && make install
[ $? -ne 0 ] && echo FREETYPE INSTALL FAIL && exit || echo FREETYPE INSTALL SUCCESS
}
function GD2()
{
mkdir $GD2_DIR
tar -zxf $GD2_TAR_DIR.tar -C $TAR_DIR
sed -i ‘s/png.h/\/usr\/local\/libpng\/include\/png.h/‘ $GD2_TAR_DIR/gd_png.c
cd $GD2_TAR_DIR && ./configure --prefix=$GD2_DIR --with-jpeg=$JPEG_DIR --with-freetype=$FREETYPE_DIR --with-png=$PNG_DIR
[ $? -eq 0 ] && make && make install
[ $? -ne 0 ] && echo GD2 INSTALL FAIL && exit || echo GD2 INSTALL SUCCESS
}
#安装APACHE
function APACHE()
{
tar -zxf $APACHE_TAR_DIR.tar.gz -C $TAR_DIR
tar -zxf $TAR_DIR/apr-1.4.6.tar.gz -C $APACHE_TAR_DIR/srclib/
tar -zxf $TAR_DIR/apr-util-1.4.1.tar.gz -C $APACHE_TAR_DIR/srclib/
mv $APACHE_TAR_DIR/srclib/apr-1.4.6/ $APACHE_TAR_DIR/srclib/apr
mv $APACHE_TAR_DIR/srclib/apr-util-1.4.1/ $APACHE_TAR_DIR/srclib/apr-util
tar -zxf $TAR_DIR/pcre-8.34.tar.gz -C $TAR_DIR
cd $TAR_DIR/pcre-8.34 && ./configure && make && make install
cd $APACHE_TAR_DIR && ./configure --prefix=$APACHE_DIR --sysconfdir=$APACHE_DIR/etc/ --enable-so --with-include-apr --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared
[ $? -eq 0 ] && make && make install
[ $? -ne 0 ] && echo APACHE INSTALL FAIL && exit || echo APACHE INSTALL SUCCESS
}
#安装MySQL
function MYSQL()
{
tar -zxf $MYSQL_TAR_DIR.tar.gz -C $TAR_DIR
useradd mysql
cd $MYSQL_TAR_DIR && cmake -DCMAKE_INSTALL_PREFIX=$MYSQL_DIR -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
[ $? -eq 0 ] && make && make install
[ $? -ne 0 ] && echo MYSQL INSTALL FAIL && exit || echo MYSQL INSTALL SUCCESS
chown -R root $MYSQL_DIR
chown -R mysql $MYSQL_DIR/data/
cp $MYSQL_DIR/support-files/my-medium.cnf /etc/my.cnf
cd $MYSQL_DIR
./scripts/mysql_install_db --user=mysql #要以相对路径执行,不然提示找不到默认文件。
}
function PHP()
{
sed -i ‘/gd_free/a void (*data);‘ /usr/local/gd2/include/gd_io.h
tar -zxf $PHP_TAR_DIR.tar.gz -C $TAR_DIR
cd $PHP_TAR_DIR && ./configure --prefix=$PHP_DIR --with-config-file-path=$PHP_DIR/etc/ --with-apxs2=$APACHE_DIR/bin/apxs --with-mysql=$MYSQL_DIR --with-libxml-dir=$XML2_DIR --with-jpeg-dir=$JPEG_DIR --with-png-dir=$PNG_DIR --with-freetype-dir=$FREETYPE_DIR --with-gd=$GD2_DIR --with-mcrypt=$MCRYPT_DIR --with-mysqli=$MYSQL_DIR/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=$MYSQL_DIR --without-pear
[ $? -eq 0 ] && make && make install
[ $? -ne 0 ] && echo PHP INSTALL FAIL && exit || echo PHP INSTALL SUCCESS
mkdir $PHP_DIR/etc
/bin/cp $PHP_TAR_DIR/php.ini-production $PHP_DIR/etc/php.ini
sed -i ‘s/index.html/& index.php/‘ $APACHE_DIR/etc/httpd.conf && sed -i ‘/AddType application\/x-gzip .gz .tgz/a AddType application\/x-httpd-php .php .phps .phtml‘ $APACHE_DIR/etc/httpd.conf
[ $? -ne 0 ] && echo PHP MODULAR QUOTE INSTALL FAIL && exit || echo PHP MODULAR QUOTE INSTALL SUCCESS
}
function START()
{
$APACHE_DIR/bin/apachectl restart && echo APACHE START SUCESS || APACHE START FAIL
$MYSQL_DIR/bin/mysqladmin -uroot password 123456 && echo DATABASES PASSWD SET UP SUCESS || DATABASES PASSWD SET UP START FAIL
$MYSQL_DIR/bin/mysqld_safe --user=mysql &
}
XML2 && LIBMCRYPT && MHASH && MCRYPT && ZLIB && LIBPNG && JPEG && FREETYPE && GD2 && APACHE && MYSQL && PHP && START && echo install success || echo install fail
编译安装LAMP脚本
标签:.gz string echo tar passwd 3.5 9.1 sys pytho
原文地址:https://www.cnblogs.com/lingshu/p/10303268.html