Comprehensive Guide: Installing CMake on Rocky Linux 9

Learn how to install CMake on Rocky Linux 9 with this comprehensive guide. Follow step-by-step instructions and optimize your software development workflow. Get started today!

Rocky Linux 9 is a powerful and reliable operating system that has gained popularity among developers and system administrators. One essential tool for software development is CMake, a cross-platform build system widely used to manage the build process of various projects. In this comprehensive guide, we will walk you through the step-by-step process of installing CMake on Rocky Linux 9, ensuring a seamless experience for your development needs.

What is CMake?

CMake is an open-source, cross-platform build system that allows developers to manage the build process of their projects efficiently. It provides a simple and unified syntax for defining dependencies, compiling source code, and generating build artifacts for various platforms and compilers. CMake offers a flexible and extensible solution that helps streamline the development workflow and ensures project portability.


Before we proceed with the installation, ensure that you have the following prerequisites:

  • A running instance of Rocky Linux 9
  • Access to a terminal with administrative privileges
  • A stable internet connection

Installing CMake on Rocky Linux 9

1. Installing CMake via Package Manager

The easiest way to install CMake on Rocky Linux 9 is by utilizing the package manager. Follow these steps:

  1. Open a terminal window.
  2. Update the package manager’s cache by running the command:
sudo dnf update
  1. Install CMake by executing the following command:
sudo dnf install cmake
  1. The package manager will resolve the dependencies and prompt for your confirmation. Type ‘y’ and press Enter to proceed with the installation.

2. Building CMake from Source

If you prefer to build CMake from source, follow these steps:

  1. Open a terminal window.
  2. Install the necessary build tools and dependencies by running the command:
sudo dnf install gcc gcc-c++ make
  1. Download the latest stable release of CMake from the official website or use the following command to fetch it:

Replace x.x with the appropriate version number.

  1. Extract the downloaded archive using the command:
tar -xzvf cmake-3.x.x.tar.gz
  1. Change to the extracted directory by running:
cd cmake-3.x.x
  1. Configure the build process by executing the following commands:
  1. Once the build process completes, install CMake by running:
sudo make install

Configuring CMake

After successfully installing CMake, you may need to configure it to suit your specific requirements. CMake provides various options and variables that can be set during the configuration phase. These include specifying the generator, setting installation paths, enabling/disabling features, and more. Refer to the official documentation for detailed information on customizing the configuration.

Verifying CMake Installation

To ensure that CMake is installed correctly, open a terminal window and execute the following command:

cmake --version

The command will display the installed version of CMake along with other relevant information. If the output appears as expected, CMake is successfully installed on Rocky Linux 9.


Congratulations! You have successfully installed CMake on Rocky Linux 9. Now you can leverage the power of CMake to efficiently manage your software projects, regardless of the platform or compiler. Remember to refer to the official CMake documentation for further guidance and explore the various features and capabilities it offers.

I hope this comprehensive guide has provided you with valuable insights into installing CMake on Rocky Linux 9. Happy coding!

Must Read

Related Articles