1

I have Ubuntu WSL installed on two different Windows 10 accounts. I want to have the same packages installed in Acct-2 as I have in Acct-1. Is there an easy way? I have a complex way.

Wes
  • 179
  • 1
  • 9
  • This seems like, basically, a duplicate of this. I'd expect the same method to work. – mkasberg Nov 09 '18 at 16:08
  • Why bother? One of the original reasons, many years ago, for the development of Apt was easy, on-demand installs. When you need a new application (like LibreOffice), simply tell Apt to install it (sudo apt install libreoffice), and let Apt handle all the details. – user535733 Nov 09 '18 at 16:27
  • @user535733, It's hard to remember the various packages you've installed over the years, and it's inconvenient to have to install them on the fly. – Wes Nov 09 '18 at 17:58
  • In that case, use @mkasberg's link – user535733 Nov 09 '18 at 18:37

1 Answers1

1

Here is my complex answer. Make sure that Acct-2 uses the same repositories as Acct-1. Create a list of packages from Acct-1 in a directory accessible to both Accounts, e.g. /mnt/c/WorkTemp and then remove the packages already installed in Acct-1. Install the remaining packages in Acct-2

Specifically, on Acct-1:

sudo apt-get update
sudo apt-get upgrade
aptitude search '~i!~M' | sort > /mnt/c/WorkTemp/aptitudelist-1

Do the same on Acct-2 piping into /mnt/c/WorkTemp/aptitudelist-2

comm -23 /mnt/c/WorkTemp/aptitudelist-{1,2} >/mnt/c/WorkTemp/pkglist

Review /mnt/c/WorkTemp/pkglist deleting the lines containing packages you don't want in Acct-2. Then in Acct-2:

sudo apt-get install $(tr -s ' ' </mnt/c/WorkTemp/pkglist |cut -d ' ' -f2)
Wes
  • 179
  • 1
  • 9
  • This automatic parts of this answer only work well when the two wsl installations are the same version. For example, xenial and bionic changed enough so that I had to visually scan the package lists to determine the significant differences. – Wes Feb 21 '20 at 00:13