Install Varnish Cache 6.0 ( Latest) on Ubuntu 16.04 | 18.04 LTS

If you want to install Varnish cache server on Ubuntu, you can quickly fire up the terminal and run the commands sudo apt install varnish… However, doing that will not install the latest version of Varnish cache on your systems….

If you need the latest version of Varnish, you’ll have to manually compile it yourself and install…. this post shows students and new users how to manually compile and install Varnish cache 6.0 which is the latest at the time of this post on Ubuntu 16.04 | 18.04 LTS servers…

For this post, we’ll install Apache2 web server and configure it to listen on port 8080… then install Varnish and configure it to listen on port 80… Varnish will cache all requests for Apache2 pages when they are made….

To get this working, please follow the steps below:

Step 1: Install Apache2 HTTP Server

To install Apache2 on Ubuntu run the commands below….

sudo apt-get update
sudo apt-get install apache2

After installing Apache2, the commands below can be used to stop, start and enable Apache2 to always startup everytime the server boots up.

It should take a few minutes for it to install… after that Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd. To make sure that the necessary links and caches of the most recent shared libraries are found, run

sudo ldconfig

If Varnish was successfully installed, run the commands below to start it….