27

Is there a way, that I could backup all my programs, all apps, put them in a directory or something, so that I could install them quickly next time, without having to manually going over the app center, downloading them from terminal, etc?

Note that I might import them from a distro other than the one I exported them on. So, say I'm in Ubuntu, exported some stuff, and then installed BT and wanted to import them from there.

Jorge Castro
  • 70,934
  • 124
  • 466
  • 653
VeXe
  • 423
  • 1
  • 7
  • 13
  • 3
    @Martin Betz: I disagree that that question is a duplicate. The OP clearly wants a comprehensive back-up of *all* installed applications, including ones that weren't installed through apt-get or dpkg. – Flimm Jan 15 '13 at 13:08
  • 4
    Possible duplicate of [How to backup settings and list of installed packages](http://askubuntu.com/questions/9135/how-to-backup-settings-and-list-of-installed-packages) – raphael Jul 02 '16 at 23:05

5 Answers5

38

When I have to format my Ubuntu I follow this steps:

  1. dpkg --get-selections > package_list This creates a text file (package_list) with all package installed in your system. You can edit the file if you want to delete some packages.
  2. Backup /etc/apt/sources.list file and /etc/apt/sources.list.d/ folder. Here there are all the repositories.
  3. Backup /home/MyUser folder. All application settings are hide folders/files in your user's home folder, maybe you want to select what settings you want to restore.
  4. Format and install new Ubuntu.
  5. Restore your repositories (/etc/apt/sources.list file and /etc/apt/sources.list.d/ folder).
  6. sudo apt-get update && sudo apt-get upgrade
  7. sudo dpkg --clear-selections and sudo dpkg --set-selections < package_list. To restore the information of your installed packages.
  8. Install them: sudo apt-get update && sudo apt-get dselect-upgrade
  9. Finally, sudo apt-get autoremove to clean some packages.

Well, there are 9 steps, but you have an easy Ubuntu clean install.

Another solution is to mantain a list with your installed applications, then sudo apt-get install app-name (you can create a bash script).

ilazgo
  • 506
  • 5
  • 8
  • @lago Is it possible to avoid default installed applications. As an example firefox is default installed, and vlc is not. So next when i will install system only install vlc. – shantanu Oct 31 '13 at 12:26
  • @shantanu for do that you have to build your own Ubuntu image. There are some software that helps you. Search in Google or ask another question :) – ilazgo Oct 31 '13 at 13:09
  • @lago sorry for my bad explanation. Actually i mean that, A fresh installed ubuntu has firefox installed. Now i install vlc. Lets get package list. There should be two package, firefox and vlc. Now i want to install fresh ubuntu again. Want to restore my packages. dpkg --set-selection < package_list. dpkg will run for firefox and vlc. But i don't need firefox, only vlc which is not installed by default (in fresh ubuntu). – shantanu Oct 31 '13 at 21:22
  • @shantanu well, for that, you have to get an empty Ubuntu image (and then install all what you want), or you have to do a `sudo apt-get remove --purge firefox` for every package you want to unninstall. Yo can do that in a bash script. – ilazgo Nov 04 '13 at 07:25
  • How exactly do you do the `back up` steps in your question? I'm using `back in time` but some people reported that `back in time` on the fresh machine can't easily find the old snapshots. The settings of `back in time` has to be exactly the same, and I can only restore on folder at a time. – Heisenberg Nov 17 '13 at 18:42
  • @Anh the back up consists in install from zero your software (previously, you make a list of your installed software) and copy/paste your configuration. – ilazgo Nov 18 '13 at 16:01
  • 2
    For future reader: I took a leap of faith and did the reinstallation yesterday. The part where I "export" then "import" list of installed software went without hitch. The "back up home folder" part went nicely because I configured my laptop exactly like before. Some people reported that `back in time` snapshot may not recognize old snapshots if the account / permission configuration is not exactly the same. – Heisenberg Nov 18 '13 at 21:02
  • When I run `sudo dpkg --set-selections < package.list` I get an epically long list of packages that are "not in database" including things like `vlc` and `postgresl-9.5`. I'm rather confused – raphael Jul 02 '16 at 22:01
  • Found the answer [here](http://askubuntu.com/questions/9135/how-to-backup-settings-and-list-of-installed-packages). `sudo apt-get install dselect sudo dselect update` – raphael Jul 02 '16 at 23:34
  • I know this is a little late, but I wanted to thank you for the response, that is a great idea. I do want to add a couple of things to it that will make it even more seamless. When you install Ubuntu and decide to do a manual partition, you can create a /home partition that will be mounted as /home. Once you have that, you can just copy the files from the /etc directory as suggested in this answer and run those commands while preserving the data in the /home partition. – Hatem Jaber Apr 17 '18 at 16:40
1

@ilazgo's answer right on point!!Thank you. I used a slightly different format due to the problem I had at hand. Mine involved moving an encrypted home folder from a disk image I had initially created to the current home folder. Using @ilazgo's solution in addition to rsync options source destination, I was able to merge the two. Another solution can be found Here

1

Aptik is something you could look into

http://www.unixmen.com/aptik-backup-ppas-themes-icons-application-settings-ubuntu/

  • 7
    Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... **:-(** Therefore, please [edit] your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! **;-)** You can always leave the link in at the bottom of your answer as a source for your material... – Fabby Aug 31 '15 at 19:29
0

If you in apt environment:

  • sudo apt install apt-clone
  • Backup your packages sudo apt-clone clone ~/my-backup-packages
  • sudo apt-clone restore-new-distro my-backup-packages.tar.gz for restore a clone file from to and try upgrading along the way. this can be used so that the current release is cloned, a new install is done and then the old clone is installed.

Carefully: restore overwrite sources.list see how-to-backup-settings-and-list-of-installed-packages for solution.

As wrote @raphael it is duplicate how-to-backup-settings-and-list-of-installed-packages

C2RLOS
  • 21
  • 6
0

For versions up to 15.04, Aptik is a nice GUI method of backing up to a remote drive and restoring everything with a few clicks of the mouse.

It's available in the PPAs.

Christopher
  • 476
  • 4
  • 6