When working with Linux, especially Fedora, CentOS, or RHEL distributions, the DNF or “Dandified YUM” is an indispensable tool. DNF is the next-generation version of the Yellowdog Updater, Modified (YUM), a package manager for .rpm systems.
Often, you may need to download package dependencies without necessarily installing them. This guide provides a detailed step-by-step process for accomplishing this task using DNF.
Prerequisites
This tutorial assumes that you’re using a Linux distribution that uses DNF as the package manager. If your system uses YUM, it may be possible to perform similar tasks, but the specific steps and commands can vary.
Step 1: Update Your System
Before you proceed with the actual download process, it’s important to ensure your system is up-to-date. Run the following command:
sudo dnf update -y
This command updates all the packages on your system. It’s a good practice to keep your system updated, as this helps fix bugs, patch security vulnerabilities, and install the latest features.
Step 2: Check the DNF Download Plugin
DNF has a plugin system that allows for added functionality. To download packages without installing, you’ll need the dnf-plugins-core package, which includes the download plugin.
You can check if it’s installed with this command:
sudo dnf list installed dnf-plugins-core
If it’s installed, you’ll see it in the list. If not, you can install it using:
sudo dnf install dnf-plugins-core -y
Step 3: Downloading Package Dependencies
Now that the download plugin is available, you can use it to download a package and its dependencies. Here is the basic command structure:
1 | sudo dnf download --resolve <package-name> |
Replace <package-name> with the name of the package you want to download. The --resolve
flag tells DNF to resolve and download dependencies.
For example, if you want to download the ‘nano’ editor and its dependencies, you would use:
sudo dnf download --resolve nano
The package and its dependencies will be downloaded to the current working directory.
Step 4: Inspect the Downloaded Packages
After the download process is complete, you can list the directory contents to see the downloaded packages. Each package will be a .rpm file:
ls
This lists all the files in the current directory. You should see the package files for the desired package and its dependencies.
Final Words
By following the steps above, you have successfully downloaded a package and its dependencies without installing them. This feature can be incredibly useful, particularly when you want to inspect package content without installing or when working with systems that, for security or other reasons, cannot be updated via standard methods. It’s just one more reason why mastering DNF can greatly enhance your effectiveness as a Linux user.
Remember to exercise caution when downloading and using packages, always verify that the source of your packages is trustworthy. Keep exploring the vast world of Linux!