Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

what I'm trying to is to make a USB disk with local repository / directory for offline installation (or upgrade) of Linux servers. Why !? Simple, I’m working on maintenance of huge cluster of asterisk IP PBX-es, asterisk (and dahdi, and ...) is build against kernel sources, and if version of kernel is changed (different from one I'm used to build), then it is a disaster waiting to happen. Now, my idea is to place all rpm's / srpm's that are installed on one server (development) and install / upgrade all other servers to same version of rpm's. Easy way to do this is to force YUM to download all installed rpm's to some directory, then copy them to usb-flash_disk and do on all other servers "yum install ./*.rpm" !? So then I'm having all systems at same revision!

Question is : how to tell YUM to (only) download all rpm's that are installed ???

share|improve this question
up vote 2 down vote accepted

There are 2 options

Either use rpm (Red Hat Package Manager) or yum (Yellowdog Updater/Modifier)

1) RPM

rpm -qa > to_be_installed; while read -r package; do yum -y install "$package"; done < to_be_installed

2) YUM

yum list installed | awk '{print $1}' > to_be_installed; while read -r line; do yum -y install "$line"; done < to_be_installed

Hope this gives you some ideas how to do it.

share|improve this answer
Yes that is (first) part of my problem (TNX), but much more dubios problem is how to tel YUM to download rpm's with out installing/reinstalling them ??? – VuLe Nov 21 '12 at 12:40
You can use yumdownloader as follow yum list installed | awk '{print $1}' > to_be_installed; while read -r line; do yumdownloader "$line"; done < to_be_installed – val0x00ff Nov 21 '12 at 12:43
Excelent !!! It is working as we "speek" download dir is filing up !!! Thanks a lot !!! :) – VuLe Nov 21 '12 at 12:48

You can get a list of installed packages with yum list installed, you may want to clean it up a bit with

yum list installed | awk 'NR >2 {print $1}' >installed.pkg

Once you have the list you can use the yumdownloader utility to download the packages

for file in $(cat installed.pkg)
    yumdownloader "$file"

this will download all of the rpms to the current directory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.