In this post, you will learn how to install CMake on Debian 11 using the following ways:
- Installation using Software Center (Graphical Method)
- Installation using tar.gz archive (Command Line Method)
Prerequisites:
To install CMake on Debian 11, users must have sudo rights.
Method 1: Installing CMake Using Software Center (GUI)
In this GUI method, we will install CMake from Debian Software Center. Complete the following steps in order to install CMake on Debian:
To begin the installation, open the Software Center in your system from the applications menu. Look for CMake application using the search button.
Once the application icon appears in the search result, click it to open the following window. Now, click Install to begin the installation of CMake on your Debian system.
Then, provide your password for authentication. After that, it begins the installation. Once CMake is installed, you will see the following window:
Method 2: Installing CMake Using Tar.gz Archive (Command Line)
In this method, we will install the latest version of CMake using the command line. Complete the following steps in order to install CMake on Debian:
Step 1: Download CMake
As the official repository of Debian does not include CMake, we will use the tar.gz package available at the CMake official site.
Launch the terminal utility using the Ctl+Alt+T keyboard shortcut in your Debian system. Then, run the following command to download the CMake tar.gz package:
The package is saved in your current Terminal directory as cmake-3.24.2.tar.gz. The CMake v3.24.2 is the latest version as of September 2022.
Step 2: Extract CMake and Run the Bootstrap
Now, you are required to uncompress the downloaded tar.gz archive. Run the following command to uncompress the cmake-3.24.2.tar.gz archive file:
It will uncompress the archive into a new directory cmake-3.24.2. Move into this directory using the cd command:
Once inside the cmake-3.24.2 directory, run the bootstrap script using the following command in the Terminal window:
Once the command is finished, you will see the following similar output:
Step 3: Install CMake
You can install CMake by following the two simple steps. First, run the cmake command:
Then, use the following command to install CMake:
Step 4: Verify Installation
To verify the installation of CMake, use the following command:
An output similar to the following screenshot that shows the CMake version will confirm the successful installation of CMake. If you do not receive such output, try again to perform the previously-mentioned steps.
Uninstall CMake
Based on how you installed CMake, there are two ways to remove it:
1. If you installed CMake via GUI, launch the Software Center, go to the Installed tab, and select CMake. Then, click Remove in order to uninstall CMake from your system.
2. If you installed CMake via the command line using the tar.gz archive, use the following method:
Move into the CMake directory which, in our scenario, is cmake-3.24.2:
Then, run the following command to uninstall CMake:
Conclusion
In this post, we covered the installation of CMake on Debian 11 using two different ways. Based on your preferences, you can choose either the graphical or command line method to install CMake. We also covered how to uninstall CMake if in case you need to remove it from your Debian system.