So you say you want to download a rpm file from some repository but you don’t necessarily want to install it right away? Or perhaps you want to host it yourself. Well, how about using yumdownloader?
I haven’t played with the Lynx web browser since the mid 90s or so. The other day there was some talk in a forum I frequent wondering what the site would look like in Lynx. So curiosity got the best of me and rather than using yum I decided to install manually.
For this example I’m using a CentOS 6.5 droplet via Digital Ocean. Step one is determining whether or not the package exists on the system. I can do with with the -q flag to perform a query.
rpm -q lynx
package lynx is not installed
Ok, so as I suspected, Lynx isn’t installed. 🙂
Now I need to download the rpm file.
yumdownloader lynx
-bash: yumdownloader: command not found
Well, poo. So not even yumdownloader is installed. What to do now? Let’s try to find the package.
yum search yumdownloader
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: linux.cc.lehigh.edu
* extras: mirror.atlanticmetro.net
* updates: centos.mirror.constant.com
======================= Matched: yumdownloader=========================
yum-utils.noarch : Utilities based around the yum package manager
Sweet! So now we know that the package we’re after is actually inside the yum-utils package. So let’s use yum to install it!
yum install yum-utils
snip
Installed:
yum-utils.noarch 0:1.1.30-30.el6
Complete!
Now we can finally download Lynx!
yumdownloader lynx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: linux.cc.lehigh.edu
* extras: mirror.atlanticmetro.net
* updates: centos.mirror.constant.com
lynx-2.8.6-27.el6.x86_64.rpm
And a quick ls to confirm it’s in our directory:
ls -l
total 1404
-rw------- 1 root root 855 Dec 17 2013 anaconda-ks.cfg
-rw-r--r-- 1 root root 8815 Dec 17 2013 install.log
-rw-r--r-- 1 root root 3384 Dec 17 2013 install.log.syslog
-rw-r--r-- 1 root root 1413432 Jul 3 2011 lynx-2.8.6-27.el6.x86_64.rpm
Excited yet? I know I am! 🙂 Let’s get this puppy installed.
rpm -i lynx-2.8.6-27.el6.x86_64.rpm
error: Failed dependencies:
redhat-indexhtml is needed by lynx-2.8.6-27.el6.x86_64
Aargh! Ok, so we have a dependency to resolve. Let’s do this the easy way. We’ll use the –resolve flag to download any dependencies for the rpm.
yumdownloader --resolve lynx
Let’s see what happened.
ls -l
total 1496
-rw------- 1 root root 855 Dec 17 2013 anaconda-ks.cfg
-rw-r--r-- 1 root root 93552 Oct 24 08:17 centos-indexhtml-6-2.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 8815 Dec 17 2013 install.log
-rw-r--r-- 1 root root 3384 Dec 17 2013 install.log.syslog
-rw-r--r-- 1 root root 1413432 Jul 3 2011 lynx-2.8.6-27.el6.x86_64.rpm
Look at that. Notice that the dependency said ‘redhat-indexhtml’ but the file we downloaded is ‘centos-indexhmtl’. The former would have just generated another error so using the –resolve flag saved us a little trouble and heartache.
Now that we have all of the dependencies resolved, let’s install everything.
rpm -i centos-indexhtml-6-2.el6.centos.noarch.rpm
rpm -i lynx-2.8.6-27.el6.x86_64.rpm
No news is good news!
lynx www.linuxtoday.com
There you go! Now you can work with rpm files directly! Isn’t that special?