环境:ubuntu 16.0.4

  Apache官网下载Apache httpd压缩包:httpd-2.4.27.tar.gz,安装之前请确定安装了make工具,我安装的是GNU make

  1.   解压文件

    sudo tar -zxvf '/home/fanchao/桌面/share/apache http server/httpd-2.4.27.tar.gz' -C /etc/httpd

    在解压后的文件目录下有个install文件,里面写着

    For complete installation documentation, see [ht]docs/manual/install.html or
    http://httpd.apache.org/docs/2.4/install.html
  2. 通过查看文档,安装所需要的环境 :

    安装 APR(其实不用安装,后面说明):下载 apr-1.6.2.tar.gz

    解压:

sudo tar -zxvf '/home/fanchao/桌面/share/apache http server/apr-1.6.2.tar.gz' -C /etc/httpd

    编译和安装:

sudo
cd /etc/httpd/apr-1.6.2 #进入解压后的文件目录
sudo ./configure #这里可以添加参数 --prefix=你要安装的目录,我这里没有加,默认安装在/user/loacl目录下 以下所有的./configure都可以添加这个参数
sudo make
sudo make install

    安装APR-UTIL(其实不用安装,后面说明):下载 apr-util-1.6.0.tar.gz

    解压:

sudo tar -zxvf '/home/fanchao/ 桌面/share/apache http server/apr-util-1.6.0.tar.gz'  -C /etc/httpd

    编译和安装

cd /etc/httpd/apr-util-1.6.
sudo ./configure --with-apr=/usr/local/apr/bin/apr--config
sudo make

    这里报错

xml/apr_xml.c::: fatal error: expat.h: 没有那个文件或目录
compilation terminated.
/etc/httpd/apr-util-1.6./build/rules.mk:: recipe for target 'xml/apr_xml.lo' failed
make[]: *** [xml/apr_xml.lo] Error
make[]: Leaving directory '/etc/httpd/apr-util-1.6.0'
/etc/httpd/apr-util-1.6./build/rules.mk:: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error

    解决办法就是安装libexpat1-dev

sudo apt-get install libexpat1-dev

    重新输

sudo make
sudo make install

    安装httpd所需要的prce库:下载prce-8.41.zip

     解压:

sudo unzip   '/home/fanchao/桌面/share/apache http server/pcre-8.41.zip' -d /etc/httpd

    编译和安装:

cd /etc/httpd/pcre-8.41
sudo ./configure
sudo make
sudo make install

    最后编译安装apache httpd

sudo ./configure --with-apr='/usr/local/apr/bin/apr-1-config' --with-apr-util='/usr/local/apr/bin/apu-1-config' --with-prce='/usr/local/bin/pcre-config' #这里还有其他参数可以配置,具体参照官方
sudo make
sudo make install

    到现在按照官方文档的说明应该就已经安装好了,但是我到make这步就报错了

collect2: error: ld returned  exit status
Makefile:: recipe for target 'htpasswd' failed
make[]: *** [htpasswd] Error
make[]: Leaving directory '/etc/httpd-2.4.27/support'
/etc/httpd-2.4./build/rules.mk:: recipe for target 'all-recursive' failed
make[]: *** [all-recursive] Error
make[]: Leaving directory '/etc/httpd-2.4.27/support'
/etc/httpd-2.4./build/rules.mk:: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error

    我查了很多地方都没有遇到这个错误或者说这个错误是怎么发生的。这个错误是因为在httpd目录下的srclib目录里面没有apr和apr-util所导致的,但是./configure又不会报错,到make才会报错,所以把下载下来到apr和apr-util解压到srclib目录下到apr和apr-util目录,注意目录名字要一致。

    这就是我之前说的不用安装apr和apr-util的原因,它会自动安装,手动安装后去指定安装路径是会报错的。

    重新生成make文件和make

 sudo ./configure  --with-prce='/usr/local/bin/pcre-config' --with-included-apr #其他参数请参照官方
sudo make
sudo make install

    现在就可以安装成功了,如果没有指定文件夹那么就会默认安装在 /usr/local/apache2

    运行

sudo '/usr/local/apache2/bin/apachectl' -k start #启动
sudo '/usr/local/apache2/bin/apachectl' -k stop #停止

    完结。

    

Linux下编译,安装Apache httpd服务器的更多相关文章

  1. Linux下编译安装Apache Http Server

    Linux下编译安装Apache Http Server [TOC] 1.下载httpd-2.4.12.tar.bz2 wget http://mirror.bit.edu.cn/apache/htt ...

  2. Linux下编译安装Apache及模块

    Apache是时下最流行的Webserver软件之中的一个,支持多平台,可高速搭建web服务,并且稳定可靠.并可通过简单的API扩充.就能够集成PHP/Python等语言解释器. 文章这里解说怎样在l ...

  3. Linux下编译安装Apache 2.4

    Linux一般会自带httpd服务,但是版本一般不是最新,性能也不是最好,生产中建议手动安装官方源码包,安装Apache官方包之前首先要停止之前的httpd服务,停止后也可以卸载之前的版本 准备工作做 ...

  4. CentOS下编译安装Apache(httpd)

    官网下载最新版本的apache, apr, apr-util http://httpd.apache.org/download.cgi#apache24 http://apr.apache.org/d ...

  5. linux下编译安装apache

    在linux(CentOS6.5)上安装Apache,要首先确保以下程序事先安装 apr:The mission of the Apache Portable Runtime (APR) projec ...

  6. Linux下编译安装Apache报APR not found错误的解决办法

    我在编译安装完Nginx.MySQL和PHP(见之前一篇博客:LNMP环境搭建详细教程)之后,进行apache的编译安装: cd /usr/local/src wget http:.tar.gz ta ...

  7. linux中编译安装Apache、PHP、MySQL(上)

    1.简介 在阿里云买了个云服务器,一直没时间折腾.过了近十天了吧,才有时间好好玩玩这个云服务器.自己是做Web开发的,所以我需要的开发环境是LAMP.之前打算是采用yum安装,不过yum安装apach ...

  8. 在linux下手动安装 apache, php, mysql--终极版

    在linux下手动安装 apache, php, mysql: 参考: http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html ...

  9. CentOS 下编译安装Apache

    CentOS 下编译安装Apache 卸载原有的apache 首先从 http://httpd.apache.or 下载apache源码包httpd-2.4.4.tar.gz然后从 http://ap ...

随机推荐

  1. SQL like查询条件中的通配符处理

    1. SQL like对时间查询的处理方法 SQL数据表中有savetime(smalldatetime类型)字段,表中有两条记录,savetime值为:2005-3-8 12:12:00和2005- ...

  2. html格式的文档转成word下载

    当我们前端使用ueditor插件来让用户输入数据,保存至数据库.在另一个地方需要打印用户输入的内容的时候可以用到.因为要将ueditor带格式保存下来保存的就是html格式的内容,后台转化如下: @R ...

  3. luoguP1002

    p1002 题意: 从坐标A到坐标B的可能路线(有一些点不能走)情况,很明显可以看出用dp做 m[i][j]=m[i-1][j]+m[i][j-1](注意处理不能走的点) 自己在初始化时犯了错,第1行 ...

  4. django patch 解决 ["'15428560000' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."]

    __init__.py import datetime from django.apps import AppConfig from django.db.models.fields import Da ...

  5. docker images镜像无法删除

    删除所有容器: docker rm $(docker ps -aq) 删除镜像: docker rmi $(docker images -q) 如果有镜像无法删除,有可能更改了名字,用docker r ...

  6. HDU 1047 Integer Inquiry( 高精度加法水 )

    链接:传送门 思路:高精度水题 /************************************************************************* > File ...

  7. BZOJ 2141 排队 (三维偏序CDQ+树状数组)

    题目大意:略 洛谷传送门 和 [CQOI2015]动态逆序对 这道题一样的思路 一开始的序列视为$n$次插入操作 把每次交换操作看成四次操作,删除$x$,删除$y$,加入$x$,加入$y$ 把每次操作 ...

  8. [luogu2592 ZJOI2008] 生日聚会 (计数dp)

    题目描述 今天是hidadz小朋友的生日,她邀请了许多朋友来参加她的生日party. hidadz带着朋友们来到花园中,打算坐成一排玩游戏.为了游戏不至于无聊,就座的方案应满足如下条件: 对于任意连续 ...

  9. Laravel源码解析之反射的使用

    前言 PHP的反射类与实例化对象作用相反,实例化是调用封装类中的方法.成员,而反射类则是拆封类中的所有方法.成员变量,并包括私有方法等.就如"解刨"一样,我们可以调用任何关键字修饰 ...

  10. vue项目中,如何对static文件夹下的静态文件添加时间戳,以达到清除缓存

    例如config.js文件是存放在static文件夹下,里面存放的是websocket信息,需要经常改动.改动了以后由于缓存信息,使其不生效,因此需要对引入的文件添加时间戳. 最新方法: 注意转义符的 ...