#writer:wuchao
#E-mail:[email protected]
#date:2013-01-24
###################install lamp#############################################
#!/bin/bash
SRC=/data/lamp/sourcepkg
DES=/usr/local
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
################install apache####################
a ( ) { tar jvxf $SRC/httpd-2.2.16.tar.bz2 -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/httpd-2.2.16
./configure --prefix=$DES/http --enable-so --enable-rewrite --with-mpm=worker
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
/usr/local/http/bin/apachectl start }
#################install mysql########################################
b ( ) { rpm -ivh /mnt/Server/ncurses-devel-5.5-24.20060715.i386.rpm
tar fvxz $SRC/mysql-5.1.44.tar.gz -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/mysql-5.1.44
./configure --prefix=$DES/mysql --with-extra-charsets=gbk,gb2312,utf8 --with-mysqld-user=mysql --enable-thread-safe-client
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
cd
useradd -r mysql
cd $DES/mysql/bin/
cp /data/lamp/mysql-5.1.44/support-files/mysql.server ./
cp /data/lamp/mysql-5.1.44/support-files/mysql.server ../
./mysql_install_db
cd $DES/mysql/mysql-test ; perl mysql-test-run.pl
cd $DES
chown -R mysql mysql
chown mysql.mysql ./mysql/var/
cd $DES/mysql/bin/
./mysqld_safe &
./mysqladmin -u root password "000000" }
#################install picture && freetype && gb############################
c ( ) { tar fvxj $SRC/libpng-1.4.4.tar.bz2 -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/libpng-1.4.4
./configure --prefix=$DES/libpng
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
tar zvxf $SRC/jpegsrc.v8b.tar.gz -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/jpeg-8b/
./configure --prefix=$DES/jpeg
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
tar zvxf $SRC/freetype-2.1.10.tar.gz -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/freetype-2.1.10
./configure --prefix=$DES/freetype
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
tar zvxf $SRC/libxml2-2.6.30.tar.gz -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/libxml2-2.6.30
./configure --prefix=$DES/libxml2
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
tar zvxf $SRC/gd-2.0.36RC1.tar.gz -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/gd-2.0.36RC1
./configure --prefix=$DES/gd --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-libxml2=/usr/local/libxml2
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
}
########################install php####################################
d ( ) { tar -jxvf $SRC/php-5.2.5.tar.bz2 -C /data/lamp/
if [ $? -eq 0 ]
then
cd /data/lamp/php-5.2.5
./configure --prefix=$DES/php --enable-mbstring --with-apxs2=$DES/http/bin/apxs --with-mysql=$DES/mysql --with-config-file-path=$DES/php --with-libxml-dir=$DES/libxml2 --with-jpeg-dir=$DES/jpeg --with-png-dir=$DES/libpng --with-freetype-dir=$DES/freetype --with-gd=$DES/gd --enable-soap --enable-gd-native-ttf --enable-ftp --enable-exif --enable-xml --enable-sockets --enable-ucd-snmp-hack
if [ $? -eq 0 ]
then
sleep 10
echo "make will run"
make
else
echo "configure ERROR,please again"
fi
make install
else
echo "tar ERROR"
fi
}
########################case##########################
case $1 in
a)
a
;;
b)
b
;;
c)
c
;;
d)
d
;;
*)
echo error
esac