Upgrade httpd (apache) service in Centos 7 os

Published on January 25, 2021 at 3:41:31 AM GMT+8 by Administrator

Guide to upgrade httpd services on Centos 7 operating system


Upgrade httpd (apache) service in Centos 7 os

Apache is the most widely used web server software for serving web applications and it is essential part of any server. To have the latest version installed, means that your software package will probably have more new features and known bugs fixes.

Introduction

In this tutorial I am going to describe simple steps to install the latest Apache (httpd) version on your Centos 7 system.

By default Centos 7 has few predefined repositories for installing packages, but unfortunately a lot of packages are out of date there.

Step 1 — Find out the Apache version in default repos

In order to check the current version of httpd package available in repositories – type the following command:

1
yum info httpd

If you have default installation, you will most likely see similar output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@mxmb ~]# yum info httpd
Loaded plugins: fastestmirror
epel/x86_64/metalink                                     |  19 kB     00:00
epel                                                     | 4.3 kB     00:00
(1/3): epel/x86_64/group_gz                                | 170 kB   00:00
(2/3): epel/x86_64/primary_db                              | 4.6 MB   00:00
(3/3): epel/x86_64/updateinfo                              | 780 kB   00:00
Loading mirror speeds from cached hostfile
 * base: mirrors.ircam.fr
 * epel: mirrors.ircam.fr
 * extras: centos.mirror.fr.planethoster.net
 * updates: centos.mirror.fr.planethoster.net
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 45.el7.centos.4
Size        : 2.7 M
Repo        : updates/7/x86_64
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

As you can see from the output above, there is only 2.4.6 Apache version available in default repos.

Please note:

Centos uses Security Backporting Practice in order to apply most recent fixes to older versions of a software package, as a result it doesn’t mean that an older version provided by default repositories is vulnerable. But in my case I didn’t have a required update.

You can see a changelog using these commands :

1
2
yum install yum-changelog
yum changelog httpd

Step 2 — Set up CodeIT repositories

There is a great custom repo created by these guys CodeIT It provides latest versions of web servers (Apache & Nginx).

Before setting up the CodeIT repository first of all you need to enable the EPEL. It satisfies some dependencies required by the CodeIT repo.

1
 yum install -y epel-release

Finally enable the CodeIT repository.

1
cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

Then verify the Apache package version again and you should see something like that.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[root@mxmb ~]# yum info httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.crazyfrogs.org
 * epel: mirror.23media.de
 * extras: mirrors.ircam.fr
 * updates: centos.mirror.fr.planethoster.net
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.25
Release     : 3.el7.codeit
Size        : 1.4 M
Repo        : CodeIT/x86_64
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

Step 3 — Install the Apache web-server

Now you should have everything set up to install the latest Apache package.

1
yum install httpd

Once Apache is installed, let’s start it and test whether it is working.

1
[root@mxmb ~]# systemctl start httpd

Finally, tell systemd to start the Apache service automatically at boot.

1
[root@mxmb ~]# systemctl enable httpd

That’s all, if you have any troubles please feel free to leave comments below.