WSL2 tarball installation¶
The WSL2 tarball installation process allows users to install and run multiple, distinct instances of Linux distributions (such as Ubuntu) on Windows Subsystem for Linux 2 (WSL2). This method is particularly useful for creating isolated environments for different projects or testing configurations without interfering with the default WSL instance.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
Installation Process¶
The procedure generally follows a workflow of downloading a distribution's filesystem archive and importing it into WSL using the wsl command-line utility.
1. Prepare WSL2¶
Ensure that the latest version of Ubuntu (or the desired distribution) is already installed via the Microsoft Store, and that WSL2 is set as the default version.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
2. Acquire the Tarball¶
Download the official root filesystem tarball for the specific Linux distribution you wish to install.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
3. Import the Instance¶
Use the wsl --import command to install the new instance. This requires defining the distribution name (e.g., Ubuntu-22.04-Test) and the installation location, pointing to the downloaded tarball as the source.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
4. Initial Login¶
Complete the installation by logging into the newly created instance.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
Post-Installation Configuration¶
Once the instance is running, initial setup is required to create a usable user environment.
User Account Creation¶
By default, you may be logged in as the root user. You must create a new user account using standard commands (e.g., adduser).^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
Default User Configuration¶
Configure the WSL instance to automatically log in as the newly created user rather than root by appending the user configuration to the WSL instance's configuration file (e.g., /etc/wsl.conf).^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
Verification¶
Terminate the instance and relaunch it to verify that the login defaults to your configured user.^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]
Related Concepts¶
- [[Windows]]
- [[WSL2]]
Sources¶
- How to install multiple instances of Ubuntu in WSL2 ^[600-developer__tools__windows__install-multiple-Ubuntu-WSL2.md]