Replicate or Migrate Ubuntu Packages with Apt-Get
One of the reasons I prefer Ubuntu over other linux distros is the frequency of updates and support for many different software packages. Apt-get is an extension of the Advanced Packaging Tool (APT) which is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from binary files or by compiling source code.
If you’ve ever needed to upgrade Ubuntu versions, setup a new server or do any other type of migration, this is the easiest and most satisfying way to do it.. using dpkg to create a list of the packages you have, and then pulling those same packages from apt-get.
First on our “old” server lets use apt-get to dump a list of installed packages to a packages.txt file:
dpkg --get-selections | grep -v deinstall > packages.txt
Then on the new server, lets update apt-get and install from our file:
apt-get update dpkg --set-selections < packages.txt apt-get -u dselect-upgrade