Operations 9 min read

Master WSL: Quickly Set Up a Development Environment with the Official Ubuntu 24.04 WSL Image

This guide explains why the official Ubuntu 24.04 WSL image is advantageous, walks through obtaining the image from Ubuntu releases or cloud images, shows how to import it to a custom directory, configure a non‑root user, and shares practical tips for file access, VS Code integration, networking, backup, and removal.

Ubuntu
Ubuntu
Ubuntu
Master WSL: Quickly Set Up a Development Environment with the Official Ubuntu 24.04 WSL Image

Why use the official Ubuntu 24.04 WSL image

Lightweight : the image omits kernel, drivers and services that are only needed on physical or virtual machines, reducing size for the container‑style WSL environment.

Fast cold‑start : the reduced footprint yields noticeably quicker startup compared with the standard Ubuntu Store image.

Install location flexibility : the image can be placed on any non‑system drive (e.g., D:, E: or external storage), freeing space on the Windows system partition.

Environment isolation : multiple independent instances (e.g., Ubuntu-Dev, Ubuntu-Test) can be created from the same base image without conflict.

Step‑by‑step deployment

1. Obtain the image

Ubuntu provides two download channels:

Channel 1 – Ubuntu Releases (recommended)

Download site: https://releases.ubuntu.com/noble/ File name: ubuntu-24.04.x-wsl-amd64.wsl (a compressed package that can be imported directly).

Channel 2 – Ubuntu Cloud Images

Download site: https://cloud-images.ubuntu.com/wsl/noble/current/ File name: ubuntu-noble-wsl-amd64-wsl.rootfs.tar.gz (daily‑build snapshot).

FAQ: Difference between .wsl and .rootfs.tar.gz Both are tarballs containing a complete Linux root filesystem and are accepted by wsl --import . .wsl files are published on the Releases page and represent stable point releases. .rootfs.tar.gz files appear on Cloud Images and include the latest daily‑build snapshots.

2. Prepare an installation directory

Create a dedicated folder on a non‑system drive, for example:

D:\WSL\Ubuntu2404

3. Import the image

Run the import command from an elevated PowerShell. Adjust the file name according to the downloaded image.

# Import using the .wsl file
wsl --import Ubuntu-24.04 D:\WSL\Ubuntu2404 D:\Downloads\ubuntu-24.04.3-wsl-amd64.wsl

# Import using the .rootfs.tar.gz file (commented example)
# wsl --import Ubuntu-24.04 D:\WSL\Ubuntu2404 D:\Downloads\ubuntu-noble-wsl-amd64-wsl.rootfs.tar.gz

4. First launch and user configuration

Start the newly imported distro: wsl -d Ubuntu-24.04 The default login user is root. Create a regular user and set it as the default:

# Inside the WSL instance
NEW_USER="yourname"
useradd -m -G sudo -s /bin/bash $NEW_USER
passwd $NEW_USER

# Write /etc/wsl.conf to make the new user default
tee /etc/wsl.conf <<EOF
[user]
default=$NEW_USER
EOF

Terminate the instance and relaunch so the new user is used by default:

wsl --terminate Ubuntu-24.04
wsl -d Ubuntu-24.04

Additional WSL usage tips

Cross‑filesystem access

From WSL to Windows: use /mnt/c/, /mnt/d/, etc.

From Windows to WSL: open File Explorer and enter \\wsl$ to view all running Linux root filesystems.

VS Code integration

In the WSL terminal, run code . to launch Windows VS Code with the Remote‑WSL extension, allowing direct editing of Linux files.

Network and proxy

WSL 2 shares the host’s network stack. To obtain the host’s IP (useful for proxy configuration), run:

cat /etc/resolv.conf

Backup and migration

Export the imported distro for backup or transfer:

wsl --export Ubuntu-24.04 D:\Backup\ubuntu_env.tar

The resulting tar archive can be imported on any machine with the same wsl --import command.

Unregister and delete an environment

To permanently remove an instance and its virtual disk:

# WARNING: irreversible deletion!
wsl --unregister Ubuntu-24.04

The associated ext4.vhdx file under the installation directory is deleted immediately.

References

[1]

https://releases.ubuntu.com/noble/ [2] https://cloud-images.ubuntu.com/wsl/noble/current/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

developmentLinuxWindowsWSLUbuntu
Ubuntu
Written by

Ubuntu

Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.