In Windows 10, how do you install multiple, separate instances of Ubuntu in WSL? I'd like separate instances for different work spaces. For instance one for Python development, one for Ruby development, one for .Net Core development, etc. I know I could jam all of these into the same Ubuntu on WSL instance, but I'd rather have a separate one for each of these scenarios. Is this possible?
The newer wsl
command's import/export feature can readily create copies of a distro without installing any additional tools or using RegEdit. For example
cd C:\Users\MattSlay
wsl --export Ubuntu ubuntu.tar
wsl --import UbuntuRuby .\UbuntuRuby ubuntu.tar
wsl --import UbuntuPython .\UbuntuPython ubuntu.tar
wsl --import UbuntuDotNet .\UbuntuDotNet ubuntu.tar
wsl -d UbuntuRuby
wsl -d <distro>
launches the distro. If WSL 2 has been installed, then the distro can be converted between versions during --import
using the --version
option:
wsl --import UbuntuRuby .\UbuntuRuby ubuntu.tar --version 2
A smaller distro, such as Alpine, can make experimentation much faster. Finally, wsl --import
can read from standard input -
and wsl --export
can write to standard output -
. This allows a compression program to be used to save disk space if desired.