Install CMake on Ubuntu 20.04 LTS

CMake is a free, open-source, and cross-platform compiler designed to build native environments, generate wrappers, build executables in arbitrary combinations. CMake is popular due to its cross-platform so that developers using the build system work the way they’re used to.

In the following tutorial, you will learn how to install CMake on Ubuntu 20.04 LTS Focal Fossa.


  • Recommended OS: Ubuntu 20.04.
  • User account: A user account with sudo or root access.

The tutorial will utilize the terminal interface, which can be found in the show applications menu.


Install CMake on Ubuntu 20.04 LTS

Update Operating System

Update your Ubuntu operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@ubuntu ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on How to Add a User to Sudoers on Ubuntu.

Use the following command with the root password to log in to use the root account.


Option 1 – Install CMake with APT Repository

The first method recommended for most users will be to install CMake from Ubuntu 20.04’s repository.

To begin the installation, use the following command.

sudo apt install cmake

Example output:

Install CMake on Ubuntu 20.04 LTS

Type Y, then press the ENTER KEY to proceed.

Once installed, confirm the installation by checking the version of CMake.

cmake --version

Example output:

cmake version 3.16.3

CMake suite maintained and supported by Kitware (

Option 2 – Install CMake by Compiling Source

The second option for users requiring the latest version of CMake is downloading the source and compiling it. This is an excellent method as it allows you to have the latest version installed, but it comes at the cost of remembering to download and re-compile for updates.

Before proceeding further, install the following required dependencies on your system using the following command.

sudo apt install build-essential checkinstall zlib1g-dev libssl-dev -y

First, visit the Github releases page and grab the latest version link, do not forget to do this as the examples link below will be outdated in time.

Next, download the archive using the wget command.

Example only:


Extract the archive contents using the following command.

tar -zxvf cmake-{version number}.tar.gz

Now CD into the directory that was extracted.

cd cmake-{version number}

In the next part, you will Bootstrap script. If you encounter any issues, make sure the dependencies mentioned further up are installed.

sudo ./bootstrap

The Bootstrap script may take a few minutes. Once done, use the make command to build the package.

sudo make

Next, install CMake using the following make install command.

sudo make install

This process can take a few minutes to almost ten minutes to make a coffee or grab a drink.

Once the installation has finished, check the CMake version.

cmake version 3.22.2

CMake suite maintained and supported by Kitware (

As above, you have successfully installed version 3.22.2 instead of the default Ubuntu APT version of 3.16.3.

Comments and Conclusion

In the tutorial, you have learned two ways to install CMake on your Ubuntu 20.04 LTS desktop or server, along with the dependencies required. Overall, if you are looking into development and programming or running a server with services, you will often come across this package.

For further reading, visit CMake’s official documentation.


Like to get automatic updates? Follow us on one of our social media accounts!