Centos – Download ALL rpms for a product

centospackage-managementrpm

I have two CentOS machines, one 6.3 box (A), and another CentOS 6.1. (B)

6.3 box is with internet connection, 6.1 box is without internet connection.

I want to download ALL dependencies of a product on Box A, then copy those n Box B, and install the product.

I tried with

yum --downloadonly --downloaddir=*~/downloadrepo* -y install *product*`
cd *~/downloadrepo*
createrepo .

Then I disabled all repos (with –disablerepo), except my repo, and installed product on the same machine (Box A). No errors.

  • yum install *product*

Now when I copied this repo to Box B, and tried to install with same command,
it starts installing, but then gives lot of errors like below:

Error: Missing Dependency: libldap-2.3.so.0()(64bit) is needed by package php-ldap-5.1.6-27.el5_5.3.x86_64 (installed)

As there any way I can achieve what I need?

UPDATE

By the time I started working with option suggested by @rkosegi (–releasever=version), I was given a new box with same version CentOS 6.1 (C)

I tried above mentioned commands on Box C, and copied repo it to Box B. Still it failed.
The reason: though both boxes are 6.1, those are not identical (uname -r returns different strings).

Yum does not download dependencies, if those are already installed. So my repo did not contain some of the dependencies (including OpenJDK). So, when I try to install on Box B, it fails.

Quite frustrating!!!

But then I found command 'repotrack' here.

cd ~/downloadrepo
repotrack -p . -a x86_64 product
createrepo .

I got a lot more files than with yum, hopefully it will do the trick.

I'll update, once I try install.

UPDATE

Command repotrack did not work for me. When I tried to install from repository created with 'repotrack', got following errors:

Error: Package: perl-CGI-3.51-127.el6.x86_64 (repo-local)
       Requires: perl = 4:5.10.1-127.el6
       Installed: 4:perl-5.10.1-119.el6_1.1.x86_64 (@anaconda-CentOS-201112102333.x86_64/6.2)
           perl = 4:5.10.1-119.el6_1.1
Error: Package: audit-libs-python-2.2-2.el6.x86_64 (repo-local)
       Requires: audit-libs = 2.2-2.el6
       Installed: audit-libs-2.1.3-3.el6.x86_64 (@anaconda-CentOS-201112102333.x86_64/6.2)
           audit-libs = 2.1.3-3.el6

I tried removing these two files from folder, and rebuilding repository with 'createrepo'.
It gave another set of errors.

Not sure what options I have at the moment…

Best Answer

If you have to do this a lot, you might want to take the time to set up Spacewalk. It will automate creating the repository and populating it with the appropriate packages (or, if you want, all of them). Not to mention everything else it does...