1.环境
我测试过的环境:
- 虚拟机CentOS-7.5
- 云服务器 CentOS 7.9
git 安装命令为 yum install git
2.安装包
Index of /files/LatestRelease (cmake.org)下载地址
官网下载较慢,可以在码云上克隆
https://gitee.com/luo-lylg/cmake.git
这里我就克隆了
git clone https://gitee.com/luo-lylg/cmake.git
解压文件
cd cmake
tar -xzvf cmake-3.27.0-linux-x86_64.tar.gz
3. 配置环境变量
配置环境变量(回到root下)
修改/etc/profile
vim /etc/profile
在最后一行的下面添加以下内容
PATH="$PATH:/root/cmake/cmake-3.27.0-linux-x86_64/bin"
export PATH
执行命令使其配置生效
source /etc/profile