Installing Varnish 3 on CentOS 7
posted | about 2 minutes to read
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:
[varnish-3.0] name=Varnish 3.0 for Enterprise Linux baseurl=https://repo.varnish-cache.org/redhat/varnish-3.0/el7/$basearch enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-VARNISH
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
varnishd.pid instead of
/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.