Chapter 3 - The Apache httpd Web Server
Apache httpd
is the web server component; it takes HTTP requests from clients (web browsers) and replies by sending the appropriate web page back to be displayed. In this setup, the PHP module which gets wrapped into Apache takes most of the glory, though Apache is a very powerful middleware tool in its own right.
Install Apache httpd
Installation of the Apache web server is straightforward, using yum
. The name of the Apache web server package is httpd
.
apache
?" I hear you say...Well, Apache is the name of a set of projects which includes the
httpd
web server, the tomcat
application server, and many other infrastructure / middleware tools, so although Apache started out as a web server project, the web server is now just one of Apache's many projects.When people talk about "Apache," though, they most commonly do mean the web server component.
So to install httpd
, we just run yum install httpd
, either directly as root
, or via sudo
as a non-priviliged user.
[john@lamp ~]$ sudo yum install httpd [sudo] password for john: john Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centoss5.centos.org * extras: centosg4.centos.org * updates: centosh2.centos.org Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.2.15-26.el6.centos will be installed
There is a lot of output here, so we'll break it down into sections. At this stage, yum
automatically starts looking for dependencies. Here, httpd depends on:
apr
(Apache Portable Runtime), a library of C data structures and routines.apr-util
, support for XML, LDAP, database interfaces, URI parsing and moreapr-util-ldap
, LDAP support for apr-utilhttpd-tools
, the htpasswd command and supporting utilitiesmailcap
, helps programs with dealing with non-text files.
If any of these had dependencies of their own, then those would be brought in at this stage, and so on until all required packages have been identified.
I am using CentOS here; the equivalent Red Hat packages would look the same but without the ".centos
" suffix.
--> Processing Dependency: httpd-tools = 2.2.15-26.el6.centos for package: httpd-2.2.15-26.el6.centos.x86_64 --> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-26.el6.centos.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-26.el6.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-26.el6.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-26.el6.centos.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed ---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed ---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed ---> Package httpd-tools.x86_64 0:2.2.15-26.el6.centos will be installed ---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: httpd x86_64 2.2.15-26.el6.centos base 821 k Installing for dependencies: apr x86_64 1.3.9-5.el6_2 base 123 k apr-util x86_64 1.3.9-3.el6_0.1 base 87 k apr-util-ldap x86_64 1.3.9-3.el6_0.1 base 15 k httpd-tools x86_64 2.2.15-26.el6.centos base 72 k mailcap noarch 2.1.31-2.el6 base 27 k Transaction Summary ================================================================================ Install 6 Package(s) Total download size: 1.1 M Installed size: 3.6 M
Now yum
provides a summary of what will be installed, and why. The total downloaded will be 1.1 Mb, which thanks to compression will take up an additional 3.6 Mb on the server. These figures can be useful in estimating download time and diskspace requirements before starting the installation or upgrade. In this case, it's a trivial change, but it's worth knowing up-front what the impact is likely to be.
You are prompted to agree to yum
continuing with the install.
Is this ok [y/N]: y
Next, all of the packages are downloaded before yum
starts to install anything.
Downloading Packages: (1/6): apr-1.3.9-5.el6_2.x86_64.rpm | 123 kB 00:00 (2/6): apr-util-1.3.9-3.el6_0.1.x86_64.rpm | 87 kB 00:00 (3/6): apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm | 15 kB 00:00 (4/6): httpd-2.2.15-26.el6.centos.x86_64.rpm | 821 kB 00:01 (5/6): httpd-tools-2.2.15-26.el6.centos.x86_64.rpm | 72 kB 00:00 (6/6): mailcap-2.1.31-2.el6.noarch.rpm | 27 kB 00:00 -------------------------------------------------------------------------------- Total 269 kB/s | 1.1 MB 00:04
yum
comes across a problem now. It does not have any signatures to tell it what is a valid package. It proposes installing a signature from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
. This is a valid file, part of the base OS install, so that is okay. You could avoid this message by running:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
before installing the packages. We can just tell it to import the key here, though. It won't ever need to ask again about valid CentOS packages, because they will all be signed with this key.
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org> Package: centos-release-6-4.el6.centos.10.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Is this ok [y/N]: y
yum
now goes and installs the packages, and then verifies that they have been installed correctly.
Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : apr-1.3.9-5.el6_2.x86_64 1/6 Installing : apr-util-1.3.9-3.el6_0.1.x86_64 2/6 Installing : httpd-tools-2.2.15-26.el6.centos.x86_64 3/6 Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 4/6 Installing : mailcap-2.1.31-2.el6.noarch 5/6 Installing : httpd-2.2.15-26.el6.centos.x86_64 6/6 Verifying : httpd-2.2.15-26.el6.centos.x86_64 1/6 Verifying : httpd-tools-2.2.15-26.el6.centos.x86_64 2/6 Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/6 Verifying : apr-1.3.9-5.el6_2.x86_64 4/6 Verifying : mailcap-2.1.31-2.el6.noarch 5/6 Verifying : apr-util-1.3.9-3.el6_0.1.x86_64 6/6 Installed: httpd.x86_64 0:2.2.15-26.el6.centos Dependency Installed: apr.x86_64 0:1.3.9-5.el6_2 apr-util.x86_64 0:1.3.9-3.el6_0.1 apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 httpd-tools.x86_64 0:2.2.15-26.el6.centos mailcap.noarch 0:2.1.31-2.el6 Complete! [john@lamp ~]$
At last, the httpd web server is installed. This whole process took less than a minute to complete, but it is worth breaking down the individual steps because there is a lot going on in this apparently simple transaction.