1.2 KiB
1.2 KiB
Installing Multiple Instances of Ubuntu WSL2
Step 1: Install Latest Version of Ubuntu WSL2
wsl install
Step 2: Download Ubuntu WSL Tarball
Go to the website cloud-images.ubuntu.com and download the .tar.gz file.
Unzip the file so there is only one .tar file left.
Step 3: Install Second Instance Ubuntu WSL2
Create a folder anywhere on the system. In this example the folder is in C:\Test_Server_Cloud\
.
Export the image:
Make a copy of the file, sometimes an error occurs and the image vanishes.
wsl --export Ubuntu2 C:\Test_Server_Cloud\ubuntu-noble-wsl-amd64-wsl.rootfs.tar
Import the image:
wsl --import Ubuntu2 .\Ubuntu2\ .\ubuntu-noble-wsl-amd64-wsl.rootfs.tar
Step 4: Login to Second Instance Ubuntu WSL2
wsl ~ -d Ubuntu2
Step 5: Setup User Accounts
useradd -m -G sudo -s /bin/bash $NEW_USER
passwd $NEW_USER
Step 6: Configure Default User
tee /etc/wsl.conf <<EOF
[user]
default=$NEW_USER
EOF
Step 7: Login as New User
wsl --terminate ubuntu2
wsl ~ -d ubuntu2