Skip to content

Instantly share code, notes, and snippets.

@henriquetorquato
Created August 26, 2025 20:15
Show Gist options
  • Save henriquetorquato/7966fbd4f25e67c4d820c7dcef2196f5 to your computer and use it in GitHub Desktop.
Save henriquetorquato/7966fbd4f25e67c4d820c7dcef2196f5 to your computer and use it in GitHub Desktop.
Automation to install Python2, which is no longer available on some official Linux distribution repositories
#!/bin/bash
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Required to run as root"
exit
fi
# Setup
mkdir /tmp/python2-install
cd /tmp/python2-install
# Download & Extraction
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -xvzf /tmp/python2-install/Python-2.7.13.tgz
chmod -R 777 /tmp/python2-install/Python-2.7.13
cd /tmp/python2-install/Python-2.7.13
# Installation
./configure
make install
# Validation
python2 -V
# Cleanup
cd -
rm -r /tmp/python2-install
@henriquetorquato
Copy link
Author

One-liner:

su -c "$(curl -fsSL https://gist.githubusercontent.com/henriquetorquato/7966fbd4f25e67c4d820c7dcef2196f5/raw/c6d7861f9db8d82f06b9ff9bb9ce069bd1279622/install-python2.sh)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment