How to download, compile, and install CMake on Linux
CMake is a cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.
Here are the simple steps to download, configure, compile, and install CMake on a Linux machine. I have tested these instructions on Debian/Ubuntu Linux distributions but they should work on all Linux machines where compilers and make utilities are installed. Please take a look at configuring Ubuntu Linux after installation to configure your Debian/Ubuntu Linux box for the required tools.
Please make sure you check the downloaded file's integrity before unzipping it. '#' (w/o quotes) in front of commands below means you have to run the command as root user (or use sudo
Download:
$ wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
Extration of cmake source code from downloaded file:
$ tar xzf cmake-2.8.3.tar.gz $ cd cmake-2.8.3
Configuration:
If you want to see the available conifuration options, run command below.
$ ./configure --help
In order to configure cmake before installation, run command below.
$ ./configure --prefix=/opt/cmake
We basically instructed the install script to install CMake in /opt/cmake.
Compilation:
$ make
Installation:
# make install
Verification:
After installation without any errors you can verify the installation by running the command below:
$ /opt/cmake/bin/cmake -version
The output should look something like below (depending upon cmake version you are installing).
cmake version 2.8.3
Please feel free to use the comments form below if you have any questions or need more explanation on anything. Use the icons below to share this tutorial with your friends.
tags cloud
popular searches
free download for mysql database server 5.1.5, php, linux, mysql mysql, mysql, java, install mysql, gearman, ubuntu, tools, source code, bison, mysql initialization, install cairo, laptop
Similar Tutorials:
- Some Tricks used by the Linux kernel
- Download, configure, compile, and install MySQL 5.5 from source code on Linux
- Installing Gearman shared PECL extension for PHP on Debian/Ubuntu Linux
- Installing MySQL Client tools, binaries, and library on Ubuntu Linux
- Installing OpenSSL on Ubuntu Linux
Tutorials in 'Operating Systems > Linux' (more):
- How to download, compile, and install GNU ncurses on Debian/Ubuntu Linux
- How to install libevent on Debian/Ubuntu/Centos Linux
- How to install MySQL Gearman UDF on Ubuntu/Debian Linux
- Installing Gearman shared PECL extension for PHP on Debian/Ubuntu Linux
- Installing Gearman application framework on Debian Linux


Comments (write a comment):
Hey,
Thanks for this guide man.
It really helped my out as I am new on Ubuntu platform.
Keep helping others as well.
Regards,
Sunny Posted by: Sunny on May 12, 2011
when i got to the part with
./configure --prefix=/opt/cmake
it just says "command not found"
i even tried . configure...
and it still says the same thing. what a i doing wrong? Posted by: james on Dec 08, 2011
please make sure you cd into the cmake folder first before running the ./configure command. Posted by: shahryar ghazi on Dec 12, 2011
just awesome... Posted by: lalit on Dec 22, 2011
when i did /opt/cmake/bin/cmake -version
i get following message
bash: /opt/cmake/bin/cmake: No such file or directory Posted by: atraya on Dec 24, 2011
@atraya:that means cmake was not installed properly at that location ... are you sure you followed the instructions and did not see any error messages at the end of configure and make commands? Posted by: shahryar on Dec 25, 2011
Morning,
When i run the instruction : make install,
the result is :
CMake Error at cmake_install.cmake:36 (FILE):
file cannot create directory: /opt/cmake/doc/cmake-2.8. Maybe need
administrative privileges.
So, I can't to run - verification...
What's the meaning of messaege ? and what can I do to continue...
Thanks Posted by: mohammad on Jan 17, 2012
try running the command as root or sudo or use some other directory that is writeable by your username as the target directory.
In order to select a different target directory, you will have to restart from configure command and mention the writeable new target directory as the value for --prefix option of configure. Posted by: shahryar ghazi on Feb 01, 2012
@atraya try using :
cd bin
./cmake -version
./ is used for executable files
it should show the output :
cmake version 2.8.3 Posted by: Muqaddas Jamil on Mar 16, 2012
Yup it worked for me.
Thank you, it is very useful. I used it on RHEL 3. Posted by: Deepti on May 11, 2012
thanks man. I really need it. it was helpful Posted by: hojat on Oct 26, 2012
Thanks a lot! Posted by: ggd on Jan 02, 2013