How to install the same packages of a CentOS server to another server using yum?

 

 Sometimes it happens , I want to migrate information from a CentOS server, because I should have it in most other hardware, because the other has better hardware specifications, because the user requires in order . Suppose we have the need for a newly installed CentOS server these packages on the server before.

  

 Obviously you can not do this step, just sometimes it's best to go see one by one the systems we have, then instalándoles , reconfigurándoles , etc. .. until you reach a state in which the new server is very similar to the old . However sometimes this way is boring medium.

  

 The first thing is to ensure that the same old server repositories are configured on the new server, you must look for it in / etc / yum.repos.d / and if both teams missing some repository , install it in the new . (eg the EPEL which is well known ) . This step is important because if a repo is not present, logically end up not installing one or more packages for lack of this repo, etc. .

  

 Now how about I just put this on the old server :

  

 yum- disablerepo = * list "*" | awk -F '{print $ 1 " \ \ " } " . "

  

 This is THE COMMAND . This command will allow me to list all the packages installed on the old server , and will print a \ at the end .

  

 I'll take this output to a text editor, remove the last \ and put up up yum install \

  

 Then I copied toooooda the output of this command in the new would something like:

  

 yum install \

  

 package1 \

  

 package2 \

  

 .

  

 .

  

 paqueteX

  

 (note that I removed the last \ )

  

 And ready, yum will install all packages on the new server does not exist but that it had in the old.

  

 This way at least I guarantee that nothing goes missing parcel to fail me . Logically then this step would touch me copy important files / etc from the old server to the / etc again. For this what I do really is a copy of / etc old and put in / root / etc ( do not put it directly in / etc ! )

  

 Then I'm going to removing rsync , say I'm interested in the / etc / mail the old file, do this :

  

 rsync- avp / root / etc / mail / etc /

  

 I say likewise interested in copying the / etc / httpd / conf file / etc / httpd / conf.d from old to new .. how to do? Exactly!

  

 rsync- avp / root / etc / httpd / conf / etc / httpd /

  

 rsync- avp / root / etc / httpd / conf.d / etc / httpd

  

 and well, the rest is boring, lift services , copy the files from / home and / or / var you want, etc ...