Objectives

Virtualbox · Linux · Vagrant

Introduction

The main purpose of this lab is to set up your laptop/workstation with the main software packages used in this module, specifically Virtualbox, Vagrant and Ubuntu Operating System. Please complete this lab before the on-site days in June as downloading and installing these packages can take some time. On successful completion, you should have a "platform independent" environment to complete the labs and assignments irrespective of the type of machine/operating system you use.

There is a "computer-systems" channel on Slack so if you've any issues with the lab you can interact with us there there and/or resolve it during the Computer Systems and Networks workshop on June 14th.

Download and install Virtualbox v5.2.12

VirtualBox.org

Virtualbox is a virtualisation hypervisor which provides an environment to create and provision virtual machine instances.

You will be using Virtualbox to explore machine virtualisation and operating systems. This and subsequent labs have been developed and tested using version 5.2.12. To keep your development environment consistent with the labs, you are advised to install this version.

Select the appropriate download and install Virtualbox 5.2.12 for your operating system:

Ensure that Virtualbox has installed correctly by starting the application as follows

  • Open a terminal window for your operating system

    • Windows 10: Click Start and then type “cmd” into the search box. Click on Command Prompt in search results.
    • OS X: Click the Spotlight icon and type "terminal" in the search field. Dbl click on Terminal in search results.
    • Linux: check online for your distro.
  • Type "virtualbox" at the prompt.

All going well you should see something similar to the following:

VirtualBox.org

For more information about Virtualbox and installation, have a look around the website.

Bionic Beaver!!!!!!!!!!!!

Ubuntu 18.04 LTS:

Version 18.04 was released in April 2018 and is guaranteed to have supported security and maintenance updates until April 2023

  • Ubuntu is an ancient African word meaning humanity to others. It also means I am what I am because of who we all are.
  • Ubuntu is free/Libre Open-Source Software
  • Ubuntu is a computer operating system!!!
  • Ubuntu used the Linux kernel

The Linux kernel on its own, is not an operating system, but rather a set of computer instructions, that enable communication between software applications and the data processing done at the hardware level.

Recommended system requirements:

  • 2 GHz dual core processor or better
  • 2 GB system memory or more
  • 25 GB of free hard drive space
  • The Ubuntu iso image file

    Also:

  • Internet access is helpful
  • Make sure you have a recent backup of your data. While it's unlikely that anything will go wrong, you can never be too prepared!!

What is an iso image file

You will actually be downloading an iso image file. ISO images are often used to distribute large programs over the internet due to the fact that all of the program's files can be neatly contained as a single file.

With this iso image, potentially you can:

  • Install or upgrade Ubuntu
  • Test out the Ubuntu desktop experience without touching your PC configuration
  • Boot into Ubuntu on a borrowed machine or from an internet cafe
  • Use tools installed by default on the USB stick to repair or fix a broken configuration

Downloading Ubuntu 18.04 LTS

Download the latest LTS version via the Ubuntu Releases page. I do not recommend to download from anywhere else

  • Scroll down to where the file description is. This is the one you will want to download:
    Ubuntu 18.04
  • Find the standard iso image file for version 18.04 Ubuntu 18.04 iso

  • Download this image to your desktop/preferred location Saving Ubuntu 18.04 iso

Installing Ubuntu using VirtualBox

Start VirtualBox and create a new virtual machine by clicking New

When the New Virtual Machine Wizard appears, click Next

New Virtual Machine

  • Click Next until it show the vm storage size. Put how much space you need depending on your hard disk

    As you go through, please feel free to use any of the online resources available: websites, chat rooms, for example askubuntu.com

  • Finish the wizard by clicking the Create button.

    The New Virtual Machine Wizard will close and you will be brought back to VirtualBox Manager.

  • Select the Virtual Machine you've just created and click Start Start Ubuntu

First Run Wizard

  • "First Run Wizard" will appear and click Next button.

    On the second screen (as shown below), click at 'folder' icon and choose your Ubuntu iso directory. Select your Ubuntu iso file you saved above

    Select the location of your Ubuntu iso image file and click Next button.

    • In 'Summary' box, click Start button

    • This screen will appear when it start boot:

Starting to boot iso file

WELCOME TO UBUNTU!!!!!

Tutorials and Extra Resources

As mentioned above, there are many many tutorials and resources available online to assist such as Installing Ubuntu inside Windows using VirtualBox - albeit this particular one is slightly out of date, the principles still remain largely the same.

Ubuntu also has a very complete Tutorial page.

Download and install Vagrant v2.0.2

www.vagrantup.com

Vagrant is a tool for building and managing virtual machine environments. Combined with hypervisor such as Virtualbox, Vagrant simplifies the set up, configuration and provisioning of environments containing several virtual devices. It also provides networking configuration capabilities such as forwarded ports, public network connections, and private networks.

Select the appropriate download for your machine (OS X, Windows, Linux):

If you have issues with the install, please visit www.vagrantup.com for guidance and support.
This and subsequent labs have been developed and tested using version 2.0.2. As before, You are advised to install this version.

To ensure that Vagrant has installed, open a terminal window and type vagrant -v at the prompt. All going well you should see something similar to the following:

$ vagrant -v
Vagrant 2.0.2

Initialise

Vagrant is preconfigured to work with VirtualBox. You will now use Vagrant to get and install virtual machine images (called boxes) preloaded with some stuff we'll be using in the labs. First lets initialise a Vagrant project to use a vagrant "box" prepared earlier.

Create a new folder on your laptop called vagrant-onsite-day

Open a terminal window in this folder and type "vagrant init frankwalsh/labvm" at the command prompt. You should see some output on the console confirming that a Vagrantfile has been placed in this directory and asking you to "vagrant up". Go ahead and enter the command "vagrant up" on at the prompt. You should see output similar to the following:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'frankwalsh/labvm'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'frankwalsh/labvm' is up to date...
==> default: Setting the name of the VM: vagrant-onsite-day_default_1527850779888_3870
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat....
....

This could take some time to complete as it will need to download the frankwalsh/labvm box (approx 800MB) from the Vagrant cloud server.

Check it out

To check all is good, type "vagrant ssh" at the command prompt to connect to the box (we'll talk about secure shell(SSH) later):

$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-144-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Fri Jun  1 10:59:56 UTC 2018

  System load:  0.31              Processes:           96
  Usage of /:   5.4% of 39.34GB   Users logged in:     0
  Memory usage: 15%               IP address for eth0: 10.0.2.15
  Swap usage:   0%
....

You now are connected to the virtual machine(VM) running in Virtualbox on your laptop(the host). There is no graphical user interface (we don't need it). We will continue from here in the on-site workshop on June 14th

Shut it down

Type "exit" at the command prompt. This will close the ssh session to the VM. Then type "vagrant halt" at the command prompt to shut down the VM. All going well, you should see something similar to the following:

vagrant@hdip-labvm-2018:~$ exit
logout
Connection to 127.0.0.1 closed.
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
$

That's it, you're now ready for the on-site day on the 14th. See you then!