Home > sysadmin > Clone your Debian server’s packages to new server with dpkg

Clone your Debian server’s packages to new server with dpkg

Make sure /etc/apt/sources.list is identical to your the file on the original server.
You may have to rsync /etc/apt from your old server to your new server if you have
installed different apt keys.

First run
dpkg –get-selections | awk ‘{print $1}’ >installed-packages ## on existing server
then sftp the installed-packages file to your new server.
on your new server, make sure you have /etc/apt/sources.list exactly like the
one on your old server.

On your new machine run:
apt-get install `cat installed-packages`

Your new server should now have all the packages your old server has.
You can copy the /etc/*.conf files to your new server (I would make a new place for them)
and add them back as needed to the new server.

Categories: sysadmin
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment