1 min read · Dec 17, 2023
--
To install Python 3.9 with OpenSSL 1.1 on CentOS 7, you can follow these steps:
sudo yum update
sudo yum install -y epel-release
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel
cd /usr/local/src
sudo wget <https://www.openssl.org/source/openssl-1.1.1l.tar.gz>
sudo tar xzf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
sudo ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
sudo make
sudo make install
cd /usr/local/src
sudo wget <https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz>
sudo tar xzf Python-3.9.7.tgz
cd Python-3.9.7
sudo ./configure --with-openssl=/usr/local/openssl --enable-optimizations
sudo make
sudo make install
python3.9 --version
This should display the Python version, confirming that Python 3.9 has been successfully installed.
sudo alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9
This step sets the new Python version as an alternative to the default Python.
Now, Python 3.9 should be installed on your CentOS 7 system with OpenSSL 1.1. Verify the installation and start using Python 3.9 for your projects.