赞
踩
[root@localhost ~]# cmake -version
cmake version 2.8.12.2
[root@localhost ~]# yum remove -y cmake
[root@localhost ~]# mkdir /opt/cmake
[root@localhost ~]# cd /opt/cmake/
|cmake下载官网地址是:https://cmake.org/download/,可以在这里下载需要的版本,然后拷贝到linux下进行 tar解压
(可以选择)[root@localhost cmake]# wget https://cmake.org/files/v3.16/cmake-3.26.0-rc3.tar.gz
[root@localhost cmake]# tar -zxvf cmake-3.26.0-rc3.tar.gz
[root@localhost cmake]# yum install -y gcc gcc-c++
[root@localhost cmake]# cd cmake-3.26.0-rc3
[root@localhost cmake]# ./configure --prefix=/usr/local/cmake
[root@localhost cmake-3.26.0-rc3]# make && make install
[root@localhost cmake-3.26.0-rc3]# ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
[root@localhost cmake-3.26.0-rc3]# cmake -version
cmake version 3.26.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
[root@localhost cmake-3.26.0-rc3]#
[root@localhost cmake-3.26.0-rc3]#
如果第9步不想创建链接的话,也可以修改环境变量
[root@localhost ~]# vim /etc/profile
...
export CMAKE_HOME=/usr/local/cmake
export PATH=$PATH:$CMAKE_HOME/bin
刷新配置
[root@localhost ~]# source /etc/profile
Centos7 升级 cmake v3.26.0 操作完毕!
#getconf LONG_BIT
mkdir app
cd /app
wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
tar xzvf cmake-3.3.2.tar.gz
yum install gcc-c++
cd cmake-3.3.2
./bootstrap
gmake
make install
调整启动版本
基本步骤:解压cmake安装包之后,在解压得到的文件夹内依次运行
./bootstrap
gmake
make install
安装时间较长,大概需要20分钟左右
关键步骤
修改环境变量:
vim ~/.bashrc
在bashrc中添加:
export PATH=/tmp/cmake/cmake-3.26.0-rc3/bin:$PATH
路径为解压cmake的路径
(自行根据实际情况对该路径进行修改)然后查看cmake版本:
cmake --version
如何在CentOS中安装cmake
1、系统:CentOS 6.4 i386 (min)
2、登录用户:root
3、版本:CMake 3.14
步骤一、安装gcc等必备程序包(已安装则略过此步)
yum install -y gcc gcc-c++ make automake
步骤二、安装wget (已安装则略过此步)
yum install -y wget
步骤三、获取CMake源码包
wget https://github.com/Kitware/CMake/releases/download/v3.14.0-rc2/cmake-3.14.0-rc2.tar.gz
步骤四、解压CMake源码包
tar -zxvf cmake-3.14.0-rc2.tar.gz
步骤五、进入目录
cd cmake-3.14.0-rc2
步骤六
./bootstrap
步骤七
make
步骤八
sudo make install
#步骤六到八可以直接运行
./bootstrap && make && sudo make install
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。