HelperSheets/wsl/SecondUbuntuInstance.md

53 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2024-08-26 18:09:02 +02:00
**Installing Multiple Instances of Ubuntu WSL2**
==============================================
### **Step 1: Install Latest Version of Ubuntu WSL2**
```bash
wsl install
```
### **Step 2: Download Ubuntu WSL Tarball**
Go to the website [cloud-images.ubuntu.com](https://cloud-images.ubuntu.com/wsl/releases/24.04/current/) 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.
```bash
wsl --export Ubuntu2 C:\Test_Server_Cloud\ubuntu-noble-wsl-amd64-wsl.rootfs.tar
```
Import the image:
```bash
wsl --import Ubuntu2 .\Ubuntu2\ .\ubuntu-noble-wsl-amd64-wsl.rootfs.tar
```
### **Step 4: Login to Second Instance Ubuntu WSL2**
```bash
wsl ~ -d Ubuntu2
```
### **Step 5: Setup User Accounts**
```bash
useradd -m -G sudo -s /bin/bash $NEW_USER
passwd $NEW_USER
```
### **Step 6: Configure Default User**
```bash
tee /etc/wsl.conf <<EOF
[user]
default=$NEW_USER
EOF
```
### **Step 7: Login as New User**
```bash
wsl --terminate ubuntu2
wsl ~ -d ubuntu2
```