How to install Varnish cache on CentOS, Ubuntu and Debian

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to install Varnish cache on CentOS, Ubuntu and Debian

I started long ago an article that stated I was using Varnish cache for one of my servers, which is true, but never caught my mind to make an article on how to install Varnish on CentOS or Ubuntu or Debian. You’ve probably noticed, but these 3 are one of the 3 OS’s on VPSs clients I’ve seen so far so this is why I’m mostly making tutorials for these 3 operating systems. Anyway, let’s get to our main topic and show you how to install Varnish cache on CentOS, Ubuntu and Debian. I’ll try to go in detail as much as possible with each one. Keep in mind, Varnish cache has been designed from ground up to be a reverse cache proxy server!

Install Varnish cache on Ubuntu, Debian

Ubuntu and debian mostly have the same process to install almost any software package, this includes varnish cache. Normally it should be present on Ubuntu, you can easily check this on both by using the command:

This should let you know if you can install varnish as it is. Else you need to get the repositories first:

This will work on both Ubuntu and Debian installations. Keep in mind however that for Debian, you will need to change wheezy to squeeze or vice versa, depending on which version you are using. To be sure which one is the distribution you need to use, you can use the command:

This will return the result similar to:

So in my case, I’m using wheezy as my Debian version. That’s it for Debian and ubuntu, its not that hard, but on Debian you need to be careful at the code name you are using for your distribution.

Install Varnish cache on CentOS

On CentOS operating system we are currently going to install it on two version, CentoOS 5 and CentoOS 6. While version 5 is getting less and less support, it is still being used a lot on the internet, hence why I’ll go through both showing you how to install it.

  • Centos 5 – run the below command to install the repository for varnish

  • Centos 6 – run the below command to install the repository for varnish

After the repository for each version is installed, you can then run the installation of varnish:

And that’s about it for installing varnish, in my next toturials I’ll go through the process of configuring it for you and showing you how to adjust the cache based on each case.

Don’t forget to subscribe and comment below if I missed anything.

Request an article ←