Operations 3 min read

Quick Guide to Setting Up an Ubuntu Virtual Machine with Vagrant

This tutorial explains how to enable virtualization, install VirtualBox and Vagrant, add an Ubuntu box from a Chinese mirror, configure the Vagrantfile, launch the VM, and connect via SSH, providing all necessary commands and screenshots for a fast Ubuntu development environment.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
Quick Guide to Setting Up an Ubuntu Virtual Machine with Vagrant

Before starting, ensure that Intel Virtualization Technology is enabled in the BIOS/UEFI settings.

Download and install VirtualBox , a popular virtual machine manager.

Download and install Vagrant , which simplifies creation and management of virtual machines.

Verify the installation by running the vagrant command in a terminal.

Add an Ubuntu box from a domestic mirror (Tsinghua University) using one of the following commands, depending on the desired Ubuntu version:

# Ubuntu 18.04 LTS
vagrant box add https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/bionic/current/bionic-server-cloudimg-amd64-vagrant.box --name ubuntu18

# Ubuntu 16.04 LTS
vagrant box add https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/xenial/current/xenial-server-cloudimg-amd64-vagrant.box --name ubuntu16

# Ubuntu 14.04
vagrant box add https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box --name ubuntu14

Initialize a Vagrant configuration file:

vagrant init

Edit the generated Vagrantfile (located at C:\Users\Administrator\Vagrantfile ) and replace the default box line:

config.vm.box = "base"   # change to
config.vm.box = "ubuntu18"

Start the virtual machine:

vagrant up

Once the VM is up, connect to it via SSH:

vagrant ssh

The article also includes several screenshots illustrating each step of the process.

DevOpsVirtual MachineubuntuSetupVagrant
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.