How To Install CMake on Fedora 40
In this tutorial, we will show you how to install CMake on Fedora 40. In the world of software development, CMake has become an indispensable tool for managing the build process of projects across various platforms. As an open-source, cross-platform build system, CMake simplifies the compilation and linking of source code, making it easier for developers to create and maintain complex software projects. Fedora 40, a popular Linux distribution known for its stability and cutting-edge features, provides multiple ways to install CMake.
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 CMake on Fedora 40.
Prerequisites
Before we dive into the installation process, ensure that you have the following prerequisites in place:
- A server running one of the following operating systems: Fedora 40.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
- A stable internet connection to download the necessary packages.
- A non-root sudo user or 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 CMake on Fedora 40
Step 1. Update the System.
To ensure a smooth installation process, it’s always a good practice to update your Fedora 40 system before installing any new software. Open a terminal and run the following command to update your system packages:
sudo dnf clean all sudo dnf update
This command will fetch the latest package information from the Fedora repositories and upgrade any outdated packages to their latest versions. Once the update process is complete, you can proceed with installing CMake.
Step 2. Installing CMake on Fedora 40.
- Installing CMake Using DNF
DNF (Dandified YUM) is the default package manager in Fedora 40. It provides a simple and efficient way to install software packages from the Fedora repositories. To install CMake using DNF, follow these steps:
sudo dnf install cmake
Once the installation is complete, you can verify the CMake version by running:
cmake --version
This command will display the installed version of CMake, confirming that the installation was successful.
- Installing CMake Using Snap
Snap is a universal package manager developed by Canonical, the company behind Ubuntu. It allows you to install and manage applications in a sandboxed environment, ensuring that each application is isolated from the rest of the system. Fedora 40 supports Snap packages out of the box, making it easy to install CMake using this method.
Install Snapd, the daemon and tooling that enables Snap packages, by running:
sudo dnf install snapd
Enable the Snapd service by executing:
sudo systemctl enable --now snapd.socket
Install CMake using the following command:
sudo snap install cmake --classic
Verify the installation by checking the CMake version:
cmake --version
If the installation was successful, you should see the version number of CMake displayed in the terminal.
- Installing CMake from Source
In some cases, you may need to install a specific version of CMake that is not available through the Fedora repositories or Snap packages. Installing CMake from source allows you to have full control over the version you want to use and enables you to customize the build options according to your needs. To install CMake from source on Fedora 40, follow these steps:
wget https://cmake.org/files/v3.30/cmake-3.30.0-rc4.tar.gz
Extract the downloaded tarball using the following command:
tar -zxvf cmake-3.30.0-rc4.tar.gz
Change into the extracted directory:
cd cmake-3.30.0-rc4
Run the bootstrap script to configure the CMake build:
./bootstrap
Compile CMake by running:
make
Once the compilation is finished, install CMake by executing:
sudo make install
Verify the installation by checking the CMake version:
cmake --version
If the installation was successful, you should see the version number of CMake that you just installed.
Congratulations! You have successfully installed CMake. Thanks for using this tutorial for installing the CMake on Fedora 40 system. For additional help or useful information, we recommend you check the CMake website.