问题描述
我在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
可执行文件。