Ubuntu: Varnish 4 on 12.04



Question:

I would like to use the latest version of Varnish (4.0.1) on precise. I tried following the instructions posted here: https://www.varnish-cache.org/installation/ubuntu

apt-get install apt-transport-https  curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | apt-key add -  echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list   apt-get update   apt-get install varnish  

However this does not work - I always end up with the older version of varnish installed (3.0.2-1). What else do I need to do to get the latest version installed?


Solution:1

The varnish repo apparently does not provide prebuilt packages for Varnish-4.0 on precise i386 (32bit).

Ideally this should be indicated in the instructions, but it it not mentioned. After a lot of heartbreak on figuring out how apt works, I was finally able to get it.

This is the root directory of packages for ubuntu - https://repo.varnish-cache.org/ubuntu/

All binary files are typically stored in pool. The dists folder lets apt select the appropriate package for the current distribution.

This file lists the packages available for the precise (Ubuntu 12.04 LTS) i386 (32bit) platform - https://repo.varnish-cache.org/ubuntu/dists/precise/varnish-4.0/binary-i386/Packages.gz

If you unzip the file and check out the packages file inside, it contains information only for varnish-doc. It does not contain the information for the main varnish package.

That is why apt gets only the ubuntu version.

If you check out the Packages file for the 64bit version all packages are present - http s://repo.varnish-cache.org/ubuntu/dists/precise/varnish-4.0/binary-amd64/Packages.gz Hence it should work fine on the 64bit distribution.

This leaves us with two options.

1. If one checks the pool directory - http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/ one can find the files http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/varnish_4.0.0-1~precise_i386.deb and http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/libvarnishapi1_4.0.0-1~precise_i386.deb which are the latest versions of varnish for the 32bit platform.

One can download these files and install them manually with dpkg -i <package-name.deb>

2. One can ask the varnish repo sysadmin to recreate the Package file for i386 with the proper package list at pkg-varnish-devel@lists.alioth.debian.org or varnish-dist@varnish-cache.org.

Or in the worst case one can still get the latest version of varnish-3 by changing the line echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list

to

echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" >> /etc/apt/sources.list.d/varnish-cache.list


Solution:2

Here is what I did to build and install Varnish 4.1 from source on Ubuntu 12.04 32 bit:

apt-get install make automake autotools-dev libedit-dev libjemalloc-dev libncurses-dev libpcre3-dev libtool pkg-config python-docutils python-sphinx graphviz  wget https://repo.varnish-cache.org/source/varnish-4.1.3.tar.gz  tar xfz varnish-4.1.3.tar.gz  cd varnish-4.1.3  sh autogen.sh  sh configure  make  make install  ldconfig  

Note that binaries built this way are located in /usr/local/bin/ and /usr/local/sbin/ directories. I had to adjust the paths in /etc/init.d/varnish* startup scripts.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »