我在 centos 7 上,只需要下载一个没有依赖项的包, yum-downloadonly 似乎是正确的工具,但是当我执行 sudo yum install yum-downloadonly 或 sudo yum install yum-plugin-downloadonly 等命令时,我得到:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Warning: No matches found for: downloadonly
对于第一个命令,对于第二个命令,我得到:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package yum-3.4.3-168.el7.centos.noarch already installed and latest version
Nothing to do
当尝试 sudo yum search downloadonly 时,我得到:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Warning: No matches found for: downloadonly
No matches found
当然,当我尝试使用它并希望 yum 以某种方式得到它时,我得到:
install: unrecognized option '--downloadonly'
Try 'install --help' for more information.
所以我的问题是,我必须做什么才能下载插件,或者如果失败,只下载没有插件的包。
答案1
它的 yum 语法是yum install --downloadonly package_name
将 rpm 下载到 /var/cache/yum/$arch/$repo/packages (除非您还使用选项--downloaddir=/tmp
),如果软件包已安装,请使用yum reinstall --downloadonly package_name
。但它也会下载所有先决条件。但无论如何,downloadonly 选项不是 yum 插件。