Ubuntu – With Snap and Apt both existing, how to backup all the apps so that I can restore it on a new machine

backuprestoresoftware installation

I see a few solutions that do dpkg list or something along that line, Store it in a file and use that file to install the apps. My question is – will it also backup all the apps I installed from the snap store (Since I am having to install them using sudo snap install?)

Is there a better way I can back up all my apps, so I can get them installed on a new machine when I move to the machine? (Installed using APT OR Snap?)

Best Answer

For snaps I think a Snapshot is the way to go.

For normal apt(.deb) software packages installed on your machine I think you could try these options:

  1. Check your apt archive directory(/var/cache/apt/archives) to see if this contains any .deb file. Those .deb are the software package from the applications you have in your system. If so, copy these .deb file to a USB stick from example, restore them on the new machine and once these files are on the new machine install them using sudo dpkg -i *.deb
  2. A second option if the previous step doesn't find anything would be to create the .deb for your current system, on console type:

    sudo apt-get install dpkg-repack
    mkdir repack
    cd repack
    dpkg-repack `dpkg --get-selections | grep install | cut -f1` 
    

The above commands will create the .deb files from your current installed system in the repack directory, from there you could copy these file to an USB stick, then restore them on the new machine, and again, perform an sudo dpkg -i *.deb on the new machine to install these deb applications in there