In this article, we will have explained the necessary steps to install Python 3.9 on Rocky Linux. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
Python is a free, open-source, and the most popular programming language around the world. It is a versatile language and is used to construct all kinds of applications. It’s the best choice for beginners due to its simple and easy-to-learn syntax. Python 3.9, the latest point release at the time of writing, comes with features such as improved time zone support, dictionary updates, and more flexible decorators.
Prerequisite:
- Operating System with Rocky Linux 8
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with DNF Commands
Install Python 3.9 on Rocky Linux
Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.
sudo dnf update sudo dnf upgrade sudo dnf groupinstall "Development Tools" sudo dnf install openssl-devel libffi-devel bzip2-devel
Step 2. Install Python 3.9 on the Rocky Linux system.
- Install Python 3.9 from the official repository.
Let us now install the latest version of Python 3.9 by running the below command:
sudo dnf install python39
Next, check the Python version using the following command:
python3 --version
Output:
[[email protected] ~]# python3 --version Python 3.9.2
- Install Python 3.9 from the official source code.
Run the following command to download the latest release source code from the Python download page:
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tar.xz
Next, extract the archive file:
tar xvf Python-3.9.7.tar.xz
Then, run the configuration script and run the build process:
cd Python-3.9.7/ ./configure --enable-optimizations sudo make altinstall
Check the version of the installation to make sure it has been installed successfully and its current build number:
python3.9 --version
That’s all you need to do to install Python on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on Python Programming Language 3.9, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.