How to Install CMake on Ubuntu 22.04 LTS

CMake is a free, open-source, cross-platform compiler designed to build native environments, generate wrappers, and 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 22.04 LTS Jammy Jellyfish using the command line terminal using the APT method and downloading and compiling manually for users that want to maintain manually the latest version at all times.

Update Ubuntu

First, run a quick update of your system to ensure it is up-to-date to avoid any conflicts during the installation.

sudo apt update && sudo apt upgrade -y

Install CMake – APT Method

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

To begin the installation, use the following command.

sudo apt install cmake -y

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

cmake --version

Example output:

How to Install CMake on Ubuntu 22.04 LTS

Install CMake – Download & Compile 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 install the newest version, 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!!!!!!!!!!:


Remember to get the latest version, do not just blindly copy and paste!

Extract the archive contents using the following command.

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

Next, move CMake to the /opt/ location.

sudo mv cmake* /opt/

Now CD into the directory that was extracted.

cd /opt/cmake-{version number}

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


The Bootstrap script may take a few minutes.

Once done, you will see a similar output.


How to Install CMake on Ubuntu 22.04 LTS

Next, use the gmake command to build the package.


Note, you can use the make command also.

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

Example output:

How to Install CMake on Ubuntu 22.04 LTS

As above, you have successfully installed version 3.23.0 instead of the default Ubuntu APT version of 3.22.1. Remember that these versions will both change in time and are just an example.

Comments and Conclusion

In the tutorial, you have learned two ways to install CMake on your Ubuntu 22.04 LTS desktop or server and 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!