Pages

Subscribe:

Thursday, December 25, 2014

Varnish Installation on Centos 7

In this post we are going to install varnish cache on Centos Linux 7.

We are going to install Varnish Cache 4 on the Centos Linux 7 i.e. 64 bit of architecture using the yum. 

Follow the following steps to install the varnish cache on your server running Centos 7 Linux.


Step 1:- Install the following rpm from the varnish-cache repo 

 yum install https://repo.varnish-cache.org/redhat/varnish-4.0/el7/x86_64/varnish/varnish-debuginfo-4.0.2-1.el7.centos.x86_64.rpm  

 yum install https://repo.varnish-cache.org/redhat/varnish-4.0/el7/x86_64/varnish/varnish-libs-4.0.2-1.el7.centos.x86_64.rpm  

 yum install https://repo.varnish-cache.org/redhat/varnish-4.0/el7/x86_64/varnish/varnish-libs-devel-4.0.2-1.el7.centos.x86_64.rpm  

 yum install https://repo.varnish-cache.org/redhat/varnish-4.0/el7/x86_64/varnish/varnish-docs-4.0.2-1.el7.centos.x86_64.rpm  



Step2:- You will need to install an additional package of jmellaoc a dependency package which is not available under the yum repository due to varnish having an EPEL license.

 yum install ftp://ftp.muug.mb.ca/mirror/fedora/epel/7/x86_64/j/jemalloc-3.6.0-1.el7.x86_64.rpm  

Step 3:- Install the Varnish Cache

 yum install https://repo.varnish-cache.org/redhat/varnish-4.0/el7/x86_64/varnish/varnish-4.0.2-1.el7.centos.x86_64.rpm  

This would conclude the Varnish Cache installation.

Starting up the Varnish service in Centos 7 is little different due to changes in the configuration with the new release. Use the following command to start the varnish service

 systemctl start varnish  

Else you can start like this as this provides backward compatability for now

 service varnish start  

Also you can enable the varnish service at startup using the following command

 systemctl enable varnish  

You can check the status of the service enabled as

 systemctl list-unit-files --type=service | grep varnish.service  

This would give an output as

 varnish.service               enabled  

You can check the running process as

 [[email protected] init.d]# ps -ef | grep varnishd  
root   45861   1 0 15:07 ?    00:00:00 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :6081 -T 127.0.0.1:6082 -t 120 -u varnish -g varnish -S /etc/varnish/secret -s file,/var/lib/varnish/varnish_storage.bin,1G
 varnish 45868 45861 0 15:07 ?    00:00:03 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :6081 -T 127.0.0.1:6082 -t 120 -u varnish -g varnish -S /etc/varnish/secret -s file,/var/lib/varnish/varnish_storage.bin,1G
 root   46393 14241 0 15:21 pts/0  00:00:00 grep --color=auto varnish


0 comments:

Post a Comment