Previously, CMake was introduced to you. To control the software compiler process, this open-sources software uses a simple platform and compiler-independent configuration files. In this way, native makefiles and workspaces would be produced to be used in a compiler environment of choice. Join us with this article to learn How To Install CMake On Ubuntu And Debian. Do not miss 2021 offers on Eldernode to purchase your own Linux VPS.
Tutorial Install CMake On Ubuntu And Debian
Prepare the latest version of CMake which is available on cmake.org/download/ and Snap Store. Also, pre-compiled binaries are available for some UNIX platforms and you can alternatively download and build CMake from the source. In this article, we will explain how you can install it through the Ubuntu & Debian Software Manager.
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.
To set up, follow our Initial server setup on Ubuntu 20.04 & Initial server setup on Debian 10.
How to install CMake on Ubuntu
Here, we will describe how to install CMake to your Ubuntu both through the UI and the command line. If you prefer to not open the Command line very much, you can install software present in the Ubuntu repository through the UI.
How to install CMake through UI
First, click the Ubuntu Software icon on your Ubuntu desktop Activities toolbar.
Then, if you search ”CMake” in the search bar, the first package listed is the one maintained by the Snap Store. Click on the CMake entry to open the page below:
To start the process of the installation, click on the Install button. Since only one authorized user is able to install software on Ubuntu, the authentication details will be displayed. So, enter your password to let the installation process begin.
Tracking the installation is like the image below:
Once the CMake is installed, you will receive the following message. So, you can choose to directly launch CMake or maybe Remove it if you wish.
How to install CMake through the Ubuntu Command Line
As we mentioned, you can install CMake through the command line. Download the source code from the Official CMake website, compile it and then install CMake through it. The same version could be installed by running the command below:
sudo apt update sudo apt upgrade sudo snap install cmake
To download the source code, type:
When the file is downloaded, use the following command to extract it:
tar -zxvf cmake-3.15.2.tar.gz
To move to the extracted folder, run:
Next, use the following command to compile and install CMake.
Now, you can make it using the command below:
And to install it, type:
sudo make install
Once the installation is completed, you can verify its installation and check the correctness of the installed version. So, run:
When you checked for the latest version, you can use the CLI too to work with your software’s code.
Note: If you have already installed CMake using Ubuntu package manager, use the command below to remove it.
sudo apt remove --purge cmake hash -r
How To uninstall CMake Using The Ubuntu Software
When you decide to remove CMake from your system using the Graphical User Interface, it would not be so difficult. Let’s go through the steps of this part.
Search for ”CMake” on the search bar above. Then, click on the CMake application. The below windows should be displayed.
To uninstall CMake from your Ubuntu system, click on the ”Remove” button.
How to install CMake on Debian
The repository of Debian does not include any of the latest version of CMake. So, you need to download it firstly. Follow the below steps to learn CMake installation on Debian.
When you opened your terminal (Using Ctl+Alt+T) download CMake in your system. Run the command below and wait for the proceeding.
Then, you should extract the downloaded file. So, type:
tar -zxvf cmake-3.15.2.tar.gz$
Now, use the cd command after extracting the director.
At this point, you can run the following command since you have reached the CMake directory. Wait for a while to see CMake will be bootstrapped.
You will do this step when CMake is bootstrapped. So, run the make command in the terminal window. Processing of the make will take time, so do not exit the terminal window and let it reach 100% completion.
Finally, to install CMake, type:
sudo make install
If you wish, verify the process of installation of CMake using the command below:
Once you view the version, you can ensure that the installation is confirmed. Otherwise, check the steps again or send us the error you receive.
Enabled snaps on Debian and install CMake
Also on Debian, you can use snaps to install CMake. Snaps are applications packaged with all their dependencies. Snapes could be run on all Linux distributions from a single build. Snap Store is the best place you can install snaps.
To install snap directly from the command line, run:
sudo apt update
sudo apt install snapd
sudo snap install core
Then, use the following commands to install CMake on your Debian Server:
sudo snap install cmake --classic
In this article, you learned How To Install CMake On Ubuntu And Debian. Two methods of installing CMake was presented to you for both Ubuntu and Debian. In case you are interested in learning more, find the related article on How To Install CMake On Windows Server.