- These instructions are intended specifically for installing the Varnish on CentOS 7.
- I’ll be working from a Liquid Web Self Managed CentOS 7 server, and I’ll be logged in as root.
Step 1: Add the EPEL RepositoryVarnish is part of Extra Packages for Enterprise Linux (EPEL), which is a community repository of non-standard packages for the RHEL distribution. First, we’ll install the EPEL repository, for directions see How to enable EPEL repository?
Step 2: Install VarnishFirst, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.
yum -y updateAt this point, installing Varnish is as simple as running just one command:
yum -y install varnish
Step 3: Start VarnishTo configure varnish to start at boot, run the following command:
systemctl enable varnishTo start varnish, run the following command as root:
systemctl start varnishTo check the status of varnish, run the following command as root:
systemctl status varnishCheck the version of Varnish that is running:
varnishd -VVarnish is configured to listen on port 6081 by default. It expects your web server to be local, or on the same serve,r and listening on port 8080.
Step 4: Configuration File LocationsA basic and 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 For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor To view or edit example.vcl: