How to install a Varnish module on Ubuntu

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?


Solution 1:

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
make 
sudo make install
sudo make check

or something similar should get you going.

Solution 2:

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 "http://example.com/varnish.src.rpm"
rpmbuild -bc /usr/src/redhat/SPECS/varnish.spec

cd libvmod-foo
./configure VARNISHSRC=/usr/src/redhat/BUILD/varnish-$VERSION
make
make install