Skip to content

Instantly share code, notes, and snippets.

@marciol
Forked from reloxx13/linux-packages
Created April 3, 2024 16:04
Show Gist options
  • Save marciol/8d60a1386d35b47fd1ca319ee49562b6 to your computer and use it in GitHub Desktop.
Save marciol/8d60a1386d35b47fd1ca319ee49562b6 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