Update Apache 2.4 to Latest Version on Ubuntu 16.04/18.04 Server VestaCP

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
Back to top button