Create VirtualBox Guest Machines on Ubuntu 17.04 / 17.10 Servers

Few days ago we showed students and new users how to install and use VirtualBox virtualization software on Ubuntu 17.04 / 17.10 server.. This can also known as headless installation.

Headless installation is when you installed and run VirtualBox on a server without direct monitor or desktop environment via remote terminal. The GUI-less installation of VirtualBox is typical in server environments.

This brief tutorial is going to show you how to install and guest operating systems on the headless installation of VirtualBox. This should be quick and easy new students should love it.

To get started with installing a guest OS on a headless VirtualBox follow the guide below:

Step 1: Install VirtualBox on Ubuntu server

Before installing a guest OS on VirtualBox software, you must first have the host server installed. Our previous post showed you how.. click the link below to read this post.

Installing VirtualBox on Ubuntu 17.04 / 17.10 Servers

Step 2: Create a Virtual Machine

Now that you’ve installed VirtualBox on the host computer.. go and install your first guest operating systems. For this post, we’ll going to install Ubuntu 17.10 server as our guest machine.

To create a VirtualBox guest machine called Ubuntu_1710, follow the guide below.

First create a location to store all the guest machines and configuration files. Run the commands below to create a folder in the /var directory called vbox.

sudo mkdir -p /var/vbox

Then run the commands below to create your first guest machine named Ubuntu_1710 and store the configurations in /var/vbox

sudo VBoxManage createvm --name Ubuntu_1710 --ostype Ubuntu_64 --register --basefolder /var/vbox

After running the commands above, run the commands below to view information about the guest OS you just created.

sudo VBoxManage showvminfo Ubuntu_1710

You should see something like the content below:

Name: Ubuntu_1710
Groups: /
Guest OS: Ubuntu (64-bit)
UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3
Config file: /var/vbox/Ubuntu_1710/Ubuntu_1710.vbox
Snapshot folder: /var/vbox/Ubuntu_1710/Snapshots
Log folder: /var/vbox/Ubuntu_1710/Logs
Hardware UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3
Memory size: 128MB
Page Fusion: off
VRAM size: 8MB
CPU exec cap: 100%
-------------
-------------

Step 3: Modify the Guest Machine

Next, modify the guest os to increase the system memory, include a virtual dvd drive and well as enable VRDP (Virtual Remote Desktop Protocol) to access the guest machine remotely by running the commands below.

sudo VBoxManage modifyvm Ubuntu_1710 --memory 1024 --boot1 dvd --vrde on --vrdeport 5001

Add a network adapter and NAT it by running the commands below. If you want it to be bridged, change nat to bridged.

sudo VBoxManage modifyvm Ubuntu_1710 --nic1 nat

Next, create a storage sata controller named “Ubuntu_1710_SATA

sudo VBoxManage storagectl Ubuntu_1710 --name "Ubuntu_1710_SATA" --add sata

Next, create virtual HDD with 10GB size and format it as VDI with standard variant.

sudo VBoxManage createhd --filename /var/box/Ubuntu_1710.vdi --size 10280 --format VDI --variant Standard

Step 4: Attach the Ubuntu ISO to the guest

Next, attach the download operating system ISO file to the VM by running the commands below.

sudo VBoxManage storageattach Ubuntu_1710 --storagectl Ubuntu_1710_SATA --port 0 --type dvddrive --medium /tmp/ubuntu-17.10-server-amd64.iso

Now when you run the showvminfo commands, you should see the new guest machine config settings.

Name: Ubuntu_1710
Groups: /
Guest OS: Ubuntu (64-bit)
UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3
Config file: /var/vbox/Ubuntu_1710/Ubuntu_1710.vbox
Snapshot folder: /var/vbox/Ubuntu_1710/Snapshots
Log folder: /var/vbox/Ubuntu_1710/Logs
Hardware UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3
Memory size: 1024MB
Page Fusion: off
VRAM size: 8MB
CPU exec cap: 100%
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 1
PAE: on
Long Mode: on
Triple Fault Reset: off

Step 5: Start the Guest Machine

Now that everything is ready, run the commands below to start the guest machine.

sudo VBoxManage startvm Ubuntu_1710 --type headless

You should see the message that the machine has started

Waiting for VM "Ubuntu_1710" to power on...
VM "Ubuntu_1710" has been successfully started.

Now open open Remote Desktop Connection on your Windows machine and connect to the server IP followed by the port 5001

ubuntu virtualbox headless

You should be able to install the guest machine remotely via RDP.

virtualbox headless ubuntu

Enjoy!

You may also like the post below:

Installing VMware Workstation 14 Pro on Ubuntu 17.04 / 17.10