What is yum download-only on CentOS
Yum is the package installer for all RHEL-based systems. That’s Red Hat, CentOS, Oracle Linux and ClearOS to name a few. Yum has many options and here we are going to explain the yum download-only option.
Yum Download-Only
The download option just downloads a package to your VPS Server without installing it. It’s a plugin that can be installed via yum and is not included by default on CentOS 5 or 6 but it is included in CentOS 7 systems.
Install Yum Download-Only
To install the plugin and enable as an option use the commands below
CentOS 6
yum install yum-plugin-downloadonly
CentOS 5
yum install yum-downloadonly
You should now be able to download a package to your sevrer without installing it. Let’s try a test file. We will download OpenVPN to our tmp folder.
yum install --downloadonly --downloaddir=/tmp openvpn.x86_64
CT-4452 tmp ls -ltr /tmp
total 592
-rw-r--r-- 1 root root 57220 Dec 3 2014 pkcs11-helper-1.11-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 536771 Apr 24 21:46 openvpn-2.4.9-1.el7.x86_64.rpm
Here we can see we have downloaded OpenVPN with yum but not installed it. You can specify any directory to download to by using the –downloaddir=/tmp switch.
Enable Download Only
If upon installing the download-only plugin, the command does not work check to ensure the plugin is enabled. (CentOS 5 & 6 only)
nano /etc/yum/pluginconf.d/downloadonly.conf
Change enabled=0 to enabled=1
enabled=1
If you don’t specify a location for the plugin to download to then programs are downloaded to the /var/cache/yum/ in rhel-{arch}-channel/packages file