Can we have multiple WSL2 distros of the same type installed in a single Windows 11 host?
Nov 14
I'd like to have 'n' debian installed, not once per version, but litterally 'n' installations of the same debian 12.
Each instance should have a different set of php/nginx|apache/mysql|mariadb
Is it possibile, for first thing, to install multiple time debian 12 on the same wsl2 on the same windows 11 pro host?
If yes, can multiple apache|nginx instances be running on same port 80/443, setting up them to listen only to internal wsl instance ip?
1 answer
Accepted answer · original discussion
Nov 14
Here is how to have several copies of the same distribution:
Install the base distribution from the Windows Store or using:
wsl --install -d <distribution name>Log into the environment and modify as needed, then exit it
Export the environment with the following command:
wsl --export <distribution name> <export file name>Create a new instance of the base environment by importing the
.tarfile:wsl --import <new distribution name> <install location> <export file name>You may now open the new environment using:
wsl -d <new distribution name>In Windows 11, you can browse the file-system of distributions in Explorer via Desktop > Linux
The new distribution will have
rootas the default user. To login as another user, either use the-u <username>flag or create/modify awsl.conffile in/etcdirectory inside the environment, with the following section:[user] default=<username>
For more information with screenshots see the article
Setting up multiple WSL distribution instances.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.