Skip to content

Instantly share code, notes, and snippets.

@dividy
Forked from kozmonaut/linux-packages
Created July 24, 2020 10:09
Show Gist options
  • Save dividy/5585682e3f2aa6d4968a35371c20f1e9 to your computer and use it in GitHub Desktop.
Save dividy/5585682e3f2aa6d4968a35371c20f1e9 to your computer and use it in GitHub Desktop.
Backup and restore installed packages inside Linux Debian
# Backup your packages list
# Get a packages list
dpkg --get-selections > ~/Package.list
# Copy list of repositories
sudo cp /etc/apt/sources.list ~/sources.list
# Export repo keys
sudo apt-key exportall > ~/Repo.keys
# Restore packages
sudo apt-key add ~/Repo.keys
sudo cp ~/sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment