On Sun, 2008-11-16 at 00:19 +1100, Amos Shapira wrote: > Hello, > > I'm looking for a way to replicate exact list of packages (including > exact versions) from one CentOS 5 system to another. > > The trigger - I want to be able to "yum update" on my test/staging > systems (mostly distro updates and security fixes), verify that > nothing breaks with this updates, then do a *smart* "yum update" on > the production servers which will force them to use exactly the same > package versions which currently exist on the test system. > > On the CentOS users mailing list somebody suggested "rpm -qa", which > looks good, it gives output like: > setup-2.5.58-1.el5 > basesystem-8.0-5.1.1.el5.centos > glibc-2.5-24 > chkconfig-1.3.30.1-2 > libsepol-1.15.2-1.el5 > libstdc++-4.1.2-42.el5 > elfutils-libelf-0.125-3.el5 > libgcrypt-1.2.3-1 > iptables-1.3.5-4.el5 > slang-2.0.6-4.el5 > > So what's the best way to get this list to become the current state on > another system? Is "xargs yum update < output-of-rpm-qa" enough? > Should I use some mrepo (http://dag.wieers.com/home-made/mrepo/) magic > to provide a repository with these exact list of yum packages and a > "yum update" which uses this repository alone? > > What about deleted packages? How should I identify them and delete > them? I supposed some shell scripting could find such packages. > > (PS - there was an excellent article with a title like "set > manipulation using shell scripts" published not long ago, maybe posted > here but I can't find it in the archives or my bookmarks, this could > be useful for my last question). > > Are there tools which already exist to do something like this or will > I have to role my own? > > Thanks, > > --Amos
I usually do the following: (Under both Fedora, CentOS and RHEL) A. Installing the missing packages. (On the source machine:) $ rpm -qa --queryformat="%{NAME}-%{ARCH}\n" | sort > package_list.txt (On the target machine:) $ yum install -y $(cay package_list.txt) B. Remove "extra" packages: (On the target machine:) $ rpm -qa --queryformat="%{NAME}-%{ARCH}\n" | sort > package_list_new.txt $ yum remove $(diff package_list_new.txt package_list.txt | grep ">" | cut -d">" -f2) While I know that there are better ways of doing it (kickstart?) this method requires the least effort on my end. - Gilba ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]