Skip to content

Instantly share code, notes, and snippets.

@reloxx13
Forked from kozmonaut/linux-packages
Created November 14, 2018 21:51
Show Gist options
  • Save reloxx13/81d8bc8e37b5ff1aa970e1adc9da7955 to your computer and use it in GitHub Desktop.
Save reloxx13/81d8bc8e37b5ff1aa970e1adc9da7955 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