返回列表 发帖

[转帖]Apche+MySQL+PHP整合安装脚本

这个脚本可以无需人工干预的完成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中,以备忘记。
脚本代码:
=====
  1. #!/bin/bash
  2. # Mysql4.0.x Start
  3. /bin/tar xzvf mysql*4.0.*.tar.gz
  4. /bin/rm -f mysql*4.0.*.tar.gz
  5. /usr/sbin/useradd mysql
  6. /bin/mv mysql*4.0* /usr/local/mysql
  7. /usr/local/mysql/scripts/mysql_install_db --user=mysql
  8. /bin/chown -R root /usr/local/mysql/.
  9. /bin/chown -R mysql /usr/local/mysql/data
  10. /bin/chgrp -R mysql /usr/local/mysql/.
  11. /bin/cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
  12. /usr/local/mysql/bin/mysqld_safe --user=mysql &
  13. echo "Please Set Your MySQL root Password:"
  14. read password
  15. /usr/local/mysql/bin/mysqladmin -u root password $password
  16. /bin/touch /usr/local/mysql/passwd.root
  17. echo $password > /usr/local/mysql/passwd.root
  18. /usr/local/mysql/bin/mysqladmin -u root --password=$password shutdown
  19. /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
  20. /sbin/chkconfig --add mysqld
  21. /etc/rc.d/init.d/mysqld start
  22. # MySQL4.0.x End
  23. # Apache2.0.x Start
  24. /bin/tar xzvf httpd-2.0.*.tar.gz
  25. cd httpd-2.0.*
  26. ./configure --prefix=/usr/local/apache --mandir=/usr/share/man --enable-mods-shared=all --enable-so
  27. make
  28. make install
  29. echo "AddType application/x-httpd-php .php" >> /usr/local/apache/conf/httpd.conf
  30. 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
  31. /usr/local/apache/bin/apachectl -k start
  32. # Apache2.0.x End
  33. # PHP4.0.x Start
  34. /bin/tar xzvf php-*.tar.gz
  35. cd php-*
  36. ./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
  37. make
  38. make install
  39. /bin/cp php.ini-recommended /etc/php.ini
  40. sed -i ';s/"register_globals = Off"/"register_globals = On"/g'; /etc/php.ini
  41. /usr/local/apache/bin/apachectl -k restart
  42. # PHP4.0.x End
复制代码
脚本中肯定还有不完善的地方,水平所限。还请各位多多指教。

[转帖]Apche+MySQL+PHP整合安装脚本

风之子, 你的apache不见得能起来,
linux自带了一个httpd ,不把它给stop,你能起来??

TOP

返回列表 回复 发帖