How to Install Python on AlmaLinux 9

If you do not already know, Python is a high-level programming language that supports multiple programming schemes, including object-oriented, functional, and structured programming.

The usage of the Python programming language is increasing on a daily basis, and the number of applications written in Python has been extremely large in past years. One of the most popular apps that are written in Python are Dropbox, Spotify, Odoo, Pinterest, Uber, and so on.

In this tutorial, we are going to show you how to install Python on AlmaLinux 9 OS.. Let’s get started! You will need the following:

  • A server with AlmaLinux 9 as OS
  • User privileges: root or non-root user with sudo privileges

Step 1. Update the System

Every fresh installation of AlmaLinux, needs the packages to be updated to their latest versions available. To do that, execute the following command:

sudo dnf update -y && sudo dnf upgrade -y

Step 2. Install Python Prerequisites

Before we proceed with Python installation, we need to install some prerequisites. To install the prerequisites execute the following command:

dnf install openssl-devel bzip2-devel libffi-devel zlib-devel wget yum-utils make gcc tar -y

Once the prerequisites are installed, update the system again.

sudo dnf update -y

Step 3. Download and Install Python

We need to download the source code of the latest Python 3.12.0 version. Execute the following command:

cd /root


Once downloaded, you should receive the following output:

[root@host ~]# wget
--2023-06-02 09:02:01--
Resolving (, 2a04:4e42:44::223
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26396588 (25M) [application/octet-stream]
Saving to: ‘Python-3.12.0a1.tgz’

Python-3.12.0a1.tgz                       100%[=====================================================================================>]  25.17M  5.67MB/s    in 4.5s

2023-06-02 09:02:06 (5.65 MB/s) - ‘Python-3.12.0a1.tgz’ saved [26396588/26396588]

Now, we need to extract the downloaded file with the following command:

tar xzf Python-3.12.0a1.tgz

Once extracted, enter into the Python installation folder and execute the following commands:

cd Python-3.12.0a1

./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions 

This will prepare the Python installation and will configure it before compiling. Once done, you should get the following output:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99

configure: creating Modules/Setup.local
configure: creating Makefile

If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations

Next, we need to compile the code and install Python with the following commands:

make -j ${nproc}

make altinstall

After the installation, you will receive the following output:

/usr/bin/install -c -m 755 Modules/ /usr/local/lib/python3.12/lib-dynload/
/usr/bin/install -c -m 644 ./Misc/ \
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
                upgrade) ensurepip="--altinstall --upgrade" ;; \
                install|*) ensurepip="--altinstall" ;; \
        esac; \
         ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
Looking in links: /tmp/tmp1hx29q38
Processing /tmp/tmp1hx29q38/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmp1hx29q38/pip-22.3-py3-none-any.whl
Installing collected packages: setuptools, pip
Successfully installed pip-22.3 setuptools-65.5.0

Now, we need to create a symbolic link from the current Python folder.

ln -s /root/Python-3.12.0a1/python /usr/bin/python3

Once the symbolic link is created, you can check the installed version:

python3 -V

You should get the following output:

[root@host ~]# python3 -V
Python 3.12.0a1

That’s it. You successfully installed the latest Python 3.12 version on AlmaLinux 9 OS. Now, you can start to use it in your applications. Of course, you do not have to do this setup on your own if you find it difficult. You can always contact our technical support and they will help you with any aspect of installation and configuration. All you need to do is to sign up for one of our Linux VPS plans and submit a support ticket. We are available 24/7.

If you liked this about installing Python on AlmaLinux 9, please share it with your friends on social networks using the buttons on the left or simply leave a reply below.

2 thoughts on “How to Install Python on AlmaLinux 9”

Leave a Comment