Understanding Virtual Machines and Setting Up Your First Linux VM

πŸ–₯️ Introduction to Virtual Machines (VMs)

A Virtual Machine is an emulated computer system that runs on top of physical hardware using a piece of software called a hypervisor.

🧱 Key Components:

ComponentDescription
Host MachineThe physical system where everything runs.
HypervisorThe software that creates and manages VMs.
Guest OSThe operating system running inside the virtual environment.
Virtual HardwareCPU, RAM, disk, and network interfaces simulated by the hypervisor.

πŸ”„ Types of Hypervisors

TypeDescriptionExamples
Type 1Bare-metal hypervisors run directly on hardware.VMware ESXi, Microsoft Hyper-V, Xen
Type 2Runs on top of an existing OS. Best for beginners.VirtualBox, VMware Workstation

πŸ› οΈ Setting Up a Linux Virtual Machine (Step-by-Step)

Let’s walk through setting up a Linux VM using VirtualBox, a free and beginner-friendly Type 2 hypervisor.

βœ… Prerequisites:

  • Download and install VirtualBox

  • Download an ISO image of a Linux distribution (e.g., Ubuntu)


πŸ”§ Step 1: Create a New VM

  1. Open VirtualBox and click "New".

  2. Name it (e.g., DevOps-Lab) and select Linux > Ubuntu (64-bit).

  3. Set RAM (at least 2048 MB recommended).

  4. Create a virtual hard disk (20 GB dynamically allocated is a good start).


πŸ“‚ Step 2: Attach ISO and Install Linux

  1. Select your VM and click "Start".

  2. Browse and attach your downloaded Linux ISO.

  3. The VM will boot from the ISO – follow the on-screen steps to install the OS.


βš™οΈ Step 3: Post-Installation Setup

  • Install Guest Additions (for better resolution, clipboard sharing).

  • Update packages:

      bashCopyEditsudo apt update && sudo apt upgrade -y
    
  • Install useful tools:

      bashCopyEditsudo apt install curl git vim -y
    

πŸ§ͺ Optional: Snapshot Your VM

Before doing major changes, take a snapshot to save the current state:

  • Right-click your VM β†’ Snapshots β†’ Take

🎯 Use Cases of VMs in DevOps

  • Local Dev/Test Environments: Spin up different OS setups easily.

  • Simulate Server Environments: Mimic production-like setups without touching real servers.

  • Practice Infrastructure Automation: Use tools like Ansible, Docker, and Terraform inside VMs.


πŸš€ What’s Next?

Now that you’ve set up a Linux VM, you're ready to start experimenting with DevOps tools inside a safe, isolated sandbox. In upcoming lessons, we'll use this VM as our playground to explore:

  • Terminal commands

  • Shell scripting

  • Configuration management (e.g., Ansible)

  • Containerization (e.g., Docker)

0
Subscribe to my newsletter

Read articles from M. T. H. Titumir directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

M. T. H. Titumir
M. T. H. Titumir

πŸš€ Curious mind | Problem solver πŸ“š Learning & creating πŸ‘€ Observing the world, one thought at a time