0

In my job, I need to install ubuntu OS multiple times with some applications. Can you please let me know how to take backup as ISO and install that ISO as OS which should include all the applications. Whenever, I am going to test application, everytime I need fresh OS, If I reset the OS, will it come to first installation phase.

Actually, Every time, i need to downgrade the kernel version from 4.15 to 4.14 and need to install some confidential applications of my company everytime. This is taking long time, is there any way to automate this. One sandisk (Bootable to ubuntu) pendrive always connected to that system. Please suggest to automate this and can be installed from anywhere.

1 Answers1

1

You can use:

dpkg --get-selections

Which will output all the packages you have installed. You can save this file like this:

sudo dpkg --get-selections > mypackages.txt

Later you can restore the package list by doing:

sudo dpkg --set-selections < mypackages.txt
sudo apt install -f

Note, however there are some caveats to this:

  • The list of packages contains everything, not just packages you have installed yourself.
  • This could be a problem if you run this command on an older version, such as 18.04.1 and then restore the package list on something like 18.04.2 where some packages may have been replaced or changed names.
  • This will almost certainly cause a problem if going from one major release of Ubuntu like 16.04 to another major release like 18.04 since they will contain drastically different package lists.
  • Some of this can be resolved by eventually doing a sudo apt install ubuntu-desktop after everything to "force" all the default Ubuntu packages to be installed.

Note: If anyone reading this knows how to get a list of packages only installed by the user and not the system, please edit this answer.

  • Thanks Kristopher. Actually, Every time, i need to downgrade the kernel version from 4.15 to 4.14 and need to install some confidential applications of my company everytime. This is taking long time, is there any way to automate this. One sandisk (Bootable to ubuntu) pendrive always connected to that system. Please suggest to automate this from anywhere. – Paloju Ram Sep 03 '19 at 09:02
  • 1
    After fresh install use sudo dpkg --get-selections > original_packages.txt. After installing extra applications use: sudo dpkg --get-selections > all_packages.txt. Then run two files through diff command and get list of all user installed packages. – WinEunuuchs2Unix Sep 03 '19 at 11:49