How to Install CMake on CentOS 8

Install CMake on CentOS 8

CMake is a free, opensource and cross-platform family of tools designed to build, test and package the software. It is created by Kitware for a powerful, cross-platform build environment for open-source projects such as VTK and ITK. In this tutorial, you are going to learn how to Install CMake on CentOS 8.

Prerequisites

Before you start to Install CMake on CentOS 8. You must have the non-root user account on your system with sudo privileges.

Install Latest Version of CMake

As the CentOS Global Repository does not provide the latest version of CMake. Here we are going to install CMake by first downloading then installing it.

First, open the terminal by pressing Ctrl+Alt+t in your CentOS System.

Now to download CMake run following wget command in the terminal:

wget https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz

Now extract the downloaded cmake-3.15.2.tar.gz file using tar command:

tar -zxvf cmake-3.15.2.tar.gz

Navigate to the extracted directory by using a cd command like given below:

cd cmake-3.15.2

Next run bootstrap file to bootstrap cmake typing following command in the terminal:

./bootstrap

Run make command:

make

Install the cmake using make command as given below:

sudo make install

Confirm the Installation

Now confirm the installation and check the cmake version typing following command in the terminal:

cmake --version

Install Latest Version of CMake using SnapCraft

Run following commands to install CMake using SnapCraft

sudo yum install epel-release
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install cmake --classic

Conclusion

You have successfully learned how to install CMake on CentOS 8. If you have any queries regarding this then please don’t forget to comment below.

Leave a Comment