Skip to content

Instantly share code, notes, and snippets.

@jdmedeiros
Created November 23, 2025 03:49
Show Gist options
  • Select an option

  • Save jdmedeiros/17042aa80b1bd8395a8e2e280a4b7ee9 to your computer and use it in GitHub Desktop.

Select an option

Save jdmedeiros/17042aa80b1bd8395a8e2e280a4b7ee9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script to install legacy dependencies for PostgreSQL 17 on Ubuntu 24.04
# This installs older library versions required by bundled PostgreSQL packages
set -e # Exit on error
echo "========================================="
echo "Installing Legacy Dependencies"
echo "========================================="
echo ""
# Create a temporary directory for downloads
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
echo "Downloading packages..."
# libssl1.1
wget -q http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
# libldap dependencies
wget -q http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.4-2_2.4.49+dfsg-2ubuntu1_amd64.deb
# Heimdal/Kerberos dependencies (for libldap)
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libroken18-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libheimbase1-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libasn1-8-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libhcrypto4-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libwind0-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libhx509-5-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libheimntlm0-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libkrb5-26-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libgssapi3-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
# libicu66
wget -q http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb
# Python 3.8 dependencies
wget -q http://archive.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8-minimal_3.8.10-0ubuntu1~20.04.18_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/m/mailcap/mailcap_3.70+nmu1ubuntu1_all.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/m/mime-support/mime-support_3.66_all.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi7_3.3-4_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.18_amd64.deb
wget -q http://archive.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8_3.8.10-0ubuntu1~20.04.18_amd64.deb
echo "Installing packages in dependency order..."
echo ""
# Install libssl1.1
echo "Installing libssl1.1..."
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
# Install Heimdal/Kerberos libraries - install base libraries first individually
echo "Installing Heimdal/Kerberos base libraries..."
sudo dpkg -i libroken18-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
sudo dpkg -i libheimbase1-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
sudo dpkg -i libasn1-8-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
sudo dpkg -i libwind0-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
sudo dpkg -i libhcrypto4-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
sudo dpkg -i libhx509-5-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
# Install remaining Heimdal libraries together (they have circular dependencies)
echo "Installing remaining Heimdal libraries..."
sudo dpkg -i libheimntlm0-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb \
libkrb5-26-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb \
libgssapi3-heimdal_7.7.0+dfsg-1ubuntu1_amd64.deb
# Configure all Heimdal packages
sudo dpkg --configure -a
# Install libldap
echo "Installing libldap-2.4-2..."
sudo dpkg -i libldap-2.4-2_2.4.49+dfsg-2ubuntu1_amd64.deb
# Install libicu66
echo "Installing libicu66..."
sudo dpkg -i libicu66_66.1-2ubuntu2_amd64.deb
# Install Python 3.8 dependencies - mailcap and mime-support FIRST
echo "Installing Python 3.8 libraries..."
sudo dpkg -i libpython3.8-minimal_3.8.10-0ubuntu1~20.04.18_amd64.deb
sudo dpkg -i mailcap_3.70+nmu1ubuntu1_all.deb
sudo dpkg -i mime-support_3.66_all.deb
sudo dpkg -i libffi7_3.3-4_amd64.deb
sudo dpkg -i libmpdec2_2.4.2-3_amd64.deb
# Now install the packages that depend on mime-support
sudo dpkg -i libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.18_amd64.deb
sudo dpkg -i libpython3.8_3.8.10-0ubuntu1~20.04.18_amd64.deb
# Final configuration
echo "Final configuration..."
sudo dpkg --configure -a
# Clean up
cd -
rm -rf "$TEMP_DIR"
echo ""
echo "========================================="
echo "Installation Complete!"
echo "========================================="
echo ""
echo "Installed packages:"
echo " ✓ libssl1.1 (1.1.1f-1ubuntu2)"
echo " ✓ libldap-2.4-2 (2.4.49+dfsg-2ubuntu1)"
echo " ✓ Heimdal libraries (7.7.0+dfsg-1ubuntu1)"
echo " ✓ libicu66 (66.1-2ubuntu2)"
echo " ✓ libpython3.8 (3.8.10-0ubuntu1~20.04.18)"
echo ""
echo "You can now proceed with your PostgreSQL 17 installation."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment