+8 votes
in Tutorials and Guides by (1.5m points)

How to install Varnish Cache on Ubuntu

1 Answer

+9 votes
by (725k points)
 
Best answer

In another article we anticipated what Varnish Cache is and what it is for and now it's time to show an installation guide for Varnish Cache in Ubuntu. This article is focused on how to install Varnish on Ubuntu but in the end I will leave some useful links for installation on CentOS and Debian.

image

How to install Varnish on Ubuntu

The easiest way to install Varnish on Ubuntu is with the command: sudo apt-get install varnish

This command has the disadvantage that the version of the official Ubuntu repositories may not be the last one , but it is usually sufficient. Even so if you are of what you want to always have the newest, I will show you how to install a more updated version.

If you need a VPS server you can visit the article on cheap VPS server ideal for practice.

Varnish installation alternative for Ubuntu 12.04

If you have an Ubuntu LTS version, you can add the official Varnish repository and install the latest stable version from it. To perform this task we follow the following steps (example valid for Ubuntu 12.04 LTS):

  1. curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
  2. echo "deb http://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" | sudo tee -a /etc/apt/sources.list
  3. sudo apt-get update
  4. sudo apt-get install varnish

Eye! I repeat that it is only available for LTS versions of Ubuntu (Ubuntu 12.04 Precise Pangolin) .

Varnish installation alternative for Ubuntu in versions: Ubuntu 10.04 Lucid Lynx, Ubuntu 12.04 Precise Pangolin, Ubuntu 12.10 Quantal Quetzal, Ubuntu 13.04 Raring Ringtail, Ubuntu 13.10 Saucy Salamander.

The steps are very simple, we execute the following commands:

  1. sudo apt-get install python-software-properties
  2. sudo add-apt-repository ppa:ondrej/varnish
  3. sudo apt-get update
  4. sudo apt-get install varnish

This method is possible thanks to the personal PPA repository of Ondřej Surý , also very famous for keeping Apache and PHP server packages updated. About a week ago, I contacted Ondřej Surý to ask him to upgrade to Varnish version 3.0.4, since version 3.0.3 was still in his repository. A few days later Ondřej Surý sent me an email informing me that it was already updated, so from Vozidea.com we thank you for your great work.

Varnish installation in Debian and CentOS.

Repositories are also available to install Varnish Cache in:

Debian : https://www.varnish-cache.org/installation/debian
CentOS : http://repo.varnish-cache.org/redhat/varnish-3.0/

Varnish installation from source code.

I've only tried to compile it on Ubuntu 12.10 without much luck, but I leave the link to the official Varnish compilation guide in case anyone needs it:

Compile Varnish from source code : https://www.varnish-cache.org/docs/trunk/installation/install.html


Most popular questions within the last 20 days

...