How To Install Python on Rocky Linux 9
In this tutorial, we will show you how to install Python on Rocky Linux 9. For those of you who didn’t know, Python is a popular, powerful programming language that is easy to get started and understand. It supports multiple programming paradigms, including structured, object-oriented, and functional programming. Python has been around since the late 1980s and continues to be one of the most popular languages in use today.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Python 3.10 on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Python on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf install dnf-utils sudo dnf install zlib-devel bzip2-devel gcc libffi-devel make
Step 2. Installing Python on Rocky Linux 9.
By default, Python is not available on Rocky Linux 9 base repository. Now run the following command below to download the latest stable version of Python from the official page to your system:
wget https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tgz
Next, extract the downloaded file:
tar xzf Python-3.11.2.tgz
Change to the decompressed directory to compile the source code:
cd Python-3.11.2 ./configure --enable-optimizations sudo make sudo make install
Once installed, you can counter-check the installed version of Python:
python3 --version
Output:
Python 3.11.2
Step 3. Install Python 3.10 Modules.
To install Python Modules, we can do so with the recommended method of using an pip
installer. You can confirm this by checking the version:
pip3 --version
Now run the following command syntax to install Python modules from the modules releases page:
python3.10 -m pip install <module>
Congratulations! You have successfully installed Python. Thanks for using this tutorial for installing Python programming language on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Python website.