Home > Linux Tips > Debian vs. Red Hat: How to transfer your package list and install them

Debian vs. Red Hat: How to transfer your package list and install them

Some time ago I came across a problem with Debian I have always solved in a matter of seconds with Red Hat I’ve had to think a little ‘…

In Debian, I often make two identical machines in a cluster for HA, and after I configured the other prepare and pass the list of packages and install them, how?

Here, the first extracts a list of Debian packages with “dpkg” and put on a file:

    root@debian1:~# dpkg –get-selections > debian1-pkgs

then you have to copy the list on the secondary machine, usually use scp:

    root@debian1:~# scp debian1-pkgs root@debian2:/root/.

now that we have the list on the secondary, the load always using “dpkg

    root@debian2:~# dpkg –set-selections < debian1-pkgs

Now we just have him install the packages using "apt":

    root@debian2:~# apt-get dselect-upgrade

And voila! You're done!

And Red Hat?!?

first retrieve all packages installed on a file, using "yum" (the Red Hat package manager and so on), and copy it to the other node:

[root@redhat1 ~]# yum list installed > redhat1-pkg
[root@redhat1 ~]# scp redhat1-pkg root@redhat2:/root/.

now we should say "yum" to install the list, but unfortunately it has more of the entries that do not serve us, this is the example that follows shows how the file:

Loaded plugins: rhnplugin, security
Installed Packages
Deployment_Guide-en-US.noarch             5.2-11                       installed
GConf2.i386                               2.14.0-9.el5                 installed
GConf2.x86_64                             2.14.0-9.el5                 installed
GConf2-devel.x86_64                       2.14.0-9.el5                 installed
MAKEDEV.x86_64                            3.23-1.2                     installed
NetworkManager.i386                       1:0.7.0-10.el5_5.2           installed
NetworkManager.x86_64                     1:0.7.0-10.el5_5.2           installed
NetworkManager-glib.i386                  1:0.7.0-10.el5_5.2           installed
NetworkManager-glib.x86_64                1:0.7.0-10.el5_5.2           installed
NetworkManager-gnome.x86_64               1:0.7.0-10.el5_5.2           installed

we clean everything with the command "cut" and take the first part of each line, so the only name of the package, and we feed it to "yum" directly

    [root@phbe2pr ~]# yum -y install $(cut -f 1 -d” ” < redhat1-pkg)

Now start the download and installation of all.
I hope that was helpfu.

  1. No comments yet.
  1. No trackbacks yet.