我们的系统平台是在centos7.5的环境下安装httpd2.4版本的软件,2.4版本的软件有一个特征就是需要安装arp包以及arp-util包才可以。

1、首先是下载httpd2.4版本的包,以及安装开发环境,这里开发环境直接使用组安装“Development tools”即可,(注意centos6是安装“Development tools和Server Platform Development”两种开发环境)

  1. wget http://ftp.cuhk.edu.hk/pub/packages/apache.org//httpd/httpd-2.4.37.tar.gz
  2. yum groupinstall "Development tools"

2、解压到指定目录/usr/local目录下

  1. tar -zxf httpd-2.4..tar.gz -C /usr/local

3、在/usr/local目录下创建一个httpd目录,然后在刚刚解压的目录里面开始执行configure检测依赖环境

  1. ./configure --prefix=/usr/local/httpd

发现报错:

  1. configure:
  2. configure: Configuring Apache Portable Runtime Utility library...
  3. configure:
  4. checking for APR-util... no
  5. configure: error: APR-util not found. Please read the documentation.
  6. configure:
  7. configure: Configuring Apache Portable Runtime library...
  8. configure:
  9. checking for APR... no
  10. configure: error: APR not found. Please read the documentation.

缺少apr-util包和apr包,那我们来安装即可

  1. yum install apr apr-util apr-devel apr-util-devel

这两个包很重要,所以大家一定要记住。也有的人是下载apr源码包编译的,都是可以的。

4、继续执行configure检测环境

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd-2.4.]#./configure --prefix=/usr/local/httpd
  2. config.status: creating build/config_vars.sh
  3. config.status: creating include/ap_config_auto.h
  4. config.status: executing default commands
  5. configure: summary of build options:
  6.  
  7. Server Version: 2.4.
  8. Install prefix: /usr/local/httpd
  9. C compiler: gcc
  10. CFLAGS: -pthread
  11. CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
  12. LDFLAGS:
  13. LIBS:
  14. C preprocessor: gcc -E

哈哈,终于编译成功了,继续安装

5、接下来执行make命令完成项目构建

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd-2.4.]#make
  1. /usr/lib64/apr-/build/libtool --silent --mode=link gcc -pthread -o mod_rewrite.la -rpath /usr/local/httpd/modules -module -avoid-version mod_rewrite.lo
  2. make[]: Leaving directory `/usr/local/httpd-2.4./modules/mappers'
  3. make[]: Leaving directory `/usr/local/httpd-2.4./modules/mappers'
  4. make[]: Leaving directory `/usr/local/httpd-2.4./modules'
  5. make[]: Entering directory `/usr/local/httpd-2.4./support'
  6. make[]: Leaving directory `/usr/local/httpd-2.4./support'
  7.  
  8. make[]: Leaving directory `/usr/local/httpd-2.4.'

看到这里说明编译成功了。

6、执行make install 安装

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd-2.4.]#make install
  2. Installing man pages and online manual
  3. mkdir /usr/local/httpd/man
  4. mkdir /usr/local/httpd/man/man1
  5. mkdir /usr/local/httpd/man/man8
  6. mkdir /usr/local/httpd/manual
  7. make[]: Leaving directory `/usr/local/httpd-2.4.'

安装成功。

7、看下安装的目录

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local]#cd httpd
  2. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd]#ls
  3. bin build cgi-bin conf error htdocs icons include logs man manual modules
  4. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd]#cd bin
  5. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/bin]#ls
  6. ab apxs dbmmanage envvars-std htcacheclean htdigest httpd logresolve
  7. apachectl checkgid envvars fcgistarter htdbm htpasswd httxt2dbm rotatelogs
  8. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/bin]#

8、我们看到了安装的目录里面有我们想要的文件,但是到这里还没有完成,我们还有一些后续工作需要做。

9、设置环境变量

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/bin]#cd /etc/profile.d/
  2. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/profile.d]#ls
  3. 256term.csh colorgrep.csh colorls.csh csh.local lang.sh less.sh sh.local vim.sh which2.sh
  4. 256term.sh colorgrep.sh colorls.sh lang.csh less.csh path.sh vim.csh which2.csh
  5. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/profile.d]#vim httpd.sh
  6. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/profile.d]#cat httpd.sh
  7. HTTPD_HOME=/usr/local/httpd
  8. PATH=$PATH:$HTTPD_HOME/bin

最后记得source一下立即生效。

10、建立库文件信息(以.so结尾的文件)

一般上我们运行程序,Linux系统会在特定的路径下为应用查找所以来的库文件:/usr/lib、/usr/lib64、/lib、/lib64这四个目录下面,但是自己编译安装的程序提供的库文件有可能不在系统搜索的路径中,因此我们需要在系统里面添加一下。注意以.conf结尾。

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/modules]#cd /etc/ld.so.conf.d/
  2. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/ld.so.conf.d]#ls
  3. dyninst-x86_64.conf kernel-3.10.-862.3..el7.x86_64.conf mysql-x86_64.conf
  4. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/ld.so.conf.d]#echo /usr/local/httpd/modules > httpd-2.4..conf
  5. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/ld.so.conf.d]#cat httpd-2.4..conf
  6. /usr/local/httpd/modules
  7. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/ld.so.conf.d]#

11、然后重新执行ldconfig命令重新生成映射缓存ld.so.conf

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /etc/ld.so.conf.d]#ldconfig

12、除了我们刚刚设置的环境变量、库文件外,我们还需要设置头文件信息。我们这里复制头文件过去即可。

  1. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/include]#ls
  2. apache_noprobes.h ap_expr.h ap_regkey.h http_core.h mod_auth.h util_cookies.h util_script.h
  3. ap_compat.h ap_hooks.h ap_release.h httpd.h mod_core.h util_ebcdic.h util_time.h
  4. ap_config_auto.h ap_listen.h ap_slotmem.h http_log.h mod_request.h util_fcgi.h util_varbuf.h
  5. ap_config_auto.h.in ap_mmn.h ap_socache.h http_main.h mpm_common.h util_filter.h util_xml.h
  6. ap_config.h ap_mpm.h heartbeat.h http_protocol.h scoreboard.h util_ldap.h
  7. ap_config_layout.h ap_provider.h http_config.h http_request.h util_cfgtree.h util_md5.h
  8. ap_config_layout.h.in ap_regex.h http_connection.h http_vhost.h util_charset.h util_mutex.h
  9. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/include]#mkdir /usr/include/httpd
  10. [root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/include]#cp ./* /usr/include/httpd/

其实我们就是把httpd安装目录下的include目录的所有头文件复制一份,放置在/usr/include/httpd目录下,注意,这个httpd需要提前创建好。

13、最后就是man手册了,Centos7下面的man手册配置文件是/etc/man_db.conf文件,我们修改一下即可。

Centos7源码安装httpd2.4版本web服务器的更多相关文章

  1. CentOS7源码安装qbittorrent最新版本

    CentOS的软件 yum 里 yum search qbittorrent yum info qbittorrent 找到的是3.37版本 官网最新的是4.12版本.但需要源码安装: 官网下载最新版 ...

  2. CentOS7 实战源码安装mysql5.7.17数据库服务器

    CentOS7 实战源码安装mysql5.7.17数据库服务器 简介:实战演练mysql数据库服务器的搭建  mysql简介: mysql是一个开源的关系型数据库管理系统,现在是oracle公司旗下的 ...

  3. centos7源码安装Python3的前提条件

    centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...

  4. centos7 源码安装指定版本的php7

    很多时候可能会遇到需要手动源码安装软件的时候,所以自己实践了一把,并且把安装过程中遇到的问题,以及在网上找到的解决办法(实测有效)都记录下来,方便日后学习实践. 1. 系统环境 # cat /etc/ ...

  5. centos7源码安装mysql5.7.19

    centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...

  6. Centos7源码安装mysql及读写分离,互为主从

       Linux服务器 -源码安装mysql 及读写分离,互为主从   一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...

  7. Centos6.6上源码安装Nodejs V4版本

    本来就是想在vps上装一个Ghost博客,这个博客依赖的是Nodejs,然后推荐的是V4版本.然后我就对着官网的步骤安装,发现根本没有Centos6 i386的资源了(64位的还是有的), 我只能在那 ...

  8. CentOS7 源码安装 PostgreSQL 12

    PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...

  9. Centos7源码安装Apache和PHP

    源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel​# ...

随机推荐

  1. Python中bisect的使用

    在<Think Python>中第十章的练习中,涉及到了分半查找的bisect模块.为此,在网上查阅了Python中bisect模块的相关内容.有几个链接相对权威和明白: 1> ht ...

  2. golang三方包应该如何安装--在线和离线

    一 在线安装 采用go get的方式安装import 的时候找不到对应的包看看pkg里面有没有 二 离线安装 redis客户端采用git clone的方法安装的话可以用以下方法 cd src git ...

  3. 设计模式学习--面向对象的5条设计原则之单一职责原则--SRP

    一.SRP简介(SRP--Single-Responsibility Principle): 就一个类而言,应该只专注于做一件事和仅有一个引起它变化的原因.   所谓职责,我们可以理解他为功能,就是设 ...

  4. [android] 看博客学习hashCode()和equals()

    equals()是Object类提供的一个方法,众所周知,每一个java类都继承自Object,所以说每一个对象都有一个equals()方法,我们在用这个方法时却一般重写这个方法 Object类中eq ...

  5. Docker的下载与安装

    一丶下载 1.win10之外的 Docker下载地址: https://www.docker.com/products/docker-toolbox 2.win10 Docker下载地址: https ...

  6. Windows中的键盘快捷方式大全

    Windows有很多键盘快捷方式,使用键盘快捷方式能够大大提高使用windows的效率,同时还能提升自己的逼格,背熟几个快捷方式,操作起来行云流水犹如大神一般! 页面较长,请使用目录浏览(点击跳转), ...

  7. 【13】享元模式(FlyWeight Pattern)

    一.引言 在软件开发过程,如果我们需要重复使用某个对象的时候,若重复地使用new创建这个对象的话,就需要多次地去申请内存空间了,这样可能会出现内存使用越来越多的情况,这样的问题是非常严重.享元模式可以 ...

  8. spring-bean实例化三种方式

    在spring中,bean的示例化有三种方式. 1.使用类的无参构造函数创建 2.使用静态工厂方式创建 3.使用实例化工厂方式创建. 具体代码如下 静态工厂方式: Bean2.java package ...

  9. js-JavaScript常见的创建对象的几种方式

    1.通过Object构造函数或对象字面量创建单个对象 这些方式有明显的缺点:使用同一个接口创建很多对象,会产生大量的重复代码.为了解决这个问题,出现了工厂模式. 2.工厂模式 考虑在ES中无法创建类( ...

  10. 结束autocad异常进程

    近日在做CAD自动化数据处理,程序在服务器上运行,运行时间长了会发生异常“autocad application 已停止工作”,这个时候需要通过守护程序去重启CAD, 通过CMD命令“@taskkil ...