Install Squid 3.2.x on Ubuntu 12.04 (Precise) LTS

Submitted by Hannes Schmidt on Thu, 01/24/2013 - 17:51.

This is how I upgraded the Squid package from 3.1.19 to 3.2.6 on my Ubuntu 12.04 installations. The 3.2.x branch contains support for multiple cores, so that's a pretty important update to have. 12.04 is an LTS release, so I'm really not sure why 3.2.6 hasn't been backported to it. Anyhow, here's how I did it:

Set up the dquilt shell alias as described in the Debian New Maintainer's Guide:

alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"

Create ~/.quiltrc-dpkg containing

d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
    # if in Debian packaging tree with unset $QUILT_PATCHES
    QUILT_PATCHES="debian/patches"
    QUILT_PATCH_OPTS="--reject-format=unified"
    QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
    QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
    QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
    if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi

Get the current source package:

mkdir squid
cd squid
apt-get source squid3

Install the build requirements:

sudo apt-get build-dep squid3
sudo apt-get install devscripts quilt

Get the new upstream release:

wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.6.tar.bz2

Migrate the debian directory to the upstream:

cd squid3-3.1.19/
uupdate ../squid-3.2.6.tar.bz2

Apply my patch. It only affects files in the debian directory, upstream files are affected by the patches in debian/patches, some of which are affected by my patch. Confusing, I know.

cd ..
wget http://diaryproducts.net/files/squid3-3.2.6-debian.patch
cd squid3-3.2.6
patch -p1 < ../squid3-3.2.6-debian.patch

Apply the Debian patches:

while dquilt push; do dquilt refresh; done

Build the .deb files:

dpkg-buildpackage -us -uc -b

Repeat process for squid-langpack:

cd ..
apt-get source squid-langpack
wget http://www.squid-cache.org/Versions/langpack/squid-langpack-20121005.tar.gz
cd squid-langpack-20111114
uupdate -v 20121005 ../squid-langpack-20121005.tar.gz
cd ../squid-langpack-20121005
dpkg-buildpackage -us -uc -b

Install:

cd ..
sudo dpkg -i squid_3.2.6-0ubuntu1_amd64.deb \
             squid3_3.2.6-0ubuntu1_amd64.deb \
             squid3-common_3.2.6-0ubuntu1_all.deb \
             squid-common_3.2.6-0ubuntu1_all.deb \
             squid-langpack_20121005-0ubuntu1_all.deb

Additionally, you may want to install the squid3-dbg, squid-cgi and squidclient packages as well.

Important: I recommend changing shutdown_lifetime from 30 seconds to 0 seconds in /etc/squid3/squid.conf. Otherwise, it could take 30 seconds after you issue service squid3 stop before the last squid3 process terminates. That is, if there are open proxy connections. This is a hack, the clean way to shutdown Squid would be to use squidclient, but even the official Debian package doesn't do that.

( categories: Unix | Administrator )