How to Upgrade Apache Version in CentOS, Redhat Linux

Last updated on September 21st, 2021 at 11:00 am

It is important to update Apache regularly for new features & security updates. It is very easy to upgrade Apache web server to the latest version in CentOS. Here’s how to upgrade Apache version in CentOS, Redhat linux. You can also use these steps to upgrade Apache 2.2 to 2.4 or even update Apache to latest version.

 

How to Upgrade Apache Version in CentOS, Redhat Linux

Here are the steps to upgrade Apache version in CentOS 6, 7, Redhat and other Linux systems.

 

1. Check Apache Version Number

First, open terminal and run the following command to check Apache version number

# yum info httpd
or
# httpd -v

Server version: Apache/2.4.16 (Unix)

Bonus Read : How to Enable KeepAlive in Apache

 

2. Backup Apache configuration File

Before you upgrade Apache version in CentOS, take a backup of your Apache configuration file. It is located at one of the following locations, depending on your installation

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf
$sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd-backup.conf

 

3. Install EPEL

Next you need to install EPEL repository on CentOS

# yum install -y epel-release

Bonus Read : How to Change Port Number in Apache

 

4. Enable EPEL Repository

Run the following command to enable EPEL repository for CentOS 7. You can get all CentOS 7 repos at http://mirror.centos.org/centos/7/

# cd /etc/yum.repos.d && wget http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

 

5. Upgrade Apache Version in CentOS

To update Apache in CentOS, we have to fully install the latest version of httpd (Apache server)

# yum install httpd

Bonus Read : How to Upgrade Apache Version in Ubuntu

 

6. Restart Apache Server

Open your config file to check if your config file has changed. If it has been overwritten then restore it from the backup you created in step 2. Finally, start Apache server

# service httpd start
or
# systemctl start httpd

 

That’s it! You have upgraded Apache web server version in CentOS, Redhat Linux.

Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!