DEV Community

Cover image for How to Install and Use Ubuntu on a Virtual Machine
Anthony
Anthony

Posted on

How to Install and Use Ubuntu on a Virtual Machine

What You’ll Need

  • A computer running Windows 10/11 or macOS

  • At least 8 GB RAM (16 GB recommended)

  • 10–25 GB free disk space

  • An internet connection


Step 1: Download Ubuntu ISO

  1. Go to the official Ubuntu site:
  2. Click Download Ubuntu 24.04 LTS

3.Save the .iso file (~4.5 GB) to your computer


Step 2: Install VirtualBox

On Windows 10/11:

1. Go to [](https://www.virtualbox.org/wiki/Downloads)

2. Download Windows hosts

3. Run the installer and follow the prompts (accept defaults)

4. After install, launch VirtualBox
Enter fullscreen mode Exit fullscreen mode

On macOS:

1. Same site  [](https://www.virtualbox.org/wiki/Downloads)

2. Download OS X hosts

3. If installation fails or USB/network support breaks, install Parallels Desktop instead (free trial):
 [](https://www.parallels.com/products/desktop/)
Enter fullscreen mode Exit fullscreen mode

*Step 3: Create the Virtual Machine
*

1. Open VirtualBox, click New

2. Name: Ubuntu 24.04
   Type: Linux
   Version: Ubuntu (64-bit)

3. Click Next
Enter fullscreen mode Exit fullscreen mode

Memory Size:

- Use 4096 MB (4 GB) minimum
Enter fullscreen mode Exit fullscreen mode

Hard Disk:

- Choose Create a virtual hard disk now
- Click Create
Enter fullscreen mode Exit fullscreen mode

Hard Disk File Type:

- Leave as VDI (VirtualBox Disk Image)
Enter fullscreen mode Exit fullscreen mode

Storage:

- Select Dynamically allocated
Enter fullscreen mode Exit fullscreen mode

Disk Size:

  • Set to 25 GB

Step 4: Mount Ubuntu ISO and Start the VM

1. Select your new VM → click Settings

2. Go to Storage tab

3. Under Controller: IDE, click the empty disk icon

4. On the right, click the disk icon → choose a disk file

5. Select the Ubuntu .iso you downloaded

6. Click OK
Enter fullscreen mode Exit fullscreen mode

Now click Start to launch the VM.


Step 5: Install Ubuntu
Once Ubuntu boots inside the VM:

1. Choose your language → Click Try or Install Ubuntu

2. Click Install Ubuntu

3. Keyboard Layout: Choose or accept default

4. Installation Type: Select Erase disk and install Ubuntu (don’t worry—it only affects the VM, not your real machine)

5. Follow the prompts:

    - Set your time zone

    -  Enter name, computer name, username, and password

6. Click Install Now

7. Wait for installation to complete (~10–20 mins)

8. When prompted, click Restart Now
If it freezes on restart, click Machine → Reset in VirtualBox menu
Enter fullscreen mode Exit fullscreen mode

Step 6: First-Time Use

After reboot:

1. Login with the username/password you created

2. You’ll see the Ubuntu desktop environment

3. Explore basic features:

    - Open Terminal (Ctrl + Alt + T)
    - Launch Firefox
    - Open the file manager
    Shut down via top-right menu
Enter fullscreen mode Exit fullscreen mode

Post-Install Tips (Recommended)

1. Install Guest Additions (for better performance)
In Ubuntu VM:

1. Click Devices → Insert Guest Additions CD image

2. Open the mounted disk on the desktop

3. Right-click inside the folder → Open in Terminal

4. Run:
Enter fullscreen mode Exit fullscreen mode
sudo ./VBoxLinuxAdditions.run
Enter fullscreen mode Exit fullscreen mode
5. Restart the VM
Enter fullscreen mode Exit fullscreen mode

Enables:

- Full-screen resolution

- Shared clipboard (copy-paste)

- Drag-and-drop files
Enter fullscreen mode Exit fullscreen mode

2. Enable Shared Folders (optional)

1. In VirtualBox, go to Settings → Shared Folders

2. Add a new folder from your host system

3. Check Auto-mount and Make Permanent

4. Restart Ubuntu → the folder appears in /media/sf_<foldername>
Enter fullscreen mode Exit fullscreen mode

3. Internet Access

Ubuntu should have internet automatically via NAT.
If not:

- Go to Settings → Network

- Ensure Attached to: NAT is selected
Enter fullscreen mode Exit fullscreen mode

Cleaning Up (Optional)

To free up space on your host:

- Delete unused snapshots

- Unused .iso file after installation
Enter fullscreen mode Exit fullscreen mode

What’s Next?

Now that Ubuntu is installed, here are beginner-friendly tasks:

- Learn Simple Commands such as `ls` `pwd` `cd` `mkdir`

- Try installing software: `sudo apt install gimp`

- Learn about system updates: `sudo apt update && sudo apt upgrade`

- Explore GNOME Settings
Enter fullscreen mode Exit fullscreen mode

Summary

You now have a fully functioning Ubuntu environment inside a safe virtual machine. This is the perfect sandbox to learn Linux without breaking anything on your main OS.

Top comments (0)