Skip to content

Instantly share code, notes, and snippets.

@vaibhaw
Last active September 20, 2016 02:40
Show Gist options
  • Save vaibhaw/156a4f0dde447fa91feb41da3833f8a4 to your computer and use it in GitHub Desktop.
Save vaibhaw/156a4f0dde447fa91feb41da3833f8a4 to your computer and use it in GitHub Desktop.
Preparing a backup before fresh Ubuntu install

backup list of installed python packages

sudo -H pip freeze > requirements.txt

backup Ubuntu PPAs

source: http://askubuntu.com/questions/24022/how-can-i-backup-my-repositories

tar cvzf sources.tar.gz /etc/apt/sources.list.d/

Or use y-ppa-manager

Backing up Ubuntu packages

source: http://askubuntu.com/questions/17823/how-to-list-all-installed-packages

# Create a backup of what packages are currently installed:
dpkg --get-selections > list.txt

# Then (on another system) restore installations from that list:
dpkg --clear-selections
sudo dpkg --set-selections < list.txt
# To get rid of stale packages
sudo apt-get autoremove
# To get installed like at backup time (i.e. to install packages set by dpkg --set-selections)
sudo apt-get dselect-upgrade
# or 
sudo apt-get -u dselect-upgrade

A very important point to remember is that it will break dependencies. Read comments on http://askubuntu.com/a/17829/258167

So I will use this to compare with the fresh installed Ubuntu and check what are the packages I had earlier installed which are not installed by default in the fresh Ubuntu OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment