DEV Community

Cover image for How to Setup Ubuntu 20.04 LTS on your local windows machine using Vagrant
Osinachi
Osinachi

Posted on • Updated on

How to Setup Ubuntu 20.04 LTS on your local windows machine using Vagrant

You have a windows computer, however you need to run some resources on a Linux operating system (OS) while still maintaining your windows machine, this is where system virtualization comes in. In this article, we will loo at how to set up Ubuntu (one of the many Linux OS distributions) on a local windows system without interrupting anything.

Requirements

A host machine (your physical hardware also called bare metal) which is your Laptop or desktop running on a windows operating system with at least an 8GB RAM size.

Outline:

  • Install VirtualBox
  • Install Vagrant
  • Setup Vagrant Box

Let's get started.

A. Download and Install VirtualBox

A virtualization software is required, this is where the Linux OS will be installed. There are a few virtualization software. Most cloud service providers make use of virtualization software to spin up the virtual machines we purchase to host resources on. For this purpose, I will be using VirtualBox (VBox).

Go to Virtual Box to download VirtualBox for windows hosts and complete the installation following the guided GUI.

On completion, a VBox shortcut icon will be created on your desktop by default except you choose not to.


B. Create a new Ubuntu machine from the installed virtual box.

1. New Linux machine named 'AltSchool' (name yours as you wish) with version Ubuntu 64-bit.

Capture 1

2. Allocate memory, here I allocated 4GB memory

Capture 2

3. Create a virtual hard disk with 12GB recommended size

Capture 3

4. My hard disk file type is VirtualBox Disk Image

Capture 4

5. Dynamic storage allocated on physical hard disk

Capture 5

6. My AltSchool Virtual Machine created! 💃

Capture 6


C. SETUP UBUNTU 20.04 LTS ON YOUR LOCAL MACHINE USING VAGRANT

1. Vagrant is an open-source software developed by Hashicorp. It enables the creation and configuration of lightweight, reproducible, and portable development environments. It is designed for anyone to have access to a simple and fast way to create a virtualized environment.

Download Vagrant from Vagrant Up and install it following the default installation prompt.

Capture-1

2. Find a virtual machine image from Vagrant called boxes in this case an Ubuntu 20.04 LTS (Focal64) and take note of the name. There are other Ubuntu images available. You can select any you find suitable.

vagrant box -focal

3. Create a folder where you want your Ubuntu image initialized.
Switch to a terminal (I used PowerShell in this case) and change into the directory. Then to initialize ubuntu, run the following command.

vagrant init ubuntu/focal64
Enter fullscreen mode Exit fullscreen mode

This action creates a Vagrantfile in the current folder, you can run ls to confirm.

Note: If you chose an image different from Ubuntu 20.04 LTS, kindly change focal64 to the exact name of your preferred Vagrant box name

Capture 2

4 Run the next command which looks for the necessary configuration files for creating the virtual machine or downloads it if not found.

vagrant up
Enter fullscreen mode Exit fullscreen mode

Capture 3

5 Then next command lets us access or log in to the ubuntu machine. When complete, your machine will be ready for use.

vagrant ssh
Enter fullscreen mode Exit fullscreen mode

Capture 4


Thanks for reading my article, feel free to drop a comment to share your experience with this method. 😊

Top comments (0)