Installing Linux#

Concepts#

Choosing Your Installation Method#

There are several ways to run Linux. For learning, a virtual machine is the safest and most practical option: you can experiment freely without risking your main operating system.

Method Pros Cons Best For
Virtual Machine (VM) Safe, reversible, snapshots Slightly slower, needs 4+ GB RAM to spare Learning (recommended)
Dual Boot Full hardware performance Risk of overwriting existing OS if done wrong Daily use alongside Windows
WSL2 (Windows) Fast, no reboot needed, integrated No real systemd (workaround exists), no desktop Quick CLI access from Windows
Bare Metal Full performance, full control Wipes existing OS (unless dual-boot) Dedicated Linux machine

This lesson walks through the VirtualBox VM approach, with brief notes on dual-boot and WSL2.

I do not recommend anything other than a VM for learning as I find it gives you full control over the resources you wish to allocate to the guest and it protects against accidental rm -rf / --no-preserve-rootcommands ;)

What Is a Virtual Machine?#

A virtual machine is a software-emulated computer that runs inside your real computer. The software that creates and manages VMs is called a hypervisor. You give the VM a share of your CPU, RAM, and disk space, and it runs an operating system as if it were a separate physical machine.

VirtualBox is a free, open-source hypervisor from Oracle that runs on Windows, macOS, and Linux. Other options include VMware Workstation (free for personal use, although the Broadcom experience will leave you traumatized) and GNOME Boxes (Linux only, for absolute nerds).

What You Need#

  • Host machine: Windows 10/11, macOS, or an existing Linux system
  • RAM: At least 8 GB total (you will give the VM 2-4 GB)
  • Disk: At least 25 GB of free space
  • CPU: Any modern 64-bit processor with virtualization enabled (VT-x for Intel, AMD-V for AMD). Enabling virtualization is platform specific and outside the scope of this guide.
  • ISO image: The installer file for your chosen distribution

Downloading the ISO#

An ISO file is a disk image — a file that contains the exact contents of an installation disc. You download it and “insert” it into your virtual machine as if it were a physical DVD.

Ubuntu 24.04 LTS: Download from the official site. Choose the “Ubuntu 24.04 LTS” desktop image. File size: ~5.7 GB.

Debian 12: Download from debian.org/distrib. Choose the “netinst” (network install) image for a minimal download (~600 MB) that fetches packages during installation, or the full DVD image (~3.7 GB) for offline install.

Large downloads can get corrupted. To verify:

# On Windows (PowerShell):
Get-FileHash ubuntu-24.04-desktop-amd64.iso -Algorithm SHA256

# On macOS / Linux:
sha256sum ubuntu-24.04-desktop-amd64.iso

Compare the output with the checksum published on the download page. They must match exactly.


Lab#

Exercise 1: Install VirtualBox#

  1. Go to virtualbox.org and download the installer for your host OS.
  2. Run the installer. Accept the defaults.
  3. On Windows, say “Yes” when asked to install network drivers. Your network will briefly disconnect but should come back online in a few instants. Were that not the case I wish you good luck as you are now on your own debugging a network connection.
  4. Launch VirtualBox when the installation finishes.

Exercise 2: Create an Ubuntu 24.04 VM#

This is only a high level overview on how to install. The process is pretty straightforward and a rule of thumb is “if you don’t know what it does then you don’t need it”. However I highly recommend finding more comprehensive sources for installation.

  1. In VirtualBox, click New.
  2. Fill in the details:
    • Name: Ubuntu-2404 or whatever you like.
    • Folder: leave default unless you have a very good reason not to.
    • ISO Image: click the dropdown and select the Ubuntu ISO you downloaded
    • VirtualBox should auto-detect “Ubuntu (64-bit)” as the type.
  3. Click Next — Unattended Install screen:
    • Disable unattended install.
  4. Click Next — Hardware:
    • Base Memory: 4096 MB (4 GB) — minimum 2048 MB
    • Processors: 2 CPUs
  5. Click Next — Virtual Hard Disk:
    • Choose Create a Virtual Hard Disk Now
    • Disk Size: 25 GB (minimum). 40 GB is more comfortable.
  6. Click Next, review the summary, click Finish.
  7. The VM will appear in the left panel. Click Start.
  8. Choose Install Ubuntu.
  9. Select your language, keyboard layout, and time zone.
  10. Choose Normal installation (includes a web browser and basic utilities).
  11. Check Install third-party software for graphics, Wi-Fi, and media codecs.
  12. Choose Erase disk and install Ubuntu — this only affects the virtual disk, not your real disk.
  13. Set your name, computer name, username, and password. Try to remember them as i’m told they’re pretty useful.
  14. Wait for the installation to complete, then click Restart Now.
  15. When prompted, press Enter to remove the installation medium (VirtualBox does this automatically but remember that, were that not the case, there is a very intuitive hardware panel in your vm settings).

You now have a working Ubuntu 24.04 VM.

Exercise 3: Create a Debian 12 VM (Optional)#

If you want to also follow along with Debian:

  1. In VirtualBox, click New.
  2. Name it Debian-12, select the Debian netinst ISO.
  3. Use the same hardware settings: 4 GB RAM, 2 CPUs, 25 GB disk.
  4. Start the VM.
  5. The Debian installer is text-based (or choose “Graphical Install” for a GUI installer):
    • Select language, location, keyboard.
    • Set a hostname (e.g., debian-lab).
    • Set a root password (Debian asks for this separately — Ubuntu does not use a root password).
    • Create a regular user account with a password.
    • Partition the disk: choose Guided — use entire disk (safest for a VM).
    • Select a desktop environment (GNOME to match Ubuntu, or none for server-only).
    • When asked about package repositories, accept the defaults.
    • Install the GRUB bootloader to the virtual disk.
  6. Reboot when done.

Debian note: Debian asks you to set a root password during installation. If you set one, sudo is not configured for your regular user by default — you must use su - to switch to root. If you leave the root password blank, Debian will set up sudo for your user, similar to Ubuntu. For this course, leave the root password blank to get the Ubuntu-like sudo behavior.

Exercise 5: Take a Snapshot#

Snapshots let you save the current state of your VM and restore it later if anything goes wrong.

  1. In VirtualBox, with the VM shut down (or running — live snapshots work too).
  2. Click the hamburger menu (☰) next to the VM name → Snapshots.
  3. Click Take (camera icon).
  4. Name it Fresh Install and click OK.

If you ever break something during a lab, you can restore this snapshot and start fresh without having to sit through the installer again.


Review#

1. Why is a virtual machine recommended for learning Linux?

It is safe and reversible. You can experiment, break things, and restore from a snapshot. It does not affect your host operating system. You can also run multiple VMs for different distributions.

2. What is an ISO file?

A disk image file that contains the exact contents of an installation disc. You download it and use it to boot and install an operating system.

3. How much RAM and disk space should you allocate to a learning VM at minimum?

At least 2 GB RAM (4 GB recommended) and 25 GB disk space.

4. What is the key difference in root/sudo setup between the Ubuntu and Debian installers?

Ubuntu does not ask for a root password and sets up sudo for the first user automatically. Debian asks for a root password — if you set one, your regular user does not get sudo access by default (you must use su -). If you leave the root password blank in Debian, it sets up sudo like Ubuntu.

5. What are VirtualBox Guest Additions, and why should you install them?

Guest Additions are drivers and utilities that improve the VM experience: dynamic screen resolution, shared clipboard between host and guest, shared folders, and smoother mouse integration.

6. What does a VM snapshot allow you to do?

Save the current state of the virtual machine at a point in time and restore to that exact state later. Useful for creating a “clean” checkpoint before experimenting.

7. What is the main limitation of WSL2 compared to a full VM?

WSL2 lacks a real boot process, desktop environment, and full hardware interaction. Some systemd features require manual enabling. It is good for CLI work but does not give the complete Linux experience.


Previous: Ubuntu and Debian | Next: The Desktop Environment