自动安装PHP,MYSQL,APACHE并且设置的脚本

天天装服务器,今天你的,明天他的,不烦死也要累死。

昨晚,错过的新服务器上架了,找我了。装吧,但不想再累死了。

于是,自己写了一个超级傻瓜的脚本,用来自动安装PHP,MYSQL,APACHE并且自动设置。

以后不管谁新上服务器,我都不用这么烦了。一个脚本,全搞定。

(脚本在DEBIAN下面用的,其他系统请勿使用)

#/bin/sh
# SCRIPT WITTEN BY SILENCE @2006-02-28
# !!! SCRIPT ONLY FOR DEBIAN !!!

# GET SOURCE TARBALL FROM INTERNET
# APACHE
wget -c http://mirror.vmmatrix.net/apache/httpd/httpd-2.0.55.tar.gz
# PHP
wget -c  http://cn.php.net/distributions/php-4.4.2.tar.gz
# MYSQL
wget -c http://mysql.mirror.vmmatrix.net/Downloads/MySQL-5.0/mysql-5.0.18.tar.gz

# GET THE DEFAULT SETTINGS FILE FROM INTERNET
wget -c http://wuhongsheng.com/lamp/httpd.conf
wget -c http://wuhongsheng.com/lamp/php.ini
wget -c http://wuhongsheng.com/lamp/my.cnf
wget -c http://wuhongsheng.com/lamp/naizhao
wget -c http://wuhongsheng.com/lamp/init.sql

# INSTALL THE GD MODULES
apt-get -y install bison flex libexpat1-dev libfreetype6-dev libgd2-xpm-dev libjpeg62-dev libpng12-dev libxpm-dev zlib1g-dev libncurses5-dev
# UNPACK THE TARBALL
tar zxvf httpd-2.0.55.tar.gz
tar zxvf php-4.4.2.tar.gz
tar zxvf mysql-5.0.18.tar.gz

# INSTALL MYSQL
cd mysql-5.0.18
make clean
./configure –prefix=/usr/local/mysql5 –with-extra-charsets=utf8,gbk,gb2312 > config_naizhao.log
make
make install
cd ..

# INSTALL APACHE
cd httpd-2.0.55
make clean
./configure –prefix=/usr/local/apache2/ –disable-cgi –disable-status –disable-asis –disable-imap –disable-userdir –disable-cgid –enable-headers –enable-vhost-alias –enable-rewrite –enable-so > config_naizhao.log
make
make install
cd ..

# INSTALL PHP
cd php-4.4.2
make clean
./configure –with-zlib –with-gd –with-mysql=/usr/local/mysql5/ –with-apxs2=/usr/local/apache2/bin/apxs –with-jpeg-dir=/usr/lib –with-png-dir=/usr/lib –with-freetype-dir=/usr/lib –with-xpm-dir=/usr/lib –enable-exif –disable-shared –disable-debug –without-pear > config_naizhao.log
make
make install
cd ..

# SETTINGS
# SETUP APACHE
cp httpd.conf /usr/local/apache2/conf/httpd.conf

# SETUP MYSQL
cp my.cnf /etc/my.cnf
# ADD USER MYSQL FOR MYSQL
groupadd mysql
useradd mysql -g mysql
# INIT DB
/usr/local/mysql5/bin/mysql_install_db
# CHOWN MYSQL DB
chown -R mysql:mysql /usr/local/mysql5/var

# SETUP PHP
cp php.ini /usr/local/lib/php.ini

# SETUP INIT.D
cp naizhao /etc/init.d/naizhao
chmod +x /etc/init.d/naizhao
update-rc.d naizhao start 99 2 3 4 5 .

# START SERVICES
/etc/init.d/naizhao

# INIT MYSQL
/usr/local/mysql5/bin/mysql -uroot < init.sql

echo “ALL DONE”

另外加上一个mysql4的下载地址

http://downloads.mysql.com/archives/mysql-4.0/mysql-4.0.26.tar.gz