In this tutorial, we will show you how to install Python on CentOS 9 Stream. For those of you who didn’t know, Python is an interpreted high-level general-purpose programming language. Python is famous for its simple, easy-to-learn syntax, emphasizes readability, and reduces program maintenance costs and more straightforward conversion to newer releases.
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 the Python Programming Language on CentOS 9 Stream.
- A server running one of the following operating systems: CentOS 9 Stream.
- 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).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Python on CentOS 9 Stream
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf clean all sudo dnf update sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make
Step 2. Installing Python on CentOS 9 Stream.
- Install Python via the Default CentOS Stream repository.
By default, Python is available on the CentOS 9 Stream base repository. Let’s install the Python using the following command below:
sudo dnf install python
You can then verify the installation information using the following command:
- Install Python from the official source.
Now we run the following command to download the latest Python from the official source:
Then, extract the archive file using tar:
tar xvf Python-3.11.2.tgz
Next, switch to the source directory and run the configuration script:
cd Python-3.11.2.tgz ./configure --enable-optimizations
Finally, build Python using the following command:
sudo make altinstall
After the installation process has finished, confirm the version using the following command:
Congratulations! You have successfully installed Python. Thanks for using this tutorial to install Python Programming Language on CentOS 9 Stream. For additional help or useful information, we recommend you check the official Python website.