How To Install Varnish 4 on CentOS 7

In this tutorial I will guide, how to install Varnish 4 version on CentOS 7 / RHEL 7.Varnish is a frontend web proxy and cache, designed to improve performance for busy, dynamic web sites. By redirecting traffic to static pages whenever possible, varnish reduces the number of dynamic page calls, also reduce the load.

Add the EPEL Repository

First, we’ll install the EPEL repository:

rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Install Varnish

yum -y update
yum -y install varnish

Start Varnish

To configure varnish to start at boot, run the following command:

systemctl enable varnish

To start varnish, run the following command as root:

systemctl start varnish

To check the status of varnish, run the command as root:

systemctl status varnish

To check the running version of Varnish:

varnishd –V

By default Varnish is configured to listen on port 6081 and it need your web server to be local, or on the same server and listening on port 8080.

Configuration File Locations

Default configuration file can be found at:

/etc/varnish/default.vcl

An example configuration can be found in example.vcl:

/usr/share/doc/varnish-4.0.1/example.vcl

That’s all there is to do and it is that simple to install Varnish on CentOS 7. Hopefully that helps and do comment below sharing your thoughts and experiences.