#!/bin/bash
echo "wget software"
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.50.tar.gz
wget http://jp2.php.net/get/php-5.3.19.tar.bz2/from/au1.php.net/mirror
wget http://ftp.riken.jp/net/apache/httpd/httpd-2.2.22.tar.gz
echo "install apache"
read -p "please input apache software directory:" dir
find $dir -name httpd-2.2.22.tar.gz
if [ $? -eq 0 ] ; then
read -p "please input install dir" insdir
tar zxf httpd-2.2.22.tar.gz
cd httpd-2.2.22
./configure --prefix=$insdir && make && make install
if [ $? -eq 0 ] ; then
$insdir/bin/apachectl start
else
echo "apache install error"
fi
else
echo "$dir not found apache's tarfile"
exit 0
fi
echo "install mysql"
while true;do
read -p "do you installed ncurses-devel curses gcc*?(Y/N)" b
case $b in
Y|y)
break;;
N|n)
mount /dev/cdrom /mnt
yum install ncurses-devel curses gcc* -y
echo "ncurses-devel curses gcc* is installed"
break
;;
*)
echo "please input Y/N"
;;
esac
done
read -p "please input mysql software directory:" dir2
find $dir2 -name mysql-5.1.50.tar.gz
if [ $? -eq 0 ] ; then
read -p "please input install dir" intdir
tar zxf mysql-5.1.50.tar.gz
cd mysql-5.1.50
groupadd mysql
useradd -g mysql mysql
./configure --prefix=$intdir && make && make install
if [ $? -eq 0 ] ; then
cp support-files/my-medium.cnf /etc/my.cnf
cd $intdir
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
bin/mysqld_safe --user=mysql &
else
echo " install error"
exit 0
fi
else
echo "$dir2 not found mysql's tarfile"
fi
echo "install php"
while true; do
read -p "do you installed libxml?(Y/N)" a
case $a in
Y|y)
break;;
N|n)
mount /dev/cdrom /mnt
yum install libxml2 libxml2-devel perl-* -y
echo "libxml libxml2 libxml2-devel is installed"
break
;;
*)
echo "please input Y/N"
;;
esac
done
read -p "please input php software directory:" dir1
find $dir1 -name php-5.3.19.tar.bz2
if [ $? -eq 0 ] ; then
read "please input install dir" inadir
tar jxf php-5.3.19.tar.bz2
cd php-5.3.19
./configure --prefix=$inadir --with-apxs2=$insdir/bin/apxs --with-mysql=$intdir && make && make install
if [ $? -eq 0 ] ; then
echo "php is install success"
else
echo "php is install error"
fi
else
echo "$dir1 not found php's tarfile"
exit 0
fi
echo "peizhi"
ca=`sed -n '53p' $insdir/conf/httpd.conf | awk '{print $2}'`
if [ $ca = "php5_module" ] ; then
echo 'AddType application/x-httpd-php .php' >> $insdir/conf/httpd.conf
sed -ni 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/' $insdir/conf/httpd.conf
else
echo "apache is not jiazai php mod"
exit 0
fi
本文出自 “海纳百川” 博客,谢绝转载!