Python 3.10+ on EC2 running Amazon Linux 2, and the openssl upgrade requirement.

0

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.

  1. Uninstall existing 1.0.2 openssl.
  2. Build from source openssl 1.1.1+ with source from https://www.openssl.org
  3. Enable new openssl reference via PATH in /etc/profile.d.
  4. Build Python 3.10+ with source from https://www.python.org referring to the openssl build from step 2 (--with-openssl)
  5. 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.

  • 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.

z1hou
asked 8 months ago12662 views
2 Answers
1
Accepted Answer

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
AWS
EXPERT
Mike_L
answered 8 months ago
0

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 :

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/

AWS
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions