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@crosp ~]# 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 | sudo 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 | sudo 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@crosp ~]# 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@crosp ~]# systemctl start httpd
|
The output should be similar to the following:
1 2 3 4 5 6 7 8 | [root@crosp ~]# curl localhost
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Apache HTTP Server on CentOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...
|
Finally, tell systemd to start the Apache service automatically at boot.
1 | [root@crosp ~]# systemctl enable httpd
|
That’s all, if you have any troubles please feel free to leave comments below.
Recent posts
- Mar 1, 2020 Implementing Laravel custom Auth Guard and Provider
- Feb 16, 2019 Hacking Java Applications with Byte Buddy and Decompilers
- Jan 5, 2019 Page Specific Dynamic Angular Components using Child Routes
- Oct 13, 2018 Understanding Dagger 2 Scopes Under The Hood
- Jul 21, 2018 Understanding and using Xdebug with PHPStorm and Magento remotely
Popular posts
- 139702 Views How to Install The Latest Apache Server (httpd) on Centos 7
- 101053 Views Routing network traffic through a transparent SOCKS5 proxy using DD-WRT
- 72334 Views How to Unbrick TP-Link WiFi Router WR841ND using TFTP and Wireshark
- 71666 Views Android Reverse Engineering: Debugging Smali in Smalidea
- 59137 Views Clean Architecture : Part 2 – The Clean Architecture