author:JevonWei

版权声明:原创作品


  • 官方网站下载httpd2.4、apr及apr-util的相关软件包,并传输到centos 7系统中的/usr/local/src(apr1.6版本过高不兼容,故需下载apr-1.5*版本)

    httpd2.4

    http://httpd.apache.org/download.cgi#apache2.4

    apr及apr-util

    http://httpd.apache.org/download.cgi#apache2.4

    lftp 172.16.0.1:/pub/Sources/sources/httpd> mget apr-1.5.2.tar.bz2 apr-util-1.5.4.tar.bz2

  • 解压软件包并安装开发包组

    [root@danran src]# cd /usr/local/src

    [root@danran src]# ls

    apr-1.5.2.tar.bz2 apr-util-1.5.4.tar.bz2 httpd-2.4.27.tar.bz2

    [root@danran src]# tar -xf apr-1.5.2.tar.bz2

    [root@danran src]# tar -xf apr-util-1.5.4.tar.bz2

    [root@danran src]# tar xf httpd-2.4.27.tar.bz2

    [root@danran src]# ls

    [root@danran src]# ls

    apr-1.5.2 apr-util-1.5.4 httpd-2.4.27

    apr-1.5.2.tar.bz2 apr-util-1.5.4.tar.bz2 httpd-2.4.27.tar.bz2

    [root@danran src]# yum -y groupinstall "Development Tools"

方法一、apr、apr-util、httpd24分别编译

编译安装apr

[root@danran src]# mkdir /usr/local/apr \\新建/usr/local/apr做apr的安装目录
[root@danran src]# cd apr-1.5.2/
[root@danran apr-1.5.2]# ./configure --prefix=/usr/local/apr \\--prefix指定安装目录
[root@danran apr-1.5.2]# make && make install \\安装

编译安装apr-util

[root@danran src]# mkdir /usr/local/apr-util \\创建apr-util的安装目录
[root@danran src]# cd apr-util-1.5.0/
[root@danran apr-util-1.5.0]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr \\--with-apr 指定apr的安装目录,--prefix=/usr/local/apr-utils指定apr-util的安装目录
[root@danran apr-util-1.5.0]# make && make install

编译httpd 2.4

[root@danran src]# mkdir /usr/local/httpd24
  • 编译

    [root@danran httpd-2.4.27]# ./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork \-with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util指定apr及apr-util的安装目录

    checking for gcc option to accept ISO C99... -std=gnu99

    checking for pcre-config... false

    configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

    提示pcre包没有安装,故需安装pcre-devel开发包

    [root@danran httpd-2.4.27]# yum -y install pcre-devel

  • 再次执行编译

    [root@danran httpd-2.4.27]# ./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork

    checking whether to enable mod_ssl... checking dependencies

    checking for OpenSSL... checking for user-provided OpenSSL base directory... none

    checking for OpenSSL version >= 0.9.8a... FAILED

    configure: WARNING: OpenSSL version is too old

    no

    checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

    根据提示,openssl软件包缺失,需安装openssl-devel开发包

    [root@danran httpd-2.4.27]# yum -y install openssl-devel

  • 缺失的程序包安装完毕再次执行编译安装

    [root@danran httpd-2.4.27]# ./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork

    [root@danran httpd-2.4.27]# make && make install

法二 apr、apr-util、httpd三个程序包一起编译

[root@danran src]# mv apr-1.5.2 httpd-2.4.27/srclib/apr
[root@danran src]# mv apr-util-1.5.4 httpd-2.4.27/srclib/apr-util
[root@danran src]# cd httpd-2.4.27
[root@danran httpd-2.4.27]# ./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork 同上编译httpd24操作一致,根据提示安装不同的程序开发包,eg
[root@danran httpd-2.4.27]# yum -y install pcre-devel
[root@danran httpd-2.4.27]# yum -y install openssl-devel [root@danran httpd-2.4.27]# make && make install
  • 导入环境变量

    [root@danran httpd-2.4.27]# cd /usr/local/httpd24/bin/

    [root@danran bin]# ls

    ab checkgid envvars-std htdbm httpd rotatelogs

    apachectl dbmmanage fcgistarter htdigest httxt2dbm

    apxs envvars htcacheclean htpasswd logresolve

    [root@danran bin]# vim /etc/profile.d/httpd.sh

    export PATH=/usr/local/httpd24/bin:$PATH

    [root@danran bin]# . /etc/profile.d/httpd.sh

    [root@danran bin]# $PATH

    -bash: /usr/local/httpd24/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin: No such file or directory

    [root@danran bin]# which apachectl

    /usr/local/httpd24/bin/apachectl

    导入man帮助路径

    [root@danran httpd-2.4.27]# ls /usr/local/httpd24/man/ \httpd的man帮助路径

    [root@danran ~]# vim /etc/man.config

    MANPATH /usr/local/httpd24/man/

man1 man8

  • 启动服务

    [root@danran bin]# apachectl start

    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using danran.com. Set the 'ServerName' directive globally to suppress this message

    [root@danran bin]# ps aux | grep http

    root 85908 0.0 0.1 97324 2324 ? Ss 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    daemon 85909 0.0 0.1 99408 1916 ? S 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    daemon 85910 0.0 0.1 99408 1916 ? S 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    daemon 85911 0.0 0.1 99408 1916 ? S 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    daemon 85912 0.0 0.1 99408 1916 ? S 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    daemon 85913 0.0 0.1 99408 1916 ? S 13:15 0:00 /usr/local/httpd24/bin/httpd -k start

    root 85915 0.0 0.0 112648 960 pts/1 R+ 13:15 0:00 grep --color=auto http

  • 编译安装的httpd的自带默认web页面保存在/usr/local/httpd24/htdocs路径下

    [root@danran htdocs]# ll /usr/local/httpd24/htdocs/index.html

  • 添加服务脚本启动服务

    Centos 7

    [root@danran htdocs]# scp 172.16.251.4:/etc/init.d/httpd /etc/init.d/httpd24 \复制某台 主机的http的服务脚本到当前系统

    [root@danran htdocs]# cd /etc/init.d/

    [root@danran init.d]# vim /etc/init.d/httpd24 \修改以下内容

    apachectl=/usr/local/httpd24/bin/apachectl \启动二进制文件路径

    httpd=${HTTPD-/usr/local/httpd24/bin/httpd}

    prog=httpd

    pidfile=${PIDFILE-/usr/local/httpd24/logs/httpd.pid} \pid进程号文件

    lockfile=${LOCKFILE-/var/lock/subsys/httpd24} \httpd的锁文件

    [root@danran init.d]# apachectl stop

    [root@danran init.d]# chkconfig --add httpd24

    [root@danran init.d]# chkconfig --list httpd24

          Note: This output shows SysV services only and does not include native
    systemd services. SysV configuration data might be overridden by native
    systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'.
    To see services enabled on particular target use
    'systemctl list-dependencies [target]'. httpd24 0:off 1:off 2:off 3:off 4:off 5:off 6:off
    [root@danran init.d]# service httpd24 start \\centos7使用此命令有缺失,建议还是使用apachectl start启动 [root@danran bin]# apachectl start \\启动httpd24服务 [root@danran init.d]# ls /usr/local/httpd24/logs/httpd.pid
    /usr/local/httpd24/logs/httpd.pid
    [root@danran init.d]# ls /usr/local/httpd24/logs/access_log
    /usr/local/httpd24/logs/access_log
    [root@danran init.d]# ls /usr/local/httpd24/logs/error_log
    /usr/local/httpd24/logs/error_log

    Centos 6

    [root@danran ~]# cp /etc/init.d/httpd /etc/init.d/httpd24

    [root@danran ~]# vim /etc/init.d/httpd24

    apachectl=/usr/local/httpd24/bin/apachectl

    httpd=${HTTPD-/usr/local/httpd24/bin/httpd}

    prog=httpd

    pidfile=${PIDFILE-/usr/local/httpd24/logs/httpd.pid}

    lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

    [root@danran httpd-2.4.27]# service httpd24 start

    Starting httpd: AH00557: httpd: apr_sockaddr_info_get() failed for danran.com

    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

    [ OK ]

    [root@danran httpd-2.4.27]# chkconfig --add httpd24

    [root@danran httpd-2.4.27]# chkconfig --list httpd24

    httpd24 0:off 1:off 2:off 3:off 4:off 5:off 6:off

编译安装httpd 2.4的更多相关文章

  1. 编译安装HTTPD 2.4.9版本

    编译安装HTTPD 2.4.9版本    服务脚本:/etc/rc.d/init.d/httpd    脚本配置文件路径:/etc/sysconfig/httpd    运行目录:/etc/httpd ...

  2. CentOS 6.4源码编译安装httpd并启动测试

    今天来总结一下在Linux中软件安装,通常我们应该知道,安装软件有两种方法:一种是软件包的安装,也就是rpm包的安装,就是指这些软件包都是 已经编译好的二进制rpm包,我们通过rpm安装工具和yum安 ...

  3. apache编译安装 httpd 2.2 httpd 2.4

    #apache编译安装#httpd 2.2 , httpd 2.4 #!/bin/sh #apache编译安装 #httpd 2.2 , httpd 2.4 #centos #rpm -e httpd ...

  4. Linux源码编译安装httpd

    Linux安装软件采用源码编译安装灵活自由,适用于不同平台,维护也十分方便. 源码编译的安装方式一般由3个步骤组成: 1.配置(configure) 2.编译(make) 3.安装(make inst ...

  5. (转)CentOS 7.6 上编译安装httpd 2.4.38

    原文:https://www.s4lm0x.com/archives/40.html https://www.cnblogs.com/sunshine-H/p/8110608.html----超详细 ...

  6. LAMP环境之编译安装httpd服务

    “Apache HTTP Server”是开源软件项目的杰出代表,它基于标准的 HTTP 网络协议提供网页浏览服务. 在配置 Apache 网站服务之前,需要正确安装好 httpd 服务器软件.htt ...

  7. 编译安装httpd

    一.安装前的说明: httpd依赖于apr和apr-util所以在安装httpd之前要把这些东西都安装上去. 事先安装的依赖: yum -y install gcc gcc-c++ pcre-deve ...

  8. 二进制编译安装httpd服务

    systemctl stop httpd yum remove httpd-----------------------(在做之前 先删掉httpd) 安装编译环境 yum -y groupinsta ...

  9. 把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理

    把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理 1 编译安装httpd 把httpd编译安装在/app/httpd/目录下. 2 在/etc/rc.d/init ...

随机推荐

  1. 浅谈jQuery Pagination Ajax 分页插件的使用

    插件介绍 此插件是jQuery的ajax分页插件.分页切换时无刷新也无延迟,因为是一次性加载的.如果你用到此插件作分页的时候,涉及到的数据量大,建议不要使用此插件,因为加载慢会导致用户体验不好! 插件 ...

  2. Android学习笔记-EditText(输入框)(二)

    6.控制EditText四周的间隔距离与内部文字与边框间的距离 我们使用margin相关属性增加组件相对其他控件的距离,比如android:marginTop = "5dp" 使用 ...

  3. spring实现文件上传(图片解析)

    合抱之木,生于毫末,千里之行,始于足下,要想了解spring的文件上传功能,首先要知道spring是通过流的方式将文件进行解析,然后上传.那么是不是所有需要用的文件上传的地方都要写一遍文件解析器呢? ...

  4. Linux 下安装jetty服务器

    jetty和我们通常使用的tomcat一样,是一个开源的servlet容器,特点是轻量易部署,一方面jetty可以作为web容器使用,另一方面也是最一般的方式是jetty以一组jar包的形式发布,所以 ...

  5. CI框架主题切换的功能

    CI框架主题切换的功能 本人接触到这个框架不就,属于菜鸟 , 公司现在用CI框架做项目 ,老大要做一个主题切换的功能,说明功能的要求我的脑子里瞬间有几个想法. 脑子里最简单的就是设置全局变量 如 : ...

  6. CI 结合 vue.js 的搜索功能模块

    CI 结合 vue.js 的搜索功能模块 最近在有优化公司后台的某个模块的搜索功能优化 原先的是这个样子的,很是单调: 老大给我找个图希望我能弄成这样子: 经过不断修改,最后成了这样子 是不是比以前好 ...

  7. 纯干货!华为软件开发云编译构建之Maven

    一.Maven介绍 Maven是一个项目管理和整合的工具.Maven为开发者提供了一套完整的构建生命周期框架.开发团队基本不用花多少时间就能自动完成工程的基础构建配置,因为Maven使用了一个标准的目 ...

  8. Mongodb启动&关闭

    mac 下mongo的启动和关闭以及启动问题解决 mongo的安装在这:http://www.cnblogs.com/leinov/p/6855784.html Mac os mongodb数据安装路 ...

  9. 同步读取各平台StreamingAssets文件

    //Path为StreamingAssets文件后面的路径 public AssetBundle GetstreamingAssets(string Path) { #if UNITY_EDITOR ...

  10. 手脱ASPack

    ESP定律到达OEP,重新分析代码块 在菜单栏中找到OllyDump插件,该插件的窗口的弹了出来,有一些选项可供我们修改,我们可以对Base of Code进行修改,这里Base of Code = ...