How to reinstall the latest cmake version?
Solution 1
Following the comments made on how to Install the latest CMake version and to post the answer for this question:
Ans:
This depends with Ubuntu OS version currently installed on your PC or Mac. If you have the following Ubuntu OS version then you have this CMake installed or that you could install and reinstall with "sudo apt-get install cmake". Even if you uninstall your version and try to reinstall later version.
Ubuntu 16.04 ships with cmake-3.5.1
Ubuntu 17.10 ships with cmake-3.9.1
Ubuntu 18.04 ships with cmake-3.10.2
Ubuntu 20.04 ships with cmake-3.16.3
Ubuntu 21.04 ships with cmake-3.18.4
Now if you have Ubuntu 16.04 installed and you want cmake-3.10, there is OS problem since you can only install and reinstalled cmake-3.5.1. To get cmake-3.10 or any other version, you have to download and install the package from https://packages.ubuntu.com/. Once you find the latest version of cmake .targz files, you have to build it yourself from the command line.
Solution 2
As far as I know the best way to get the latest CMake version installed on any Linux is not by apt but using pip.
Remove the apt cmake and install the latest version from pip which can easily keep up-to-date.
apt remove cmake
pip install cmake --upgrade
Solution 3
Edit: As GNUton has pointed out, the following only works on Ubuntu 16.04 and 18.04(Checked on June 2019).
Now CMake developer team in Kitware Inc provides APT repositiory. It allows you to install latest CMake via apt-get.
-
If you are using a minimal Ubuntu image or a Docker image, you may need to install the following packages:
sudo apt-get update sudo apt-get install apt-transport-https ca-certificates gnupg \ software-properties-common wget
-
Obtain a copy of our signing key:
wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add -
-
Add the repository to your sources list and update.
For Ubuntu Bionic Beaver (18.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' sudo apt-get update
For Ubuntu Xenial Xerus (16.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' sudo apt-get update
- ... Optional steps. See details in reference.
-
... Optional steps. See details in reference.
Now call
sudo apt-get install cmake
Reference: Kitware APT Repository.
Solution 4
You can try the following steps that have worked for me on Ubuntu 18.04.3 LTS as OS of the NVIDIA jetson Nano to get the last version of cmake "cmake-3.14.0" from https://cmake.org/download/.
Delete the installed version in your system
sudo apt purge cmake
Download cmake3.13.4 source
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz
Extract files
tar zxvf cmake-3.13.4.tar.gz
Execute the following commands in this order to build it
cd cmake-3.13.4
sudo ./bootstrap
sudo make
sudo make install
Verify the version is installed correctly
cmake --version
Solution 5
For CentOS/RHEL you can help these following steps:
yum -y install python-pip
pip install cmake --upgrade
Juniar
I am an ardent Programmer, Programming in C++, Java, C with Javascript, Angular JS, AWS S3, EC2, RDS, CloudFront, JQuery, CSS Including DBs SQL Server, MySQL and Opengl etc. I am interested in Computer Graphics and an enthusiast. Ceaseless Cloud Computing in addition with Data Science.
Updated on July 09, 2022Comments
-
Juniar almost 2 years
I would like to install cmake the latest version, on Linux environment. I have cmake version 3.5 installed and is not supported by some applications. I tried to upgrade it by uninstalling the current version. But when I reinstall with sudo apt-get install cmake, I get the same version 3.5 re-installed. How do I install the latest version with sudo apt-get install ....?