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

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

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

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

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

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

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

发现报错:

configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.

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

yum install apr apr-util apr-devel apr-util-devel

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

4、继续执行configure检测环境

[root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd-2.4.]#./configure --prefix=/usr/local/httpd
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options: Server Version: 2.4.
Install prefix: /usr/local/httpd
C compiler: gcc
CFLAGS: -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E

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

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

[root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd-2.4.]#make
/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
make[]: Leaving directory `/usr/local/httpd-2.4./modules/mappers'
make[]: Leaving directory `/usr/local/httpd-2.4./modules/mappers'
make[]: Leaving directory `/usr/local/httpd-2.4./modules'
make[]: Entering directory `/usr/local/httpd-2.4./support'
make[]: Leaving directory `/usr/local/httpd-2.4./support' make[]: Leaving directory `/usr/local/httpd-2.4.'

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

6、执行make install 安装

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

安装成功。

7、看下安装的目录

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

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

9、设置环境变量

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

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

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

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

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

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

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

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

[root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/include]#ls
apache_noprobes.h ap_expr.h ap_regkey.h http_core.h mod_auth.h util_cookies.h util_script.h
ap_compat.h ap_hooks.h ap_release.h httpd.h mod_core.h util_ebcdic.h util_time.h
ap_config_auto.h ap_listen.h ap_slotmem.h http_log.h mod_request.h util_fcgi.h util_varbuf.h
ap_config_auto.h.in ap_mmn.h ap_socache.h http_main.h mpm_common.h util_filter.h util_xml.h
ap_config.h ap_mpm.h heartbeat.h http_protocol.h scoreboard.h util_ldap.h
ap_config_layout.h ap_provider.h http_config.h http_request.h util_cfgtree.h util_md5.h
ap_config_layout.h.in ap_regex.h http_connection.h http_vhost.h util_charset.h util_mutex.h
[root@:vg_adn_tidbCkhsTest:172.31.30.62 /usr/local/httpd/include]#mkdir /usr/include/httpd
[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. 精读JavaScript模式(二)

    我在想知识点怎么去分类,原本计划一章节一篇,但这样会会显得长短不一.更主要的是看到哪写的哪更为随意.那么这一篇还是紧接第一篇进行知识梳理,上篇说到了更优化的for循环,现在继续聊聊其它的循环方式. 1 ...

  2. python 使用 matplotlib.pyplot来画柱状图和饼图

    导入包 import matplotlib.pyplot as plt 柱状图 最简柱状图 # 显示高度 def autolabel(rects): for rect in rects: height ...

  3. Apriori算法进行关联分析

    设全集U = {a, b, c, d, e},其元素a,b, c, d, e称为项. 数据集: D = [ {a, b}, {b, c, d}, {d, e}, {b, c, e}, {a,b, c, ...

  4. 并发编程之 Condition 源码分析

    前言 Condition 是 Lock 的伴侣,至于如何使用,我们之前也写了一些文章来说,例如 使用 ReentrantLock 和 Condition 实现一个阻塞队列,并发编程之 Java 三把锁 ...

  5. openssh升级到openssh-7.5p1踩坑

    环境:ubuntu 需要的安装包: http://zlib.net/   zlib 1.2.11最新版 http://www.linux-pam.org/library/   pam 1.3.0 ht ...

  6. DataSet & DataTable &DataRow 深入浅出

    本篇文章适合有一定的基础的人去查看 ,最好学习过一定net 编程基础在来查看此文章. 1.概念 DataSet是ADO.NET的中心概念.可以把DataSet当成内存中的数据库,DataSet是不依赖 ...

  7. String的equals()方法源码解析

    每个String对象在创建的时候都构造了一个char类型的final声明的不可替换数组,数组中的每一个元素即字符串对应的每一个字符如图: String的equals()在比较的时候会进行两步比较: 1 ...

  8. Spring boot实现自定义拦截器

    Sprintboot的拦截器提供了精细的控制:在request被响应之前.request被响应之后.request全部结束之后至视图渲染之前 三个时间点,我们都可以通过编写他们的函数来控制. 首先新建 ...

  9. php7 AES IOS Android

    $key = 'SK7381DNSU#&#@DS'; //key的长度保持16位 加粗 标识 $cipher = "AES-128-ECB"; $iv_len = open ...

  10. H5添加禁止缩放功能

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scal ...