CentOS 7中提供的cmake比CentOS 8中提供的新版本?

问题描述

我在2个VM上安装了CentOS 7和CentOS 8。两者都启用了epel

CentOS 7:

$ cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)

$ yum repolist
...
repo id                                                                                              repo name                                                                                                                          status
base/7/x86_64                                                                                        CentOS-7 - Base                                                                                                                    10070
epel/x86_64                                                                                          Extra Packages for Enterprise Linux 7 - x86_64                                                                                     13445
extras/7/x86_64                                                                                      CentOS-7 - Extras                                                                                                                    413
updates/7/x86_64                                                                                     CentOS-7 - Updates                                                                                                                  1127
repolist: 25055

CentOS 8:

$ cat /etc/redhat-release 
CentOS Linux release 8.2.2004 (Core) 

$ yum repolist
repo id                                                                                           repo name
AppStream                                                                                         CentOS-8 - AppStream
BaSEOS                                                                                            CentOS-8 - Base
PowerTools                                                                                        CentOS-8 - PowerTools
epel                                                                                              Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                                                      Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                                                            CentOS-8 - Extras

CentOS 7上,cmake3可从epel回购中获得,并提供cmake版本3.17。

$ yum provides cmake3
...
cmake3-3.17.3-3.el7.x86_64 : Cross-platform make system
Repo        : epel

CentOS 8上,cmake3的仓库中可以使用AppStream,并提供cmake版本3.11。

$ yum provides cmake3
...
cmake-3.11.4-7.el8.x86_64 : Cross-platform make system
Repo        : @System
Matched from:
Provide    : cmake3 = 3.11.4-7.el8

我尝试禁用除epel之外的所有存储库,但它仍与AppStream中的存储库一起返回(这对我来说似乎很不直观-如果我已经这样做,肯定不会返回任何内容)禁用所有其他存储库?)

$ yum --disablerepo=* --enablerepo=epel info cmake
Last Metadata expiration check: 0:21:06 ago on Fri 11 Sep 2020 09:44:08 AM UTC.
Installed Packages
Name         : cmake
Version      : 3.11.4
Release      : 7.el8
Architecture : x86_64
Size         : 24 M
Source       : cmake-3.11.4-7.el8.src.rpm
Repository   : @System
From repo    : AppStream
Summary      : Cross-platform make system
URL          : http://www.cmake.org
License      : BSD and MIT and zlib
Description  : CMake is used to control the software compilation process using simple
             : platform and compiler independent configuration files. CMake generates
             : native makefiles and workspaces that can be used in the compiler
             : environment of your choice. CMake is quite sophisticated: it is possible
             : to support complex environments requiring system configuration,preprocessor
             : generation,code generation,and template instantiation.

我在pkgs.org上进行了搜索,显然cmake-3.11似乎是CentOS 8可用的最新版本。

除了从源代码构建之外,还有其他方法可以在cmake上获得CentOD 8的较新版本吗?

解决方法

运行cmake: 3.11.4时,仍会列出yum info版本,因为它已经已安装,因此禁用AppStream存储库不会影响显示的内容。如果只想显示可用软件包(基于启用的yum存储库),则可以运行以下软件包:

yum --disablerepo=* --enablerepo=epel info cmake --available

如果要安装最新版本的CMake(或其他版本),则始终可以从CMake download page下载二进制发行版。

下载后,您可以将软件包解压缩到机器上可以访问的位置,例如:

mkdir ~/cmake
tar xvzf ~/Downloads/cmake-3.18.2-Linux-x86_64.tar.gz -C ~/cmake

最后,请确保将提取的bin目录添加到PATH环境变量中,以便可以从命令行运行cmake可执行文件。