Default cmake version of 14.04 is 2.8. How can I install cmake 3.2 and replace the default one? Or how can I upgrade 2.8 to 3.2?
8 Answers
Either use a PPA or compile it yourself:
Installation by a PPA (Upgrade to 3.2)
sudo apt-get install software-properties-common sudo add-apt-repository ppa:george-edison55/cmake-3.x sudo apt-get updateWhen cmake is not yet installed:
sudo apt-get install cmakeWhen cmake is already installed:
sudo apt-get upgrade
Compile it yourself
Currently, the latest version is 3.2.2, the following instructions based on this version. You should therefore check this URL and adjust the file name accordingly.
sudo apt-get install build-essential wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz tar xf cmake-3.2.2.tar.gz cd cmake-3.2.2 ./configure makeNow you can have to choose an installation type to decide, I recommend installing with
checkinstall, as this creates a DEB package.With
checkinstallsudo apt-get install checkinstall sudo checkinstallWith
make installsudo make install
- 92,125
There are three options:
- install from a PPA
- install the pre-built binary distribution from cmake.org
- compile it yourself
Installation from PPA
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
When cmake is not already installed:
sudo apt-get install cmake
When cmake is already installed:
sudo apt-get upgrade
Installation from cmake.org binary distrubtion
curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | sudo tar -xzC /opt
CMake executables will be in /opt/cmake-3.5.2-Linux-x86_64/bin/.
Compile it yourself
Currently, the latest version is 3.5.2, the following instructions based on this version. You should therefore check the download page and adjust the file name accordingly.
sudo apt-get install build-essential
wget http://www.cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar xf cmake-3.5.2.tar.gz
cd cmake-3.5.2
./configure
make
Now you can have to choose an installation type to decide, I recommend installing with checkinstall, as this creates a DEB package.
with
checkinstallsudo apt-get install checkinstall sudo checkinstallwith
make installsudo make install
- 36,890
- 56
- 97
- 151
- 423
I am not sure if I am late to the party, but recently on Ubuntu 14.04 I faced same issues and this is how I got it solved. First, you need to remove the existing cmake by executing the command:
sudo apt-get remove cmake
Hit return or enter. Next, you need to install cmake3 by using the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake3
Assuming, my answer will get old in few years, consider searching for a cmake package that has a number associated with it. For example, at this time, cmake3 works for me.
To do so, all you have to execute is
apt-cache search cmake
Once you find the package, just install as suggested.
Thank you
Happy Coding!
- 241
Try to build it from source, install it and adjust your $PATH variables to make it available. Maybe you should add the exported variables to your bashrc. That is basically how I would do it, please change file and folder names to your needs:
sudo apt-get install build-essential
wget http://url.to/cmake-3.2-src.tar.gz
tar xzf cmake-3.2-src.tar.gz
cd cmake-3.2-src
./configure
make
# If make finishes without errors:
sudo make install
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake --version # This should give v3.2
- 417
Just install the latest from the sh from https://cmake.org/download/
cd /usr
sudo wget https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh -P /usr/
sudo chmod 755 /usr/cmake-3.8.2-Linux-x86_64.sh
sudo ./cmake-3.8.2-Linux-x86_64.sh
- 111