Once you have both the cmake and the cmake3 package installed on your machine, you can use update-alternatives to switch between both packages.

Use the alternatives command to register both installations:

$ sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
--family cmake

$ sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
--family cmake

After these two commands, cmake3 will be invoked by default, when you enter cmake from a bash prompt or start a bash script. The commands also take care of registering a few secondary commands like ctest which need to be switched along with cmake.

If you need to switch back to cmake 2.8 as the default, run the following command:

$ sudo alternatives --config cmake

There are 2 programs which provide 'cmake'.

  Selection    Command
-----------------------------------------------
   1           cmake (/usr/bin/cmake)
*+ 2           cmake (/usr/bin/cmake3)

Enter to keep the current selection[+], or type selection number: 1
Answer from sakra on Stack Overflow
🌐
GitHub
gist.github.com › zrsmithson › 8a1b7923a8f37dcb2e6b12b7e408fd50
Installing latest cmake and git versions on Rhel/Centos, and setting it as the default commands · GitHub
sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \ --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \ --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \ --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \ --family cmake · And that's it, we're suddenly 7+ years in the future. ... For this, we will install the latest version of git from source (mainly following their instructions), and then do the same process as before. ... sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel sudo yum install gcc perl-ExtUtils-MakeMaker
🌐
Xinyustudio
xinyustudio.wordpress.com › 2014 › 06 › 18 › how-to-install-cmake-3-0-on-centos-6-centos-7
How to Install CMake 3.0 on CentOS 6 / CentOS 7 – Xinyustudio
June 18, 2014 - … though warning copying/pasting the cmake -version failed because the - character was odd… writing it out tho shows the correct version. October 29, 2017 at 2:10 am · Alternatively: sudo yum install epel-release sudo yum install cmake3 ·
🌐
Matheus Bratfisch
matbra.com › 2017 › 12 › 07 › install-cmake-on-aws-linux.html
Install Cmake 3 on AWS Linux · Matheus Bratfisch
December 7, 2017 - # yum install gcc-c++ Download latest version from: Cmake Download · $ wget https://cmake.org/files/v3.10/cmake-3.10.0.tar.gz · Extract it: $ tar -xvzf cmake-3.10.0.tar.gz · Enter on cmake folder · $ cd cmake-3.10.0 · Install it with: # ./bootstrap # make # make install ·
🌐
CentOS Repositories
centos.pkgs.org › 7 › okey-x86_64 › cmake3-3.12.1-2.el7.x86_64.rpm.html
cmake3-3.12.1-2.el7.x86_64.rpm CentOS 7 Download
# yum install cmake3 · 2018-08-20 - Antonio Trande <sagitter@fedoraproject.org> - 3.12.1-1 - Update to cmake-3.12.1 · 2018-07-27 - Antonio Trande <sagitter@fedoraproject.org> - 3.12.0-1 - Update to cmake-3.12.0 - Use %_metainfodir · 2018-05-19 - Antonio Trande <sagitter@fedoraproject.org> - 3.11.2-1 - Update to cmake-3.11.2 - Fix appdata file's entries ·
🌐
GitHub
gist.github.com › 1duo › 38af1abd68a2c7fe5087532ab968574e
Install CMake on CentOS 7. - Gist - GitHub
Looks like you installed to /usr/local/bin/cmake, try invoke which the full path. Your current cmake might still linked to the previous installation. ... Worked as expected in RHEL 7. Although I didn't install the default version (with yum install cmake etc.) at all.
🌐
Contradodigital
yum-info.contradodigital.com › view-package › epel › cmake3
About cmake3 for Yum on Linux
Control the cmake3 package with the following handy commands outlined below. ... This command will install cmake3 on the server.
🌐
LinuxVox
linuxvox.com › blog › how-to-install-cmake-on-linux
How to Install CMake on Linux: A Comprehensive Guide — linuxvox.com
# For CentOS sudo yum install cmake # For Fedora sudo dnf install cmake · If you need the latest version of CMake or the package manager version is too old, you can compile CMake from source.
Find elsewhere
🌐
Blogger
jotmynotes.blogspot.com › 2016 › 10 › updating-cmake-from-2811-to-362-or.html
JotMyNotes: Updating CMake from 2.8.11 to 3.6.2 or Newer Version on CentOS Linux
October 4, 2016 - If you don't perform the above step to remove old CMake version, you may see below error after the final step that you installed the newer CMake version. CMake has most likely not been installed correctly · Download, extrace, compile and install the code cmake-3.6.2.tar.gz from https://cm...
🌐
Bits and Dragons
bitsanddragons.wordpress.com › 2022 › 09 › 19 › error-cmake-3-1-or-higher-is-required-you-are-running-version-on-centos-7-x
ERROR: CMake 3.1 or higher is required. You are running version … on CentOS 7.X | Bits and Dragons
September 26, 2022 - One of the basic ones is, of course, CMake. I got the above message trying to compile one of my gpu monitoring tools and decided to fix it at least in one of our clients. Let’s start. ... We remove it, get it, bootstrap it, make it, and install it. Here you have the HOWTO for debian. In the next lines, my CentOS 7.X version of it. ## > yum ...
🌐
Steemit
steemit.com › undefined › @dothebest0927 › centos7-how-to-cmake-3-8-2-build-required-minimum-version-1
[CentOS7] How to cmake 3.8.2 build (Required minimum version) - 1 — Steemit
May 27, 2019 - How to larger space(https://sjnov11.github.io/blog/cent_os/2018/11/02/extend_disk_size_on_centos7.html) ** Virutal marchine : ** Guest OS : ** Host OS : Windows 10 ... *How To Install GCC on CentOS 7 : (https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/) $ yum -y install gcc //Gcc ...
Top answer
1 of 2
9

You don't say but what versions are you getting and what versions do you expect?

What repositories do I have?

You can find out what repositories your system is configured to query using this command:

$ yum repolist | expand
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: centos.mirror.constant.com
 * epel: mirror.steadfast.net
 * extras: mirror.symnds.com
 * updates: bay.uchicago.edu
77 packages excluded due to repository priority protections
repo id         repo name                                               status
base            CentOS-6 - Base                                         6,297+70
epel            Extra Packages for Enterprise Linux 6 - x86_64            10,246
extras          CentOS-6 - Extras                                            7+7
updates         CentOS-6 - Updates                                           314
repolist: 16,864

Package info

You can query any package whether it's installed or not using yum info <pkg>.

$ yum info cmake
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: centos.mirror.constant.com
 * epel: mirror.steadfast.net
 * extras: mirror.symnds.com
 * updates: bay.uchicago.edu
77 packages excluded due to repository priority protections
Installed Packages
Name        : cmake
Arch        : x86_64
Version     : 2.6.4
Release     : 5.el6
Size        : 18 M
Repo        : installed
From repo   : base
Summary     : Cross-platform make system
URL         : http://www.cmake.org
License     : BSD
Description : CMake is used to control the software compilation process using simple
            : platform and compiler independent configuration files. CMake generates
            : native makefiles and workspaces that can be used in the compiler
            : environment of your choice. CMake is quite sophisticated: it is possible
            : to support complex environments requiring system configuration, pre-processor
            : generation, code generation, and template instantiation.

Package's URL

You can find out where a RPM is being downloaded from using the repoquery command.

$ repoquery --location cmake
http://centos.mirrors.hoobly.com/6.5/os/x86_64/Packages/cmake-2.6.4-5.el6.x86_64.rpm

Which is part of this repository:

$ repoquery -i cmake | grep Repos
Repository  : base

So this is a base repository to the CentOS distro that's providing this package.

What other repositories have it?

You can query what repositories contain a specific package (at least most of the major repos) using pkgs.org.

  • http://pkgs.org/search/?query=cmake&type=smart

According to this list the EPEL repo has the latest version pre-built. The version of this package is as follows: cmake 28-2.8.11.2-1.

2 of 2
6

I needed cmake 2.8 on CentOS 6.5, but my attempts at using yum would also always keep cmake at 2.6 even though I tried adding repos that seemingly contained the correct version. It's kind of hacky, but I was able to get what I needed by executing the following commands as root:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6.8.noarch.rpm
yum install cmake28
cd /usr/bin
mv cmake cmake26
mv ccmake ccmake26
mv cpack cpack26
mv ctest ctest26
ln -s cmake28 cmake
ln -s ccmake28 ccmake
ln -s cpack28 cpack
ln -s ctest28 ctest
🌐
Ask Ubuntu
askubuntu.com › questions › 1132850 › install-gcc-g-and-cmake3
14.04 - Install gcc, g++ and cmake3 - Ask Ubuntu
$ yum install gcc64-c++ libcurl-devel $ export CC=gcc64 $ export CXX=g++64 $ yum install cmake3 ... $ sudo add-apt-repository ppa:ubuntu-toolchain-r/test $ sudo apt update $ sudo apt install -y g++-6 $ sudo apt install -y gcc-6 $ gcc --version ...
🌐
CMake
cmake.org › install
Resources
February 22, 2023 - Since CMake is the most downloaded software build platform, there is an overwhelming number of resources out there. We wanted to pull together some of the best resources so you can easily find what you need no matter where you are in your CMake journey.
🌐
Snapcraft
snapcraft.io › install › cmake › centos
Install CMake on CentOS using the Snap Store | Snapcraft
September 30, 2025 - sudo yum install snapd · Once ... are updated correctly. To install CMake, simply use the following command: sudo snap install cmake --classic ·...
🌐
CMake Discourse
discourse.cmake.org › usage
Do you know how to install CMake 3.5 or higher in Cent OS ? - Usage - CMake Discourse
March 18, 2022 - I found this: https://cmake.org/pipermail/cmake/2016-March/063085.html But I do not find any download link for CMake 3.5 or higher on https://cmake.org/download/. The last downloadable version of CMake that I see is 3.…
🌐
OS Radar
osradar.com › home › linux › how to install cmake on centos 8
How To Install CMake On CentOS 8 - Linux Windows and android Tutorials
June 11, 2020 - ./bootstrap · Then run the make ... of CMake with the help of SnapCraft. To do so hit the below listed commands. sudo yum install epel-release ·...
🌐
Command Not Found
command-not-found.com › cmake3
command-not-found.com – cmake3
apt-get install cmake · CentOS · yum install cmake · Fedora · dnf install cmake · Windows (WSL2) sudo apt-get update sudo apt-get install cmake · OS X · brew install cmake · Raspbian · apt-get install cmake · Dockerfile · ...
🌐
idroot
idroot.us › home › how to install cmake on centos 8
How To Install CMake on CentOS 8 - idroot
August 6, 2024 - You’ve successfully installed CMake on your CentOS 8 system. Installing CMake using Snap. Snap is a universal package manager that works across many Linux distributions, including CentOS 8. To install CMake using Snap: sudo yum ...