I would like to use the latest version of Varnish (4.0.1) on precise. I tried following the instructions posted here:
apt-get install apt-transport-https
curl | apt-key add -
echo "deb precise varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list
apt-get update
apt-get install varnishHowever 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?
2 Answers
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 -
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 -
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:// Hence it should work fine on the 64bit distribution.
This leaves us with two options.
1. If one checks the pool directory - http s:// one can find the files http s:// and http s:// 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 or .
Or in the worst case one can still get the latest version of varnish-3 by changing the line echo "deb precise varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list
to
echo "deb precise varnish-3.0" >> /etc/apt/sources.list.d/varnish-cache.list
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
tar xfz varnish-4.1.3.tar.gz
cd varnish-4.1.3
sh autogen.sh
sh configure
make
make install
ldconfigNote 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.