How To Install Varnish 4 on CentOS 7

Varnish is a proxy and cache, or HTTP accelerator, 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, thus reducing load.

 
Step 1: Add the EPEL Repository


Varnish 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:

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


Step 2: Install Varnish


First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.

yum -y update


At this point, installing Varnish is as simple as running just one command:

yum -y install varnish


Step 3: 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 following command as root:

systemctl status varnish


Check the version of Varnish that is running:

varnishd -V


Varnish 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 Locations


A 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


To view or edit example.vcl:

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

  • 61 Users Found This Useful
Was this answer helpful?

Related Articles

How to Install and Configure ProFTPD on Ubuntu 12.04 LTS

Step 1: Install ProFTPD Warning: FTP data is insecure; traffic is not encrypted, and all...

How to Install Logwatch on CentOS 6

Logwatch is a Perl-based log management tool for analyzing, summarizing, and reporting on a...

How to Install the MongoDB PHP Driver (Extension) on CentOS 6

Step 1: Setup Environment, Install PHP Extension & Application Repository (PEAR) As a matter...

How to Upgrade MySQL 5.1 to MariaDB 10.0 on CentOS 6

Step #1: Upgrade from MySQL 5.1 to MariaDB 5.5 The proper upgrade path from MySQL 5.1 to MariaDB...

How To Install Git on Ubuntu 12.04

Installation First, you’ll follow a simple best practice: ensuring the list of available...

Powered by WHMCompleteSolution