Recently we had to install Varnish from source so that we could compile it with some additional modules. Here are the steps to install Varnish 3 from source on Ubuntu 12.04:
1) Clone Varnish source from git.
git clone https://github.com/varnish/Varnish-Cache.git
2) Change into the cloned directory.
cd Varnish-Cache
3) Checkout branch 3.0 from git and pull the latest content of this branch.
git checkout 3.0; git pull origin 3.0;
4) Install the dependencies. We are installing these via apt-get since we don't need to compile them from source to add a new Varnish module.
sudo apt-get install python-docutils libpcre3-dev pkg-config automake libtool autoconf libncurses5-dev libncurses5
5) Execute autogen.sh so that configure file can be created.
./autogen.sh
6) Configure the make file with prefix set to the directory where you want to install Varnish.
./configure --prefix=/home/neemehta/varnish3 // replace prefix by the directory path where you want to install Varnish
7) Make Varnish.
make
8) Test to make sure that "make" command was executed correctly.
make check
9) Install Varnish
make install
That's it. Now you should have Varnish installed in the directory of your choice. To run Varnish, execute the following command:
sudo /home/neemehta/varnish3/sbin/varnishd -P /var/run/varnishd.pid -a :80 -T localhost:6082 -f /home/neemehta/varnish3/etc/varnish/default.vcl -S /home/neemehta/varnish3/etc/varnish/secret -s malloc,1g