Skip to content

Instantly share code, notes, and snippets.

@rahulsing
Created October 2, 2024 01:13
Show Gist options
  • Save rahulsing/ccb3a480da4004ea5711ca7990a13b1c to your computer and use it in GitHub Desktop.
Save rahulsing/ccb3a480da4004ea5711ca7990a13b1c to your computer and use it in GitHub Desktop.
install glue python 3.9 on ec2
sudo su
yum update -y
yum install -y shadow-utils
yum install -y sudo
yum erase openssl-devel -y
yum install openssl11 openssl11-devel libffi-devel bzip2-devel wget tar xz -y
# Install python optional standard libary module dependencies
yum install ncurses-devel gdbm-devel readline-devel xz-libs xz-devel uuid-devel libuuid-devel -y
yum install glibc -y
# install system dependency to enable the installation of most of the extras
yum install -y gcc gcc-c++ cyrus-sasl-devel python3-devel python3-wheel make
# Python 3.10 install
PYTHON_VERSION=3.9.0
sudo mkdir python_install
python_file=Python-$PYTHON_VERSION
python_tar=$python_file.tar
python_xz=$python_tar.xz
sudo mkdir python_source
wget "https://www.python.org/ftp/python/$PYTHON_VERSION/$python_xz" -P /python_source
cp /python_source/$python_xz ./python_install/$python_xz
unxz ./python_install/$python_xz
tar -xf ./python_install/$python_tar -C ./python_install
pushd ./python_install/Python-3.9.0
./configure --enable-optimizations --enable-loadable-sqlite-extensions --prefix=/usr ## Override the install at /usr/bin/python3
make install -j $(nproc) # use -j to set the cores for the build
popd
# Upgrade pip
pip3 install $PIP_OPTION --upgrade 'pip<23'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment