手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

手动编译安装LAMP-----并通过NFS实现两个LAMP主机共享一个论坛

[日期:2013-05-18] 来源:51cto  作者:邓俊阳 [字体:大 中 小]
手动配置httpd服务脚本
编辑服务脚本/etc/init.d/httpd;添加系列代码:
  1. #!/bin/bash
  2. #
  3. # chkconfig: - 85 15
  4. # description: Apache is a World Wide Web server. It is used to serve \
  5. . /etc/rc.d/init.d/functions -----读取函数
  6. if [ -f /etc/sysconfig/httpd ]; then
  7. . /etc/sysconfig/httpd
  8. fi
  9. # Start httpd in the C locale bydefault.
  10. HTTPD_LANG=${HTTPD_LANG-"C"}
  11. # This will prevent initlog from swallowing up a pass-phrase prompt if
  12. # mod_ssl needs a pass-phrase from the user.
  13. INITLOG_ARGS=""
  14. # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
  15. # with the thread-based "worker" MPM; BE WARNED that some modules may not
  16. # work correctly with a thread-based MPM; notably PHP will refuse to start.
  17. # Path to the apachectl script, server binary, and short-form for messages.
  18. apachectl=/usr/local/apache/bin/apachectl -----指定apachectl程序位置
  19. httpd=${HTTPD-/usr/local/apache/bin/httpd} -------httpd程序位置
  20. prog=httpd
  21. pidfile=${PIDFILE-/var/run/httpd.pid} ----如果文件存在就使用存在文件路径,如果不存在就使用/var/rum/httpd.pid
  22. lockfile=${LOCKFILE-/var/lock/subsys/httpd} --------创建的锁文件
  23. RETVAL=0
  24. start() {
  25. echo -n $"Starting $prog: "
  26. LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS----以$pidfile文件执行httpd 并且使用选项start
  27. RETVAL=$? ------定义执行状态返回值
  28. echo
  29. [ $RETVAL = 0 ] && touch ${lockfile}-----成功时创建锁文件
  30. return $RETVAL
  31. }
  32. stop() {
  33. echo -n $"Stopping $prog: "
  34. killproc -p ${pidfile} -d 10 $httpd
  35. RETVAL=$?
  36. echo
  37. [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
  38. }
  39. reload() {
  40. echo -n $"Reloading $prog: "
  41. if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
  42. RETVAL=$?
  43. echo $"not reloading due to configuration syntax error"
  44. failure $"not reloading $httpd due to configuration syntax error"
  45. else
  46. killproc -p ${pidfile} $httpd -HUP
  47. RETVAL=$?
  48. fi
  49. echo
  50. }
  51. # See how we were called.
  52. case"$1"in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. status)
  60. status -p ${pidfile} $httpd
  61. RETVAL=$?
  62. ;;
  63. restart)
  64. stop
  65. start
  66. ;;
  67. condrestart)
  68. if [ -f ${pidfile} ] ; then
  69. stop
  70. start
  71. fi
  72. ;;
  73. reload)
  74. reload
  75. ;;
  76. graceful|help|configtest|fullstatus)
  77. $apachectl $@
  78. RETVAL=$?
  79. ;;
  80. *)
  81. echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
  82. exit 1
  83. esac
  84. exit $RETVAL
为/etc/init.d/httpd服务脚本添加执行权限
# chmod +x /etc/init.d/httpd
测试一下
将httpd加进服务列表中,使其能够开机启动,并且定义当在35级别时才启动
为httpd服务的相关命令添加环境变量
# vim /etc/profile.d/httpd.sh
(直接在/etc/profile.d目录下创建的httpd.sh环境变量文件,因为在默认的情况下这个目录下定义的环境变量都是profile文件的组成部分)
添加的内容是:
  1. export PATH=$PATH:/usr/local/apache/bin
配置后不会立即生效,重新登录一下终端就可以了
现在httpd服务的相关命令就可以直接使用了
安装MySQLmysql-5.5.28
(使用的是已经编译好的二进制程序)
创建一个链接
# ln -sv mysql-5.5.28-linux2.6-i686 mysql
创建mysql用户与mysql组
更改属主属组
# chown mysql.mysql /usr/local/mysql/* -R
linux
相关资讯       lamp  LAMP安装 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款