编译安装httpd-2.4.38

1、下载源码并解压缩
[root@centos7 data]#wget http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.38.tar.bz2
--2019-03-03 12:45:15-- http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.38.tar.bz2
Resolving mirrors.shu.edu.cn (mirrors.shu.edu.cn)... 202.121.199.235
Connecting to mirrors.shu.edu.cn (mirrors.shu.edu.cn)|202.121.199.235|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7035030 (6.7M) [application/x-bzip2]
Saving to: ‘httpd-2.4.38.tar.bz2’

100%[====================================================================================>] 7,035,030 6.38MB/s in 1.1s

2019-03-03 12:45:16 (6.38 MB/s) - ‘httpd-2.4.38.tar.bz2’ saved [7035030/7035030]
[root@centos7 data]#wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.bz2
--2019-03-03 12:47:04-- http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.bz2
Resolving mirror.bit.edu.cn (mirror.bit.edu.cn)... 114.247.56.117
Connecting to mirror.bit.edu.cn (mirror.bit.edu.cn)|114.247.56.117|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 855393 (835K) [application/octet-stream]
Saving to: ‘apr-1.6.5.tar.bz2’

100%[====================================================================================>] 855,393 --.-K/s in 0.1s

2019-03-03 12:47:04 (6.43 MB/s) - ‘apr-1.6.5.tar.bz2’ saved [855393/855393]
[root@centos7 data]#wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2
--2019-03-03 12:48:00-- http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2
Resolving mirror.bit.edu.cn (mirror.bit.edu.cn)... 114.247.56.117
Connecting to mirror.bit.edu.cn (mirror.bit.edu.cn)|114.247.56.117|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 428595 (419K) [application/octet-stream]
Saving to: ‘apr-util-1.6.1.tar.bz2’

100%[====================================================================================>] 428,595 --.-K/s in 0.1s
2019-03-03 12:48:00 (3.48 MB/s) - ‘apr-util-1.6.1.tar.bz2’ saved [428595/428595]
tar xvf apr-1.6.5.tar.bz2
tar xvf apr-util-1.6.1.tar.bz2
tar xvf httpd-2.4.38.tar.bz2
[root@centos7 data]#ls
apr-1.6.5.tar.bz2 apr-util-1.6.1.tar.bz2 httpd-2.4.38.tar.bz2
[root@centos7 data]#ls
apr-1.6.5 apr-1.6.5.tar.bz2 apr-util-1.6.1 apr-util-1.6.1.tar.bz2 httpd-2.4.38 httpd-2.4.38.tar.bz2
2、 将三个源码合并
[root@centos7 data]#mv apr-1.6.5 httpd-2.4.38/srclib/apr
[root@centos7 data]#mv apr-util-1.6.1 httpd-2.4.38/srclib/apr-util
[root@centos7 data]#ls httpd-2.4.38/srclib/
apr apr-util Makefile.in
3、 安装相关包 yum install gcc gcc-c++ glibc glibc-devel pcre-devel openssl-devel expat-devel
4、编译安装[root@centos7 httpd-2.4.38]#1、 cd httpd-2.4.38/
./configure --prefix=/app/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
2、make && make install
configure: summary of build options:
Server Version: 2.4.38
Install prefix: /app/httpd24
C compiler: gcc -std=gnu99
CFLAGS: -g -O2 -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E
此时,为了避免冲突,我们把本机yum安装的httpd卸载,不然都走80端口会冲突。
[root@centos7 httpd-2.4.38]#cd /app/
[root@centos7 app]#ls
httpd24
[root@centos7 app]#cd httpd24/
[root@centos7 httpd24]#ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@centos7 httpd24]#ls bin/
ab apr-1-config apxs dbmmanage envvars-std htcacheclean htdigest httpd:主配置文件 logresolve
apachectl:系统启动文件 apu-1-config checkgid envvars fcgistarter htdbm htpasswd httxt2dbm rotatelogs
5、[root@centos7 httpd24]#vim /etc/profile.d/env.sh 将变量写入文件
PS1="[\e[1;32m][\u@\h \W]\$[\e[0m]"
PATH=/app/httpd24/bin:$PATH
[root@centos7 httpd24]#. /etc/profile.d/env.sh
[root@centos7 httpd24]#echo $PATH
/app/httpd24/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
6、尝试启动:[root@centos7 httpd24]#apachectl
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using centos7.localdomain. Set the ‘ServerName‘ directive globally to suppress this message
[root@centos7 ~]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::80 :::
7、因为配置已经写入文件中
[root@centos7 ~]#cd /app/httpd24/htdocs/
[root@centos7 htdocs]#ls
index.html
[root@centos7 htdocs]#cat index.html
<html><body><h1>It works!</h1></body></html>

8、此时在进程中显示是demon服务,我们要把它改为Apache服务:修改文件
[root@centos7 httpd24]#ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@centos7 httpd24]#cd conf
[root@centos7 conf]#ls
extra httpd.conf magic mime.types original
[root@centos7 conf]#vim httpd.conf
User apache Group apache
[root@centos7 conf]#apachectl restart
[root@centos7 conf]#ps aux
apache 58161 0.0 0.1 101620 1924 ? S 14:33 0:00 /app/httpd24/bin/httpd
apache 58162 0.0 0.1 101620 1924 ? S 14:33 0:00 /app/httpd24/bin/httpd
apache 58163 0.0 0.1 101620 1924 ? S 14:33 0:00 /app/httpd24/bin/httpd
apache 58164 0.0 0.1 101620 1924 ? S 14:33 0:00 /app/httpd24/bin/httpd
apache 58165 0.0 0.1 101620 1924 ? S 14:33 0:00 /app/httpd24/bin/httpd
9、[root@centos7 conf]#cd /etc/init.d/
[root@centos7 init.d]#ls
functions netconsole network README
[root@centos7 init.d]#vim /etc/rc.local
/app/httpd24/bin/apachectl
[root@centos7 init.d]#ll /etc/rc.d/rc.local
-rw-r--r--. 1 root root 500 Mar 3 14:37 /etc/rc.d/rc.local
[root@centos7 init.d]#chmod +x /etc/rc.d/rc.local
[root@centos7 init.d]#reboot
[root@centos7 ~]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::80 :::

原文地址:https://blog.51cto.com/14128387/2357327

时间: 2024-10-16 12:23:42

编译安装httpd-2.4.38的相关文章

编译安装httpd 2.4

编译安装LAMP之:编译安装httpd 2.4 环境介绍: 系统环境:CentOS6.5 所需软件包:apr-1.5.2.tar.gz.apr-util-1.5.2.tar.gz.httpd-2.4.6.tar.gz 注意:httpd2.4需要依赖apr和arp-util 1.4以上版本 CentOS编译安装Apache准备:确保开发包组已安装(Development tools.Server Platform Development) yum groupinstall "Development

CentOS 6.5下编译安装httpd+mysql+php+phpMyAdmin

CentOS 6.5下编译安装httpd+mysql+php+phpMyAdmin+cacti+nagios 一.安装环境 Linux系统:CentOS 6.5 Apache版本:http-2.4.12 MySQL版本:MySQL 5.6.24 PHP版本:PHP-5.6.8 基本的安装顺序为:先安装httpd,然后安装mysql,最后安装PHP. 软件包: [[email protected] httpdbao]# ll total 334908 -rwxrw-rw-. 1 root root

编译安装httpd

CentOS 6默认提供的是httpd 2.2,现尝试在CentOS 6上编译安装httpd 2.4 1.编译安装apr和apr-util httpd程序依赖于apr和apr-util.apr(Apache portable Run-time libraries,Apache可移植运行库)旨在为上层的httpd应用程序提供一个可以跨越多种操作系统平台使用的底层支持接口库,给httpd程序提供了一个虚拟机环境,由此实现了httpd的跨平台性 httpd 2.4依赖apr 1.4以上的版本,因此若a

编译安装httpd 2.4 ---格式待整理

httpd 2.4 版本需要依赖于apr 1.4版本httpd 依赖于 apr,apr-util    其安装又先后顺序之分:        1.apr        2.apr-util        3.httpd [[email protected] httpd]# rpm -q httpdhttpd-2.2.15-39.el6.centos.x86_64[[email protected] httpd]# service httpd stopStopping httpd:        

编译安装HTTPD 2.4.9版本

编译安装HTTPD 2.4.9版本 ? ?服务脚本:/etc/rc.d/init.d/httpd ? ?脚本配置文件路径:/etc/sysconfig/httpd ? ?运行目录:/etc/httpd ? ?配置文件: ? ? ? ?主配置:/etc/httpd/conf/httpd.conf ? ? ? ?扩展配置:/etc/httpd/conf.d/*.conf ? ?监听的Socket: tcp的80, 443是https/tcp的监听端口 ? ?在内核中使用小于1023的端口的只有管理员

编译安装httpd服务

首先,编译安装http,需要有它的源码包,这里提供官方下载:http://httpd.apache.org 我使用的是httpd-2.4.4.tar.bz2软件包 在进行源码编译安装之前,我们需要设定一下安装环境 1.安装开发包组: # yum groupinstall "Development tools" "Server Platform Development" "Desktop Platform Development" "Co

linux命令:编译安装httpd、mysql、php等LAMP环境

Httpd 2.4新特性: 1.MPM可于运行时装载: --enable-mpms-shared=all --with-mpm=event  编译安装是指定MPM运行模块为event 2.Event MPM 支持event新的多路处理模块 3.异步读写 4.在每模块及每目录上指定日志级别 5.每请求配置: <If>,<ElseIf>,<Else>; 6.增强的表达式分析器: 7.毫秒级的Keepalive Timeout; 8.基于域名的虚拟主机不再需要NameVirt

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

今天来总结一下在Linux中软件安装,通常我们应该知道,安装软件有两种方法:一种是软件包的安装,也就是rpm包的安装,就是指这些软件包都是 已经编译好的二进制rpm包,我们通过rpm安装工具和yum安装工具就可以直接安装了.另一种则是源代码安装,这种软件安装就是指它只有源代码,没有经 过编译的二进制,需要通过手动去编译安装的. rpm包是别人所编译好的软件包,比如说编译好的rpm包没有某个功能,也我们又想用,那我们就得自去手动下载源代码来自行安装了,自定义去安装程序包,这个是我们要撑握的. 下面

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* Ve=2.2 [ $1 = 2.4 ] && Ve=2.4 || Ve=2.2 #设置安装版本2.2或2.4 #目录 Ddir=/it/tools #定义下载目录 Sdir=/www/server #定义安装目录 Adir=$Sdir/apache$Ve [ ! -d $Ddir ] &a

搭建Yum服务器及编译安装Httpd

搭建yum服务器 编译安装Httpd 原文地址:http://blog.51cto.com/10461810/2106438