Installez apache 2.4.46 à partir des sources sur CentOS 7

introduction

C'est l'histoire de l'installation d'apache 2.4.46 à partir des sources sur CentOS7. Parfois, j'ai essayé de l'installer à partir de la source.

environnement

# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

Installation

Télécharger la source

# cd /usr/local/src/
# curl -OL https://ftp.jaist.ac.jp/pub/apache//httpd/httpd-2.4.46.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   338  100   338    0     0    789      0 --:--:-- --:--:-- --:--:--   812
100 9143k  100 9143k    0     0  9108k      0  0:00:01  0:00:01 --:--:-- 50.1M

# ls
httpd-2.4.46.tar.gz

Déploiement

# tar zxf httpd-2.4.46.tar.gz
# ls
httpd-2.4.46  httpd-2.4.46.tar.gz

exécuter configure

# cd httpd-2.4.46/
# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

Puisqu'une erreur va se produire, on me demandera de regarder le document pour le moment, alors regardez le document

# ls
ABOUT_APACHE     ap.d          CHANGES         configure     httpd.dsp   InstallBin.dsp  LICENSE       NWGNUmakefile     ROADMAP  VERSIONING
acinclude.m4     build         CMakeLists.txt  configure.in  httpd.mak   LAYOUT          Makefile.in   os                server
Apache-apr2.dsw  BuildAll.dsp  config.layout   docs          httpd.spec  libhttpd.dep    Makefile.win  README            srclib
Apache.dsw       BuildBin.dsp  config.log      emacs-style   include     libhttpd.dsp    modules       README.cmake      support
apache_probes.d  buildconf     config.nice     httpd.dep     INSTALL     libhttpd.mak    NOTICE        README.platforms  test

Vérifiez le fichier README

# cat README
<~ Omis ~>
  Installation
  ------------

  Please see the file called INSTALL.  Platform specific notes can be
  found in README.platforms.
<~ Omis ~>

Voulez-vous dire regardez README.platforms? Essaye de réfléchir

# cat README.platforms

                          Apache HTTP Server

  Platform specific notes:
  ------------------------

================
  Darwin (OS X):
   Apache 2 relies heavily on the use of autoconf and libtool to
   provide a build environment.  Darwin provides these tools as part
   of the Developers Tools package. Under Darwin, however, GNUlibtool
   is installed as 'glibtool' to avoid conflicting with the Darwin
   'libtool' program.  Apache 2 knows about this so that's not a
   problem.

   As of OS X 10.2 (Jaguar), the bundled versions work perfectly. Partly
   this is due to the fact that /bin/sh is now 'bash' and not 'zsh' as
   well as the fact that the bundled versions are up-to-date:
   autoconf 2.52 and (g)libtool 1.4.2.

   You will note that GNU libtool should actually be installed as
   glibtool, to avoid conflict with a Darwin program of the same
   name.

   There have been some reports that autoconf 2.52 prevents Apache's
   build system from correctly handling passing multi-value envvars
   to the build system (eg: CFLAGS="-g -O3" ./configure),  causing
   errors.  Use of bash does not seem to help in this situation.  If
   this affects you, downgrading to autoconf 2.13 (which is installed
   on Darwin) will help.

   With Leopard (at least up to 10.5.2), when running configure
   you will likely see errors such as:

      rm: conftest.dSYM: is a directory

   This is a known issue and will be fixed in a later version of the
   autoconf suite. These errors can be safely ignored.

   For later versions of OS X, (10.8 and 10.9), be sure to have Xcode
   AND Xcode Command Line Tools installed. httpd will built both with
   gcc and clang.

==========
  FreeBSD:
   autoconf 2.52 creates scripts that are incompatible with the Posix
   shell implementation (/bin/sh) on FreeBSD.  Be sure to use v2.13
   of autoconf.

   Threaded MPMs are not supported on FreeBSD 4.x.  Current releases of
   FreeBSD 5.x (5.2 or later) support threaded MPMs correctly.  You must pass
   '--enable-threads=yes' to APR's configure in order to enable threads.
   Additionally, you must use libthr or libkse via libmap.conf as the default
   libc_r is still broken as of this writing.  Please consult the man page for
   libmap.conf for more details about configuring libthr or libkse.
================
  HP-UX:
   The dlopen() system call in HP-UX has problems when loading/unloading
   C++ modules. The problem can be resolved by using shl_load() instead
   of dlopen(). This is fixed in the Apache 2.0.44 release.
   To enable loading of C++ modules, the httpd binary has to be linked with
   the following libraries :

   HP-UX (11.0 / 11i):
      When using shl_load        : "cpprt0_stub.s -lcl"
      When using dlopen          : "cpprt0_stub.s -lcl -lCsup"

   HP-UX (11i version 1.5 and greater):
      When using dlopen/shl_load : "cpprt0_stub.s -lcl -lunwind"

   The cpprt0_stub.s can be downloaded from the web site :
      http://h21007.www2.hp.com/hpux-devtools/CXX/hpux-devtools.0107/0083.html

   Compile cpprt0_stub.s with the PIC option
     cc -c +z cpprt0_stub.s
       - OR -
     gcc -c -fPIC cpprt0_stub.s
================
  AIX, using the vendor C compiler with optimization:
    There is an issue with compiling server/core.c with optimization enabled
    which has been seen with C for AIX 5.0.2.3 and above.  (5.0.2.0, 5.0.2.1,
    and 5.0.2.2 have an additional problem with Apache 2.0.x, so either upgrade
    the compiler or don't use optimization in order to avoid it.)

    cc_r works fine with -O2 but xlc_r does not.  In order to use xlc_r with
    -O2, apply the patch at

    http://www.apache.org/dist/httpd/patches/apply_to_2.0.49/aix_xlc_optimization.patch

    (That patch works with many recent levels of Apache 2+.)

================
  Solaris:

    On Solaris, better performance may be achieved by using the Sun Studio
    compiler instead of gcc.  As of version 11, it is now free (registration
    required).  Download the compiler from:

    http://developers.sun.com/prodtech/cc/downloads/index.jsp

    If you use Sun Studio, the following compiler flags (CFLAGS) are
    recommended:

      -XO4 -xchip=generic

================
  Ubuntu:

    You will need to ensure that you have either libtool 1.5.6
    or 2.2.6b, or later. Expat 2.0.1 and PCRE 8.02 are also
    recommended to be installed. If building PCRE from source,
    you'll also need g++.

Je pensais que je n'avais pas écrit sur Linux, mais devrais-je inclure libtool? Et installez

# rpm -q libtool
package libtool is not installed

# yum install libtool
<~ Omis ~>
Installed:
  libtool.x86_64 0:2.4.2-22.el7_3

Dependency Installed:
  autoconf.noarch 0:2.69-11.el7         automake.noarch 0:1.13.4-3.el7          cpp.x86_64 0:4.8.5-39.el7                      gcc.x86_64 0:4.8.5-39.el7
  glibc-devel.x86_64 0:2.17-307.el7.1   glibc-headers.x86_64 0:2.17-307.el7.1   kernel-headers.x86_64 0:3.10.0-1127.19.1.el7   libmpc.x86_64 0:1.0.1-3.el7
  m4.x86_64 0:1.4.16-10.el7             mpfr.x86_64 0:3.1.1-4.el7               perl-Test-Harness.noarch 0:3.28-3.el7          perl-Thread-Queue.noarch 0:3.02-2.el7

Dependency Updated:
  glibc.x86_64 0:2.17-307.el7.1                                                   glibc-common.x86_64 0:2.17-307.el7.1

Configurer à nouveau

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

même contenu. Dois-je installer APR? Alors vérifiez le paquet

# yum search apr
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
=========================================================================== 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
pcp-pmda-haproxy.x86_64 : Performance Co-Pilot (PCP) metrics for HAProxy
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
haproxy.x86_64 : TCP/HTTP proxy and load balancer for high availability environments

  Name and summary matches only, use "search all" for everything.

Il semble y avoir. Je pense que j'ai également besoin du package de développement, alors installez-le

# yum install  apr-devel
<~ Omis ~>
Installed:
  apr-devel.x86_64 0:1.4.8-5.el7

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7

Réalisé une fois de plus

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-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.

J'y suis allé un peu. Entrez car APR-util est requis

# yum -y install apr-util
<~ Omis ~>
Installed:
  apr-util.x86_64 0:1.5.2-6.el7

Complete!

Réessayer

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-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.

Comme d'habitude. Je pense que nous avons également besoin d'un package de développement. Je pensais que c'était installé

# yum install apr-util-devel
<~ Omis ~>
Installed:
  apr-util-devel.x86_64 0:1.5.2-6.el7

Dependency Installed:
  cyrus-sasl.x86_64 0:2.1.26-23.el7           cyrus-sasl-devel.x86_64 0:2.1.26-23.el7     expat-devel.x86_64 0:2.1.0-11.el7     libdb-devel.x86_64 0:5.3.21-25.el7
  openldap-devel.x86_64 0:2.4.44-21.el7_6

Dependency Updated:
  expat.x86_64 0:2.1.0-11.el7

Complete!

Réimplémenté sans discipline

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-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... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
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/

Un peu avancé, mais on dit qu'il n'y a pas de libpcre

# yum search libpcre
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
=========================================================================== Matched: libpcre ===========================================================================
pcre.i686 : Perl-compatible regular expression library
pcre.x86_64 : Perl-compatible regular expression library
pcre2.i686 : Perl-compatible regular expression library
pcre2.x86_64 : Perl-compatible regular expression library

Error: Nothing to do

Il semble qu'il existe un package appelé pcre, alors installez-le

# yum install pcre
<~ Omis ~>
Installed:
  pcre2.x86_64 0:10.23-2.el7

Complete!

Je vais réessayer.

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-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... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
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/

Une erreur se produit au même endroit. Vérifier le paquet pcre

# yum search pcre
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
========================================================================== N/S matched: pcre ===========================================================================
pcre-devel.i686 : Development files for pcre
pcre-devel.x86_64 : Development files for pcre
pcre-static.i686 : Static library for pcre
pcre-static.x86_64 : Static library for pcre
pcre-tools.x86_64 : Auxiliary utilities for pcre
pcre2-devel.i686 : Development files for pcre2
pcre2-devel.x86_64 : Development files for pcre2
pcre2-static.i686 : Static library for pcre2
pcre2-static.x86_64 : Static library for pcre2
pcre2-tools.x86_64 : Auxiliary utilities for pcre2
pcre2-utf16.i686 : UTF-16 variant of PCRE2
pcre2-utf16.x86_64 : UTF-16 variant of PCRE2
pcre2-utf32.i686 : UTF-32 variant of PCRE2
pcre2-utf32.x86_64 : UTF-32 variant of PCRE2
pcre.i686 : Perl-compatible regular expression library
pcre.x86_64 : Perl-compatible regular expression library
pcre2.i686 : Perl-compatible regular expression library
pcre2.x86_64 : Perl-compatible regular expression library

  Name and summary matches only, use "search all" for everything.
You have new mail in /var/spool/mail/root

Avez-vous besoin d'un package de développement? Alors installez

# yum install pcre-devel
<~ Omis ~>
Installed:
  pcre-devel.x86_64 0:8.32-17.el7

Complete!

encore

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
<~ Omis ~>
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options:

    Server Version: 2.4.46
    Install prefix: /usr/local/apache2
    C compiler:     gcc -std=gnu99
    CFLAGS:           -pthread
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    LDFLAGS:
    LIBS:
    C preprocessor: gcc -E

l'a fait

make

# make
Making all in srclib
make[1]: Entering directory `/usr/local/src/httpd-2.4.46/srclib'
make[1]: Leaving directory `/usr/local/src/httpd-2.4.46/srclib'
Making all in os

<~ Omis ~>

make[4]: Leaving directory `/usr/local/src/httpd-2.4.46/modules/mappers'
make[3]: Leaving directory `/usr/local/src/httpd-2.4.46/modules/mappers'
make[2]: Leaving directory `/usr/local/src/httpd-2.4.46/modules'
make[2]: Entering directory `/usr/local/src/httpd-2.4.46/support'
make[2]: Leaving directory `/usr/local/src/httpd-2.4.46/support'

make[1]: Leaving directory `/usr/local/src/httpd-2.4.46'

l'a fait

make install

# make install
Making install in srclib
make[1]: Entering directory `/usr/local/src/httpd-2.4.46/srclib'
make[2]: Entering directory `/usr/local/src/httpd-2.4.46/srclib

<~ Omis ~>

Installing build system files
mkdir /usr/local/apache2/build
Installing man pages and online manual
mkdir /usr/local/apache2/man
mkdir /usr/local/apache2/man/man1
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: Leaving directory `/usr/local/src/httpd-2.4.46'

l'a fait.

démarrer apache

# /usr/local/apache2/bin/apachectl start

# ps axuwf |grep apache
root     29457  0.0  0.0 112812   972 pts/0    S+   06:24   0:00                      \_ grep --color=auto apache
root     29367  0.0  0.1  79164  2528 ?        Ss   06:23   0:00 /usr/local/apache2/bin/httpd
daemon   29368  0.0  0.2 368128  4268 ?        Sl   06:23   0:00  \_ /usr/local/apache2/bin/httpd
daemon   29369  0.0  0.2 368128  4268 ?        Sl   06:23   0:00  \_ /usr/local/apache2/bin/httpd
daemon   29370  0.0  0.2 368128  4268 ?        Sl   06:23   0:00  \_ /usr/local/apache2/bin/httpd

navigation sur le Web

Confirmez que cela fonctionne!

Résumé

――Sans attente, il était facile à installer.

Recommended Posts

Installez apache 2.4.46 à partir des sources sur CentOS 7
Installez samba4 à partir du code source sur CentOS8
Installez Golang sur CentOS 8
Installez Neo4j 4.1.3 sur centOS
Installez Vertica 10.0 sur CentOS 6.10
Installez PostgreSQL 12 sur Centos8
Installez Python 3 sur CentOS 7
Installez kuromoji sur CentOS7
Installez PostGIS 2.5.5 sur CentOS7
Installez jpndistrict sur CentOS 7
Installez Redmine 4.1.1 sur CentOS 7
Installation de Smokeping sur CentOS7
Installez PostgreSQL 13 sur CentOS 7.5
Construisez openssl, apache2.4, php7.4 à partir des sources sur Ubuntu-server20.04.
Installez OpenFOAM v2006 sur CentOS
Installez Jenkins sur CentOS de Docker
Installez Ruby 2.7 sur CentOS 7 (SCL)
Installez le dernier pilote matériel d'ELRepo sur CentOS
Installez Ruby 2.5 sur CentOS 7 en utilisant SCL
Remarque: installez nginx à partir du référentiel officiel sur CentOS 8 avec dnf
Installation de Java Open JDK 8 sur CentOS 7
Étapes pour installer devtoolset-6 sur CentOS 7
Installez Java 9 sur Windows 10 et CentOS 7
Installez le client de messagerie Web Rainloop sur CentOS 8
Comment installer la beta php8.0 sur CentOS8
Installez CentOS 7 sur Raspberry pi 4 modèle B
Installer Apache J Meter
Installez MariaDB (CentOS 8)
[CentOS] Installez apache-loggen
Installez NextCloud sur CentOS 7 avec Alibaba Cloud ECS
Commande pour installer nginx / PHP7 / php-fpm sur CentOS7
Installez SonarQube sur Mac et testez l'analyse des sources
Installez Java, Apache, Tomcat 9 sur EC2 (Amazon Linux 2)
Installez Gradle sur Mac
Installez Corretto 8 sur Windows
Tutoriel Maven sur CentOS 7
Installez OpenJDK sur macOS
Installez Java sur Mac
Installation de Docker sur CentOS 6
Utiliser perltidy sur CentOS 8
Installez pyqt5 sur ubuntu
Installer le wiki de documentation BookStack sur Elastic Compute Service sur CentOS 7
Essayez OpenLiteSpeed sur CentOS8
Évaluer la source Java à partir de Java
[CentOS7] Installez aws cli
Installez Docker sur Manjaro
Installez Ruby sur Ubuntu 20.04
Utilisez mod_auth_cas sur CentOS 8
Installez lombok sur SpringToolSuite4
Jetty v8 sur CentOS7
Installation d'OpenJDK sur CentOS7
Apache2 sur Ubuntu20.04 LTS