Guides 11792 Published by

The guide explains how to upgrade Apache from the older 2.4.41 build on Ubuntu 20.04 LTS to a newer version by adding a backport PPA and installing the desired package. It begins with checking the current version, then adds Ondřej Surý’s PPA to bring in Apache 2.4.54 from Debian Buster, followed by an apt update. The tutorial shows how to pin that exact version with apt install, re‑enable modules such as ssl, proxy, and rewrite, verify configuration syntax, restart the service, and confirm it is running before testing a site. Finally, it warns that any custom modules may need recompilation against new headers and offers quick tips for ensuring all dependencies remain intact after the upgrade.



How to Upgrade Apache on Ubuntu 20.04 LTS (Step‑by‑step)

If your server’s running an old Apache build and you’re tired of the stale bug reports, this quick guide will get you a newer version without breaking your sites.

Why a fresh Apache matters

I’ve seen admins hit a “404 not found” after a clean install because the default 2.4.41 had a broken mod_proxy on their network. Upgrading gives you new security patches and better performance, but it also means the module set changes. That’s why we’ll keep an eye on modules and dependencies.

Check what you have
apache2 -v

If it prints 2.4.41 or older, you’re ready to upgrade. If you see “Apache/2.4.x (Ubuntu)”, the system package is already up‑to‑date for Ubuntu’s repositories.

Add a backport repo

The official Ubuntu repos ship Apache 2.4.41 on 20.04. To get a newer version, we’ll use the apache2 PPA from the Debian Buster repository (which ships 2.4.54).

sudo add-apt-repository ppa:ondrej/apache2 -y
sudo apt update

The “add‑apt‑repository” command pulls in a deb-src entry you can ignore unless you plan to compile from source.

Install the newer package
sudo apt install apache2=2.4.54-1~bionic+0~ppa~ondrej

If you want the latest patch level, replace the exact version with apache2* and let apt pick the newest.

Why specify the version?

Ubuntu’s dependency resolver will otherwise lock you to the repository version, which defeats the purpose. Pinning it guarantees you hit the PPA build.

Verify modules are still enabled

After a major upgrade, some modules may get disabled automatically if they’re not in the new package list.

apache2ctl -M | grep -E 'ssl|proxy|rewrite'

If you see missing modules that your sites rely on, re‑enable them:

sudo a2enmod ssl proxy rewrite

Then restart Apache to apply changes.

Test the configuration

A broken config will bring the web server down. Before restarting, run:

apachectl -t

If it reports Syntax OK, you’re safe. If not, read the error message and fix the indicated file.

Restart and check uptime
sudo systemctl restart apache2
sudo systemctl status apache2 | grep Active

You should see “active (running)”. Open one of your sites in a browser; if it loads, you’ve upgraded successfully.

Quick tip: If you’re running custom modules compiled for 2.4.41, they’ll need recompiling against the new headers. Drop them into /usr/lib/apache2/modules/ after you verify the core works.