1. Download Python 3.10 Precompiled Binaries
Python releases come with precompiled binary installers for
various platforms. On Windows or another Linux machine with internet access,
you can download the Python 3.10 precompiled binaries.
Steps to Download Python 3.10 Binaries:
- Go
to the Official Python Downloads Page:
- Visit
the Python 3.10 release page.
- Download
the Linux Binary:
- Python
provides precompiled tarball binaries (.tar.xz) for Linux, which
include all necessary files to run Python.
- Download
the appropriate precompiled binary:
- For
x86_64 architecture (64-bit), download:
Python-3.10.0.tar.xz - Extract
the Python Tarball: After downloading the tarball, extract it on your
local machine (Windows or Linux):
bash
tar -xvf Python-3.10.0.tar.xz
- Transfer
the Extracted Python Files to EC2: Once you’ve extracted the Python
files on your local machine, transfer the entire directory to the EC2
instance using SCP, WinSCP, or another file transfer tool.
Using SCP:
bash
scp -i your-key.pem Python-3.10.0/
user@ec2-instance-ip:/home/user/python310/
Using WinSCP:
- Open
WinSCP, connect to your EC2 instance, and upload the extracted Python
directory to /home/user/python310/.
2. Download Precompiled Dependencies
Python has several key dependencies like zlib, openssl, libffi,
and others that need to be installed for proper functionality. These libraries
can also be downloaded as precompiled binaries and transferred to the EC2
instance.
Steps to Download Precompiled Dependencies:
- Visit
RPM Repositories: Use trusted RPM repositories like RPMFind or CentOS
Vault to download the precompiled binaries for the following
libraries:
- GCC
(GNU Compiler Collection)
- zlib-devel
- openssl-devel
- libffi-devel
- bzip2-devel
- sqlite-devel
- Download
RPMs for Your EC2 Version:
- Make
sure to download the correct version of these dependencies compatible
with the Linux distribution running on your EC2 instance (e.g., Amazon
Linux 2, Red Hat 8.x).
For example, you might search and download:
- gcc-<version>.rpm
- zlib-devel-<version>.rpm
- openssl-devel-<version>.rpm
- libffi-devel-<version>.rpm
- bzip2-devel-<version>.rpm
- sqlite-devel-<version>.rpm
- Transfer
the Dependencies to EC2: After downloading the RPM files, transfer
them to the EC2 instance using SCP or WinSCP.
Using SCP:
bash
scp -i your-key.pem /path/to/rpms/*.rpm
user@ec2-instance-ip:/home/user/rpms/
Using WinSCP:
- Connect
to your EC2 instance via WinSCP and upload the RPM files to /home/user/rpms/.
3. Install the Precompiled Python and Dependencies on EC2
Install Python:
Once you’ve transferred the Python precompiled files, you
can set it up on the EC2 instance.
- Extract
Python on EC2: If you transferred a .tar.xz file (or the entire
extracted folder), use the following commands to extract it on the EC2
instance:
bash
cd /home/user
tar -xvf Python-3.10.0.tar.xz
- Make
the Python Executable: Ensure that the Python binary is executable:
bash
chmod +x /home/user/python310/python
- Set
Up Python Environment: Set up the environment to use the Python
binary:
bash
echo 'export PATH=/home/user/python310:$PATH' >>
~/.bashrc
source ~/.bashrc
- Verify
Python Installation: Run the following to verify Python:
bash
python3 --version
Install Dependencies:
Install the transferred dependencies using the RPM
command.
- Install
RPM Packages: Navigate to the directory where you uploaded the RPM
files and install them:
bash
cd /home/user/rpms
sudo rpm -ivh *.rpm
This command will install the necessary libraries such as zlib,
openssl, libffi, etc.
- Verify
Dependencies: After installation, you can verify that the dependencies
are properly installed:
bash
rpm -qi gcc
rpm -qi zlib-devel
rpm -qi openssl-devel
4. Verify Python and Dependencies:
Once the Python binary and dependencies are installed,
verify the setup:
- Check
Python Version:
bash
python3 --version
- Check
Installed Libraries: Ensure that libraries like openssl and zlib are
available by testing with Python:
bash
python3 -c "import ssl;
print(ssl.OPENSSL_VERSION)"
python3 -c "import zlib; print(zlib.ZLIB_VERSION)"
No comments:
Post a Comment