Skip to content

Instantly share code, notes, and snippets.

@t04glovern
Created April 26, 2024 12:45
Show Gist options
  • Save t04glovern/a4344cd2d9e6880b39241c8df4cd4944 to your computer and use it in GitHub Desktop.
Save t04glovern/a4344cd2d9e6880b39241c8df4cd4944 to your computer and use it in GitHub Desktop.
Create Ubuntu-24.04 WSL
# Create scratch location
cd
mkdir wsl-ubuntu-24.04
# Download WSL image
wget `
https://cloud-images.ubuntu.com/wsl/noble/current/ubuntu-noble-wsl-amd64-24.04lts.rootfs.tar.gz `
-O ubuntu-noble-wsl-amd64-24.04lts.rootfs.tar.gz
# Import image to new WSL VM
wsl --import Ubuntu-24.04 .\wsl-ubuntu-24.04\ .\ubuntu-noble-wsl-amd64-wsl.rootfs.tar.gz
# Start WSL (root user)
wsl -d Ubuntu-24.04
# Create new user
$ sudo apt update && sudo apt install -y sudo
$ myUsername=nathan # Change your name
$ sudo adduser --ingroup sudo $myUsername
$ echo -e "[user]\ndefault=$myUsername" >> /etc/wsl.conf
# Restart WSL
wsl --terminate Ubuntu-24.04
wsl -d Ubuntu-24.04
wsl --set-default Ubuntu-24.04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment