Post Date: May 15, 2019
Last Updated: October 22, 2026
Introduction
CMake is an open-source, cross-platform build system generator used to configure and manage software build processes. It reads configuration instructions from files named CMakeLists.txt and generates the appropriate build files for tools such as Make or Ninja.
CMake is commonly used to compile and build C and C++ applications on Linux and other operating systems.
This guide explains how to install CMake on Ubuntu, Debian, and CentOS, and how to verify that the installation was successful.
Prerequisites
Before you begin, ensure you have:
- A Linux server or system running Ubuntu, Debian, or CentOS.
- A user account with
sudoprivileges or root access. - An active internet connection to download the required packages.
Steps to Install CMake on Linux
Step 1: Update the Package Repository
Before installing CMake, update the package repository information on your Linux system.
For Ubuntu and Debian, run:
sudo apt update
This refreshes the available package information from the configured repositories.
Step 2: Install CMake on Ubuntu or Debian
Run the following command to install CMake:
sudo apt install cmake
If you also need the graphical CMake interface, check whether cmake-gui is available in your distribution’s repositories and install it separately:
sudo apt install cmake-gui
The graphical interface may require a desktop environment and is generally unnecessary on headless Linux servers.
Step 3: Install CMake on CentOS
For CentOS systems that use the traditional YUM package manager, run:
sudo yum install cmake
On newer RPM-based distributions, including CentOS Stream versions that use DNF, you can use:
sudo dnf install cmake
Note: The available CMake version depends on your Linux distribution and enabled package repositories. Older CentOS releases may provide an outdated version or may have reached end of life.
Step 4: Verify the CMake Installation
After installation, check the installed version:
cmake --version
If CMake is installed correctly, the command displays its version information.
You can also view the available command-line options:
cmake --help
To learn more about the command and its options, use the manual page if available:
man cmake
Press q to exit the manual page.
Troubleshooting
CMake Is Not Found
If you receive a cmake: command not found error, check whether CMake is installed and available in your system’s PATH.
On Ubuntu or Debian, run:
dpkg -l cmake
On CentOS or other RPM-based systems, run:
rpm -q cmake
If the package is not installed, repeat the appropriate installation command and review any package manager errors.
The Installed Version Is Too Old
If your project requires a newer CMake version than your distribution provides, consult the official CMake download page for supported installation methods:
Before upgrading, confirm that the chosen installation method is compatible with your Linux distribution and project requirements.
Conclusion
CMake simplifies the process of configuring and building software projects on Linux. By following the steps above, you can install CMake on Ubuntu, Debian, or CentOS and verify that it is ready to use.
Frequently Asked Questions
1. How do I check the installed CMake version?
Run cmake --version in the terminal to display the installed version.
2. Is CMake available on Ubuntu and Debian?
Yes. CMake can generally be installed through the APT package manager using sudo apt install cmake.
3. Can I install CMake on a Linux server without a graphical interface?
Yes. The CMake command-line tool works without a graphical desktop environment. The cmake-gui package is optional.
4. What should I do if the package manager provides an older version of CMake?
Check your project’s version requirements and consult the official CMake website for supported alternatives.
Related Articles
- How the Linux Kernel Handles Network Connections Using DNS and Routing
- Modifying File Timestamps in Linux Using touch
Need Assistance?
If you encounter issues installing CMake or configuring your Linux build environment, please contact the Pheonix Solutions support team. Include your Linux distribution, version, and any error messages so our team can investigate and assist you.
For further assistance, please contact our support team.

Pingback: How to Install Cmake form source on Linux. - PHEONIX SOLUTIONS