In addition to the basic development tools, there's a few other dependencies:

yum install ncurses-devel pcre-devel libtool python-docutils readline-devel

Download the Varnish source code:

cd /extra/src
tar zxf varnish-4.1.3.tar.gz
cd varnish-4.1.3

Configure and build it:


If you want, you can run the tests before installing:

cd bin/varnishtest
./varnishtest tests/*.vtc

Then install it:

make install

Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl.
You can start up varnish to test it out using but you must enable a backend in /usr/local/etc/varnish/default.vcl:

varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T -a

Automatic Startup
There's a number of different ways to get Varnish to start automatically (rc.d/init.d script, rc.local, xinetd). We're going to use daemontools.
If you haven't already, install daemontools.

Create a directory for the Varnish service:

mkdir -m 1755 /var/service/varnish
cd /var/service/varnish

Create the run script and make it executable:

echo '#!/bin/sh' > run
echo 'exec 2>&1' >> run
echo 'exec varnishd -F -f /usr/local/etc/varnish/default.vcl -s malloc,1G' >> run
chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/varnish /service/varnish

Confirm that the service is running:

svstat /service/varnish /service/varnish/log

Mobile Device Detection with Varnish

Configure Varnish 3 for Drupal 7

Recent Updates

  • 7 months 1 week ago
  • 7 months 1 week ago
  • 7 months 1 week ago
    php 8.x
  • 7 months 1 week ago
  • 7 months 1 week ago
    Drop Centos 5/6 stuff