[LINUX] How to install Apache (httpd) on CentOS7

I will show you how to install ʻApache (httpd)in haste using theyum command on CentOS7`.

environment

1. Check Apache (httpd)

Check the package to be installed (httpd) with the following command. yum list | grep httpd

[[email protected] ~]# yum list | grep httpd
httpd.x86_64                                2.4.6-90.el7.centos        base
httpd-devel.x86_64                          2.4.6-90.el7.centos        base
httpd-manual.noarch                         2.4.6-90.el7.centos        base
httpd-tools.x86_64                          2.4.6-90.el7.centos        base
keycloak-httpd-client-install.noarch        0.8-1.el7                  base
libmicrohttpd.i686                          0.9.33-2.el7               base
libmicrohttpd.x86_64                        0.9.33-2.el7               base
libmicrohttpd-devel.i686                    0.9.33-2.el7               base
libmicrohttpd-devel.x86_64                  0.9.33-2.el7               base
libmicrohttpd-doc.noarch                    0.9.33-2.el7               base
python2-keycloak-httpd-client-install.noarch
[[email protected] ~]#

Here, the packages related to httpd are as follows.

package Contents
httpd body of httpd
httpd-tools Tools related to httpd
httpd-devel httpd development tools, modules, etc.
httpd-manual httpd manual

2. Install Apache (httpd)

Here we will install httpd, httpd-tools, httpd-devel, httpd-manual.

Install with the following command. Add -y to make all confirmations yes. yum install -y httpd httpd-tools httpd-devel httpd-manual

[[email protected] ~]# yum install -y httpd httpd-tools httpd-devel httpd-manual
Loaded plugin:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ty1.mirror.newmediaexpress.com
 * extras: ty1.mirror.newmediaexpress.com
 * updates: ty1.mirror.newmediaexpress.com
base                                                     | 3.6 kB     00:00
extras                                                   | 2.9 kB     00:00
updates                                                  | 2.9 kB     00:00
Resolving dependencies
-->Performing transaction confirmation.
--->Package httpd.x86_64 0:2.4.6-90.el7.Install centos
-->I'm dealing with dependencies: /etc/mime.packages of types: httpd-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: libaprutil-1.so.0()(64bit)Package: httpd-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: libapr-1.so.0()(64bit)Package: httpd-2.4.6-90.el7.centos.x86_64
--->Package httpd-devel.x86_64 0:2.4.6-90.el7.Install centos
-->I'm dealing with dependencies: perl >= 5.004 package: httpd-devel-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: perl(strict)Package: httpd-devel-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: apr-util-devel package: httpd-devel-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: apr-devel package: httpd-devel-2.4.6-90.el7.centos.x86_64
-->I'm dealing with dependencies: /usr/bin/perl package: httpd-devel-2.4.6-90.el7.centos.x86_64
--->Package httpd-manual.noarch 0:2.4.6-90.el7.Install centos
--->Package httpd-tools.x86_64 0:2.4.6-90.el7.Install centos
-->Performing transaction confirmation.
--->Package apr.x86_64 0:1.4.8-5.install el7
--->Package apr-devel.x86_64 0:1.4.8-5.install el7
--->Package apr-util.x86_64 0:1.5.2-6.install el7
--->Package apr-util-devel.x86_64 0:1.5.2-6.install el7
-->I'm dealing with dependencies: openldap-devel(x86-64)Package: apr-util-devel-1.5.2-6.el7.x86_64
-->I'm dealing with dependencies: libdb-devel(x86-64)Package: apr-util-devel-1.5.2-6.el7.x86_64
-->I'm dealing with dependencies: expat-devel(x86-64)Package: apr-util-devel-1.5.2-6.el7.x86_64
--->Package mailcap.noarch 0:2.1.41-2.install el7
--->Package perl.x86_64 4:5.16.3-294.el7_Install 6
-->I'm dealing with dependencies: perl-libs = 4:5.16.3-294.el7_6 packages: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Socket) >= 1.3 packages: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Scalar::Util) >= 1.10 packages: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl-macros package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl-libs package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(threads::shared)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(threads)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(constant)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Time::Local)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Time::HiRes)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Storable)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Socket)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Scalar::Util)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Pod::Simple::XHTML)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Pod::Simple::Search)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Getopt::Long)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Filter::Util::Call)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(File::Temp)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(File::Spec::Unix)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(File::Spec::Functions)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(File::Spec)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(File::Path)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Exporter)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Cwd)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: perl(Carp)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->I'm dealing with dependencies: libperl.so()(64bit)Package: 4:perl-5.16.3-294.el7_6.x86_64
-->Performing transaction confirmation.
--->Package expat-devel.x86_64 0:2.1.0-10.el7_Install 3
--->Package libdb-devel.x86_64 0:5.3.21-25.install el7
--->Package openldap-devel.x86_64 0:2.4.44-21.el7_Install 6
-->I'm dealing with dependencies: cyrus-sasl-devel(x86-64)Package: openldap-devel-2.4.44-21.el7_6.x86_64
--->Package perl-Carp.noarch 0:1.26-244.install el7
--->Package perl-Exporter.noarch 0:5.68-3.install el7
--->Package perl-File-Path.noarch 0:2.09-2.install el7
--->Package perl-File-Temp.noarch 0:0.23.01-3.install el7
--->Package perl-Filter.x86_64 0:1.49-3.install el7
--->Package perl-Getopt-Long.noarch 0:2.40-3.install el7
-->I'm dealing with dependencies: perl(Pod::Usage) >= 1.14 packages: perl-Getopt-Long-2.40-3.el7.noarch
-->I'm dealing with dependencies: perl(Text::ParseWords)Package: perl-Getopt-Long-2.40-3.el7.noarch
--->Package perl-PathTools.x86_64 0:3.40-5.install el7
--->Package perl-Pod-Simple.noarch 1:3.28-4.install el7
-->I'm dealing with dependencies: perl(Pod::Escapes) >= 1.04 package: 1:perl-Pod-Simple-3.28-4.el7.noarch
-->I'm dealing with dependencies: perl(Encode)Package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--->Package perl-Scalar-List-Utils.x86_64 0:1.27-248.install el7
--->Package perl-Socket.x86_64 0:2.010-4.install el7
--->Package perl-Storable.x86_64 0:2.45-3.install el7
--->Package perl-Time-HiRes.x86_64 4:1.9725-3.install el7
--->Package perl-Time-Local.noarch 0:1.2300-2.install el7
--->Package perl-constant.noarch 0:1.27-2.install el7
--->Package perl-libs.x86_64 4:5.16.3-294.el7_Install 6
--->Package perl-macros.x86_64 4:5.16.3-294.el7_Install 6
--->Package perl-threads.x86_64 0:1.87-4.install el7
--->Package perl-threads-shared.x86_64 0:1.43-6.install el7
-->Performing transaction confirmation.
--->Package cyrus-sasl-devel.x86_64 0:2.1.26-23.install el7
-->I'm dealing with dependencies: cyrus-sasl(x86-64) = 2.1.26-23.el7 package: cyrus-sasl-devel-2.1.26-23.el7.x86_64
--->Package perl-Encode.x86_64 0:2.51-7.install el7
--->Package perl-Pod-Escapes.noarch 1:1.04-294.el7_Install 6
--->Package perl-Pod-Usage.noarch 0:1.63-3.install el7
-->I'm dealing with dependencies: perl(Pod::Text) >= 3.15 packages: perl-Pod-Usage-1.63-3.el7.noarch
-->I'm dealing with dependencies: perl-Pod-Perldoc package: perl-Pod-Usage-1.63-3.el7.noarch
--->Package perl-Text-ParseWords.noarch 0:3.29-4.install el7
-->Performing transaction confirmation.
--->Package cyrus-sasl.x86_64 0:2.1.26-23.install el7
--->Package perl-Pod-Perldoc.noarch 0:3.20-4.install el7
-->I'm dealing with dependencies: perl(parent)Package: perl-Pod-Perldoc-3.20-4.el7.noarch
-->I'm dealing with dependencies: perl(HTTP::Tiny)Package: perl-Pod-Perldoc-3.20-4.el7.noarch
--->Package perl-podlators.noarch 0:2.5.1-3.install el7
-->Performing transaction confirmation.
--->Package perl-HTTP-Tiny.noarch 0:0.033-3.install el7
--->Package perl-parent.noarch 1:0.225-244.install el7
-->Dependency resolution finished.

Resolved the dependency

================================================================================
Package architecture
Version repository
capacity
================================================================================
During installation:
 httpd                      x86_64     2.4.6-90.el7.centos       base     2.7 M
 httpd-devel                x86_64     2.4.6-90.el7.centos       base     197 k
 httpd-manual               noarch     2.4.6-90.el7.centos       base     1.3 M
 httpd-tools                x86_64     2.4.6-90.el7.centos       base      91 k
Dependency related installation:
 apr                        x86_64     1.4.8-5.el7               base     103 k
 apr-devel                  x86_64     1.4.8-5.el7               base     188 k
 apr-util                   x86_64     1.5.2-6.el7               base      92 k
 apr-util-devel             x86_64     1.5.2-6.el7               base      76 k
 cyrus-sasl                 x86_64     2.1.26-23.el7             base      88 k
 cyrus-sasl-devel           x86_64     2.1.26-23.el7             base     310 k
 expat-devel                x86_64     2.1.0-10.el7_3            base      57 k
 libdb-devel                x86_64     5.3.21-25.el7             base      39 k
 mailcap                    noarch     2.1.41-2.el7              base      31 k
 openldap-devel             x86_64     2.4.44-21.el7_6           base     804 k
 perl                       x86_64     4:5.16.3-294.el7_6        base     8.0 M
 perl-Carp                  noarch     1.26-244.el7              base      19 k
 perl-Encode                x86_64     2.51-7.el7                base     1.5 M
 perl-Exporter              noarch     5.68-3.el7                base      28 k
 perl-File-Path             noarch     2.09-2.el7                base      26 k
 perl-File-Temp             noarch     0.23.01-3.el7             base      56 k
 perl-Filter                x86_64     1.49-3.el7                base      76 k
 perl-Getopt-Long           noarch     2.40-3.el7                base      56 k
 perl-HTTP-Tiny             noarch     0.033-3.el7               base      38 k
 perl-PathTools             x86_64     3.40-5.el7                base      82 k
 perl-Pod-Escapes           noarch     1:1.04-294.el7_6          base      51 k
 perl-Pod-Perldoc           noarch     3.20-4.el7                base      87 k
 perl-Pod-Simple            noarch     1:3.28-4.el7              base     216 k
 perl-Pod-Usage             noarch     1.63-3.el7                base      27 k
 perl-Scalar-List-Utils     x86_64     1.27-248.el7              base      36 k
 perl-Socket                x86_64     2.010-4.el7               base      49 k
 perl-Storable              x86_64     2.45-3.el7                base      77 k
 perl-Text-ParseWords       noarch     3.29-4.el7                base      14 k
 perl-Time-HiRes            x86_64     4:1.9725-3.el7            base      45 k
 perl-Time-Local            noarch     1.2300-2.el7              base      24 k
 perl-constant              noarch     1.27-2.el7                base      19 k
 perl-libs                  x86_64     4:5.16.3-294.el7_6        base     688 k
 perl-macros                x86_64     4:5.16.3-294.el7_6        base      44 k
 perl-parent                noarch     1:0.225-244.el7           base      12 k
 perl-podlators             noarch     2.5.1-3.el7               base     112 k
 perl-threads               x86_64     1.87-4.el7                base      49 k
 perl-threads-shared        x86_64     1.43-6.el7                base      39 k

Transaction summary
================================================================================
Installation 4 packages(+37 dependency packages)

Total download capacity: 17 M
Installation capacity: 59 M
Downloading packages:
(1/41): apr-util-1.5.2-6.el7.x86_64.rpm                    |  92 kB   00:00
(2/41): apr-util-devel-1.5.2-6.el7.x86_64.rpm              |  76 kB   00:00
(3/41): apr-devel-1.4.8-5.el7.x86_64.rpm                   | 188 kB   00:00
(4/41): expat-devel-2.1.0-10.el7_3.x86_64.rpm              |  57 kB   00:00
(5/41): cyrus-sasl-devel-2.1.26-23.el7.x86_64.rpm          | 310 kB   00:00
(6/41): cyrus-sasl-2.1.26-23.el7.x86_64.rpm                |  88 kB   00:01
(7/41): apr-1.4.8-5.el7.x86_64.rpm                         | 103 kB   00:01
(8/41): libdb-devel-5.3.21-25.el7.x86_64.rpm               |  39 kB   00:00
(9/41): httpd-tools-2.4.6-90.el7.centos.x86_64.rpm         |  91 kB   00:00
(10/41): mailcap-2.1.41-2.el7.noarch.rpm                   |  31 kB   00:00
(11/41): httpd-devel-2.4.6-90.el7.centos.x86_64.rpm        | 197 kB   00:04
(12/41): perl-Carp-1.26-244.el7.noarch.rpm                 |  19 kB   00:00
(13/41): openldap-devel-2.4.44-21.el7_6.x86_64.rpm         | 804 kB   00:09
(14/41): httpd-manual-2.4.6-90.el7.centos.noarch.rpm       | 1.3 MB   00:11
(15/41): perl-Exporter-5.68-3.el7.noarch.rpm               |  28 kB   00:00
(16/41): perl-File-Path-2.09-2.el7.noarch.rpm              |  26 kB   00:00
(17/41): perl-File-Temp-0.23.01-3.el7.noarch.rpm           |  56 kB   00:00
(18/41): perl-Getopt-Long-2.40-3.el7.noarch.rpm            |  56 kB   00:00
(19/41): perl-Filter-1.49-3.el7.x86_64.rpm                 |  76 kB   00:01
(20/41): perl-PathTools-3.40-5.el7.x86_64.rpm              |  82 kB   00:00
(21/41): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm             |  38 kB   00:00
(22/41): perl-Encode-2.51-7.el7.x86_64.rpm                 | 1.5 MB   00:09
(23/41): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm        |  51 kB   00:00
(24/41): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm            |  87 kB   00:00
(25/41): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm    |  36 kB   00:00
(26/41): perl-Pod-Usage-1.63-3.el7.noarch.rpm              |  27 kB   00:00
(27/41): perl-Pod-Simple-3.28-4.el7.noarch.rpm             | 216 kB   00:02
(28/41): perl-Storable-2.45-3.el7.x86_64.rpm               |  77 kB   00:00
(29/41): perl-Socket-2.010-4.el7.x86_64.rpm                |  49 kB   00:01
(30/41): perl-Text-ParseWords-3.29-4.el7.noarch.rpm        |  14 kB   00:00
(31/41): perl-constant-1.27-2.el7.noarch.rpm               |  19 kB   00:00
(32/41): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm           |  45 kB   00:00
(33/41): perl-Time-Local-1.2300-2.el7.noarch.rpm           |  24 kB   00:01
(34/41): perl-parent-0.225-244.el7.noarch.rpm              |  12 kB   00:00
(35/41): perl-macros-5.16.3-294.el7_6.x86_64.rpm           |  44 kB   00:01
(36/41): perl-threads-1.87-4.el7.x86_64.rpm                |  49 kB   00:01
(37/41): perl-podlators-2.5.1-3.el7.noarch.rpm             | 112 kB   00:02
(38/41): perl-threads-shared-1.43-6.el7.x86_64.rpm         |  39 kB   00:00
(39/41): perl-libs-5.16.3-294.el7_6.x86_64.rpm             | 688 kB   00:04
(40/41): httpd-2.4.6-90.el7.centos.x86_64.rpm              | 2.7 MB   00:23
(41/41): perl-5.16.3-294.el7_6.x86_64.rpm                  | 8.0 MB   00:29
--------------------------------------------------------------------------------
Total 559 kB/s |  17 MB  00:31
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
During installation: apr-1.4.8-5.el7.x86_64                         1/41
During installation: apr-util-1.5.2-6.el7.x86_64                    2/41
During installation: apr-devel-1.4.8-5.el7.x86_64                   3/41
During installation: httpd-tools-2.4.6-90.el7.centos.x86_64         4/41
During installation: 1:perl-parent-0.225-244.el7.noarch             5/41
During installation: perl-HTTP-Tiny-0.033-3.el7.noarch              6/41
During installation: perl-podlators-2.5.1-3.el7.noarch              7/41
During installation: perl-Pod-Perldoc-3.20-4.el7.noarch             8/41
During installation: 1:perl-Pod-Escapes-1.04-294.el7_6.noarch       9/41
During installation: perl-Encode-2.51-7.el7.x86_64                 10/41
During installation: perl-Text-ParseWords-3.29-4.el7.noarch        11/41
During installation: perl-Pod-Usage-1.63-3.el7.noarch              12/41
During installation: 4:perl-libs-5.16.3-294.el7_6.x86_64           13/41
During installation: 4:perl-macros-5.16.3-294.el7_6.x86_64         14/41
During installation: 4:perl-Time-HiRes-1.9725-3.el7.x86_64         15/41
During installation: perl-Exporter-5.68-3.el7.noarch               16/41
During installation: perl-constant-1.27-2.el7.noarch               17/41
During installation: perl-Time-Local-1.2300-2.el7.noarch           18/41
During installation: perl-Socket-2.010-4.el7.x86_64                19/41
During installation: perl-Carp-1.26-244.el7.noarch                 20/41
During installation: perl-Storable-2.45-3.el7.x86_64               21/41
During installation: perl-PathTools-3.40-5.el7.x86_64              22/41
During installation: perl-Scalar-List-Utils-1.27-248.el7.x86_64    23/41
During installation: 1:perl-Pod-Simple-3.28-4.el7.noarch           24/41
During installation: perl-File-Temp-0.23.01-3.el7.noarch           25/41
During installation: perl-File-Path-2.09-2.el7.noarch              26/41
During installation: perl-threads-shared-1.43-6.el7.x86_64         27/41
During installation: perl-threads-1.87-4.el7.x86_64                28/41
During installation: perl-Filter-1.49-3.el7.x86_64                 29/41
During installation: perl-Getopt-Long-2.40-3.el7.noarch            30/41
During installation: 4:perl-5.16.3-294.el7_6.x86_64                31/41
During installation: libdb-devel-5.3.21-25.el7.x86_64              32/41
During installation: cyrus-sasl-2.1.26-23.el7.x86_64               33/41
During installation: cyrus-sasl-devel-2.1.26-23.el7.x86_64         34/41
During installation: openldap-devel-2.4.44-21.el7_6.x86_64         35/41
During installation: expat-devel-2.1.0-10.el7_3.x86_64             36/41
During installation: apr-util-devel-1.5.2-6.el7.x86_64             37/41
During installation: mailcap-2.1.41-2.el7.noarch                   38/41
During installation: httpd-2.4.6-90.el7.centos.x86_64              39/41
During installation: httpd-devel-2.4.6-90.el7.centos.x86_64        40/41
During installation: httpd-manual-2.4.6-90.el7.centos.noarch       41/41
During verification: perl-HTTP-Tiny-0.033-3.el7.noarch              1/41
During verification: mailcap-2.1.41-2.el7.noarch                    2/41
During verification: httpd-tools-2.4.6-90.el7.centos.x86_64         3/41
During verification: perl-threads-shared-1.43-6.el7.x86_64          4/41
During verification: 4:perl-Time-HiRes-1.9725-3.el7.x86_64          5/41
During verification: 1:perl-Pod-Escapes-1.04-294.el7_6.noarch       6/41
During verification: httpd-2.4.6-90.el7.centos.x86_64               7/41
During verification: perl-Exporter-5.68-3.el7.noarch                8/41
During verification: perl-constant-1.27-2.el7.noarch                9/41
During verification: perl-PathTools-3.40-5.el7.x86_64              10/41
During verification: apr-devel-1.4.8-5.el7.x86_64                  11/41
During verification: expat-devel-2.1.0-10.el7_3.x86_64             12/41
During verification: 1:perl-parent-0.225-244.el7.noarch            13/41
During verification: 4:perl-libs-5.16.3-294.el7_6.x86_64           14/41
During verification: perl-File-Temp-0.23.01-3.el7.noarch           15/41
During verification: 1:perl-Pod-Simple-3.28-4.el7.noarch           16/41
During verification: perl-Time-Local-1.2300-2.el7.noarch           17/41
During verification: openldap-devel-2.4.44-21.el7_6.x86_64         18/41
During verification: cyrus-sasl-devel-2.1.26-23.el7.x86_64         19/41
During verification: 4:perl-macros-5.16.3-294.el7_6.x86_64         20/41
During verification: perl-Socket-2.010-4.el7.x86_64                21/41
During verification: cyrus-sasl-2.1.26-23.el7.x86_64               22/41
During verification: perl-Carp-1.26-244.el7.noarch                 23/41
During verification: apr-util-1.5.2-6.el7.x86_64                   24/41
During verification: perl-Storable-2.45-3.el7.x86_64               25/41
During verification: perl-Scalar-List-Utils-1.27-248.el7.x86_64    26/41
During verification: perl-Pod-Usage-1.63-3.el7.noarch              27/41
During verification: perl-Encode-2.51-7.el7.x86_64                 28/41
During verification: perl-Pod-Perldoc-3.20-4.el7.noarch            29/41
During verification: perl-podlators-2.5.1-3.el7.noarch             30/41
During verification: apr-1.4.8-5.el7.x86_64                        31/41
During verification: httpd-devel-2.4.6-90.el7.centos.x86_64        32/41
During verification: perl-File-Path-2.09-2.el7.noarch              33/41
During verification: apr-util-devel-1.5.2-6.el7.x86_64             34/41
During verification: perl-threads-1.87-4.el7.x86_64                35/41
During verification: libdb-devel-5.3.21-25.el7.x86_64              36/41
During verification: perl-Filter-1.49-3.el7.x86_64                 37/41
During verification: perl-Getopt-Long-2.40-3.el7.noarch            38/41
During verification: perl-Text-ParseWords-3.29-4.el7.noarch        39/41
During verification: 4:perl-5.16.3-294.el7_6.x86_64                40/41
During verification: httpd-manual-2.4.6-90.el7.centos.noarch       41/41

Installation:
  httpd.x86_64 0:2.4.6-90.el7.centos
  httpd-devel.x86_64 0:2.4.6-90.el7.centos
  httpd-manual.noarch 0:2.4.6-90.el7.centos
  httpd-tools.x86_64 0:2.4.6-90.el7.centos

I have installed dependency related:
  apr.x86_64 0:1.4.8-5.el7
  apr-devel.x86_64 0:1.4.8-5.el7
  apr-util.x86_64 0:1.5.2-6.el7
  apr-util-devel.x86_64 0:1.5.2-6.el7
  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-10.el7_3
  libdb-devel.x86_64 0:5.3.21-25.el7
  mailcap.noarch 0:2.1.41-2.el7
  openldap-devel.x86_64 0:2.4.44-21.el7_6
  perl.x86_64 4:5.16.3-294.el7_6
  perl-Carp.noarch 0:1.26-244.el7
  perl-Encode.x86_64 0:2.51-7.el7
  perl-Exporter.noarch 0:5.68-3.el7
  perl-File-Path.noarch 0:2.09-2.el7
  perl-File-Temp.noarch 0:0.23.01-3.el7
  perl-Filter.x86_64 0:1.49-3.el7
  perl-Getopt-Long.noarch 0:2.40-3.el7
  perl-HTTP-Tiny.noarch 0:0.033-3.el7
  perl-PathTools.x86_64 0:3.40-5.el7
  perl-Pod-Escapes.noarch 1:1.04-294.el7_6
  perl-Pod-Perldoc.noarch 0:3.20-4.el7
  perl-Pod-Simple.noarch 1:3.28-4.el7
  perl-Pod-Usage.noarch 0:1.63-3.el7
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
  perl-Socket.x86_64 0:2.010-4.el7
  perl-Storable.x86_64 0:2.45-3.el7
  perl-Text-ParseWords.noarch 0:3.29-4.el7
  perl-Time-HiRes.x86_64 4:1.9725-3.el7
  perl-Time-Local.noarch 0:1.2300-2.el7
  perl-constant.noarch 0:1.27-2.el7
  perl-libs.x86_64 4:5.16.3-294.el7_6
  perl-macros.x86_64 4:5.16.3-294.el7_6
  perl-parent.noarch 1:0.225-244.el7
  perl-podlators.noarch 0:2.5.1-3.el7
  perl-threads.x86_64 0:1.87-4.el7
  perl-threads-shared.x86_64 0:1.43-6.el7

Has completed!
[[email protected] ~]#

3. Confirmation of installation

Make sure it is installed with the following command. yum list installed | grep httpd

[[email protected] ~]# yum list installed | grep httpd
httpd.x86_64                            2.4.6-90.el7.centos            @base
httpd-devel.x86_64                      2.4.6-90.el7.centos            @base
httpd-manual.noarch                     2.4.6-90.el7.centos            @base
httpd-tools.x86_64                      2.4.6-90.el7.centos            @base
[[email protected] ~]#

Check the installation path with the following command. which httpd

[[email protected] ~]# which httpd
/usr/sbin/httpd
[[email protected] ~]#

4. Check the configuration file

/etc/httpd/conf/httpd.conf is the Apache (httpd) configuration file. Please refer to the manual for the details of the setting.

The manual is stored in / usr / share / httpd / manual and can be viewed by opening ʻindex.html`.

The manual (Japanese version) on the official page is as follows. Apache HTTP Server Version 2.4 Document-Apache HTTP Server Version 2.4

Only the following parts have been changed here.

/etc/httpd/conf/httpd.conf


- #ServerName www.example.com:80
+ ServerName CentOS7

You can check the syntax of httpd.conf with the following command. apachectl configtest

[[email protected] conf]# apachectl configtest
Syntax OK
[[email protected] conf]#

5. Start Apache (httpd)

Start Apache (httpd) with the following command. systemctl start httpd

[[email protected] ~]# systemctl start httpd
[[email protected] ~]#

The httpd Unit definition file'httpd.service' is located below. /usr/lib/systemd/system/httpd.service

To stop it, use the following command. systemctl stop httpd

6. CentOS firewall settings

Set CentOS to allow external access to port 80.

firewall-cmd --add-service=http --zone=public --permanent

[[email protected] ~]# firewall-cmd --add-service=http --zone=public --permanent
success
[[email protected] ~]#

The http.xml in the --add-service = http part of the above command is defined below. http.xml defines that http is the `80'port of the'tcp' protocol.

/usr/lib/firewalld/services/http.xml


<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>WWW (HTTP)</short>
  <description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
  <port protocol="tcp" port="80"/>
</service>

Reflects the firewall settings. firewall-cmd --reload

[[email protected] ~]# firewall-cmd --reload
success
[[email protected] ~]#

Check the firewall settings. firewall-cmd --list-all

[[email protected] ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources:
  services: dhcpv6-client http ssh
  ports: 8888/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[[email protected] ~]#

It is OK if http is added to services.

7. Check with a browser from another PC

Access the following URL from the browser of another PC.

http: // host name (or IP address) /

It is OK when the following page opens. httpd01.png

that's all

Recommended Posts

How to install Apache (httpd) on CentOS7
How to install Apache (httpd) on CentOS8
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
How to install Maven on CentOS
How to install Eclipse GlassFish 5.1.0 on CentOS 7
Steps to install MySQL 8.0 on CentOS 8.1
How to install mysql-connector-python on mac
Steps to install VirtualBox on CentOS
How to install graph-tool on macOS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install Go on Ubuntu
How to install music 21 on windows
How to integrate Apache httpd 2.4 and Tomcat 9 on Cent OS 8
How to install aws-session-manager-plugin on Manajro Linux
How to install drobertadams / toggl-cli on Mac
[Kivy] How to install Kivy on Windows [Python]
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to switch mouse operations on CentOS
How to install richzhang / colorization on Windows 10
How to update security on CentOS Linux 8
How to install php7.4 on Linux (Ubuntu)
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
How to install python3 with docker centos
Install Faiss on CentOS 7
How to install Python
How to install pip
How to install archlinux
Install numba on CentOS 7.2
Install Python3.4 on CentOS 6.6
How to install BayesOpt
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
How to install Nbextensions
How to install Prover9
Install awscli on centos7
Install Chainer on CentOS 6.7
[2020 version] How to install Python3 on AWS EC2
How to install OpenGM on OSX with macports
How to install Camunda Modeler on Manjaro Linux
[Python] How to install OpenCV on Anaconda [Windows]
How to install / verify graphviz on anaconda / windows10
How to install Python [Windows]
How to embed mod_wsgi into Apache on Python Windows
Tabpy 1.0 (2020-01 version) How to install
Install ImageMagick-6.2.x series on CentOS7.7
How to install Linux on a 32bit UEFI PC
Install Python 3.8 on CentOS 7 (SCL)
Apache installation fails on CentOS 8.2
How to install caffe on OS X with macports
How to register on pypi
[Note] How to give sudo authority to user on CentOS
Install Chrome on CentOS 7 series
[AWS EC2] How to install Maven on Amazon Linux 2
Install Python 3.8 on CentOS 8 (AppStream)
How to install Pelican blog
How to install git on Linux such as EC2