CentOS 8 —— DNF 管理器如何仅下载不安装软件
在某些情况下,我们希望从命令行下载特定或一组 RPM 包而不安装它。虽然我们可以使用 wget 命令下载,但 wget 不会下载安装包的依赖项。
在 CentOS 8 中DNF(或 yum)是一个命令行包管理工具。使用 DNF我们可以安装、更新和删除 rpm 包。除此之外,它还可以用于下载软件包以及依赖项,而无需安装它们。
下载指定的RPM安装包
下面使用
download
子命令在当前目录下载指定安装包:该命令在当前目录下载cifs-utils 包。它不会下载依赖项。下面查看一下是否下载完成:
下载 RPM 和依赖项
在 dnf 中使用
--downloadonly
选项,可以下载 rpm 包及其依赖项。我们还可以使用--downloaddir
选项指定下载的位置。下面在/root/package目录下载ansible相关的安装包:
[root
@localhost ~]# mkdir /root/
package[root
@localhost ~]# dnf install -y ansible --downloadonly --downloaddir=/root/
package可以验证一下,是否已经下载了ansible和相关的依赖项:
现在我们就可以将这些安装包压缩起来,传入到没有连接网络的服务器中安装。
[root
@localhost ~]# tar -zcvf ansible-installer.tar.gz /root/
package下载一组安装包
假设我们要下载
Development Tools
组下的所有软件包,可以使用下面命令来安装:[root
@localhost ~]# dnf groupinstall -y
"Development Tools" --downloadonly --downloaddir=/root/
package进入/root/package目录,验证一下是否下载相关软件包
总 结
每当我们使用 dnf 命令下载安装包时,如果没有使用
--downloadidr
标志,那么包将被下载到
/var/cache/dnf/baseos-xxxx/packages
,
/var/cache/dnf/appstream-xxxx/packages
,
/var/cache/dnf/epel-xxxx/packages
目录中。官方站点:www.linuxprobe.com
Linux命令大全:www.linuxcool.com
刘遄老师QQ:5604241
Linux技术交流群:3762708
(新群,火热加群中……)
想要学习Linux系统的读者可以点击"阅读原文"按钮来了解书籍《Linux就该这么学》,同时也非常适合专业的运维人员阅读,成为辅助您工作的高价值工具书!
阅读原文 最新评论
推荐文章
作者最新文章
你可能感兴趣的文章
Copyright Disclaimer: The copyright of contents (including texts, images, videos and audios) posted above belong to the User who shared or the third-party website which the User shared from. If you found your copyright have been infringed, please send a DMCA takedown notice to [email protected]. For more detail of the source, please click on the button "Read Original Post" below. For other communications, please send to [email protected].
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。