I will show you how to install ʻApache (httpd)in haste using the
dnf command on
CentOS8`.
Check the package to be installed (httpd
) with the following command.
dnf list | grep httpd
[root@CENTOS8 ~]# dnf list | grep httpd
centos-logos-httpd.noarch 80.5-2.el8 AppStream
httpd.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream
httpd-devel.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream
httpd-filesystem.noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream
httpd-manual.noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream
httpd-tools.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream
keycloak-httpd-client-install.noarch 0.8-7.el8 AppStream
libmicrohttpd.i686 1:0.9.59-2.el8 BaseOS
libmicrohttpd.x86_64 1:0.9.59-2.el8 BaseOS
python3-keycloak-httpd-client-install.noarch 0.8-7.el8 AppStream
[root@CENTOS8 ~]#
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-filesystem | Basic directory layout for Apache HTTP Server |
httpd-manual | httpd manual |
Httpd
and httpd-tools
are required, and httpd-devel
may be required when installing Apache and related software with ./configure
, make
, and make install
.Here we will install httpd
, httpd-tools
, httpd-devel
, httpd-manual
.
Install with the following command. Add -y
to make all confirmations yes
.
dnf install -y httpd httpd-tools httpd-devel httpd-manual
[root@CENTOS8 ~]# dnf install -y httpd httpd-tools httpd-devel httpd-manual
Final confirmation of metadata expiration: 0:01:It was held 37 hours ago on December 30, 2019 at 17:12:32.
The dependency has been resolved.
================================================================================
Package architecture
Version repository
size
================================================================================
Installing:
httpd x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 1.7 M
httpd-devel x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 216 k
httpd-manual noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 2.4 M
httpd-tools x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 102 k
Installing dependencies:
apr x86_64 1.6.3-9.el8 AppStream 125 k
apr-devel x86_64 1.6.3-9.el8 AppStream 246 k
apr-util x86_64 1.6.1-6.el8 AppStream 105 k
apr-util-devel x86_64 1.6.1-6.el8 AppStream 86 k
centos-logos-httpd
noarch 80.5-2.el8 AppStream 24 k
httpd-filesystem noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 35 k
libdb-devel x86_64 5.3.28-36.el8 AppStream 46 k
mod_http2 x86_64 1.11.3-3.module_el8.0.0+185+5908b0db AppStream 158 k
cyrus-sasl x86_64 2.1.27-0.3rc7.el8 BaseOS 96 k
cyrus-sasl-devel x86_64 2.1.27-0.3rc7.el8 BaseOS 127 k
expat-devel x86_64 2.2.5-3.el8 BaseOS 55 k
mailcap noarch 2.1.48-3.el8 BaseOS 39 k
openldap-devel x86_64 2.4.46-9.el8 BaseOS 810 k
perl-Carp noarch 1.42-396.el8 BaseOS 30 k
perl-Errno x86_64 1.28-416.el8 BaseOS 76 k
perl-Exporter noarch 5.72-396.el8 BaseOS 34 k
perl-File-Path noarch 2.15-2.el8 BaseOS 38 k
perl-IO x86_64 1.38-416.el8 BaseOS 141 k
perl-PathTools x86_64 3.74-1.el8 BaseOS 90 k
perl-Scalar-List-Utils
x86_64 3:1.49-2.el8 BaseOS 68 k
perl-Socket x86_64 4:2.027-2.el8 BaseOS 59 k
perl-Text-Tabs+Wrap
noarch 2013.0523-395.el8 BaseOS 24 k
perl-Unicode-Normalize
x86_64 1.25-396.el8 BaseOS 82 k
perl-constant noarch 1.33-396.el8 BaseOS 25 k
perl-interpreter x86_64 4:5.26.3-416.el8 BaseOS 6.3 M
perl-libs x86_64 4:5.26.3-416.el8 BaseOS 1.6 M
perl-macros x86_64 4:5.26.3-416.el8 BaseOS 72 k
perl-parent noarch 1:0.237-1.el8 BaseOS 20 k
perl-threads x86_64 1:2.21-2.el8 BaseOS 61 k
perl-threads-shared
x86_64 1.58-2.el8 BaseOS 48 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 AppStream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 AppStream 27 k
Enabling module streams:
httpd 2.4
Transaction overview
================================================================================
Installation 36 packages
Total download size: 15 M
Installed size: 41 M
The package is being downloaded:
(1/36): apr-util-1.6.1-6.el8.x86_64.rpm 65 kB/s | 105 kB 00:01
(2/36): apr-1.6.3-9.el8.x86_64.rpm 74 kB/s | 125 kB 00:01
(3/36): apr-util-bdb-1.6.1-6.el8.x86_64.rpm 113 kB/s | 25 kB 00:00
(4/36): apr-devel-1.6.3-9.el8.x86_64.rpm 118 kB/s | 246 kB 00:02
(5/36): centos-logos-httpd-80.5-2.el8.noarch.rp 237 kB/s | 24 kB 00:00
(6/36): apr-util-devel-1.6.1-6.el8.x86_64.rpm 176 kB/s | 86 kB 00:00
(7/36): apr-util-openssl-1.6.1-6.el8.x86_64.rpm 45 kB/s | 27 kB 00:00
(8/36): httpd-filesystem-2.4.37-12.module_el8.0 154 kB/s | 35 kB 00:00
(9/36): httpd-devel-2.4.37-12.module_el8.0.0+18 159 kB/s | 216 kB 00:01
(10/36): httpd-tools-2.4.37-12.module_el8.0.0+1 183 kB/s | 102 kB 00:00
(11/36): libdb-devel-5.3.28-36.el8.x86_64.rpm 136 kB/s | 46 kB 00:00
(12/36): mod_http2-1.11.3-3.module_el8.0.0+185+ 170 kB/s | 158 kB 00:00
(13/36): cyrus-sasl-2.1.27-0.3rc7.el8.x86_64.rp 137 kB/s | 96 kB 00:00
(14/36): cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86 191 kB/s | 127 kB 00:00
(15/36): expat-devel-2.2.5-3.el8.x86_64.rpm 133 kB/s | 55 kB 00:00
(16/36): mailcap-2.1.48-3.el8.noarch.rpm 163 kB/s | 39 kB 00:00
(17/36): httpd-2.4.37-12.module_el8.0.0+185+590 203 kB/s | 1.7 MB 00:08
(18/36): perl-Carp-1.42-396.el8.noarch.rpm 112 kB/s | 30 kB 00:00
(19/36): perl-Errno-1.28-416.el8.x86_64.rpm 208 kB/s | 76 kB 00:00
(20/36): perl-Exporter-5.72-396.el8.noarch.rpm 171 kB/s | 34 kB 00:00
(21/36): perl-File-Path-2.15-2.el8.noarch.rpm 179 kB/s | 38 kB 00:00
(22/36): openldap-devel-2.4.46-9.el8.x86_64.rpm 174 kB/s | 810 kB 00:04
(23/36): perl-IO-1.38-416.el8.x86_64.rpm 176 kB/s | 141 kB 00:00
(24/36): perl-PathTools-3.74-1.el8.x86_64.rpm 138 kB/s | 90 kB 00:00
(25/36): perl-Socket-2.027-2.el8.x86_64.rpm 170 kB/s | 59 kB 00:00
(26/36): perl-Text-Tabs+Wrap-2013.0523-395.el8. 132 kB/s | 24 kB 00:00
(27/36): perl-Scalar-List-Utils-1.49-2.el8.x86_ 84 kB/s | 68 kB 00:00
(28/36): perl-constant-1.33-396.el8.noarch.rpm 81 kB/s | 25 kB 00:00
(29/36): httpd-manual-2.4.37-12.module_el8.0.0+ 221 kB/s | 2.4 MB 00:10
(30/36): perl-Unicode-Normalize-1.25-396.el8.x8 187 kB/s | 82 kB 00:00
(31/36): perl-macros-5.26.3-416.el8.x86_64.rpm 123 kB/s | 72 kB 00:00
(32/36): perl-parent-0.237-1.el8.noarch.rpm 80 kB/s | 20 kB 00:00
(33/36): perl-threads-2.21-2.el8.x86_64.rpm 93 kB/s | 61 kB 00:00
(34/36): perl-threads-shared-1.58-2.el8.x86_64. 103 kB/s | 48 kB 00:00
(35/36): perl-libs-5.26.3-416.el8.x86_64.rpm 426 kB/s | 1.6 MB 00:03
(36/36): perl-interpreter-5.26.3-416.el8.x86_64 442 kB/s | 6.3 MB 00:14
--------------------------------------------------------------------------------
Total 494 kB/s | 15 MB 00:31
Performing transaction confirmation
The transaction was confirmed successfully.
Running transaction test
You have successfully tested the transaction.
Transaction is in progress
Preparation: 1/1
Installing : perl-Exporter-5.72-396.el8.noarch 1/36
Installing : perl-libs-4:5.26.3-416.el8.x86_64 2/36
Installing : perl-Carp-1.42-396.el8.noarch 3/36
Installing : apr-1.6.3-9.el8.x86_64 4/36
scriptlet running: apr-1.6.3-9.el8.x86_64 4/36
Installing : apr-util-bdb-1.6.1-6.el8.x86_64 5/36
Installing : apr-util-openssl-1.6.1-6.el8.x86_64 6/36
Installing : apr-util-1.6.1-6.el8.x86_64 7/36
scriptlet running: apr-util-1.6.1-6.el8.x86_64 7/36
Installing : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 8/36
Installing : apr-devel-1.6.3-9.el8.x86_64 9/36
Installing : httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db. 10/36
Installing : perl-macros-4:5.26.3-416.el8.x86_64 11/36
Installing : perl-parent-1:0.237-1.el8.noarch 12/36
Installing : perl-Errno-1.28-416.el8.x86_64 13/36
Installing : perl-Socket-4:2.027-2.el8.x86_64 14/36
Installing : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 15/36
Installing : perl-Unicode-Normalize-1.25-396.el8.x86_64 16/36
Installing : perl-File-Path-2.15-2.el8.noarch 17/36
Installing : perl-IO-1.38-416.el8.x86_64 18/36
Installing : perl-PathTools-3.74-1.el8.x86_64 19/36
Installing : perl-constant-1.33-396.el8.noarch 20/36
Installing : perl-threads-1:2.21-2.el8.x86_64 21/36
Installing : perl-threads-shared-1.58-2.el8.x86_64 22/36
Installing : perl-interpreter-4:5.26.3-416.el8.x86_64 23/36
Installing : mailcap-2.1.48-3.el8.noarch 24/36
Installing : expat-devel-2.2.5-3.el8.x86_64 25/36
scriptlet running: cyrus-sasl-2.1.27-0.3rc7.el8.x86_64 26/36
Installing : cyrus-sasl-2.1.27-0.3rc7.el8.x86_64 26/36
scriptlet running: cyrus-sasl-2.1.27-0.3rc7.el8.x86_64 26/36
Installing : cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64 27/36
Installing : openldap-devel-2.4.46-9.el8.x86_64 28/36
Installing : libdb-devel-5.3.28-36.el8.x86_64 29/36
Installing : apr-util-devel-1.6.1-6.el8.x86_64 30/36
scriptlet running: httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908 31/36
Installing : httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908 31/36
Installing : centos-logos-httpd-80.5-2.el8.noarch 32/36
Installing : mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86 33/36
Installing : httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64 34/36
scriptlet running: httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64 34/36
Installing : httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db. 35/36
Installing : httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db 36/36
scriptlet running: httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64 36/36
scriptlet running: httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db 36/36
Verification: apr-1.6.3-9.el8.x86_64 1/36
Verification: apr-devel-1.6.3-9.el8.x86_64 2/36
Verification: apr-util-1.6.1-6.el8.x86_64 3/36
Verification: apr-util-bdb-1.6.1-6.el8.x86_64 4/36
Verification: apr-util-devel-1.6.1-6.el8.x86_64 5/36
Verification: apr-util-openssl-1.6.1-6.el8.x86_64 6/36
Verification: centos-logos-httpd-80.5-2.el8.noarch 7/36
Verification: httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64 8/36
Verification: httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db. 9/36
Verification: httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908 10/36
Verification: httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db 11/36
Verification: httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db. 12/36
Verification: libdb-devel-5.3.28-36.el8.x86_64 13/36
Verification: mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86 14/36
Verification: cyrus-sasl-2.1.27-0.3rc7.el8.x86_64 15/36
Verification: cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64 16/36
Verification: expat-devel-2.2.5-3.el8.x86_64 17/36
Verification: mailcap-2.1.48-3.el8.noarch 18/36
Verification: openldap-devel-2.4.46-9.el8.x86_64 19/36
Verification: perl-Carp-1.42-396.el8.noarch 20/36
Verification: perl-Errno-1.28-416.el8.x86_64 21/36
Verification: perl-Exporter-5.72-396.el8.noarch 22/36
Verification: perl-File-Path-2.15-2.el8.noarch 23/36
Verification: perl-IO-1.38-416.el8.x86_64 24/36
Verification: perl-PathTools-3.74-1.el8.x86_64 25/36
Verification: perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 26/36
Verification: perl-Socket-4:2.027-2.el8.x86_64 27/36
Verification: perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 28/36
Verification: perl-Unicode-Normalize-1.25-396.el8.x86_64 29/36
Verification: perl-constant-1.33-396.el8.noarch 30/36
Verification: perl-interpreter-4:5.26.3-416.el8.x86_64 31/36
Verification: perl-libs-4:5.26.3-416.el8.x86_64 32/36
Verification: perl-macros-4:5.26.3-416.el8.x86_64 33/36
Verification: perl-parent-1:0.237-1.el8.noarch 34/36
Verification: perl-threads-1:2.21-2.el8.x86_64 35/36
Verification: perl-threads-shared-1.58-2.el8.x86_64 36/36
Installation complete:
httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64
httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64
httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db.noarch
httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
apr-1.6.3-9.el8.x86_64
apr-devel-1.6.3-9.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
apr-util-devel-1.6.1-6.el8.x86_64
centos-logos-httpd-80.5-2.el8.noarch
httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908b0db.noarch
libdb-devel-5.3.28-36.el8.x86_64
mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86_64
cyrus-sasl-2.1.27-0.3rc7.el8.x86_64
cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64
expat-devel-2.2.5-3.el8.x86_64
mailcap-2.1.48-3.el8.noarch
openldap-devel-2.4.46-9.el8.x86_64
perl-Carp-1.42-396.el8.noarch
perl-Errno-1.28-416.el8.x86_64
perl-Exporter-5.72-396.el8.noarch
perl-File-Path-2.15-2.el8.noarch
perl-IO-1.38-416.el8.x86_64
perl-PathTools-3.74-1.el8.x86_64
perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
perl-Socket-4:2.027-2.el8.x86_64
perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
perl-Unicode-Normalize-1.25-396.el8.x86_64
perl-constant-1.33-396.el8.noarch
perl-interpreter-4:5.26.3-416.el8.x86_64
perl-libs-4:5.26.3-416.el8.x86_64
perl-macros-4:5.26.3-416.el8.x86_64
perl-parent-1:0.237-1.el8.noarch
perl-threads-1:2.21-2.el8.x86_64
perl-threads-shared-1.58-2.el8.x86_64
Has completed!
[root@CENTOS8 ~]#
Make sure it is installed with the following command.
dnf list --installed | grep httpd
[root@CENTOS8 ~]# dnf list --installed | grep httpd
centos-logos-httpd.noarch 80.5-2.el8 @AppStream
httpd.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db @AppStream
httpd-devel.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db @AppStream
httpd-filesystem.noarch 2.4.37-12.module_el8.0.0+185+5908b0db @AppStream
httpd-manual.noarch 2.4.37-12.module_el8.0.0+185+5908b0db @AppStream
httpd-tools.x86_64 2.4.37-12.module_el8.0.0+185+5908b0db @AppStream
[root@CENTOS8 ~]#
Check the installation path with the following command.
which httpd
[root@CENTOS8 ~]# which httpd
/usr/sbin/httpd
[root@CENTOS8 ~]#
/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 CENTOS8
You can check the syntax of httpd.conf
with the following command.
apachectl configtest
[root@CENTOS8 ~]# apachectl configtest
Syntax OK
[root@CENTOS8 ~]#
Start Apache (httpd) with the following command.
systemctl start httpd
[root@CENTOS8 ~]# systemctl start httpd
[root@CENTOS8 ~]#
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
Set CentOS to allow external access to port 80.
firewall-cmd --add-service=http --zone=public --permanent
[root@CENTOS8 ~]# firewall-cmd --add-service=http --zone=public --permanent
success
[root@CENTOS8 ~]#
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
[root@CENTOS8 ~]# firewall-cmd --reload
success
[root@CENTOS8 ~]#
Check the firewall settings.
firewall-cmd --list-all
[root@CENTOS8 ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3
sources:
services: cockpit dhcpv6-client http ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@CENTOS8 ~]#
It is OK if http
is added to services
.
Create a test page under var / www / html
.
/var/www/html/index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<title>test</title>
</head>
<body>
<h1>test1</h1>
<h2>test2</h2>
<h3>test3</h3>
<h4>test4</h4>
</body>
</hrml>
Access the following URL from the browser of another PC.
http: // host name (or IP address) /
It is OK when the following page (test page created in 7) opens.
that's all
Recommended Posts