centos7 中 升级cmake
001、
(base) [root@pc1 build]# cat /etc/redhat-release ## 系统 CentOS Linux release 7.6.1810 (Core) (base) [root@pc1 build]# cmake --version ## 当前cmake版本 cmake version 2.8.12.2
002、卸载当前版本
yum remove cmake -y
003、安装需要的模块
yum install -y libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel zstd libzstd-devel curl libpng libpng-devel
004、下载安装包
wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1.tar.gz
005、解压、编译
tar -xzvf cmake-3.24.1.tar.gz cd cmake-3.24.1/ mkdir cmake-3.24.1-build cd cmake-3.24.1-build/ ../configure --prefix=/usr/local/cmake-3.24.1 gmake -j2 gmake install
006、配置环境变量
touch /etc/profile.d/cmake.sh chmod 777 /etc/profile.d/cmake.sh echo -e '\nexport PATH=/usr/local/cmake-3.24.1/bin:$PATH\n' >> /etc/profile.d/cmake.sh source /etc/profile.d/cmake.sh
007、测试配置效果
(base) [root@pc1 bin]# cmake --version cmake version 3.24.1 CMake suite maintained and supported by Kitware (kitware.com/cmake).