How To Install varnish-redis on Debian 12

Learn how to install varnish-redis on Debian 12 with this tutorial. varnish-redis is access Redis servers from VCL

Introduction

In this tutorial we learn how to install varnish-redis on Debian 12.

What is varnish-redis

varnish-redis is:

VMOD using the synchronous hiredis library API to access Redis servers from VCL.

Highlights:

  • Full support for execution of Lua scripts (i.e. EVAL command), including optimistic automatic execution of EVALSHA commands.
  • All Redis reply data types are supported, including partial support to access to components of simple (i.e. not nested) array replies.
  • Redis pipelines are not (and won’t be) supported. Lua scripting, which is fully supported by the VMOD, it’s a much more flexible alternative to pipelines for atomic execution and minimizing latency. Pipelines are hard to use and error prone, specially when using the WATCH command.
  • Support for classic Redis deployments using multiple replicated Redis servers and for clustered deployments based on Redis Cluster.
  • Support for multiple databases and multiple Redis connections, local to each Varnish worker thread, or shared using one or more pools.
  • Support for smart command execution, selecting the destination server according with the preferred role (i.e. master or slave) and with distance and healthiness metrics collected during execution.
  • Support for Redis Sentinel, allowing automatic discovery of sick / healthy servers and changes in their roles.

There are three methods to install varnish-redis on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install varnish-redis Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install varnish-redis using apt-get by running the following command:

sudo apt-get -y install varnish-redis

Install varnish-redis Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install varnish-redis using apt by running the following command:

sudo apt -y install varnish-redis

Install varnish-redis Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install varnish-redis using aptitude by running the following command:

sudo aptitude -y install varnish-redis

How To Uninstall varnish-redis on Debian 12

To uninstall only the varnish-redis package we can use the following command:

sudo apt-get remove varnish-redis

Uninstall varnish-redis And Its Dependencies

To uninstall varnish-redis and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove varnish-redis

Remove varnish-redis Configurations and Data

To remove varnish-redis configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge varnish-redis

Remove varnish-redis configuration, data, and all of its dependencies

We can use the following command to remove varnish-redis configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge varnish-redis

Dependencies

varnish-redis have the following dependencies:

References

Summary

In this tutorial we learn how to install varnish-redis package on Debian 12 using different package management tools: apt, apt-get and aptitude.