How to Install Python 3.12 on AlmaLinux

Ready to bring the magic of Python 3.12 to your AlmaLinux server? This guide makes it a breeze. We'll update your system, add essential tools, and walk through downloading and installing Python. Excited to see Python 3.12 in action? Let's dive in, no tech fuss – just simple steps! 🐍✨

How to Install Python 3.12 on AlmaLinux

Python, the versatile and powerful programming language, is a must-have on your AlmaLinux server. Follow this simple guide to install Python 3.12 and unlock a world of possibilities.


Prerequisites:

  • A fresh installation of AlmaLinux with root or sudo access.


Step 1: Update System Packages

Before diving into Python, ensure your system is up to date:

sudo dnf update -y
Update System Packages

Step 2: Install Development Tools

Install essential development tools and libraries:

sudo dnf groupinstall "Development Tools" -y
sudo dnf install wget openssl-devel libffi-devel -y
Executing the sudo dnf groupinstall "Development Tools" -y command
Installation of the first command: sudo dnf groupinstall "Development Tools" -y completed
Installation of the second command: sudo dnf install openssl-devel libffi-devel -y completed

Step 3: Download and Compile Python 3.12

  1. Fetch the Python 3.12 source code and compile it:
wget https://www.python.org/ftp/python/3.12.1/Python-3.12.1.tgz
tar xzf Python-3.12.1.tgz
cd Python-3.12.1
Downloading Python 3.12 source code and extracting it

  1. Configure the Build:
./configure --enable-optimizations
Configure the build
💡
This command configures the build, enabling optimizations for the specific system architecture. It tailors the Python installation to take full advantage of the host machine's capabilities.

  1. Build Python:
make -j8
Building Python 3.12 completed
💡
The make command compiles the Python source code. The -j8 flag allows parallel compilation, utilizing 8 processors (you can adjust the number based on your machine's capabilities). This speeds up the compilation process.

  1. Install Python:
sudo make altinstall
Installing Python 3.12 completed
💡
The make altinstall command installs Python without replacing the system's default Python interpreter. This avoids potential conflicts with the operating system. The use of sudo grants the necessary permissions for system-level installation.

Step 4: Verify Python Installation

Check that Python 3.12 is installed:

python3.12 -V
Verify python 3.12 installation


Conclusion:

Congratulations! Python 3.12 is now successfully installed on your AlmaLinux server. Dive into the Python world and start building amazing projects. If you have any questions, feel free to ask in the comments below. Happy coding!


Enjoying our content? Your support keeps us going! 🚀

Consider buying us a coffee to help fuel our creativity.