How to Install Varnish 4 on CentOS 6 / CentOS 7

Varnish is an open source web accelerator typically run in front of web servers such as Apache or Nginx. It is also known as HTTP reverse proxy and designed to serve static content, such as images, stylesheets or scripts. Varnish will keep copies of pages from page revisit the same web server ( Apache or Nginx ) and re-use the cached copy for subsequent requests. This will help dynamic website such as wordpress or joomla improve in website response times and also will reduce the server load.

READ  How to Grep Multiples Lines and using Specific Keyword on Linux

Varnish is also can be downloaded from EPEL (Extra Packages for Enterprise Linux) package repositories but the new major versions will not hit EPEL and it is not necessarily up to date. The following steps will describe how we can install Varnish 4 on CentOS 6 and CentOS 7.

Install Varnish 4 on CentOS 6 :

1. Prepare varnish repository :

# rpm -Uvh http://repo.varnish-cache.org/redhat/varnish-4.0/el6/noarch/varnish-release/varnish-release-4.0-4.el6.noarch.rpm

2. Prepare EPEL repository :

# rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

3. Install Varnish :

# yum install varnish -y

4. Start varnish and make varnish start at boot :

# service varnish start
# chkconfig varnish on

Install Varnish 4 on CentOS 7 :

READ  How to Install man Pages Command on CentOS 5.7

1. Prepare EPEL repository :

# rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Or alternatively you can install by using yum command :

# sudo yum install epel-release -y

2. Install Varnish :

# sudo yum install varnish -y

3. Start varnish and make varnish start at boot :

# sudo systemctl start varnish.service
# sudo systemctl enable varnish.service

varnish-cache

Leave a Reply

Your email address will not be published. Required fields are marked *

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee