这个脚本可以无需人工干预的完成L.A.M.P的整合工作。
\n
\n
该脚本适用于整合源码包方式的apache2.0.5x,php4.0.x和已编译好的(Binary版本)的MySQL4.0.2x。
\n
\n
注意,以上三个包最好从各自的官方站点下载,并且下载后最好不要改变文件名!
\n
\n
使用方法:
\n
=====
\n
1、将下载好的3个包和本安装脚本(install_lamp.sh)放置在
\n
/home/Nanu下。放置的位置随意,但注意必须把3个包和本安装脚本放在同一目录!
\n
2、Apache和PHP的./configure部分根据需要换成你的编译参数;
\n
3、执行install_lamp.sh;
\n
4、安装完成后,MySQL的root密码默认保存在/usr/local/mysql/passwd.root中,以备忘记。
\n
\n
脚本代码:
\n
=====
\n
\n
\n
CODE:[Copy to clipboard]#!/bin/bash
\n
\n
# Mysql4.0.x Start
\n
/bin/tar xzvf mysql*4.0.*.tar.gz
\n
/bin/rm -f mysql*4.0.*.tar.gz
\n
/usr/sbin/useradd mysql
\n
/bin/mv mysql*4.0* /usr/local/mysql
\n
/usr/local/mysql/scripts/mysql_install_db –user=mysql
\n
/bin/chown -R root /usr/local/mysql/.
\n
/bin/chown -R mysql /usr/local/mysql/data
\n
/bin/chgrp -R mysql /usr/local/mysql/.
\n
/bin/cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
\n
/usr/local/mysql/bin/mysqld_safe –user=mysql &
\n
echo “Please Set Your MySQL root Password:”
\n
read password
\n
/usr/local/mysql/bin/mysqladmin -u root password password
\n
/bin/touch /usr/local/mysql/passwd.root
\n
echo password >; /usr/local/mysql/passwd.root
\n
/usr/local/mysql/bin/mysqladmin -u root –password=password shutdown
\n
/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
\n
/sbin/chkconfig –add mysqld
\n
/etc/rc.d/init.d/mysqld start
\n
# MySQL4.0.x End
\n
\n
# Apache2.0.x Start
\n
/bin/tar xzvf httpd-2.0.*.tar.gz
\n
cd httpd-2.0.*
\n
./configure –prefix=/usr/local/apache –mandir=/usr/share/man –enable-mods-shared=all –enable-so
\n
make
\n
make install
\n
echo “AddType application/x-httpd-php .php” >;>; /usr/local/apache/conf/httpd.conf
\n
sed -i ‘s/”DirectoryIndex index.html index.html.var”/”DirectoryIndex index.htm index.html index.php index.html.var”/g’ /usr/local/apache/conf/httpd.conf
\n
/usr/local/apache/bin/apachectl -k start
\n
# Apache2.0.x End
\n
\n
# PHP4.0.x Start
\n
/bin/tar xzvf php-*.tar.gz
\n
cd php-*
\n
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –mandir=/usr/share/man –with-mysql=/usr/local/mysql –with-config-file-path=/usr/local/php/etc
\n
make
\n
make install
\n
/bin/cp php.ini-recommended /etc/php.ini
\n
sed -i ‘s/”register_globals = Off”/”register_globals = On”/g’ /etc/php.ini
\n
/usr/local/apache/bin/apachectl -k restart
\n
# PHP4.0.x End
\n
来源:网络
\n