How to compile and install CMake on Linux

CMake is a cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.

Here are the simple steps to download, configure, compile, and install CMake on a Linux machine. I have tested these instructions on Debian/Ubuntu Linux distributions but they should work on all Linux machines where compilers and make utilities are installed. Please take a look at configuring Ubuntu Linux after installation to configure your Debian/Ubuntu Linux box for the required tools.

Please make sure you check the downloaded file's integrity before unzipping it. '#' (w/o quotes) in front of commands below means you have to run the command as root user (or use sudo instead if your system supports that).

Download:

$ wget https://github.com/Kitware/CMake/archive/refs/tags/v3.30.1.tar.gz

Extration of cmake source code from downloaded file:

$ tar xzf tar xzf v3.30.1.tar.gz
$ cd CMake-3.30.1

Configuration:

If you want to see the available conifuration options, run command below.

$ ./configure --help

In order to configure cmake before installation, run command below.

$ ./configure --prefix=/opt/cmake

We basically instructed the install script to install CMake in /opt/cmake.

Compilation:

$ make

Installation:

# make install

Verification:

After installation without any errors you can verify the installation by running the command below:

$ /opt/cmake/bin/cmake -version

or

$ cmake --version

The output should look something like below (depending upon cmake version you are installing).

cmake version 3.30.1

Did this tutorial help? How about buy me a cup of coffee?

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution