Skip to content

Installing CMake

Install without Snap

Installing cmake not using snap and used by Docker images not using fuse.
Install steps are performed root user.

Steps to Take

1) Remove any existing CMake

apt remove --purge --auto-remove cmake

2) Install 'Install' Prerequisites

apt update && \
apt install --yes software-properties-common lsb-release && \
apt clean all

3) Install the current GPG Keyring

wget -q -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --yes --dearmor -o /etc/apt/trusted.gpg.d/kitware.gpg

4) Add the CMake Apt Repository

Add a source-list file kitware.sources to the directory /etc/apt/sources.list.d/.

cat <<EOD | sudo tee /etc/apt/sources.list.d/kitware.sources >/dev/null
Types: deb
URIs: https://apt.kitware.com/$(lsb_release -si  | tr '[:upper:]' '[:lower:]')/ 
Suites: $(lsb_release -sc)
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By:
$(wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc | sed 's/^/ /')
EOD
Using: apt-add-repository
apt-add-repository --yes --uri "https://apt.kitware.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')" --component main

To remove te repository, add the --remove option at the end of the same command-line when adding.

Optional: Install the Keyring

apt update && apt install kitware-archive-keyring
rm /etc/apt/trusted.gpg.d/kitware.gpg

On error 'NO_PUBKEY' when running apt update run the command replacing <public-key>.

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <public-key>

5) Install the CMake Package

apt update && apt install cmake

6) Install the ccmake App Package

apt-get install cmake-curses-gui