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?
Best Answer
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 packageyum-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 runyum 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.