Update Apache 2.4 to Latest Version on Ubuntu 16.04 Server VestaCP

by Sandy

In this tutorial we’ll be upgrading apache2 on Ubuntu 16.04 (also works with previous versions of Ubuntu) server to latest version, it is safe to upgrade & latest version of Apache includes many bug fixes and gain in performance also. It is recommended to update if you always like to have latest version for stability and feature updates.

Step 1 :

First we need to install this package :

apt-get install software-properties-common

Step 2 :

Adding this apache2 PPA by ondrej to your system

add-apt-repository ppa:ondrej/apache2
apt-get update

If you get this error (highlighted as red):

W: GPG error: http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
W: The repository 'http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Then simply run this command and don’t forget to replace the NO_PUBKEY highlighted in red with your PUBKEY :

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5267A6C

Then again run :

apt-get update

You’ll see the error is gone now.

Step 3 :

Backup current apache config :

cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak1

Then run this command finally to upgrade apache2 to latest version :

apt-get update
apt-get upgrade

Select NO when this Prompt screens appears :

Configuration file '/etc/apache2/apache2.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** apache2.conf (Y/I/N/O/D/Z) [default=N] ? N
Configuration file '/etc/logrotate.d/apache2'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** apache2 (Y/I/N/O/D/Z) [default=N] ? N

DONE, you’ve now latest version of Apache 2.4 is installed on your server, to check the version of Apache run this command :

apache2 -v

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

Donate with Paytm :

md-donate

You may also like

9
Leave a Reply

avatar
7 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
SandyIanMarc SchröderPreetpal SinghZahid Ullah Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Charles Warren III
Guest
Charles Warren III

Very nice tutorial, any idea on a release date for Apache version 2.4.35 on this distro?

anony
Guest
anony

i don’t think you want to run apt-get dist-upgrade, it will upgrade the entire OS from 16 to 18.

sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install apache2
sudo service apache2 restart

foofel
Guest
foofel

thanks bro

Zahid Ullah
Guest

nice very helpful

Preetpal Singh
Guest
Preetpal Singh

Just run sudo apt-get –only-upgrade install apache2
Don’t need to run dis-upgrade it will upgrade the os version and other packages

Marc Schröder
Guest

Hi,

I have Debian 9.9 and Apache 2.4.25 It does not work for me! It is always shown to me that the latest version is installed.

Ian
Guest
Ian

This is a very useful article. Many thanks for taking the time to write it.

I have used it to upgrade Apache on some Linux servers.

But I have tried to upgrade from Apache 2.4.34 to the latest version of Apache 2.4.41 but I get a message saying that the server is already running the latest version of Apache.

Do you know how I can fix this?