Ways to Run Linux: WSL2, VMs & Cloud

Linux · Lesson 2 of 32 8 min read Updated

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

OptionWhat it isGood forDownsides
WSL2Linux running inside Windows 10/11Fastest start, daily practice, developmentNo full desktop by default; shares Windows resources
Virtual machineA whole computer simulated by VirtualBoxSafe experiments, snapshots, server practiceNeeds spare RAM and disk
Cloud VPSA rented Linux server with a public IPReal servers, hosting websites (the final project)Costs money every month; exposed to the internet
Dual bootUbuntu installed next to Windows on your diskFull speed, full desktopRisk 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:

PowerShell
wsl --install

This 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:

PowerShell
wsl --list --online
wsl --install -d Debian
wsl --list --verbose
wsl --update
wsl --shutdown
Output
  NAME      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:

Terminal
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.

  1. Install Oracle VirtualBox from virtualbox.org.
  2. Download an Ubuntu 26.04 LTS image (an .iso file) 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.
  3. In VirtualBox, choose New, select the ISO, and give the VM 2 CPUs, enough memory and a 25 GB disk.
  4. Start the VM and follow the installer. On Ubuntu Server, tick "Install OpenSSH server" so you can connect from your laptop later.
  5. 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:

  1. Choose an Ubuntu 26.04 LTS image and the smallest plan (1 CPU and 1 GB of RAM is enough to learn).
  2. Choose a data centre region close to your users, such as Mumbai or Bengaluru.
  3. Upload your SSH public key (you will create one in SSH & Key-based Login).
  4. Note the public IP address the provider gives you, then connect from your own terminal:
Terminal
ssh root@203.0.113.10
Output
Welcome 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.

Terminal
sudo apt update
sudo apt upgrade

sudo 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 --install in a normal PowerShell window. It needs Administrator rights. Close the window and open "Run as administrator".
  • Working in /mnt/c inside 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 --install from 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 update and sudo apt upgrade on 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
Terminal
whoami
pwd
uname -r
ls /mnt/c/Users
Output
priya
/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?

2. Where do your Windows C: drive files appear inside WSL?

3. What is a snapshot in VirtualBox?

4. Why should you harden a new cloud VPS quickly?

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