Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to install an additional module for Varnish Cache, the Shield module.

How can I do that? I installed Varnish 3.0 from the Ubuntu repositories.

How do I get the Varnish source which the module needs to compile? Do I need to compile Varnish from source as well? Does this disable updating Varnish through the repositories?

Can someone give a step-by-step instruction?

share|improve this question
up vote 8 down vote accepted

You can get the source packages with

apt-get source varnish

It looks like the module only requires the varnish sources for the header files so you don't need to compile varnish. You should be ok to continue updating varnish from the reops although when you upgrade the main package be prepared to download the source and rebuild the module.

If you downloaded the module source to your $HOME/libvmod-shield and the varnish is in $HOME/varnish-3.0.2 then

cd $HOME/libvmod-shield
./configure VARNISHSRC=$HOME/varnish-3.0.2
sudo make install
sudo make check

or something similar should get you going.

share|improve this answer
Thanks! Very nice. – Tobe Jul 14 '12 at 18:06
I had to build the Varnish source first, then I had to also specify the module directory like ./configure VARNISHSRC=/usr/local/src/varnish-3.0.0 VMODDIR=/usr/lib/varnish/vmods – Tobe Jul 14 '12 at 18:09
@Tobe : I'm facing a similar problem. Could you please tell me how I can build safely. I fear that building would mess with the varnish, as it is already installed. Thanks – naka Oct 12 '13 at 12:46
Take a backup of your configuration-files, then you can restore Varnish from the repositories if something goes wrong. But it should be pretty safe to install. Try following Ians suggestion, other than that I can't help you. – Tobe Oct 12 '13 at 17:19

I know you asked about how to do this on Ubuntu, but this answer comes up in searches. :)

On CentOS (or other RHEL-based systems), you want to do something like this:

rpm -i ""
rpmbuild -bc /usr/src/redhat/SPECS/varnish.spec

cd libvmod-foo
./configure VARNISHSRC=/usr/src/redhat/BUILD/varnish-$VERSION
make install
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.