The “yum downloadonly” is a plugin for the yum package manager in CentOS (and other distributions based on Red Hat Enterprise Linux). It allows users to download the package without the installation process. It could be useful in cases where you have limited internet bandwidth and don’t want to install the package right away or want to take a backup of packages.
This post will address the usage of the “yum downloadonly” command without installing it on the system.
- Install the “yum-plugin-downloadonly” Package
- Use “yum downloadonly” to Download the Package
- Download the Specific Package Without Installation
- Specify a Different Directory to Download Package
- Download Multiple Packages Without Installation
Prerequisites: Install the “yum-plugin-downloadonly” Package
You need first to install the “yum-plugin-downloadonly” package to use “yum downloadonly“:
$ sudo yum install yum-plugin-downloadonly
How to Use “yum downloadonly” to Download the Package Without Installation?
Before getting into examples, let’s look at the syntax of the “–downloadonly”:
$ yum --downloadonly [options] [package]
In the above syntax, the “package” parameter is the name of the package you want to download.
Example 1: Download the Specific Package Without Installation
To download the package without installing it, the “yum” is utilized with the “–downloadonly” utility by specifying the package name as “cockpit-packagekit.x86_64”:
$ sudo yum --downloadonly install cockpit-packagekit.x86_64
The package will be downloaded to the directory specified by the “cachedir” parameter in the “/etc/yum.conf” file. By default, it is located in the “/var/cache/yum/” folder.
Example 2: Specify a Different Directory to Download Package
You can specify a different directory to download the package using the “downloaddir” option. In our case, specify the “cockpit-packagekit.x86_64” package to download in the directory “/home/itslinuxfoss”
$ sudo yum --downloadonly --downloaddir=/home/itslinuxfoss install cockpit-packagekit.x86_64
The output shows that the specified package will be downloaded to the “/home/itslinuxfoss” directory.
Example 3: Download Multiple Packages Without Installation
Users can also download multiple packages without installing them. For example, the packages “cockpit-packagekit.x86_64” and “compat-libpackagekit-glib2-16.x86_64” will be downloaded using the command:
$ sudo yum --downloadonly install cockpit-packagekit.x86_64 compat-libpackagekit-glib2-16.x86_64
The output confirms that both mentioned packages have been successfully downloaded.
Note: To install the downloaded RPM package file, execute the “sudo yum install package-file.rpm” command in the terminal.
Conclusion
The “yum –downloadonly [options] [package]” command allows users to download packages without installing them in CentOS. It is helpful to download a package and then manually transfer it to other machines. Additionally, users can specify the location where to download the package. This article has explained the usage of the “yum downloadonly” for downloading the package without installation.