這個腳本可以無需人工干預的完成l.a.m.p的整合工作。
該腳本適用于整合源碼包方式的apache2.0.5x,php4.0.x和已編譯好的(binary版本)的mysql4.0.2x。
注意,以上三個包最好從各自的官方站點下載,并且下載后最好不要改變文件名!
使用方法:
=====
1、將下載好的3個包和本安裝腳本(install_lamp.sh)放置在
/home/nanu下。放置的位置隨意,但注意必須把3個包和本安裝腳本放在同一目錄!
2、apache和php的./configure部分根據需要換成你的編譯參數;
3、執行install_lamp.sh;
4、安裝完成后,mysql的root密碼默認保存在/usr/local/mysql/passwd.root中,以備忘記。
腳本代碼:
=====
code:[copy to clipboard]#!/bin/bash
# mysql4.0.x start
/bin/tar xzvf mysql*4.0.*.tar.gz
/bin/rm -f mysql*4.0.*.tar.gz
/usr/sbin/useradd mysql
/bin/mv mysql*4.0* /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql
/bin/chown -r root /usr/local/mysql/.
/bin/chown -r mysql /usr/local/mysql/data
/bin/chgrp -r mysql /usr/local/mysql/.
/bin/cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe --user=mysql &
echo "please set your mysql root password:"
read password
/usr/local/mysql/bin/mysqladmin -u root password $password
/bin/touch /usr/local/mysql/passwd.root
echo $password >; /usr/local/mysql/passwd.root
/usr/local/mysql/bin/mysqladmin -u root --password=$password shutdown
/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
/sbin/chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
# mysql4.0.x end
# apache2.0.x start
/bin/tar xzvf httpd-2.0.*.tar.gz
cd httpd-2.0.*
./configure --prefix=/usr/local/apache --mandir=/usr/share/man --enable-mods-shared=all --enable-so
make
make install
echo "addtype application/x-httpd-php .php" >;>; /usr/local/apache/conf/httpd.conf
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
/usr/local/apache/bin/apachectl -k start
# apache2.0.x end
# php4.0.x start
/bin/tar xzvf php-*.tar.gz
cd php-*
./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
make
make install
/bin/cp php.ini-recommended /etc/php.ini
sed -i 's/"register_globals = off"/"register_globals = on"/g' /etc/php.ini
/usr/local/apache/bin/apachectl -k restart
# php4.0.x end
最大的網站源碼資源下載站,
新聞熱點
疑難解答