Skip to content
Follow
Ubuntu Linux

How to Check & Install Specific Apache Version on Ubuntu Linux

Richard
Written by
Richard
Dec 27, 2021 Updated Oct 10, 2026 4 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux

Checking and installing a specific Apache version on Ubuntu Linux is done entirely from the command line. Apache HTTP Server is free, open-source web server software. It powers a large share of the internet and can serve millions of requests per second.

Advertisement
⚡ Quick Answer

Run apache2 -v in the terminal to see your installed Apache version. To list the versions your Ubuntu repositories offer, run apt policy apache2. Ubuntu’s default repositories carry only one build per release, so installing a different upstream version means adding a third-party repository, and you should back up your Apache configuration first.

Advertisement

Knowing your Apache version matters for two reasons: security updates and compatibility. Modules, configuration syntax and third-party applications can all depend on a particular 2.4.x release. The version you get depends on your Ubuntu release, and the default changes from one release to the next. Ubuntu 20.04 LTS ships with Apache 2.4.41. Ubuntu 22.04 LTS typically ships with 2.4.52. Ubuntu 24.04 LTS, the current LTS release, ships with 2.4.58. Interim releases ship whatever was current when they were frozen, so do not assume a version from memory. Ask apt on the machine in front of you by running apt policy apache2. It shows the installed version, if any, and the candidate version your repositories would install.

One thing trips people up. Ubuntu usually backports security fixes into the version it already ships instead of moving to a newer upstream release. A server reporting 2.4.52 on Ubuntu 22.04 can therefore be fully patched. The package revision, the suffix after the upstream number, shows which Ubuntu build you have. Check that suffix before you decide an older-looking version is out of date. The same applies to 2.4.41 on 20.04 and 2.4.58 on 24.04.

This guide covers three things, all from the terminal:

  • Finding out which Apache version is installed on your server.
  • Seeing which versions your Ubuntu repositories offer.
  • Installing a different, specific version when you need one.

Before you start, you need a user account with sudo rights, because installing or changing packages requires administrator privileges. Ubuntu’s default repositories only carry the version built for your release. If you need a different upstream version, you have two realistic options, and both carry risk. Back up your Apache configuration first so you can roll back if something breaks.

Option 1: a newer 2.4.x from the Ondřej Surý PPA. If you want a newer Apache 2.4.x than your release provides, the usual method is the ppa:ondrej/apache2 PPA. It is a third-party repository, maintained by Ondřej Surý, who also maintains the PHP packages many Ubuntu admins rely on. The steps in outline:

Advertisement
  1. Back up your Apache configuration.
  2. Add ppa:ondrej/apache2 to your system's software sources.
  3. Refresh the package lists, then run apt policy apache2 again. The candidate version should now be newer than the Ubuntu default.
  4. Upgrade or install the apache2 package through apt as you normally would.
  5. Check your sites and modules after the upgrade. Restart Apache if the package did not do it for you.

Keep in mind that a PPA gives you the newest build it publishes for your Ubuntu release. It is not a catalogue of every historic version, so it will not help if you need one exact older release. Going back to the Ubuntu default after using a PPA means downgrading packages, which is fiddly. That is another reason to back up first and to test on a non-production machine.

Option 2: building from source. If you need an upstream version that is not in any repository, you can compile it from the official Apache httpd source tarball. Download it from httpd.apache.org. Do this step by step:

  1. Open the httpd.apache.org download page and pick the release you need. Older releases are kept in the archive area of the site.
  2. Download the source tarball. Download its matching signature file (ending in .asc) and, if offered, the checksum file as well.
  3. Download the KEYS file published by the Apache project and import it into GPG. This gives you the public keys of the release managers.
  4. Verify the tarball against its .asc file with GPG. You want a "Good signature" message. If you see a bad signature or a failure, delete the files and download them again. Do not build anything you cannot verify.
  5. Check the checksum against the published value as a second check.
  6. Install the compiler and build tools, plus the development libraries Apache needs, such as APR, APR-util, PCRE and OpenSSL.
  7. Unpack the tarball, then run the configure script with the options and modules you want, followed by make and make install.

A source build is separate from the apt-managed package. It will not receive Ubuntu security updates, so you are responsible for watching Apache security announcements and rebuilding when needed. It also uses its own file layout rather than the Debian-style layout under the usual Ubuntu configuration directories. Do not run it alongside the packaged Apache on the same ports. Stop and disable the packaged service first, or choose different ports. Use this method only when the repository and PPA options cannot give you the version you need.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Tags: #Windows 11

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

0 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *