[CentOS] one-shot yum command to match rpms between systems?
johnny at centos.org
Wed May 18 18:23:31 UTC 2016
On 05/18/2016 12:37 PM, Frank Cox wrote:
> On Wed, 18 May 2016 18:17:10 +0100
> James Hogarth wrote:
>> Well if you're planning on doing a yum update anyway just cat rpmlist |
>> xargs yum -y install
> That wouldn't remove the unneeded packages on the second system.
So, reinstall it from scratch, a minimal install, then yum install the
package list .. obviously if you want to mirror on the second machine
exactly what is on the other system, whats on it now is irrelevant (right?).
Yum is a tool to install stuff, it is not a configuration management
tool. They make configuration management programs as well. Ansible,
Puppet, Salt (all with or without Foreman) and several other things can
do what you want to manage system configurations.
If you don't want to reinstall that other machine from scratch .. You
can create a filelist using rpm -qa from each machine .. use diff of
those filelists to figure out what is on the second machine you don't
want (it will have a + or a - in the diff file, depending on how you run
the command). The things you want on the second machine which are not
there will have the opposite sign.
Then you can rpm -e <to_remove> .. then yum install <to_add> and be done.
But learning configuration management and getting required packages tied
to specific roles will the better in the end, as you can take a data
backup and a configuration management system .. push a button (or issues
a command) and build out a new machine with all the services already
setup, then restore 'data' and be back online.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: OpenPGP digital signature
More information about the CentOS