How do I install a newer version of Apache on CentOS 7?
I'd like to install a newer version of Apache on CentOS 7 so that I can take advantage of new features like HTTP/2, how do I do that?
1 Reply
CentOS 7 mirrors the release cycle of the Red-Hat supported Red Hat Enterprise Linux (RHEL). The benefit of this is that CentOS is very stable and has a very long support window (until 2024 for CentOS 7). The downside is that sometimes popular packages, like Apache, are older and missing more modern features.
Luckily, CentOS also follows Red-Hat in offering Software Collections. Software Collections allow you to install newer packages alongside packages from the default repositories.
To install the newest version of Apache on CentOS 7 via Software Collections, first install the centos-release-scl
package repository:
sudo yum install centos-release-scl
Then, install the newest Apache package httpd24
and enable it with the scl
command:
sudo yum install httpd24
scl enable httpd24 bash
You should then be able to use httpd24
in place of httpd
and have access to newer features:
service http24-httpd start
Note: You may have to repeat this process for additional pacakges such as PHP or OpenSSL for all of the features to work correctly.