安装前准备:

开发环境:Development Libraries 和 Development Tools

httpd环境包:apr-1.4.6.tar.bz2 和 apr-util-1.4.1.tar.bz2

httpd代码包:httpd-2.4.3.tar.bz2

确保安装之前的环境是干净的

1. 编译安装apr 和 apr -util

(1) 编译安装apr



# tar xf apr-1.4.6.tar.bz2

# cd apr-1.4.6

# ./configure --prefix=/usr/local/apr

# make && make install



(2) 编译安装apr-util

# tar xf apr-util-1.4.1.tar.bz2

# cd apr-util-1.4.1

# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make && make install

(3) httpd-2.4.3编译过程也要依赖于pcre-devel软件包,需要事先安装。此软件包系统光盘自带,因此,找到并安装即可。

2、编译安装httpd-2.4.3



首先下载httpd-2.4.3到本地,注意2.4.3之前的版本不支持event模块。而后执行如下命令进行编译安装过程:



# tar xf httpd-2.4.3.tar.bz2

# cd httpd-2.4.3

# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=event

# make && make install

3、修改httpd的主配置文件,设置其Pid文件的路径





编辑/etc/httpd/httpd.conf,添加如下行即可:

PidFile  "/var/run/httpd.pid"

4、提供SysV服务脚本/etc/rc.d/init.d/httpd,内容如下:





#!/bin/bash

#

# httpd        Startup script for the Apache HTTP Server

#

# chkconfig: - 85 15

# description: Apache is a World Wide Web server.  It is used to serve \

#       HTML files and CGI.

# processname: httpd

# config: /etc/httpd/conf/httpd.conf

# config: /etc/sysconfig/httpd

# pidfile: /var/run/httpd.pid





# Source function library.

. /etc/rc.d/init.d/functions





if [ -f /etc/sysconfig/httpd ]; then

        . /etc/sysconfig/httpd

fi





# Start httpd in the C locale by default.

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

httpd=${HTTPD-/usr/local/apache/bin/httpd}

prog=httpd

pidfile=${PIDFILE-/var/run/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0





start() {

        echo -n $"Starting $prog: "

        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS

        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





而后为此脚本赋予执行权限:

# chmod +x /etc/rc.d/init.d/httpd





加入服务列表:

# chkconfig --add httpd









接下来就可以启动服务进行测试了。

手动编译安装LAMP之httpd的更多相关文章

  1. 手动编译安装lamp之php

    转自马哥教育讲课文档 三.编译安装php-5.4.8 1.解决依赖关系: 请配置好yum源(可以是本地系统光盘)后执行如下命令: # yum -y groupinstall "X Softw ...

  2. 手动编译安装lamp之mysql

    转自马哥教育的讲课文档 二.安装mysql-5.5.28 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/mydata,而后需要 ...

  3. ubuntu10.04编译安装LAMP

    ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关 ...

  4. CentOS 6编译安装lamp,并分别安装event模块方式和FPM方式的PHP

    任务目标: 编译安装LAMP 要求(1) 安装一个模块化的PHP 要求(2) 安装一个FPM的PHP 注意PHP需要最后一个安装,因为需要前两者的支持. 所以这里的安装次序为 1.httpd 2.Ma ...

  5. FastCGI模式编译安装LAMP+Xcache

    PHP的工作模式:php在lamp环境下共有三种工作模式:CGI模式.apache模块.FastCGI模式.CGI模式下运行PHP,性能不是很好.(已淘汰)FastCGI的方式和apache模块的不同 ...

  6. 二、编译安装LAMP之httpd-2.4.4

    回顾 PHP:脚本编程语言,php解释器 Webapp:面向对象的特性 Zend: 第一段:词法分析.句法分析.编译为Opcode: opcode放置于内存中 第二段:执行opcode: opcode ...

  7. CentOS6.3 编译安装LAMP(1):准备工作

    卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...

  8. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

    所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...

  9. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6

    Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...

随机推荐

  1. 停止调试 IIS 不退出

    在VS主面板打开:工具->选项->调试->编辑继续   取消选中[启用"编辑并继续"] 就可以(不过这是针对所有的调试). 若只想对单个项目进行设置,可以选择自己 ...

  2. 关于Android App开发知识体系的一个小总结

     前言 本文从热更新.异步并发.性能优化.网络请求等多个方面对Android App开发的知识体系进行了一个分类总结.欢迎大家沟通交流. 热更新 [原]热更新开源项目Tinker源码解析之Dex热更新 ...

  3. springcloud(四) ribbon和feign

    Ribbon使用 order-service工程: application.yml: server: port: 9010 #order 服务都是用90 开头的端口 spring: applicati ...

  4. Servlet类源码说明

    servlet是学习java web不可不懂的一个类,网上各种教程都参杂太多,每次理解都感觉像把别人吐出来的食物再放在嘴里咀嚼,小编一怒之下,直接打开源码,原汁原味的芬芳扑面而来: /** * Def ...

  5. c++类对象 指针区别

    class Test{ public: int a; Test(){ a = ; } }; int main1() { Test* t1 = new Test(); t1->a = ; Test ...

  6. ffmpeg源码分析--av_find_best_stream <转>

    1. av_find_best_streama. 就是要获取音视频及字幕的stream_indexb.以前没有函数av_find_best_stream时,获取索引可以通过如下 ; i<is-& ...

  7. C#中DateTime详解

    //2008年4月24日 System.DateTime.Now.ToString("D"); //2008-4-24 System.DateTime.Now.ToString(& ...

  8. Hadoop Streaming:aggregate

    [Hadoop Streaming:aggregate] 1.实例1 测试文件test.txt mapper程序: 运行: $hadoop streaming -input /app/test.txt ...

  9. python之daemon线程

    [python之daemon线程] A thread can be flagged as a “daemon thread”. The significance of this flag is tha ...

  10. myeclipse10安装了activiti插件后创建BPMN 文件时报错,

    以上错误需要,下载一个补丁. 补丁地址:http://www.shareyx.com/blog/2 补丁的安装可以参考: http://jingyan.baidu.com/article/dca1fa ...