How to Install CMake 3.0 on CentOS 6 / CentOS 7


Follow the step below to install CMake 3.0 on CentOS 7:

  • Download cmake-3.0.0.tar.gz to a folder, e.g. /home/user/Downloads
  • Open a terminal and run below commands:

tar -zxvf cmake-3.0.0.tar.gz

image
     This will unpack the gz file to a folder cmake-3.0.0 under the Downloads folder

image

 

  • In the terminal and run below commands:

cmake-3.0.0
./bootstrap
gmake
sudo gmake install

    It will take several minutes to build cmake out of source files.

image

But If you run the command below, you will see the cmake version is still the old 2.82 or earlier version!

cmake –version

image

  • Now in the terminal, type below commands

sudo mv cmake-3.0.0 /usr/local/

    This move the newly built output folder

Downloads/cmake-3.0.0/       ==>
/usr/local/cmake-3.0.0/

  • Edit ~/.bashrc file, add the directory /usr/local/cmake-3.0.0/bin to the PATH variable:

gedit ~/.bashrc

    At the end of .bashrc file, add below line to add the cmake/bin folder to system path:

PATH=/usr/local/cmake-3.0.0/bin:$PATH
export PATH

image

  • Next, in the terminal, type below commands

cd /usr/local/cmake-3.0.0
mkdir share
cp -R /usr/local/share/cmake-3.0/ share/

image

This copies folder
     usr/local/share/cmake-3.0/       ==>
     usr/local/cmake-3.0.0/share/

If you don’t do so, errors will pop up and complain that the share folder is not accessible to centOS!

Now, rerun the below command and you will succeed! 

cmake –version

image

8 thoughts on “How to Install CMake 3.0 on CentOS 6 / CentOS 7

  1. Pingback: Building KDE (Plasma) 5 on RHEL / CentOS 7 « D. C. Southwick

  2. Pingback: Recent hot posts | Xinyustudio

  3. Pingback: Install Simple-2.5 (therefore cmake-3.8 and gcc-4.9.2) on Cent OS 7 | Bits and Dragons

  4. jimbomorrison

    Works for me (thanks!) … though warning copying/pasting the cmake -version failed because the - character was odd… writing it out tho shows the correct version.

Leave a comment