#!/bin/bash
#edtior tangbo 2016-03-01
#QQ 79313760
##################this is my lnmp##################
libs="lrzsz gcc gcc+ gcc-c++ gd autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel pcre pcre-devel gcc-g77 autoconf automake fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake gcc-devel gcc-c++-devel autoconf*automake*ncurses libtool* cmake bison bison-devel unzip autoconf automake "
yum -y install $libs
###############Server Configuration##################
soft_dir="/var/soft"
if [ ! -d $soft_dir ]
then
mkdir $soft_dir
else
echo "the $soft_dir no exits"
exit 1
fi
##########Install software upload and extract files############
echo "Upload source to $soft_dir,Completed after input ok:"
read stat
if [ $stat == "ok" ]
then
echo "Enter a software package that needs to be installed to separate the space from the space:"
read list_tmp
cd $soft_dir
echo $list_tmp
for sft_temp in `echo $list_tmp`
do
sft=`ls | grep $sft_temp`
/bin/tar -zxvf $sft 1>/dev/null 2>&1
echo "$sft 解压完成"
done
else
echo "please input ok"
fi
########Compile and install#####################
home_dir=/usr/local
add_usr() {
groupadd $1
useradd -M -s /sbin/nologin -g $1 $2
}
get_dir() {
b_name=$1
cd $soft_dir
b_dir=`ls | grep $b_name | grep -v tar`
}
cd $soft_dir
for mk_temp in `echo $list_tmp`
do
case $mk_temp in
#1.install pcre
pcre)
# add_usr www www
get_dir $mk_temp
cd $b_dir
./configure &>/dev/null && make && make install && echo "$mk_temp success"
;;
#2.install nginx
nginx)
add_usr nginx nginx
get_dir $mk_temp
cd $b_dir
./configure --user=nginx --group=nginx --prefix=$home_dir/nginx --user=nginx --group=nginx --with-http_stub_status_module --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcsi �http-uwsgi-temp-path=/var/tmp/nginx/uwsgi �http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-http_flv_module --with-http_gzip_static_module &>/dev/null && make && make install && echo "$mk_temp success"
;;
mysql)
add_usr mysql mysql
get_dir $mk_temp
cd $b_dir && echo "$b_dir"
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql && make && make install && echo "$mk_temp success"
;;
libmcrypt)
# add_usr www www
get_dir $mk_temp
cd $b_dir
./configure &>/dev/null && make && make install && echo "$mk_temp success"
;;
php)
# add_usr www www
get_dir $mk_temp
cd $b_dir
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts --with-mcrypt &>/dev/null && make && make install && echo "$mk_temp success"
;;
*)
echo "This installation type is not supported"
exit
;;
esac
done
本文出自 “山猫” 博客,谢绝转载!