Installing Varnish 3 on CentOS 7

posted | about 2 minutes to read

tags: varnish tutorials system administration

Oddly, there isn’t a lot of information on installing Varnish 3 on CentOS 7. There’s well-written instructions on the official site for CentOS 5/6, but for 7, it seems like you’re stuck with Varnish 4 (from the epel-release repository), especially if you’ve searched around and found forum threads like this one.

I did some digging, though, and it turns out that there actually are packages for CentOS 7 – there just isn’t any documentation on how to install them. I played around a little and found something that worked, though. So far, I haven’t experienced any problems installing via the following:

Set up a new yum repository in /etc/yum.repos.d as follows:

name=Varnish 3.0 for Enterprise Linux

Once you have the repo in place, just install using:

yum install gcc
yum –enablerepo=varnish-3.0 –disablerepo=epel install varnish-libs varnish-libs-devel varnish

You do need to install the packages in this order, as Varnish depends on having gcc and the libraries in place.

You may need to adjust the config and point the pidfile to instead of in /etc/rc.d/init.d/varnish. If you do, remember to run systemctl daemon-reload and kill all active processes before starting the service again.

Keep in mind that Varnish 3 and 4 are radically different in terms of how you write the ACLs, so if you’re migrating back to 3 from 4, you’ll need to rewrite all your ACLs.