How To Install varnish-re2 on Debian 12
Introduction
In this tutorial we learn how to install varnish-re2
on Debian 12.
What is varnish-re2
varnish-re2 is:
Varnish Module (VMOD) for access to the Google RE2 regular expression engine. Varnish VCL uses the PCRE library (Perl Compatible Regular Expressions) for its native regular expressions, which runs very efficiently for many common uses of pattern matching in VCL, as attested by years of successful use of PCRE with Varnish.
But for certain kinds of patterns, the worst-case running time of the PCRE matcher is exponential in the length of the string to be matched. The matcher uses backtracking, implemented with recursive calls to the internal match() function. In principle there is no upper bound to the possible depth of backtracking and recursion, except as imposed by the varnishd runtime parameters pcre_match_limit and pcre_match_limit_recursion; matches fail if either of these limits are met. Stack overflow caused by deep backtracking has occasionally been the subject of varnishd issues.
RE2 differs from PCRE in that it limits the syntax of patterns so that they always specify a regular language in the formally strict sense. Most notably, backreferences within a pattern are not permitted, for example (foo|bar)\1 to match foofoo and barbar, but not foobar or barfoo. See the link in SEE ALSO for the specification of RE2 syntax.
This means that an RE2 matcher runs as a finite automaton, which guarantees linear running time in the length of the matched string. There is no backtracking, and hence no risk of deep recursion or stack overflow.
There are three methods to install varnish-re2
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-re2 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-re2
using apt-get
by running the following command:
sudo apt-get -y install varnish-re2
Install varnish-re2 Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install varnish-re2
using apt
by running the following command:
sudo apt -y install varnish-re2
Install varnish-re2 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-re2
using aptitude
by running the following command:
sudo aptitude -y install varnish-re2
How To Uninstall varnish-re2 on Debian 12
To uninstall only the varnish-re2
package we can use the following command:
sudo apt-get remove varnish-re2
Uninstall varnish-re2 And Its Dependencies
To uninstall varnish-re2
and its dependencies that are no longer needed by Debian 12, we can use the command below:
sudo apt-get -y autoremove varnish-re2
Remove varnish-re2 Configurations and Data
To remove varnish-re2
configuration and data from Debian 12 we can use the following command:
sudo apt-get -y purge varnish-re2
Remove varnish-re2 configuration, data, and all of its dependencies
We can use the following command to remove varnish-re2
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge varnish-re2
Dependencies
varnish-re2 have the following dependencies:
References
Summary
In this tutorial we learn how to install varnish-re2
package on Debian 12 using different package management tools: apt
, apt-get
and aptitude
.