How to Install Python in Almalinux 8? - ZirveSunucum Information
Login
Customer Panel
Login
Register

How to Install Python in Almalinux 8?

Installing Python 3.12.2 on AlmaLinux 8.10

Tested Version: AlmaLinux 8.10 (Cerulean Leopard)

Pre-packaged Python versions may sometimes be outdated or unavailable. For full control and stability, compiling Python from source is a reliable method—especially on production servers where precision matters.

Follow the steps below to compile and install Python 3.12.2. Run each command in order and wait for all processes to complete before moving on.

🔧 Step 1: Install Dependencies

sudo dnf groupinstall "Development Tools" -y
sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make -y
Installs essential build tools and libraries required for compilation.

📦 Step 2: Download Python Source

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz
sudo tar xzf Python-3.12.2.tgz
cd Python-3.12.2
Ensure you're in a writable system directory like /usr/src.

⚙️ Step 3: Compile & Install

sudo ./configure --enable-optimizations
sudo make -j$(nproc)
sudo make altinstall
--enable-optimizations improves performance. altinstall prevents overwriting system Python.

✅ Step 4: Verify Installation

python3.12 --version
You should see Python 3.12.2 as output.

Once completed, your system will have a stable, manually compiled version of Python ready for production use. This method avoids dependency conflicts and gives you full control over your environment.

Happy compiling, and may your kernel always be clean 🐧