Python 3.10+ on EC2 running Amazon Linux 2, and the openssl upgrade requirement.
To upgrade Python from 3.7 on EC2 to 3.10 upwards running Amazon Linux 2 it looks like the following steps have to be broadly followed.
- Uninstall existing 1.0.2 openssl.
- Build from source openssl 1.1.1+ with source from https://www.openssl.org
- Enable new openssl reference via PATH in /etc/profile.d.
- Build Python 3.10+ with source from https://www.python.org referring to the openssl build from step 2 (--with-openssl)
- Go through the alt install/customized install of the Python3.10 build to migrate or develop new applications under 3.10+
Are there any repos available to do a direct sudo yum install of openssl and Python3.10 avoiding compilation from source. It looks like this may be possible for openssl, but not very clear for Python3.10+
Thank you.
- z1hou3 years ago
3.8 is already available on AWS Linux 2. So, it does give me some options now. Thanks for pointing that out. The reason to upgrade was driven by the EOL for 3.7. If 3.8 is the preferred release of AWS Linux 2 distribution, will go with it. If 3.10+ is required, will explore other options like Lambda.
- Topics
- Compute
- Language
- English
asked 3 years ago32.4K views
- Newest
- Most votes
- Most comments
Guess you are concerned that Python 3.7 EOL June this year
If you want to avoid compiling and is fine with older version, python 3.8 is available from amazon-linux-extras You will need to remove python 3.7 first. Possible commands as below
# python3 --version
Python 3.7.16
# sudo yum remove python3
# amazon-linux-extras | grep python
36 python3.8 available [ =stable ]
# sudo amazon-linux-extras install python3.8
# rpm -ql python38
/usr/bin/pydoc3.8
/usr/bin/python3.8
/usr/share/doc/python38-3.8.16
/usr/share/doc/python38-3.8.16/README.rst
/usr/share/man/man1/python3.8.1.gz
# python3.8 --version
Python 3.8.16
# sudo ln -s /usr/bin/python3.8 /usr/bin/python3
# sudo ln -s /usr/bin/pydoc3.8 /usr/bin/pydoc
# python3 --version
Python 3.8.16
Hello,
The latest stable version of Python available for Amazon Linux 2 AMI is 3.8 and you may install it using the amazon-linux-extras library.
[+] Extras library (Amazon Linux 2) - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library
Regarding OpenSSL, Amazon Linux 2 comes with OpenSSL 1.0.2 by default.
[+] https://docs.aws.amazon.com/linux/al2023/ug/compare-with-al2.html
Any security concerns and CVEβs regarding OpenSSL could be found in the document below : https://alas.aws.amazon.com/alas2.html
In order to apply the security updates for OpenSSL, you may run the βyum update opensslβ command on the instance.
Additionally, you may keep an eye on the documents below for information about the upcoming features and announcements to services in order to check for the availability of the latest versions of the above packages in Amazon Linux 2 :
- Whatβs New - https://aws.amazon.com/new/
- AWS Blog - https://aws.amazon.com/blogs/aws/
Further, you may manually install the required Python version (Python 3.10) from the official Python download page and configure it on your instance. Please find below a third-party article that I hope would be helpful to you : https://techviewleo.com/how-to-install-python-on-amazon-linux-2/
Relevant content
- Accepted Answer
asked 3 years ago
asked 3 years ago
