Apache Version: How to Upgrade Beyond Ubuntu’s Standard Repository?

We’ll use the Ondřej Surý PPA (Personal Package Archive). If you think it is not safe, do not use it. The choice is entirely yours. You can also check out this discussion.

1. If you’re trying this on a virtual machine first — which is a good idea — create a snapshot. That way, you can easily roll back changes on the VM.

2. Check your current Apache version:

apache2 -v

On Ubuntu 22.04 I’ve got:

3. Check enabled Apache modules:

apache2ctl -M

4. Add the PPA (Personal Package Archive):

sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/apache2 -y

and update the package list:

sudo apt update

5. Upgrade Apache from the PPA:

Make a copy of your current Apache2 configuration file /etc/apache2/apache2.conf. Then run:

sudo apt upgrade apache2

Please notice:

1. You can consider upgrading all Ubuntu packages, not just apache2:

sudo apt upgrade

2. If Apache isn’t installed on your server, you’ll need to install it instead of upgrading, of course:

sudo apt install apache2

6. Restart Apache:

service apache2 restart

7. Check the Apache version:

apache2 -v

Now, on Ubuntu 22.04 I’m getting:

Conclusion

Thank you for reading to the end.

If you have any questions or thoughts to share, feel free to ask in the comments section below—I’d be happy to help!

Sergei Korolev
Sergei Korolev
Web developer and the author of all articles on this site. With over 26 years of programming experience, he has specialized in web programming for more than 20 years. He is a Zend Certified Engineer in PHP 5.3 and holds several additional certifications in programming, SEO, web design, UX design, digital marketing, copywriting. You can see his resume here. He is available for remote projects at a rate of $60 USD per hour. You can contact him via this contact form. He currently lives in Belgrade, Serbia.

Leave a Reply

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