Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Run Multiple Instances of the Same Linux Distro on WSL

August 23, 2024
in A, Blog, WSL
0
ADVERTISEMENT

Table of Contents

Running multiple instances of the same Linux distribution on Windows Subsystem for Linux (WSL) is possible and can be quite useful for testing, development, or isolating different environments.  Each instance runs independently, so you can configure, install software, and set up environments as needed. Each instance will have its own filesystem and configuration.

PS C:\> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
PS C:\>
PS C:\> wsl --install -d ubuntu
Ubuntu is already installed.
Launching Ubuntu...
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

bonben@win11-e2208:~$

Install WSL and Your Desired Linux Distribution

Before you can create multiple instances, ensure that WSL is installed and you have your desired Linux distribution installed (e.g., Ubuntu).

Right-click on the Windows Start icon then open PowerShell (Terminal) as administrator. 

IRElHZRjD9m15gGlJT5QtSsgMSSZvw8JZr27T0zfrWZdS1s9goRmUjUx9tAd

Run the following command:

wsl --install

This command will install the default WSL distro, typically Ubuntu. This will be your base distribution.. If WSL is already installed, you can skip this step.

PS C:\> wsl --install
Installing: Virtual Machine Platform
Virtual Machine Platform has been installed.
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.
Installing: Ubuntu
Ubuntu has been installed.
The requested operation is successful. 
Changes will not be effective until the system is rebooted.

Export the Base Distribution

Once your distribution is installed, you need to export it so that you can create multiple instances from this base. 

PS C:\> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2

Open a PowerShell terminal and run the following command, replacing with the name of your installed distribution (e.g., Ubuntu):

wsl --export ubuntu 'D:\backup\mydistro.tar'

This command will export your current WSL distribution to a .tar file at the specified path.

IRElHZRjD9m15gGlJT5QtSsgMSSZvw8JZr27T0zfrWZdS1s9goRmUjUx9tAd

Import the Distribution as a New Instance

Now that you have the exported .tar file, you can import it as a new instance. Run the following command to import the .tar file as a new WSL instance:

wsl --import <NewDistroName> 'C:\path\to\new\instance\' 'C:\path\to\backup\mydistro.tar'
  • <NewDistroName>: The name you want to give the new instance (e.g., Ubuntu-Instance2).
  • C:\path\to\new\instance\: The directory where the new instance’s filesystem will be stored.
  • C:\path\to\backup\mydistro.tar: The path to the exported .tar file.
# Example
wsl --import Ubuntu-Instance2 'D:\wsl\Ubuntu-Instance2' 'D:\backup\mydistro.tar'
IRElHZRjD9m15gGlJT5QtSsgMSSZvw8JZr27T0zfrWZdS1s9goRmUjUx9tAd

After importing, you will have multiple instances of the same Linux distribution. You can manage these instances with the following commands:

wsl -l -v

This will show you all the installed WSL distributions, including the new instance you just created.

PS C:\> wsl -l -v
  NAME                STATE           VERSION
* Ubuntu              Stopped         2
  Ubuntu-Instance2    Stopped         2

To start a specific instance, replace <NewDistroName> with the name of the instance you want to run.

wsl -d <NewDistroName>

To terminate a running instance, run the below command. This will stop the specified WSL instance.

wsl --terminate <DistroName>

If you no longer need an instance, you can unregister it. This will delete the instance and its filesystem.

wsl --unregister <DistroName>
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

Related Titles:

  • How to Clone a Linux Distro in WSL
  • Managing Multiple Linux Instances on WSL
  • Running Multiple Ubuntu Instances on Windows Subsystem for Linux
  • How to Create Multiple WSL Instances for Developers
  • WSL Tips: Run Multiple Versions of the Same Linux Distribution
  • Step-by-Step Guide to Duplicating Linux Environments in WSL
  • How to Setup Multiple WSL Instances on Windows 10/11
  • Using WSL to Run Multiple Linux Distributions Simultaneously
  • Advanced WSL Setup: Running Multiple Linux Instances
  • How to Create Multiple Ubuntu Instances on Windows
  • Running Multiple WSL Environments for Testing and Development
  • How to Export and Import WSL Distros for Multiple Instances
  • Managing Multiple Ubuntu Distributions on Windows WSL
  • Create and Manage Multiple Linux Distro Instances on WSL
  • Windows Subsystem for Linux: Running Multiple Instances

 

Keywords: WSL multiple instances, run multiple Linux on WSL, duplicate WSL distro, WSL import export guide, multiple Ubuntu WSL, WSL tips and tricks, Linux distribution WSL, managing WSL environments, WSL setup multiple instances, Windows Subsystem for Linux tutorial, running Linux on Windows, multiple Linux distributions WSL, WSL how to, duplicate Ubuntu on WSL, tech guide WSL

 

Hashtags: #WSL #LinuxOnWindows #WSLTutorial #TechGuide #MultipleInstances #UbuntuWSL #Windows10 #Windows11 #DeveloperTools #LinuxDistro #Bonguides

5/5 - (1 vote)
Previous Post

How to Set Root as Default User for WSL Instances

Next Post

How to Uninstall Microsoft Graph PowerShell Modules Completely

Related Posts

Images Hidden Due To Mature Content Settings In CivitAI

August 31, 2024

Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

August 20, 2024

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024

How to Remove The Test Mode Watermark Without Disabling Test Mode

July 28, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory