softare development

Configure Linux on a Virtual Machine

What Is a Virtual Machine (VM)?

Virtual Machine (VM) is a software-based computer system that emulates a physical computer.
It allows you to run multiple operating systems (OS) — like Linux, Windows, or macOS — on the same physical machine simultaneously.

For example:

  • You can have Windows as your main (host) operating system.
  • Then, install Linux inside a Virtual Machine — running it like an app on Windows.

What a Virtual Machine Does

A VM:

  • Creates an isolated environment inside your host OS.
  • Lets you test, develop, and experiment without affecting your main system.
  • Allows you to run different OSes at once (e.g., Ubuntu inside Windows).
  • Uses a hypervisor (e.g., VirtualBox, VMware, Hyper-V) to manage and allocate resources (CPU, RAM, disk, etc.) to virtual systems.

System Requirements for Running a VM

To run a Linux VM smoothly, your computer should meet these minimum requirements:

ComponentMinimumRecommended
CPU64-bit processor (dual-core)Quad-core or higher
RAM4 GB8 GB or more
Disk Space20 GB free50 GB+ free
Virtualization SupportEnabled in BIOS/UEFIMust be enabled
InternetOptionalRecommended for updates

Step 1: Choose a Virtualization Software (Hypervisor)

There are many, but here are the most popular free ones:

  1. VirtualBox (by Oracle) — Free and beginner-friendly
    🔗 https://www.virtualbox.org
  2. VMware Workstation PlayerFree for personal use
    🔗 https://www.vmware.com/products/workstation-player.html
  3. Hyper-V (Windows built-in option) — For Windows Pro/Enterprise users only

👉 We’ll use VirtualBox in this guide (it’s easy and widely supported).

Step 2: Download a Linux Distribution ISO

Linux ISO file is the installation image (like a bootable CD).

Common beginner-friendly choices:

Download the ISO file and save it somewhere you can find it later.

Step 3: Install and Set Up VirtualBox

  1. Install VirtualBox
    • Download and install VirtualBox from its official website.
    • Follow the installation wizard (Next → Next → Finish).
  2. Launch VirtualBox
    • Open the app and click “New” to create a new virtual machine.
  3. Create the Virtual Machine
    • Name: e.g., “Ubuntu Linux”
    • Type: Linux
    • Version: Ubuntu (64-bit) or whichever distro you downloaded
    • Click Next
  4. Assign Memory (RAM)
    • Allocate at least 2048 MB (2 GB) — or more if your system allows.
  5. Create a Virtual Hard Disk
    • Choose “Create a virtual hard disk now.”
    • File type: VDI (VirtualBox Disk Image)
    • Storage: Dynamically allocated
    • Size: 20 GB or more

Click Create.

Step 4: Mount the Linux ISO File

  1. Select your new VM in VirtualBox.
  2. Click Settings → Storage.
  3. Under “Controller: IDE”, click the empty disk icon.
  4. Click the small CD icon → Choose a disk file → locate and select your downloaded Linux ISO.
  5. Click OK.

Now your VM is set up to boot from the Linux installer ISO.

Step 5: Boot and Install Linux

  1. Select your VM and click Start.
  2. It will boot from the ISO (like starting a new computer with a Linux CD).
  3. Follow the on-screen instructions:
    • Choose your language.
    • Click “Install Ubuntu” (or equivalent).
    • Choose installation type: Erase disk and install Linux (affects only the virtual disk, not your host PC).
    • Set your username and password.
  4. Wait for installation to complete.
  5. Once done, reboot the VM.
  6. When asked, remove the ISO (VirtualBox may prompt this automatically).

Step 6: Post-Installation Configuration

After logging in to your new Linux VM:

Update system packages

sudo apt update && sudo apt upgrade -y

Install Guest Additions for better performance:

In VirtualBox menu → Devices → Insert Guest Additions CD image

Follow on-screen prompts to install it.

This enables:

  • Better screen resolution
  • Clipboard sharing (copy-paste between host and VM)
  • Shared folders and drag-and-drop

Step 7: Optional Enhancements

Enable shared folders to access host files in the VM.

Install developer tools:

sudo apt install build-essential git curl -y

Take snapshots in VirtualBox before big changes — easy rollback points.

Summary

StepActionPurpose
1Install VirtualBoxCreate virtual environment
2Download Linux ISOGet Linux installer
3Create a new VMAllocate resources
4Mount ISOBoot from Linux image
5Install LinuxSet up OS
6Update & configureOptimize performance
7Enhance & useDevelop, learn, or test safely
Share
Published by
codeflare

Recent Posts

The Golden Ratio (φ)

1. What Is the Golden Ratio? The Golden Ratio, represented by the Greek letter φ (phi), is…

4 days ago

CSS Combinators

In CSS, combinators define relationships between selectors. Instead of selecting elements individually, combinators allow you to target elements based…

6 days ago

Boolean Algebra

Below is a comprehensive, beginner-friendly, yet deeply detailed guide to Boolean Algebra, complete with definitions, laws,…

1 week ago

Why It’s Difficult to Debug Other People’s Code (And what Can be Done About it)

Debugging your own code is hard enough — debugging someone else’s code is a whole…

1 week ago

Complete Git Commands

Git is a free, open-source distributed version control system created by Linus Torvalds.It helps developers: Learn how to…

2 weeks ago

Bubble Sort Algorithm

Bubble Sort is one of the simplest sorting algorithms in computer science. Although it’s not…

2 weeks ago