Install cmake in unroot account of unix

Under the unix sys, when you are unroot account, you cannot directly install camke or other softwares in root directory. This is a tutorial about how to install them in your directory.

All Starting with Trinity installation

  • After I used wget to download trinity and installed it, it reported that I needed cmake version higher than 3. The cmake in server is too old so I needed to re-install it. Create new directory:
1
$ mkdir cmake

Download cmake latest version:

1
$ wget https://github.com/Kitware/CMake/releases/download/v3.17.2/cmake-3.17.2.tar.gz

Unzip the file:

1
$ tar -zvxf cmake-3.17.2.tar.gz

Start installation:

1
2
3
4
5
$ cd cmake-3.17.2
$ ./bootstrap
$ ./configure --prefix=/home/jia/local/cmake  
$ make
$ make install
  • Configure the bashrc file. It’s a very important step!
1
$ vim ~/.bashrc

Write the code into the file:

1
export PATH=/home/jia/local/cmake/bin:$PATH

Source it:

1
$ source ~/.bashrc

Check the version:

1
2
3
4
$ cmake -version
cmake version 3.17.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Done!