Using custom Debootstrap to install Ubuntu version of your choice

There are times when you want to install a newer version of the Ubuntu server but your Cloud/VPS provider might not include the version you want. This could be due to some of the following reasons.

If you are running debian flavored linux it is easy to overcome the above limitations.

Steps

apt remove --yes debootstrap
mkdir -p /tmp/debootstrap
cd /tmp/debootstrap
wget https://mirrors.kernel.org/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.124_all.deb
ar -x *.deb
zcat /tmp/debootstrap/data.tar.gz | tar xv
cp -r usr /
rm -rf /tmp/debootstrap

Now you should be able to use the new debootstrap.

Script

You are looking to automate here is the entire script with slight changes allowing you to re-run the script multiple times to try it out.

apt remove --yes debootstrap || true
rm -rf /tmp/debootstrap
mkdir -p /tmp/debootstrap
pushd /tmp/debootstrap
wget https://mirrors.kernel.org/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.124_all.deb
ar -x *.deb
zcat /tmp/debootstrap/data.tar.gz | tar xv
cp -r usr /
popd
rm -rf /tmp/debootstrap