手动配置httpd服务脚本
编辑服务脚本/etc/init.d/httpd;添加系列代码:
- #!/bin/bash
- #
- # chkconfig: - 85 15
- # description: Apache is a World Wide Web server. It is used to serve \
- . /etc/rc.d/init.d/functions -----读取函数
- if [ -f /etc/sysconfig/httpd ]; then
- . /etc/sysconfig/httpd
- fi
- # Start httpd in the C locale bydefault.
- HTTPD_LANG=${HTTPD_LANG-"C"}
- # This will prevent initlog from swallowing up a pass-phrase prompt if
- # mod_ssl needs a pass-phrase from the user.
- INITLOG_ARGS=""
- # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
- # with the thread-based "worker" MPM; BE WARNED that some modules may not
- # work correctly with a thread-based MPM; notably PHP will refuse to start.
- # Path to the apachectl script, server binary, and short-form for messages.
- apachectl=/usr/local/apache/bin/apachectl -----指定apachectl程序位置
- httpd=${HTTPD-/usr/local/apache/bin/httpd} -------httpd程序位置
- prog=httpd
- pidfile=${PIDFILE-/var/run/httpd.pid} ----如果文件存在就使用存在文件路径,如果不存在就使用/var/rum/httpd.pid
- lockfile=${LOCKFILE-/var/lock/subsys/httpd} --------创建的锁文件
- RETVAL=0
- start() {
- echo -n $"Starting $prog: "
- LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS----以$pidfile文件执行httpd 并且使用选项start
- RETVAL=$? ------定义执行状态返回值
- echo
- [ $RETVAL = 0 ] && touch ${lockfile}-----成功时创建锁文件
- return $RETVAL
- }
- stop() {
- echo -n $"Stopping $prog: "
- killproc -p ${pidfile} -d 10 $httpd
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
- }
- reload() {
- echo -n $"Reloading $prog: "
- if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
- RETVAL=$?
- echo $"not reloading due to configuration syntax error"
- failure $"not reloading $httpd due to configuration syntax error"
- else
- killproc -p ${pidfile} $httpd -HUP
- RETVAL=$?
- fi
- echo
- }
- # See how we were called.
- case"$1"in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status -p ${pidfile} $httpd
- RETVAL=$?
- ;;
- restart)
- stop
- start
- ;;
- condrestart)
- if [ -f ${pidfile} ] ; then
- stop
- start
- fi
- ;;
- reload)
- reload
- ;;
- graceful|help|configtest|fullstatus)
- $apachectl $@
- RETVAL=$?
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
- exit 1
- esac
- exit $RETVAL
为/etc/init.d/httpd服务脚本添加执行权限
# chmod +x /etc/init.d/httpd
测试一下
为httpd服务的相关命令添加环境变量
# vim /etc/profile.d/httpd.sh
(直接在/etc/profile.d目录下创建的httpd.sh环境变量文件,因为在默认的情况下这个目录下定义的环境变量都是profile文件的组成部分)
添加的内容是:
- 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




