centos7编译安装httpd2.4.25

源码的好处是比较灵活,想放哪里定制路径就放哪里

前提准备:Centos7系统、下载httpd2.4源代码、安装编译前的软件环境;连接教室物理网络。

1、下载httpd2.4.25源码
[[email protected] ~]# yum -y install lftp
[[email protected] ~]# lftpget ftp://172.18.0.1/pub/Sources/sources/httpd/httpd-2.4.25.tar.bz2
将下载好的http2.4.25进行解压缩,
[[email protected] data]# ll
total 6268
-rw------- 1 root root 1421 Jan 30 13:05 anaconda-ks.cfg
-rwxr-xr-x 1 root root 360 Jan 26 14:24 hallo.sh
drwxr-xr-x 11 501 games 4096 Dec 17 2016 httpd-2.4.25
-rw-r--r-- 1 root root 6398218 Oct 15 08:31 httpd-2.4.25.tar.bz2
-rw-r--r-- 1 root root 984 Jan 24 20:34 magedu.pubkey
[[email protected] data]# du -sh httpd-2.4.25
43M httpd-2.4.25
[[email protected] data]# cd httpd-2.4.25/
[[email protected] httpd-2.4.25]# ls
ABOUT_APACHE CMakeLists.txt INSTALL NWGNUmakefile
acinclude.m4 config.layout InstallBin.dsp os
Apache-apr2.dsw configure LAYOUT README
Apache.dsw configure.in libhttpd.dep README.cmake
apache_probes.d docs libhttpd.dsp README.platforms
ap.d emacs-style libhttpd.mak ROADMAP
build httpd.dep LICENSE server
BuildAll.dsp httpd.dsp Makefile.in srclib
BuildBin.dsp httpd.mak Makefile.win support
buildconf httpd.spec modules test
CHANGES include NOTICE VERSIONING
[[email protected] httpd-2.4.25]# tree
│?? └── wintty.mak
├── test
│?? ├── check_chunked
│?? ├── cls.c
│?? ├── Makefile.in
│?? ├── make_sni.sh
│?? ├── README
│?? ├── tcpdumpscii.txt
│?? ├── test_find.c
│?? ├── test_limits.c
│?? ├── test_parser.c
│?? ├── test_select.c
│?? ├── test-writev.c
│?? └── time-sem.c
└── VERSIONING

95 directories, 2776 files
可以看到有非常多“ . c ”文件,
[[email protected] httpd-2.4.25]# find -name "*.c" |wc -l
284 共284个
对于此类复杂脚本如何编译安装,我们接着看:

2、安装编译前的环境即安装Development tools包组及依赖
[[email protected] ~]# yum -y groupinstall “Development Tools”
[[email protected] httpd-2.4.25]# make
make: *** No targets specified and no makefile found. Stop.
[[email protected] httpd-2.4.25]# which make
/usr/bin/make
[[email protected] httpd-2.4.25]# rpm -qf /usr/bin/make
make-3.82-23.el7.x86_64
[[email protected] httpd-2.4.25]# file /usr/bin/make
/usr/bin/make: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=77eee6e2b89ced609bef92cd9ef75bb7e056d83b, stripped
make本身是一个二进制文件,要借助于mskefile文本文件。
我们要在Makefile文件中放安装路径,那些文件启用哪些文件不启用。利用 make 项目管理器就能实现自动安装和编译安装。

3、预编译config配置
[[email protected] httpd-2.4.25]# ./configure --prefix=/apps/httpd/ --sysconfdir=/etc/httpd/ --enable-ssl
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
[[email protected] httpd-2.4.25]# yum search apr
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
============================= N/S matched: apr =============================
apr-devel.i686 : APR library development kit
apr-devel.x86_64 : APR library development kit
apr-util-devel.i686 : APR utility library development kit
apr-util-devel.x86_64 : APR utility library development kit
apr-util-ldap.x86_64 : APR utility library LDAP support
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
apr-util-nss.x86_64 : APR utility library NSS crytpo support
apr-util-odbc.x86_64 : APR utility library ODBC DBD driver
apr-util-openssl.x86_64 : APR utility library OpenSSL crytpo support
apr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driver
apr-util-sqlite.x86_64 : APR utility library SQLite DBD driver
libapreq2-devel.x86_64 : Development files for libapreq2
libchromaprint-devel.x86_64 : Headers for developing programs that will use
: chromaprint
pcp-pmda-haproxy.x86_64 : Performance Co-Pilot (PCP) metrics for HAProxy
php-whitehat101-apr1-md5.noarch : Apache‘s APR1-MD5 algorithm in pure PHP
apr.i686 : Apache Portable Runtime library
apr.x86_64 : Apache Portable Runtime library
apr-util.i686 : Apache Portable Runtime Utility library
apr-util.x86_64 : Apache Portable Runtime Utility library
golang-github-armon-go-proxyproto-devel.noarch : Golang package to handle
: HAProxy Proxy Protocol
haproxy.x86_64 : TCP/HTTP proxy and load balancer for high availability
: environments
libapreq2.x86_64 : Apache HTTP request library
libchromaprint.x86_64 : Library implementing the AcoustID fingerprinting
libfap.x86_64 : An APRS parser written in C
perl-libapreq2.x86_64 : Perl interface to the Apache HTTP request library
snapraid.x86_64 : Disk array backup for many large rarely-changed files
Name and summary matches only, use "search all" for everything.
[[email protected] httpd-2.4.25]# yum install apr-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package apr-devel.x86_64 0:1.4.8-3.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================
Package Arch Version Repository Size

Installing:
apr-devel x86_64 1.4.8-3.el7_4.1 development 188 k

Transaction Summary

Install 1 Package

Total download size: 188 k
Installed size: 771 k
Is this ok [y/d/N]: y
Downloading packages:
apr-devel-1.4.8-3.el7_4.1.x86_64.rpm | 188 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-devel-1.4.8-3.el7_4.1.x86_64 1/1
Verifying : apr-devel-1.4.8-3.el7_4.1.x86_64 1/1

Installed:
apr-devel.x86_64 0:1.4.8-3.el7_4.1

Complete!

此处报错提示“ checking for APR... no ”,我们要安装的是“ yum install apr-devel ”。

我们再次检查,报错提示:
[[email protected] httpd-2.4.25]# ./configure --prefix=/apps/httpd/ --sysconfdir=/etc/httpd/ --enable-ssl
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
[[email protected] httpd-2.4.25]# yum search apr
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
============================= N/S matched: apr =============================
apr-devel.i686 : APR library development kit
apr-devel.x86_64 : APR library development kit
apr-util-devel.i686 : APR utility library development kit
apr-util-devel.x86_64 : APR utility library development kit
apr-util-ldap.x86_64 : APR utility library LDAP support
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
apr-util-nss.x86_64 : APR utility library NSS crytpo support
apr-util-odbc.x86_64 : APR utility library ODBC DBD driver
apr-util-openssl.x86_64 : APR utility library OpenSSL crytpo support
apr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driver
apr-util-sqlite.x86_64 : APR utility library SQLite DBD driver
libapreq2-devel.x86_64 : Development files for libapreq2
libchromaprint-devel.x86_64 : Headers for developing programs that will use
: chromaprint
pcp-pmda-haproxy.x86_64 : Performance Co-Pilot (PCP) metrics for HAProxy
php-whitehat101-apr1-md5.noarch : Apache‘s APR1-MD5 algorithm in pure PHP
apr.i686 : Apache Portable Runtime library
apr.x86_64 : Apache Portable Runtime library
apr-util.i686 : Apache Portable Runtime Utility library
apr-util.x86_64 : Apache Portable Runtime Utility library
golang-github-armon-go-proxyproto-devel.noarch : Golang package to handle
: HAProxy Proxy Protocol
haproxy.x86_64 : TCP/HTTP proxy and load balancer for high availability
: environments
libapreq2.x86_64 : Apache HTTP request library
libchromaprint.x86_64 : Library implementing the AcoustID fingerprinting
libfap.x86_64 : An APRS parser written in C
perl-libapreq2.x86_64 : Perl interface to the Apache HTTP request library
snapraid.x86_64 : Disk array backup for many large rarely-changed files

Name and summary matches only, use "search all" for everything.
[[email protected] httpd-2.4.25]# yum install apr-util-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package apr-util-devel.x86_64 0:1.5.2-6.el7 will be installed
--> Processing Dependency: openldap-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Processing Dependency: libdb-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Processing Dependency: expat-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package libdb-devel.x86_64 0:5.3.21-24.el7 will be installed
---> Package openldap-devel.x86_64 0:2.4.44-20.el7 will be installed
--> Processing Dependency: cyrus-sasl-devel(x86-64) for package: openldap-devel-2.4.44-20.el7.x86_64
--> Running transaction check
---> Package cyrus-sasl-devel.x86_64 0:2.1.26-23.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================
Package Arch Version Repository Size

Installing:
apr-util-devel x86_64 1.5.2-6.el7 development 76 k
Installing for dependencies:
cyrus-sasl-devel x86_64 2.1.26-23.el7 development 310 k
expat-devel x86_64 2.1.0-10.el7_3 development 57 k
libdb-devel x86_64 5.3.21-24.el7 development 38 k
openldap-devel x86_64 2.4.44-20.el7 development 804 k

Transaction Summary

Install 1 Package (+4 Dependent packages)

Total download size: 1.3 M
Installed size: 5.2 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): apr-util-devel-1.5.2-6.el7.x86_64.rpm | 76 kB 00:00
(2/5): cyrus-sasl-devel-2.1.26-23.el7.x86_64.rpm | 310 kB 00:00
(3/5): expat-devel-2.1.0-10.el7_3.x86_64.rpm | 57 kB 00:00
(4/5): libdb-devel-5.3.21-24.el7.x86_64.rpm | 38 kB 00:00
(5/5): openldap-devel-2.4.44-20.el7.x86_64.rpm | 804 kB 00:00

Total 1.2 MB/s | 1.3 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libdb-devel-5.3.21-24.el7.x86_64 1/5
Installing : expat-devel-2.1.0-10.el7_3.x86_64 2/5
Installing : cyrus-sasl-devel-2.1.26-23.el7.x86_64 3/5
Installing : openldap-devel-2.4.44-20.el7.x86_64 4/5
Installing : apr-util-devel-1.5.2-6.el7.x86_64 5/5
Verifying : openldap-devel-2.4.44-20.el7.x86_64 1/5
Verifying : apr-util-devel-1.5.2-6.el7.x86_64 2/5
Verifying : cyrus-sasl-devel-2.1.26-23.el7.x86_64 3/5
Verifying : expat-devel-2.1.0-10.el7_3.x86_64 4/5
Verifying : libdb-devel-5.3.21-24.el7.x86_64 5/5

Installed:
apr-util-devel.x86_64 0:1.5.2-6.el7

Dependency Installed:
cyrus-sasl-devel.x86_64 0:2.1.26-23.el7
expat-devel.x86_64 0:2.1.0-10.el7_3
libdb-devel.x86_64 0:5.3.21-24.el7
openldap-devel.x86_64 0:2.4.44-20.el7
Complete!
我们按上面的思路安装即可。第一次安装无经验,下一次安装就知道缺什么,就可直接安装了。

4、编译:[[email protected] httpd-2.4.25]# make -j 4
注意:使用-j 4表示编译时,使用4个cpu同时工作

5、安装:[[email protected] httpd-2.4.25]# make install
6、添加全局环境变量即将执行命令和帮助文档的路径写入PATH
[[email protected] httpd-2.4.25]# vim /etc/profile.d/env.sh
添加:
export PATH=/app/apache24/BIN:$PATH
使其立即生效:
[[email protected] httpd-2.4.25]# source
/etc/profile.d/env.sh
配置帮助文档路径:
[[email protected] httpd-2.4.25]# vim /etc/man_db.conf
添加:
MANDATORY_MANPATH
/app/apache24/man

7、关闭防火墙:
[[email protected] ~]# apachectl start
[[email protected] ~]# iptables -F
完成!

原文地址:http://blog.51cto.com/14128387/2348726

时间: 2024-10-10 03:02:59

centos7编译安装httpd2.4.25的相关文章

CentOS7编译安装httpd-2.4.41 php7.3

CentOS7编译安装httpd-2.4.41 php7.3 安装参考环境: CentOS Linux release 7.5.1804 (Core) 一.安装依赖包 httpd安装的依赖包 # yum -y install pcre-devel # yum -y install openssl-devel # yum -y groupinstall "Development Tools" arp-util安装的依赖包 # yum install expat-devel 二.编译安装a

centos 7中编译安装httpd-2.4.25.tar.gz

检查是否已经安装了下载工具wget和编译环境gcc.make: [[email protected] ~]# rpm -qa|grep -e wget -e ^gcc -e makegcc-4.8.3-9.el7.x86_64 make-3.82-21.el7.x86_64 wget-1.14-10.el7_0.1.x86_64 如果没有安装,则使用下面的命令安装: [[email protected] ~]# yum -y install wget gcc makeLoaded plugins

Centos7编译安装MySQL5.7.25

一.准备工作 1.删除centos系统自带的mariadb数据库防止发生冲突 rpm -qa |grep mariadb rpm -e mariadb-libs --nodeps 2.安装文件准备 # 下载mysql-5.7.25 wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz # 下载boost-1.59.0 wget https://sourceforg

centos7 编译安装lamp

系统:centos7 软件版本:php-7.1.0 +mysql-boost-5.7.16 + httpd-2.4.23 一.linux 系统限制配置 1.关闭系统防火墙 systemctl stop firewalld.service 关闭防火墙 systemctl disable firewalld.service  禁用防火墙 2.关闭SElinux sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config  setenfor

CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src/Apache-2.2.25 tar -xzvf ./httpd-2.2.25.tar.gz cd ./httpd-2.2.25 #生成configure ./configure --prefix=/usr/local/apache --with-included-apr --enable-so -

【Apache学习】编译安装httpd2.4 含傻瓜版自动安装脚本

学习编译安装httpd2.4,考虑到要和httpd2.2共存,所以安装httpd2.4时需要指定安装目录,考虑包之间的依赖关系. apr-1.5.0.tar.bz2 apr-util-1.5.3.tar.bz2(需要apr-1.5.0) httpd-2.4.9.tar.bz2 (需要pcre-devel.openssl-devel) 目录结构如下 [[email protected] soft]# pwd /root/soft [[email protected] soft]# tree . ├

编译安装httpd-2.2.32

环境介绍: 系统环境:CentOS6.4 所需软件包:apr-1.4.2.tar.gz.apr-util-1.4.2.tar.gz.httpd-2.2.32.tar.gz 注意:官方网站提示apr/arp-util版本要1.4(含)版本以上. 依赖包:zlib-devel # yum install zlib-devel 开发环境包组:Development Tools, Server Platform Development # yum groupinstall "Development To

编译安装LAMP(一)——编译安装httpd-2.4.4

1.解决依赖关系httpd-2.4.4需要较新版本的apr(apache portable runtime)和apr-util,因此需要事先对其进行升级.升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包.这里选择使用编译源代码的方式进行.(1) 编译安装apr # tar xf apr-1.4.6.tar.bz2 # cd apr-1.4.6 # ./configure --prefix=/usr/local/apr # make && make instal (2) 编译

编译安装httpd-2.4.4

一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级.升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包.这里选择使用编译源代码的方式进行 (1) 编译安装apr tar xf apr-1.4.6.tar.bz2 cd apr-1.4.6 ./configure --prefix=/usr/local/aprmake && make install (2) 编译安装apr-util tar xf a