How to Install CMake on Ubuntu 20.04

Install CMake on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure CMake on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

CMake is an open-source, cross-platform family of tools designed to build, test, and package software. CMake is used to control the software compilation process using simple platform and compiler-independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.

Install CMake on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install CMake on the Ubuntu system.

  • Install CMake using Snap.

Now run the following command below to install CMake on Ubuntu:

sudo snap install cmake -classic

After installed, you can try to verify the CMake version to check if it is successfully installed on your system, type:

cmake --version
  • Install CMake from the official.

Download the CMake source code from its official website:

tar -zxvf cmake-3.20.2.tar.gz
cd cmake-3.20.2

Next, run the command below to compile and install CMake in your Ubuntu system:

sudo ./bootsrap
make install

To confirm that CMake installed successfully in your system, run the “version” command:

cmake --version

That’s all you need to do to install Install CMake on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Install CMake, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.