How to install Python on Rocky Linux 8

Share on Social Media

In this article, you will learn how to install Python on Rocky Linux 8 or other RPM based distros. #centlinux #linux #python

Install Python Prerequisites:

Connect with your Rocky Linux server as root user by means of a ssh client.

Install Python 3.10 prerequistes by using dnf command.

# dnf install -y curl gcc openssl-devel bzip2-devel libffi-devel zlib-devel tar wget make

Install Python on Rocky Linux 8:

Download tarball of Python 3.10 from their official website. You can use wget or curl command for this purpose.

# cd /tmp
# wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tar.xz
--2022-04-23 21:46:50--  https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tar.xz
Resolving www.python.org (www.python.org)... 199.232.44.223, 2a04:4e42:48::223
Connecting to www.python.org (www.python.org)|199.232.44.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19342692 (18M) [application/octet-stream]
Saving to: ‘Python-3.10.4.tar.xz’

Python-3.10.4.tar.x 100%[===================>]  18.45M   751KB/s    in 20s

2022-04-23 21:47:11 (947 KB/s) - ‘Python-3.10.4.tar.xz’ saved [19342692/19342692]

Extract downloaded tarball as follows.

# tar -xf Python-3.10.4.tar.xz -C /opt/

Change to extracted directory of Python and configure the downloaded Python source according to your Linux operating system.

# cd /opt/Python-3.10.4
# ./configure --enable-optimizations

Install Python 3.10 by using following commands.

# make -j 2
# make altinstall

Verify the version of installed Python as follows.

# python3.10 -V
Python 3.10.4

Video to install Python on Rocky Linux 8:

YouTube player

Conclusion:

In this article, you have learned how to install Python on Rocky Linux 8 or other RPM based distros.

If you want to develop some amazing projects in Python Programming Language, then you should start with Python Crash Course, 2nd Edition (PAID LINK) by Eric Matthews. Or you can buy an Online Course: Complete Python Tutorial for Beginners to speedup your learning process.