Open In App

How to Install Python 2.8 on AWS EC2?

Last Updated : 31 Oct, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report


AWS or Amazon Web Services is one of the biggest cloud services providers with a variety of services such as on-demand computational services, databases, storage space, etc. EC2 or Elastic Compute Cloud is one of its services which acts as an on-demand computing service on the cloud platform. From a computational point of view, it includes various different computing services as well as a virtual environment.

Steps to Create a New AWS Instance

To create a free AWS account refer to Amazon Web Services (AWS) – Free Tier Account Set up.

Step 1: Visit the AWS website and search for EC2 from various different available options.

Step 2: On the EC2 page, click on the Launch Instance button to create a new instance. There are different instance types. For more information, refer to Amazon EC2 – Instance Types

Step 3: Give a suitable name for your instance.

Step 4: Select UBUNTU as the Amazon Machine Image.


file

Step 5: Go to the Key-pair section, and create a new key-pair set (if you don’t have one already). Put a suitable name for your key and download it on your local machine. This key would help to log in to our instance using an SSH client.

file

Step 6: Click on the launch instance button on the right-hand bottom side to launch the instance.

Step 7: It will take a few seconds for the instance to start completely and go into a running state.


file

Connect to the Instance Using SSH Client

Step 1: Wait till the instance is up and running and after that click on Connect button on the top right-hand side of the page.

Step 2: Start the SSH client on your local system. (PuTTy for Windows, Terminal for Linux/MacOS).

Step 3: Go to the folder where you stored your private key file onto the terminal using the following command:

cd <path-to-your-folder>

Step 4: To give execute permission to the secret key file, execute the following command:

chmod 400 <privateKeyFile.pem>

Step 5: Connect to your instance using its public DNS. Copy the command given in the Example section and execute it on your terminal.

file

Step 6: After running this command, you will be asked “Are you sure you want to continue connecting (yes/no/[fingerprint])?”. Put “yes” and click Enter.

Step 7: You are now successfully connected to your instance on AWS from your local machine using an SSH client.

Install Python 2.7 on AWS Instance

Step 1: Before doing anything, let's update the package list on our local system using the following command.

sudo apt update

Step 2: Follow the give command to install all dependencies which are important to follow basic linux operations.

sudo apt-get install build-essential


file

Step 3: The AWs EC2 does not offer installation capabilities of specific python versions. It can install python2.7 for a default version, but, to install a specific version like python2.7.8, we need to do the installation manually using the executable file. Use the given command to install such a file for python2.7.8 version.

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz


file

Step 4: Check that the following file is a tar.gz file. So, use the following command to unzip this folder.

tar -xzyf Python-2.7.8.tgz


file

Step 5: Use the following command to check if the folder has been properly unzipped.


file

Step 6: After going inside the folder, use the following commands to finish the installation process for python2.7.8 version.

./configure
make
sudo make install

file

file

file

Step 7: The status of the installed python versin can be checked using the following command.

 python2.7 --version

file


Next Article

Similar Reads