How To Install Linux On Virtual Machine

How To Install Linux On Virtual Machine

Reading time1 min
#Linux#VirtualMachine#Installation#Ubuntu#VirtualBox

Mastering Linux Installation on a Virtual Machine: A Step-by-Step Practical Guide

Forget the overwhelming, jargon-filled tutorials — this guide cuts through the noise with a straightforward, hands-on approach that IT pros can rely on. Learn not just the 'how,' but the 'why' behind each step to gain real mastery, not just rote execution.


Installing Linux on a virtual machine (VM) is an essential skill for IT professionals, developers, and anyone eager to get hands-on experience with this versatile operating system — all without touching your primary computer setup. Virtual machines offer a safe sandbox to experiment, test new software, and hone your skills without risking data loss or system instability.

In this guide, we'll break down the entire process into clear, concise steps and explain why each one matters. By the end, you'll be confidently running a Linux VM tailored to your needs.


Why Use a Virtual Machine for Linux?

Before diving in, let’s get clarity on why you should install Linux on a VM instead of a physical machine:

  • Safety: Test new configurations and software without impacting your main OS.
  • Convenience: Run multiple OSes side-by-side on the same hardware.
  • Portability: Easily export and transfer VM environments.
  • Learning: Quickly experiment with different Linux distros and setups.

With that in mind, let’s get practical.


What You’ll Need

  • A host machine (Windows, macOS, or Linux)
  • Virtualization software (I recommend VirtualBox — free and cross-platform)
  • A Linux ISO image (we'll use Ubuntu Desktop as an example)

Step 1: Download and Install VirtualBox

Why this matters: VirtualBox is your VM manager. It creates isolated environments on your host OS, making the rest of this guide possible.

  1. Go to the VirtualBox Official Download Page.
  2. Select the installer for your operating system.
  3. Run the downloaded installer and follow the prompts.
  4. Once installed, open VirtualBox.

Step 2: Download the Linux Distribution ISO

Why this matters: The ISO is basically a digital copy of the Linux OS installation disc.

  1. Visit Ubuntu’s Official Website.
  2. Download the latest LTS (Long Term Support) version — this is stable and recommended for beginners.
  3. Save the ISO file somewhere accessible on your hard drive.

Step 3: Create a New Virtual Machine

Why this matters: This reserves hardware resources for your Linux VM and sets its environment.

  1. In VirtualBox, click New.
  2. Name your VM — e.g., Ubuntu-VM.
  3. For Type, choose Linux.
  4. For Version, choose Ubuntu (64-bit).
  5. Allocate memory (RAM) — a good starting point is 2048 MB (2 GB), more if your host can spare it.
  6. Choose Create a virtual hard disk now > VDI (VirtualBox Disk Image) > Dynamically allocated.
  7. Set disk size — a minimum of 25 GB is recommended to allow system and app installations.
  8. Click Create.

Step 4: Configure Your Virtual Machine to Use the Linux ISO

Why this matters: The VM needs to boot from the Linux ISO to start the installation process.

  1. Select your newly created VM in VirtualBox.
  2. Click Settings > Storage.
  3. Under the Controller: IDE, click the empty CD icon.
  4. On the right panel, click the small CD icon next to Optical Drive > Choose a disk file….
  5. Navigate and select your downloaded Ubuntu ISO file.
  6. Click OK.

Step 5: Start the Virtual Machine and Install Linux

  1. Select your VM and click Start.
  2. The VM will boot using the ISO — you’ll see the Ubuntu installer splash screen.
  3. Choose Install Ubuntu.
  4. Follow the on-screen prompts:
    • Select your language.
    • Choose your keyboard layout.
    • Opt for Normal installation and check Download updates while installing Ubuntu for a smoother experience.
    • On the installation type, select Erase disk and install Ubuntu. Don’t worry — this only affects the virtual disk, not your physical hard drive.
  5. Set your timezone.
  6. Create your user account and password.
  7. Wait for the installation to complete.
  8. Once done, click Restart Now.

Step 6: Remove the ISO to Boot into Your New Linux System

If you don’t remove the ISO, the VM will boot into the installer again.

  1. After the VM restarts and prompts you to remove installation media, press Enter or go to Devices > Optical Drives in VirtualBox’s menu and unmount the ISO.
  2. The VM should now boot into your freshly installed Ubuntu desktop.

Step 7: Post-Installation Tips

  • Install Guest Additions: This enhances screen resolution, clipboard sharing, and overall integration between host and VM.
    • While your VM is running, go to Devices > Insert Guest Additions CD Image.
    • Follow on-screen instructions inside your Linux VM to install.
  • Take Snapshots: Before major experimentation, take snapshots of your VM state. This lets you revert if something breaks.
  • Update your system:
    sudo apt update && sudo apt upgrade -y
    

Why This Matters: Not Just "How" but "Why"

  • Memory & Disk Allocation: You choose resources based on what your development or testing workload requires, balancing VM performance with your host computer’s capacity.
  • Dynamically Allocated Storage: Saves physical disk space by expanding as needed, rather than reserving the maximum upfront.
  • Guest Additions: Improves your daily usability — better graphics, seamless mouse movements, shared folders — making the VM a practical day-to-day tool.
  • Snapshots: A safety net allowing risk-taking and quick recovery, accelerating your learning and experimentation.

Wrapping Up

With a Linux VM set up, you’ve opened a versatile sandbox that powers everything from software development environments to network testing labs. You’ve taken a key step towards mastering Linux without jeopardizing your primary system.

Remember, the best way to learn Linux is by doing — so start installing apps, exploring the terminal, and maybe even try setting up a web server or programming environment right inside your VM.

Got questions or stuck at any step? Drop a comment below — let's master Linux installation together!


Happy Linuxing! 🚀