Step 1 · Windows
Install Ubuntu 24.04 LTS with WSL
WSL — the Windows Subsystem for Linux — runs a real Ubuntu system inside Windows. No partitioning, no dual boot, no virtual machine to configure. Your Windows files stay where they are and Linux can reach them.
This installs Ubuntu 24.04 LTS specifically, so everyone following these steps ends up on the same system.
Run this
Open PowerShell as Administrator: press Windows, type PowerShell, right-click Windows PowerShell and choose Run as administrator. Then paste:
irm https://aikaryashala.com/system_setup/scripts/install_ubuntu_wsl.ps1 | iex
irm downloads the script and iex runs it. You can
read it first — it is
plain text.
WSL depends on two Windows features that cannot switch on while Windows is running. If the script turns them on, it stops and asks you to restart. That is expected — restart, then run the same command again to finish.
What the script does
- Checks you are running as Administrator, and that your Windows build is 19041 or newer.
- Enables the Windows Subsystem for Linux and Virtual Machine Platform features.
- Updates the WSL kernel and sets WSL 2 as the default version.
- Installs Ubuntu 24.04 LTS — unless you already have an Ubuntu, in which case it installs nothing.
- Makes your Ubuntu the default, so typing
wslopens it. - Prints what to do next.
Running it twice is harmless. Anything already in place is reported as skip and left alone.
wsl --install -d Ubuntu installs whichever release Microsoft
currently treats as the default, and that changes over time. Two people
running it months apart would end up on different systems, with different
package versions and different behaviour.
This script asks for Ubuntu-24.04 by name. Every other step on
this site is written and tested against 24.04 LTS. LTS means Long
Term Support: it receives security updates for five years.
Already have Ubuntu installed? Any version — 22.04, for example — and the script installs nothing. It leaves what you have alone and uses it. The later steps work on any recent Ubuntu, so a second several-hundred-megabyte download is not worth having two systems to keep straight.
Keep it. Everything on this site works there — the only differences you might meet are occasional package names, and the scripts already handle the common ones.
If you would rather have 24.04 as well, the script prints the command for it. You can run that yourself at any time:
wsl --install -d Ubuntu-24.04
Chapter 3 of the book explains how two
operating systems share one machine, where each keeps its files, and why
work under /mnt/c is slow.
First launch
Open the Start menu and launch Ubuntu 24.04.x LTS — or whichever Ubuntu you already had. The first launch takes a minute while it unpacks, then asks you to create an account:
Enter new UNIX username: yourname
New password:
Retype new password:
The password does not appear as you type. No dots, no asterisks, nothing moves. It is being recorded. Type it and press Enter.
This is a new account. It has nothing to do with your
Windows or Microsoft password. You will type this Linux password whenever a
command starts with sudo, so pick something you can type quickly.
Forgotten your Ubuntu password?
It happens, and it locks you out of every command that starts with
sudo. You do not need to reinstall anything. Windows can open
Ubuntu as the root account, which is allowed to set anyone's
password without knowing the old one.
Open PowerShell or Command Prompt — this part happens on the Windows side, not inside Ubuntu.
Start Ubuntu as root:
wsl -u root
You are now inside Ubuntu, and the prompt ends with # instead of
$. That hash mark means you are root.
Set a new password, putting your own username in place of the example:
passwd lokesh
Type the new password, press Enter, then type it again to confirm. As always, nothing appears on screen while you type.
Leave the root session:
exit
Now open Ubuntu normally from the Start menu. Your new password works
everywhere sudo asks for one.
After wsl -u root, list the home folders:
ls /home
You may see more than one name. ubuntu is a built-in account
that comes with the system — yours is the other one, the name you chose at
first launch.
wsl -u root opens whichever one is the default. To reach a
specific one, name it:
wsl -d Ubuntu-24.04 -u root
wsl --list --verbose shows the names you can use.
Check it worked
In your Ubuntu window:
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
And back in PowerShell, to confirm it is running under WSL 2:
wsl --list --verbose
Your Ubuntu should have a * next to it in the NAME
column, meaning it is the default, and VERSION should read
2. If the version reads 1, convert it — put your
own distribution name in place of Ubuntu-24.04:
wsl --set-version Ubuntu-24.04 2
Finding your way around
You now have two file systems, and knowing which is which saves a lot of confusion later.
| Where | From Linux | From Windows |
|---|---|---|
| Your Linux home | ~ or /home/yourname |
\\wsl$\Ubuntu-24.04\home\yourname |
| Your Windows C: drive | /mnt/c |
C:\ |
| Your Windows desktop | /mnt/c/Users/<you>/Desktop |
C:\Users\<you>\Desktop |
Files under /mnt/c are reached through a translation layer, and
compiling there can be several times slower. Work in ~/ and you
will not notice the difference from native Linux.
Handy commands
explorer.exe .Open the current Linux folder in Windows File Explorerwsl --shutdownFrom PowerShell: stop WSL completely. The fix for most odd behaviour.code .Open the current folder in VS Code on Windows, editing Linux files directlyexitClose the Ubuntu shell
If something goes wrong
“WslRegisterDistribution failed with error: 0x80370102”
Virtualization is switched off in your computer's firmware. Restart, enter the BIOS/UEFI settings, and enable Intel VT-x or AMD-V (often listed as SVM Mode or Virtualization Technology).
“Sorry, try again” whenever I use sudo
That is the password prompt refusing what you typed. If you cannot remember it, see forgotten your Ubuntu password above — it can be reset from Windows in about a minute.
“The term 'wsl' is not recognized”
The Windows features have not finished installing. Restart the computer and run the script again.
The install is extremely slow, or stalls at 0%
Usually corporate VPN or antivirus interference. Try again off the VPN, or install the distribution manually from the Microsoft Store.
Doing it by hand instead
If you would rather not run a script, these are the same steps:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# restart Windows here
wsl --update
wsl --set-default-version 2
wsl --install -d Ubuntu-24.04
Next
With Ubuntu running, everything else happens inside that terminal. Before installing anything, step 1.5 teaches you to move around it — how to make a folder, write a file and delete it again. It takes twenty minutes and every later step assumes it.