#! /bin/sh
#这是手动安装lighttpd及php5的脚本
support(){
SUPPORT="gcc g++ gcc-3.4 g++-3.4 libc6-dev libaio1 libbz2-dev libaio-dev bzip2 ntpdate make gawk libncurses5-dev libpcre3-dev openssl libxml2-dev libssl-dev libjpeg62-dev libpng12-dev libmysqlclient15off libmysqlclient15-dev libfreetype6-dev libmcrypt-dev axel";
for pkgs in ${SUPPORT};
do
pkg_status=`dpkg -l|grep ${pkgs}|awk '$2~/'^${pkgs}$'/{print $2}'`;
if [ "${pkg_status}" != "${pkgs}" ]; then
apt-get install ${pkgs}
fi
done;
}
lighttpd(){
echo "please select a path where you want to install! eg. /opt/moudules/lighttpd!"
read path
LITPATH=$path ;
if [ ! -d "/opt" ]; then
mkdir /opt
fi
if [ ! -d "/opt/distfiles" ]; then
mkdir /opt/distfiles
fi
cd /opt/distfiles
axel -10
tar zxvf lighttpd-1.4.20.tar.gz
cd lighttpd-1.4.20
export CFLAGS="-O3 -fomit-frame-pointer"
export CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=$LITPATH --enable-static --without-mysql --without-ldap --with-openssl --with-linux-aio
make && make install
if [ "$?" != "0" ]; then
echo "configure lighttpd ERROR!";
echo "SKIP lighttpd install...";
return 1;
fi
}
phpcgi(){
echo "please select a path where you want to install! eg. /opt/moudules/phpcgi!"
read path
PHPPATH=$path
if [ ! -d "/opt" ]; then
mkdir /opt
fi
if [ ! -d "/opt/distfiles" ]; then
mkdir /opt/distfiles
fi
cd /opt/distfiles
axel -10
tar zxvf php-5.2.6.tar.gz
cd php-5.2.6
export CFLAGS="-O3 -fomit-frame-pointer"
export CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure \
--prefix="$PHPPATH" \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-bcmath \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-sockets \
--enable-mbstring \
--enable-sqlite-utf8 \
--enable-safe-mode \
--enable-gd-native-ttf \
--enable-ftp \
--disable-debug \
--with-mcrypt \
--with-openssl \
--with-mysql=/opt/modules/mysql5 \
--with-pdo-mysql=/opt/modules/mysql5 \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-jpeg-dir \
--with-gd \
--with-ttf \
--with-iconv-dir \
--with-zlib-dir \
--with-openssl \
--enable-soap \
--enable-pdo
make && make install
if [ "$?" != "0" ]; then
echo "configure lighttpd ERROR!";
echo "SKIP lighttpd install...";
return 1;
fi
}
read -p "Enter a number: " opmode
if [ "$opmode" = "" ] ; then
continue;
fi
echo
if [ "$opmode" != "q" ] ; then
echo "Your input number is : $opmode";
read -p "Are you sure to continue?[y/n]: " opsure ;
if [ "${opsure}" != "y" ] ; then
opmode="0";
fi
else
read -p "Are you sure to exit this script?[y/n]: " opsure ;
if [ "${opsure}" != "y" ] ; then
continue;
else
exit 0;
fi
fi
case ${opmode} in
1)
delftpuser;
;;
2)
delftpuserdata;
;;
q)
exit 0;
;;
esac
done
}
while : ; do
echo "1) lighttpd install"
echo "2) php install "
echo "3) source "
echo "q) Exit this tool"
echo
read -p "Enter a number: " opmode
if [ "$opmode" = "" ] ; then
continue;
fi
echo
if [ "$opmode" != "q" ] ; then
echo "Your input number is : $opmode";
read -p "Are you sure to continue?[y/n]: " opsure ;
if [ "${opsure}" != "y" ] ; then
opmode="0";
fi
else
read -p "Are you sure to exit this script?[y/n]: " opsure;
if [ "${opsure}" != "y" ] ; then
continue;
else
exit 0;
fi
fi
case ${opmode} in
1)
lighttpd;
;;
2)
phpcgi ;
;;
3)
support ;
;;
q)
exit 0;
;;
esac
done
阅读(1559) | 评论(0) | 转发(0) |