I can install packages from Internet using:

yum install packagex

This will download all the dependent packages and install them in order. For some of our customers who do not have Internet access, we want to do this by giving them a tarball of a repository creating just these packages.

Is it possible to do something like:

yum install packagex  --createRepo /tmp/foo

where all the packages are put in /tmp/foo in a repo format which I can tar and then can be used by yum to install packages offline?


Yes, you could do that via using the downloadonly yum plugins. This is described in more detail in the RedHat article: How to use yum to download a package without installing it

You would e.g. run
yum install packagex --downloadonly --downloaddir=/tmp/packagex_repo
which would download packagex and all dependencies required for the current system to only be downloaded to /tmp/packagex_repo.

There's also yumdownloader which is contained in package yum-utils which provides the same means, although due to a bug it will download both i586 and x86_64 versions of a package, and the option --archlist does not always work the way you'd want it to.

For more information see the following:

For the creation of a repo from that search around here for createrepo as there are a lot of results there. To pack that into a tarball involves only a few commands, first download the packages, then run createrepo in the repo directory and finally create a tarball from that folder plus the yum configuration for the repo. But you can also just put everything into a tarball and tell people to extract the tarball and run yum install ./*rpm in the extracted repo folder. Using the repo approach would provide the benefit that yum history and yum package listing would show from which repo a given package was originally installed.

  • Alternative approach would be to use yum caching to achieve the same result - that is, keeping packages which are downloaded by yum. That is enabled via the keepcache=1 option in /etc/yum.conf. See e.g. 10. Working with yum Caching for more details. – doktor5000 Jun 20 '15 at 18:21

RPM is already made to do this. All the packages you can get by yum, you can get an RPM. RPM also is installed already everywhere you find yum. So just round up your RPMs, put them in a tar ball, and yeah you can just extract it and run a few RPM commands to get the job done.

Of course a big thing of package management is dependencies, it will be up to you to ensure you include a package for every dependency.

  • How do I round up RPMs? When I do "yum install x", it downloads hundreds of dependent RPMs. Can yum download these and put them in a folder which can then be used by the "rpm" utility? – k2k2e6 Jun 18 '15 at 2:51
  • I think you would have to search for the RPMs and dependencies you need yourself and download them. Yum is a management tool for RPM packages, but the packages themselves dictate how/where they will be installed. For your purpose it might be better to create your own yum repo and put the packages you want to distribute in there. Either way seems like it will take some leg work. – Baazigar Jun 18 '15 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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