The approach is simple: generate a list of installed packages on Debian-based systems and install this list of packages on the new box. This approach is useful when you want to install the same packages on another fresh OS install for example.
1. To export the list of installed packages, proceed as follows:
[codesyntax lang="bash"]
dpkg --get-selections | grep -v deinstall > LIST_FILE
[/codesyntax]
The file LIST_FILE is small so it can be emailed to yourself by using:
[codesyntax lang="bash"]
dpkg --get-selections | grep -v deinstall > LIST_FILE && cat LIST_FILE | mailx -s "`hostname -f`: Package list" "user@test.org"
[/codesyntax]
2. Once you’ve got your server up and running with a fresh base install
[codesyntax lang="bash"]
apt-get update apt-get dist-upgrade
[/codesyntax]
3. Move your LIST_FILE file into your home directory and run the following commands to recover the previous generated list:
[codesyntax lang="bash"]
dpkg --clear-selections dpkg --set-selections < LIST_FILE
[/codesyntax]
4. Install the packages
[codesyntax lang="bash"]
aptitude install
[/codesyntax]
Recent Comments