{"id":4602,"date":"2019-05-16T19:12:40","date_gmt":"2019-05-16T13:42:40","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=4602"},"modified":"2026-10-22T16:35:29","modified_gmt":"2026-10-22T11:05:29","slug":"how-to-install-cmake-on-linux","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-cmake-on-linux\/","title":{"rendered":"How to Install CMake on Linux (Ubuntu, Debian, and CentOS)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Post Date: May 15, 2019 <br>Last Updated: October 22, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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 <code>CMakeLists.txt<\/code> and generates the appropriate build files for tools such as Make or Ninja.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CMake is commonly used to compile and build C and C++ applications on Linux and other operating systems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to install CMake on Ubuntu, Debian, and CentOS, and how to verify that the installation was successful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you begin, ensure you have:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>A Linux server or system running Ubuntu, Debian, or CentOS.<\/li>\n\n\n\n<li>A user account with <code>sudo<\/code> privileges or root access.<\/li>\n\n\n\n<li>An active internet connection to download the required packages.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Install CMake on Linux<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Update the Package Repository<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before installing CMake, update the package repository information on your Linux system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Ubuntu and Debian, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This refreshes the available package information from the configured repositories.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install CMake on Ubuntu or Debian<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to install CMake:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you also need the graphical CMake interface, check whether <code>cmake-gui<\/code> is available in your distribution&#8217;s repositories and install it separately:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install cmake-gui<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The graphical interface may require a desktop environment and is generally unnecessary on headless Linux servers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Install CMake on CentOS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For CentOS systems that use the traditional YUM package manager, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo yum install cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On newer RPM-based distributions, including CentOS Stream versions that use DNF, you can use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo dnf install cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> 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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Verify the CMake Installation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After installation, check the installed version:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cmake --version<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If CMake is installed correctly, the command displays its version information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also view the available command-line options:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cmake --help<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To learn more about the command and its options, use the manual page if available:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">man cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Press <code>q<\/code> to exit the manual page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">CMake Is Not Found<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you receive a <code>cmake: command not found<\/code> error, check whether CMake is installed and available in your system&#8217;s <code>PATH<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu or Debian, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dpkg -l cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On CentOS or other RPM-based systems, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">rpm -q cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the package is not installed, repeat the appropriate installation command and review any package manager errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Installed Version Is Too Old<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If your project requires a newer CMake version than your distribution provides, consult the official CMake download page for supported installation methods:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/cmake.org\/download\" target=\"_blank\" rel=\"noopener\">https:\/\/cmake.org\/download<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before upgrading, confirm that the chosen installation method is compatible with your Linux distribution and project requirements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. How do I check the installed CMake version?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <code>cmake --version<\/code> in the terminal to display the installed version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Is CMake available on Ubuntu and Debian?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. CMake can generally be installed through the APT package manager using <code>sudo apt install cmake<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Can I install CMake on a Linux server without a graphical interface?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The CMake command-line tool works without a graphical desktop environment. The <code>cmake-gui<\/code> package is optional.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. What should I do if the package manager provides an older version of CMake?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check your project&#8217;s version requirements and consult the official CMake website for supported alternatives.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-the-linux-kernel-handles-network-connections-using-dns-and-routing\/\">How the Linux Kernel Handles Network Connections Using DNS and Routing<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/modifying-file-timestamps-in-linux-using-touch\/\">Modifying File Timestamps in Linux Using touch<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Need Assistance?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you encounter issues installing CMake or configuring your Linux build environment, please contact the <a href=\"https:\/\/pheonixsolutions.com\/\" data-type=\"link\" data-id=\"https:\/\/pheonixsolutions.com\/\">Pheonix Solutions<\/a> support team. Include your Linux distribution, version, and any error messages so our team can investigate and assist you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For further assistance, please <a href=\"https:\/\/pheonixsolutions.com\/contact\/\" data-type=\"link\" data-id=\"https:\/\/pheonixsolutions.com\/contact\/\">contact our support team<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: May 15, 2019 Last Updated: October 22, 2026 Introduction CMake is an open-source, cross-platform build system generator used [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12447,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[656],"class_list":["post-4602","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","tag-cmake-instsall","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1ce","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/CMake-Installation-Guide-for-Linux.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4602"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4602\/revisions"}],"predecessor-version":[{"id":12449,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4602\/revisions\/12449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/12447"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}