Search

Getting started with Varnish Enterprise 6.0 Tutorial

Introduction

This tutorial shows how to do initial installation Varnish Enterprise 6.0 on Ubuntu Server 20.04 (Focal). Looking for another platform?

Prerequisites

Before you can start this tutorial, you should have:

  • A host running Ubuntu 20.04 (Focal).
  • Credentials to access the Varnish Software Ubuntu repository.

Step 1 - Repository setup

Install packages needed to set up the repository:

sudo apt-get update
sudo apt-get install apt-transport-https curl

Add the Varnish Enterprise gpg key to the keyring used by APT:

curl -L https://TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo apt-key add -

Create the file /etc/apt/sources.list.d/varnish-software.list with the following contents:

deb https://packagecloud.io/varnishplus/60/ubuntu/ focal main

Create the file /etc/apt/auth.conf with the following contents:

machine packagecloud.io/varnishplus/60
login TOKEN

Make sure the file auth.conf is not world readable:

sudo chown root:root /etc/apt/auth.conf
sudo chmod 600 /etc/apt/auth.conf

Authenticated access to multiple repositories

The order of entries in /etc/apt/auth.conf matters. If enabling authenticated access to multiple repositories, make sure to have the more specific machine names on top in /etc/apt/auth.conf. The following is an example showing how to enable multiple Varnish related repositories:

machine packagecloud.io/varnishplus/60-extra1
login TOKEN1

machine packagecloud.io/varnishplus/60-extra2
login TOKEN2

machine packagecloud.io/varnishplus/60
login TOKEN

Step 2 - Installation

Install Varnish Enterprise and VMODs:

sudo apt-get update
sudo apt-get install varnish-plus

Step 3 - Initial configuration

The configuration files for Varnish are:

  • /etc/varnish/default.vcl

    The VCL configuration file that is loaded by default when Varnish starts. In this file you can specify the location of your web servers.

  • /lib/systemd/system/varnish.service

    The systemd unit file specifying the Varnish parameters, storage engines and the VCL configuration file to load on startup. This file should not be edited but overridden according to systemd best practices.

Step 4 - Process management

Varnish is started, stopped, restarted and reloaded using the following commands:

sudo systemctl start varnish
sudo systemctl stop varnish
sudo systemctl restart varnish
sudo systemctl reload varnish

Verify if Varnish is running using the following command:

sudo systemctl status -l varnish

Next steps

Varnish Enterprise 6.0 has now been installed in Ubuntu Server 20.04 (Focal). At this point it is possible to dive in to VCL and VMODs.

VCL resources: