Last Updated: February 25, 2016
·
639
· ajithhub

Download packages with yum

Source: http://www.cyberciti.biz/faq/yum-downloadonly-plugin/

When you need to get your hands on the RPM package that you would install on your local system, it is really hard to just go searching, or try to browse the repos yourself. You may as well just use yum to resolve the package location and download it for you

Install the downloadonly pluigin for yum

$ sudo yum install yum-downloadonly

Perform a yum operation that would trigger a download

$ sudo yum install libvirt-python -y --downloadonly --downloaddir=/tmp/packages 

$ find /tmp/packages/                       
/tmp/packages/                                                
/tmp/packages/polkit-0.96-5.el6_4.x86_64.rpm                  
/tmp/packages/polkit-0.96-5.el6_4.i686.rpm                    
/tmp/packages/libvirt-python-0.10.2-18.el6_4.14.x86_64.rpm    
/tmp/packages/libvirt-client-0.10.2-18.el6_4.14.x86_64.rpm    
/tmp/packages/libvirt-0.10.2-18.el6_4.14.x86_64.rpm           

Extract the contents of the package

If you need to inspect the contents you can extract them and do as you like. This will extract all the files into the target directory structure, but rooted in the working dir.

$ rpm2cpio  /tmp/packages/libvirt-python-0.10.2-18.el6_4.14.x86_64.rpm    |cpio -id
$ find ./
./
./usr
./usr/share
./usr/share/doc
./usr/share/doc/libvirt-python-0.10.2
./usr/share/doc/libvirt-python-0.10.2/uuid.py
./usr/share/doc/libvirt-python-0.10.2/python
./usr/share/doc/libvirt-python-0.10.2/python/esxlist.py
./usr/share/doc/libvirt-python-0.10.2/python/domstart.py
./usr/share/doc/libvirt-python-0.10.2/python/domsave.py
./usr/share/doc/libvirt-python-0.10.2/python/domrestore.py
./usr/share/doc/libvirt-python-0.10.2/python/dominfo.py
./usr/share/doc/libvirt-python-0.10.2/python/consolecallback.py
./usr/share/doc/libvirt-python-0.10.2/python/README
./usr/share/doc/libvirt-python-0.10.2/python/Makefile.am
./usr/share/doc/libvirt-python-0.10.2/node.py
./usr/share/doc/libvirt-python-0.10.2/events-python
./usr/share/doc/libvirt-python-0.10.2/events-python/event-test.py
./usr/share/doc/libvirt-python-0.10.2/error.py
./usr/share/doc/libvirt-python-0.10.2/create.py
./usr/share/doc/libvirt-python-0.10.2/basic.py
./usr/share/doc/libvirt-python-0.10.2/TODO
./usr/share/doc/libvirt-python-0.10.2/README
./usr/share/doc/libvirt-python-0.10.2/NEWS
./usr/share/doc/libvirt-python-0.10.2/COPYING.LIB
./usr/share/doc/libvirt-python-0.10.2/AUTHORS
./usr/lib64
./usr/lib64/python2.6
./usr/lib64/python2.6/site-packages
./usr/lib64/python2.6/site-packages/libvirt.pyc
./usr/lib64/python2.6/site-packages/libvirt.pyo
./usr/lib64/python2.6/site-packages/libvirt_qemu.pyc
./usr/lib64/python2.6/site-packages/libvirt_qemu.pyo
./usr/lib64/python2.6/site-packages/libvirtmod_qemu.so
./usr/lib64/python2.6/site-packages/libvirtmod.so
./usr/lib64/python2.6/site-packages/libvirt_qemu.py
./usr/lib64/python2.6/site-packages/libvirt.py