我们的系统平台是在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. 性能提速:debounce(防抖)、throttle(节流/限频)

    debounce与throttle是用户交互处理中常用到的性能提速方案,debounce用来实现防抖动,throttle用来实现节流(限频).那么这两个方法到底是什么(what)?为何要用(why-解 ...

  2. idea调试springmvc出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    idea调试springmvc出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderList ...

  3. Python字符串与容器

    []运算符是Python中访问容器元素和切片的运算符 []有正向和反向两种下标,正向下标从0开始,向后递增: 反向下标以-1表示最后一个元素,-2表示倒数第二个字符,向前递减. []不仅可以访问单个元 ...

  4. 从零开始学JAVA(09)-使用SpringMVC4 + Mybatis + MySql 例子(注解方式开发)

    项目需要,继续学习springmvc,这里加入Mybatis对数据库的访问,并写下一个简单的例子便于以后学习,希望对看的人有帮助.上一篇被移出博客主页,这一篇努力排版整齐,更原创,希望不要再被移出主页 ...

  5. django2.1---终端打印orm转义的sql语句

    print(connection.queries)可以打印转义后的sql语句 例子: from django.http import JsonResponse,HttpResponse from .m ...

  6. Netty 内存回收之 noCleaner 策略

    前言 对于堆外内存,使用 System.gc() 是不靠谱的,依赖老年代 FGC 也是不靠谱的,而且大部分调优指南都设置了 -DisableExplicitGC 禁用 System.gc().所以主动 ...

  7. Spring学习之路-从入门到放弃

    后台框架是真难入门啊!!!IDE的使用,环境的搭建,框架下载,上手,每一步都恶心人. 花了整整两天,才学会用idea,并且初步了解了maven(TM就是一个npm),然后跟着下载了对应的jar包,搭建 ...

  8. ETCD 简介 + 使用

    etcd简介 etcd是一个高可用的分布式键值(key-value)数据库.etcd内部采用raft协议作为一致性算法,etcd基于Go语言实现. etcd是一个服务发现系统,具备以下的特点: 简单: ...

  9. Three.js开发指南---学习使用几何体(第五章)

    一 基础几何体 1 二维图形:二维图形都是基于x和y轴构建的,即展示的形式就是他们都是“直立”的,如果希望这些二维图形躺下,则需要将几何体沿着x轴向后旋转1/4圈 mesh.rotation.x=-M ...

  10. html前端学习

    html : 1.相当于没有穿衣服的人,一套浏览器认识的规则, 2.开发者: 学习html规则 开发后台程序: -写html文件(充当模板) -数据库获取数据,然后替换到html文件的指定位置(web ...