我们的系统平台是在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. Java NIO系列教程(十二) Java NIO与IO

    当学习了Java NIO和IO的API后,一个问题马上涌入脑海: 我应该何时使用IO,何时使用NIO呢?在本文中,我会尽量清晰地解析Java NIO和IO的差异.它们的使用场景,以及它们如何影响您的代 ...

  2. Java NIO系列教程(二) Channel

    Java NIO的通道类似流,但又有些不同: 既可以从通道中读取数据,又可以写数据到通道.但流的读写通常是单向的. 通道可以异步地读写. 通道中的数据总是要先读到一个Buffer,或者总是要从一个Bu ...

  3. Tomcat学习总结(7)——Tomcat与Jetty比较

    Jetty 基本架构 Jetty目前的是一个比较被看好的 Servlet 引擎,它的架构比较简单,也是一个可扩展性和非常灵活的应用服务器. 它有一个基本数据模型,这个数据模型就是 Handler(处理 ...

  4. 管理git生成的多个ssh key

    http://www.bootcss.com/p/git-guide/ 问题阐述 当有多个git账号的时候,比如一个github,用于自己进行一些开发活动,再来一个gitlab,一般是公司内部的git ...

  5. Autowired使用说明

    使用了那么久Spring,一下子问我Autowired注解使用条件,答不上来吧,看了Spring源码,一点点收货: 废话少说,要是Autowired生效,需要注册BeanPostProcessor,你 ...

  6. es6学习笔记9--函数的扩展

    函数参数的默认值 基本用法 在ES6之前,不能直接为函数的参数指定默认值,为了避免这个问题,通常需要先判断一下参数y是否被赋值,如果没有,再等于默认值. ES6允许为函数的参数设置默认值,即直接写在参 ...

  7. C# WebApi 返回JSON

    在默认情况下,当我们新建一个webapi项目,会自动返回XML格式的数据,如果我们想返回JSON的数据,可以设置下面的三种方法. 1. 不用改配置文件,在Controller的方法中,直接返回Http ...

  8. [转]DevOps实战:百度持续交付体系与最佳实践大解密!

    本文转自:http://dbaplus.cn/news-21-471-1.html “互联网+”时代,软件产品要想满足快速增长的用户需求,高效.快速的迭代转型必不可少,面对时刻发生改变的互联网及业务模 ...

  9. IDEA Tomcat Web项目修改了代码,重新部署页面没改变

    今天被IDEA坑的不浅直接说一下问题: 这是html页面不管我怎么修改重启服务器在浏览器中还是一点都不变化,甚至把一些内容都删了都没有变化,target可执行文件是最新的没问题,找了点资料发现是浏览器 ...

  10. Bell(矩阵快速幂+中国剩余定理)

    Bell Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status  ...