Ubuntu Virtual Machine Installation Demo

In this demo, we will

1. Install VirtualBox

2. Download Ubuntu Server

3. Create a Ubuntu Server VM

Launch VirtualBox and create your first Ubuntu VM using the downloaded .iso image file. We use Ubuntu Server instead of Ubuntu Desktop because we only need a basic server machine without too many unnecessary functionalities. The resulting overhead to your host machine is smaller, and the VM starts up faster too.

Some notes when creating a new VM:

Refer to the videos Creating VM, Setting up VM

Start Installing Ubuntu

Some notes about installing Ubuntu:

Refer to videos Install Ubuntu 1, Install Ubuntu 2

Log in into Ubuntu

Reboot after Ubuntu installation complete; wait a little bit for some initialization steps complete. Then log in with your username and password.

vbox-34-vm-prompt.png

First try the ifconfig command´╝Ü

ubuntu@ubuntu:~$ ifconfig

Command 'ifconfig' not found, but can be installed with:

sudo apt install net-tools

ubuntu@ubuntu:~$

If some messages like above show, it means ifconfig has not been installed yet. (ifconfig is no longer installed by defaults in newer Ubuntu, and is replaced by more versatile ip command, but we will use it here for simplicity).

Follow its suggestion and install ifconfig:

ubuntu@ubuntu:~$ sudo apt install net-tools

Below shows the installation result:

vbox-35-vm-net-tools.png

Run ifconfig again to check the network interfaces:

vbox-36-vm-ifconfig.png

Your display may look different, but take notes about the IP address of the Host-only interface card. The example above shows 192.168.56.101. You can SSH from your host machine into this Ubuntu VM using the IP later. (Another IP address, 10.0.2.15 is the IP address of the NAT interface card, the apps in your host machine cannot access it).

Finally check if the VM has internet access:

ubuntu@ubuntu:~$ ping google.com
vbox-37-vm-ping.png

Refer to the first part of the video Ping, SSH, and Upgrade

4. Connect to the Ubuntu VM using SSH

Launch your favorite SSH client from the host machine.
Some operation systems (Mac, Ubuntu, some Windows) have pre-installed SSH clients. If you are using Windows, you can also download third-party SSH clients. For example, search “windows ssh download” on the web and you can find PuTTY site

The benefit of using SSH is that you can easily copy and paste commands from your machine to Ubuntu VM for execution, and vice versa. You can also create multiple SSH connections with the Ubuntu VM for control and monitoring at the same time.

Below shows some examples on a Mac host machine. Suppose the Host-only network IP is 192.168.56.101, and tue username is ubuntu:

ssh 192.168.56.101 -l ubuntu

The first time you connect to the VM, your SSH client may show some message asking you for confirmation. Enter yes:

vbox-45-ssh-connect.png

(If somehow SSH shows some warning messages telling you the machine has potential security risk, you may have to remove an entry in the file <your home directory>/.ssh/known_hosts related the the IP address).

If you log in successfully, you will enter a command line interface:

vbox-46-ssh-log-in.png

Repeat the basic commands such as ping, ifconfig to see if the VM is working properly. If so, we can access the Ubuntu VM “remotely” from now on.

ifconfig:

vbox-47-ssh-ifconfig.png

ping:

vbox-48-ssh-ping.png

Refer to the second part of the video Ping, SSH, and Upgrade

5. Update and Upgrade your Ubuntu

Let also update and upgrade the Ubuntu VM right now to make sure it is up-to-date with proper security updates.

sudo apt update
sudo apt upgrade

Refer to the last part of the video Ping, SSH, and Upgrade