UbuntuUbuntu Based

How To Install CMake on Ubuntu 24.04 LTS

Install CMake on Ubuntu 24.04

In this tutorial, we will show you how to install CMake on Ubuntu 24.04 LTS. CMake is an open-source, cross-platform family of tools designed to build, test, and package software. It is widely used by developers, system administrators, and Linux enthusiasts to simplify the software compilation process and ensure a consistent build across different platforms.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the CMake on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

Before installing CMake on Ubuntu 24.04 LTS, ensure your system meets the following requirements:

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install CMake on Ubuntu 24.04 LTS

Step 1. Updating the Package Repository.

First, update your system’s package list to ensure you have the latest information on available packages:

sudo apt update
sudo apt upgrade

The apt update command refreshes the package list, while apt upgrade installs the available updates. This step helps resolve any dependency issues and provides access to the latest security patches and bug fixes.

Step 2. Installing CMake on Ubuntu 24.04.

  • Method 1: Installing CMake from Ubuntu Repositories

The simplest way to install CMake on Ubuntu 24.04 LTS is by using the default Ubuntu repositories. This method is straightforward and easy to use, but it may not provide the latest version of CMake. To install CMake from the Ubuntu repositories, follow these steps:

sudo apt install cmake

Verify the installation:

cmake --version
  • Method 2: Installing CMake via Snap

Snap is a package management system developed by Canonical, the company behind Ubuntu. It allows users to install and manage applications in a sandboxed environment. Installing CMake via Snap ensures that you always have the latest version available. To install CMake using Snap, follow these steps:

sudo apt install snapd

Next, install CMake using Snap:

sudo snap install cmake --classic

Verify the installation:

cmake --version
  • Method 3: Installing CMake from Source

Installing CMake from the source gives you full control over the version you want to install and allows you to customize the build options. This method is more complex and time-consuming compared to the previous methods.

First, install the necessary build dependencies:

sudo apt install build-essential libssl-dev

Download the CMake source code. Replace 3.XX.X with the desired version:

wget https://github.com/Kitware/CMake/releases/download/v3.30.0-rc4/cmake-3.30.0-rc4.tar.gz

Extract the downloaded archive:

tar -zxvf cmake-3.30.0-rc4.tar.gz

Change to the extracted directory:

cd cmake-3.30.0-rc4

Configure and build CMake:

./bootstrap
make

Install CMake:

sudo make install

Verify the installation:

cmake --version

The output should display the version of CMake you installed from the source.

Congratulations! You have successfully installed CMake. Thanks for using this tutorial for installing the CMake on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the CMake website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button