Ways to Run Linux: WSL2, VMs & Cloud
You cannot learn Linux by reading alone; you need a Linux terminal to practise in. The good news is that you do not have to wipe your laptop. You can run Ubuntu inside Windows, inside a virtual machine, or on a rented server in a data centre.
This lesson compares the four common options, then walks you through the two best ones for beginners: WSL2 and a virtual machine. Pick one and set it up before the next lesson.
The four options
| Option | What it is | Good for | Downsides |
|---|---|---|---|
| WSL2 | Linux running inside Windows 10/11 | Fastest start, daily practice, development | No full desktop by default; shares Windows resources |
| Virtual machine | A whole computer simulated by VirtualBox | Safe experiments, snapshots, server practice | Needs spare RAM and disk |
| Cloud VPS | A rented Linux server with a public IP | Real servers, hosting websites (the final project) | Costs money every month; exposed to the internet |
| Dual boot | Ubuntu installed next to Windows on your disk | Full speed, full desktop | Risk of data loss if done carelessly; reboot to switch |
A virtual machine (VM) is software that pretends to be a complete computer, with its own virtual disk, memory and network card. A VPS (virtual private server) is a VM that a hosting company runs for you in its data centre. Dual boot means two operating systems on one disk, and you choose one each time the computer starts.
Option 1: WSL2 on Windows
The Windows Subsystem for Linux (WSL) runs a real Linux kernel inside a lightweight virtual machine that Windows manages for you. WSL2 is the current version; the old WSL1 translated Linux calls instead of running a real kernel and is now rarely used. You need Windows 11, or Windows 10 version 2004 (build 19041) or later.
Open PowerShell as Administrator (right-click, "Run as administrator") and run:
wsl --installThis turns on the required Windows features and installs Ubuntu, the default distribution. Restart when asked. When Ubuntu opens for the first time, it asks you to create a Linux user name and password. This account is separate from your Windows login. Choose a short lower-case name such as priya, and remember the password: you will type it for sudo often.
A few WSL commands you will use from PowerShell:
wsl --list --online
wsl --install -d Debian
wsl --list --verbose
wsl --update
wsl --shutdownNAME STATE VERSION * Ubuntu Running 2
--list --online shows the distributions you can install, -d picks one by name, --list --verbose (short form wsl -l -v) shows what you have and whether each uses WSL 1 or 2 (the output above), --update updates WSL itself, and --shutdown stops all running distributions.
Inside WSL, your Windows drives appear under /mnt. Windows can see your Linux files too:
cd ~
ls /mnt/c/Users
explorer.exe .explorer.exe . opens the current Linux folder in Windows File Explorer (the address looks like \\wsl.localhost\Ubuntu\home\priya). Keep your Linux practice files inside your Linux home folder, not under /mnt/c: access across the boundary is much slower, and Windows does not understand Linux permissions.
Option 2: a virtual machine with VirtualBox
A VM gives you a complete, separate Ubuntu that you can break and restore without any risk to Windows. This is the best choice for security practice.
- Install Oracle VirtualBox from virtualbox.org.
- Download an Ubuntu 26.04 LTS image (an
.isofile) from ubuntu.com. Ubuntu Server has no desktop and needs only about 1.5 GB of RAM and 4 GB of disk, which is perfect for this course. Ubuntu Desktop needs at least 6 GB of RAM and 25 GB of disk. - In VirtualBox, choose New, select the ISO, and give the VM 2 CPUs, enough memory and a 25 GB disk.
- Start the VM and follow the installer. On Ubuntu Server, tick "Install OpenSSH server" so you can connect from your laptop later.
- After installing, take a snapshot (Machine, Take Snapshot). A snapshot saves the VM's state, so you can return to it in seconds if you damage something.
The default network mode, NAT, gives the VM internet access through your laptop. Switch to Bridged Adapter if you want other machines on your Wi-Fi to reach the VM.
Option 3: a cloud VPS
For the final project you will want a real server with a public IP address. Most cloud and hosting providers let you create one in a few minutes:
- Choose an Ubuntu 26.04 LTS image and the smallest plan (1 CPU and 1 GB of RAM is enough to learn).
- Choose a data centre region close to your users, such as Mumbai or Bengaluru.
- Upload your SSH public key (you will create one in SSH & Key-based Login).
- Note the public IP address the provider gives you, then connect from your own terminal:
ssh root@203.0.113.10Welcome to Ubuntu 26.04 LTS (GNU/Linux 7.0.0-15-generic x86_64) ... root@shop-server:~#
203.0.113.10 is an example address; use the one from your provider. A VPS is on the public internet from the first minute, and bots will start trying passwords almost immediately, so read Basic Server Hardening before you leave one running.
Option 4: dual boot or a live USB
You can write the Ubuntu Desktop ISO to a USB drive (with Ubuntu's Startup Disk Creator or a tool such as Rufus on Windows) and boot from it. Choose "Try Ubuntu" to run it without installing anything; this is called a live session. From there the installer can also put Ubuntu next to Windows.
Your first commands after installing
Whatever option you choose, update the system first. You will learn exactly what these do in Package Management.
sudo apt update
sudo apt upgradesudo runs a command as the administrator and asks for your password. On Ubuntu 26.04 you will see an asterisk for each character you type; older systems showed nothing at all, which confused many beginners.
Common mistakes
- Running
wsl --installin a normal PowerShell window. It needs Administrator rights. Close the window and open "Run as administrator". - Working in
/mnt/cinside WSL. It works, but it is slow and file permissions behave strangely. Work in~(your Linux home). - Forgetting the Linux password. WSL, VMs and servers all ask for it with
sudo. Write it down somewhere safe. - Leaving a VPS with password login enabled. Use SSH keys and harden the server early.
Key points
- WSL2 runs a real Linux kernel inside Windows; install it with
wsl --installfrom an Administrator PowerShell. - A VirtualBox VM is a safe, separate computer with snapshots you can roll back to.
- A cloud VPS is a rented server with a public IP that you reach with
ssh. - Dual boot gives full speed but carries a risk of data loss; back up first.
- Run
sudo apt updateandsudo apt upgradeon any new Ubuntu system.
Exercise
Set up one Linux environment (WSL2 or a VirtualBox VM). Then, inside Linux, find out three things: your user name, your current folder and the kernel version. If you use WSL, also list the folders in /mnt/c/Users.
Show solution
whoami
pwd
uname -r
ls /mnt/c/Userspriya /home/priya 6.6.87.2-microsoft-standard-WSL2 Default Priya Public
whoami prints your Linux user name and pwd prints the current folder, your home. On WSL the kernel version ends in WSL2; in a VirtualBox VM running Ubuntu 26.04 it would look like 7.0.0-15-generic. The exact numbers on your machine will be different.
Quick Quiz
1. Which command installs WSL and Ubuntu on a Windows 11 laptop?
wsl --install enables the Windows features and installs Ubuntu as the default distribution.
2. Where do your Windows C: drive files appear inside WSL?
WSL mounts Windows drives under /mnt, so C: is /mnt/c.
3. What is a snapshot in VirtualBox?
Snapshots let you undo mistakes by restoring the VM to an earlier state.
4. Why should you harden a new cloud VPS quickly?
Anything on the public internet is scanned constantly, so weak logins are found fast.
Learn Linux with a mentor
Free lessons get you started. Our Ethical Hacking & Cyber Security training adds real projects and code reviews from working developers.
- Project-based learning
- Mentor code reviews
- Free counselling call
