Step 3: Build Squid 5ΒΆ
In order to get Squid 5 on Ubuntu 20.04 LTS we will use the original version from Debian Unstable Repository. Run script 03_build_squid.sh to do the compilation.
#!/bin/bash
if [[ $EUID -eq 0 ]]; then
echo "This script must NOT be run as root" 1>&2
exit 1
fi
# drop squid build folder
rm -R build/squid
# we will be working in a subfolder make it
mkdir -p build/squid
# set squid version
source squid.ver
# copy the patches to working directory
cp control.patch build/squid/
# decend into working directory
pushd build/squid
# get squid from debian experimental
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_PKG}.dsc
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_VER}.orig.tar.xz
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_VER}.orig.tar.xz.asc
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_PKG}.debian.tar.xz
# unpack the source package
dpkg-source -x squid_${SQUID_PKG}.dsc
# patch the control
patch squid-${SQUID_VER}/debian/control < control.patch
# build the package
cd squid-${SQUID_VER} && dpkg-buildpackage -rfakeroot -b -us -uc
# and revert
popd
squid.ver file is just to easier manage Squid versions in script.
#!/usr/bin/env bash
# set squid version
SQUID_VER="5.7"
SQUID_PKG="${SQUID_VER}-1"
control.patch is small patch file that allows sources of squid package from Debian 11 to be built on Ubuntu 20.
--- control.old 2022-10-12 10:24:13.396181441 +0000
+++ control 2022-10-12 10:24:35.228069617 +0000
@@ -13,7 +13,7 @@
# The compiler dependencies are relevant for backporting.
, g++ (>= 4.9) <!cross> | clang (>= 3.7) <!cross>
, gcc (>= 4.9) <!cross> | clang (>= 3.7) <!cross>
- , debhelper-compat (= 13)
+ , debhelper-compat (= 12)
, lsb-release
, dh-apparmor
, libcppunit-dev
After build is successful, run script 04_install_squid.sh to install Squid.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# set squid version
source squid.ver
# decend into working directory
pushd build/squid
# install squid packages
sudo apt-get install squid-langpack
dpkg --install squid-common_${SQUID_PKG}_all.deb
dpkg --install squid-openssl_${SQUID_PKG}_amd64.deb
dpkg --install squidclient_${SQUID_PKG}_amd64.deb
# and revert
popd
# verify the installed squid binary
systemctl stop squid && systemctl start squid && systemctl status squid && /usr/sbin/squid -v