为什么 yum install 有效,但 yum search 和 yum info 无效?
Why does yum install work, but yum search and yum info not?
我运行 CentOs 8 上的以下命令
$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
我从一个干净且更新的 yum 数据库开始:
$ yum clean all
46 files removed
$ yum update
CentOS-8 - AppStream 18 MB/s | 5.8 MB 00:00
CentOS-8 - Base 15 MB/s | 2.2 MB 00:00
CentOS-8 - Extras 121 kB/s | 7.9 kB 00:00
CentOS-8 - PowerTools 9.0 MB/s | 1.9 MB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 271 kB/s | 117 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 26 MB/s | 8.0 MB 00:00
yum Dependencies resolved.
Nothing to do.
Complete!
如果我用 yum 搜索 cmake3
包,或试图显示详细信息,它不起作用:
$ yum search cmake3
Last metadata expiration check: 0:01:03 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
No matches found.
$ yum info cmake3
Last metadata expiration check: 0:02:24 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
Error: No matching Packages to list
如果我尝试安装 cmake3
包,它会安装 cmake
包
$ yum install cmake3
Last metadata expiration check: 0:22:10 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
Dependencies resolved.
==============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================
Installing:
cmake x86_64 3.11.4-7.el8 AppStream 8.1 M
Installing dependencies:
cmake-data noarch 3.11.4-7.el8 AppStream 1.3 M
cmake-filesystem x86_64 3.11.4-7.el8 AppStream 40 k
cmake-rpm-macros noarch 3.11.4-7.el8 AppStream 39 k
libuv x86_64 1:1.23.1-1.el8 AppStream 134 k
Transaction Summary
==============================================================================================================================================================================================================================================
Install 5 Packages
Total download size: 9.7 M
Installed size: 29 M
Is this ok [y/N]:
这里发生了什么?为什么 search
和 info
失败,但 install
成功(并安装略有不同的包)?
由于 cmake3
由 cmake
包提供,该包将由 yum install
安装,因为不存在具有确切 cmake3
名称的包:
# yum provides cmake3
cmake-3.11.4-7.el8.x86_64 : Cross-platform make system
Repo : AppStream
Matched from:
Provide : cmake3 = 3.11.4-7.el8
yum
联机帮助页中有一个类似的示例(在 RHEL8 中重定向到 dnf
):
dnf install vim
DNF will automatically recognize that vim is not a package name, but will look up and install a package that provides vim with all the required dependencies. Note: Package name match has precedence over package provides match.
我运行 CentOs 8 上的以下命令
$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
我从一个干净且更新的 yum 数据库开始:
$ yum clean all
46 files removed
$ yum update
CentOS-8 - AppStream 18 MB/s | 5.8 MB 00:00
CentOS-8 - Base 15 MB/s | 2.2 MB 00:00
CentOS-8 - Extras 121 kB/s | 7.9 kB 00:00
CentOS-8 - PowerTools 9.0 MB/s | 1.9 MB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 271 kB/s | 117 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 26 MB/s | 8.0 MB 00:00
yum Dependencies resolved.
Nothing to do.
Complete!
如果我用 yum 搜索 cmake3
包,或试图显示详细信息,它不起作用:
$ yum search cmake3
Last metadata expiration check: 0:01:03 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
No matches found.
$ yum info cmake3
Last metadata expiration check: 0:02:24 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
Error: No matching Packages to list
如果我尝试安装 cmake3
包,它会安装 cmake
包
$ yum install cmake3
Last metadata expiration check: 0:22:10 ago on Fri 11 Sep 2020 07:47:47 AM UTC.
Dependencies resolved.
==============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================
Installing:
cmake x86_64 3.11.4-7.el8 AppStream 8.1 M
Installing dependencies:
cmake-data noarch 3.11.4-7.el8 AppStream 1.3 M
cmake-filesystem x86_64 3.11.4-7.el8 AppStream 40 k
cmake-rpm-macros noarch 3.11.4-7.el8 AppStream 39 k
libuv x86_64 1:1.23.1-1.el8 AppStream 134 k
Transaction Summary
==============================================================================================================================================================================================================================================
Install 5 Packages
Total download size: 9.7 M
Installed size: 29 M
Is this ok [y/N]:
这里发生了什么?为什么 search
和 info
失败,但 install
成功(并安装略有不同的包)?
由于 cmake3
由 cmake
包提供,该包将由 yum install
安装,因为不存在具有确切 cmake3
名称的包:
# yum provides cmake3
cmake-3.11.4-7.el8.x86_64 : Cross-platform make system
Repo : AppStream
Matched from:
Provide : cmake3 = 3.11.4-7.el8
yum
联机帮助页中有一个类似的示例(在 RHEL8 中重定向到 dnf
):
dnf install vim
DNF will automatically recognize that vim is not a package name, but will look up and install a package that provides vim with all the required dependencies. Note: Package name match has precedence over package provides match.