How to Download RPM Packages Without Installing on RHEL 8

DNF is a package management command line utility on RHEL distributions like Red Hat Enterprise Linux, CentOS Stream and Fedora. Usually, DNF or Yum command is used to install, update and remove rpm packages from command line.

Apart from this, dnf can also be used to download packages locally on the system without installing. In this guide, we will learn how to download rpm packages without installing them on RHEL 8.

Note: There are some setups where we don’t have internet connectivity on RHEL systems, but we have a task to install some packages, may be from some external repository like EPEL. So, in this situation, downloading RPM packages becomes handy. We can download the packages on RHEL systems where we have internet connectivity and then will transfer those packages to remote systems.

Let’s suppose we want to download bind and bind-utils packages along with its dependencies. Login to RHEL 8 system, open the terminal and run following commands.

Note: Below steps are also applicable for Rocky Linux 8, CentOS 8 stream and AlmaLinux OS 8.

Downloading RPM Packages Without Installing

1) First create a directory where we will download packages.

$ mkdir bind-pkg

2) Run dnf command with –downloadonly and –downloaddir options

$ sudo dnf install --downloadonly --downloaddir bind-pkg bind bind-utils

In above command, –downloadonly will instruct dnf command to download bind packages along with its dependencies without installing it. –downloaddir will instruct dnf command to download packages to directory ‘bind-pkg’.

Output of above command,

RPM-Package-Download-DNF-Command-RHEL8

3) Verify the downloaded packages using ls command,

$ ls -l bind-pkg/

Verify-downloaded-packages-rhel8

Now we can make an archive file using tar command and then we can transfer it to the system where we want to install bind server.

$ tar zcpvf bind-packages.tgz bind-pkg/

Archive-Downloaded-Packages-RHEL8

While downloading the packages using dnf command, if we don’t specify —downloadidr option then packages will be downloaded to ‘/var/cache/dnf/baseos-xxxxxxx/packages/’, ‘/var/cache/dnf/appstream-xxxxx/packages’ and ‘/var/cache/dnf/epel-xxxxxxxx/packages/’.

Appstream-Baseos-Packages-Cache-Directory

That’s all from this guide. I hope you have found it informative. Please don’t hesitate to share your queries and feedback in below comments section.

Leave a Comment

11 − 8 =