Lab #5 Guide: Installing Ubuntu as a Virtual Machine CTEC1863/2018F Operating Systems Mike Boldin
Tools, Materials and Equipment Oracle VirtualBox software official site: https://www.virtualbox.org/wiki/downloads Ubuntu 18.04.1 LTS.iso file official site: https://www.ubuntu.com/download/desktop Minimum 25 GB of hard disk space USB 3.0 flash drive (32 GB or larger) or hard disk CTEC1863 Lab 5 Guide 2018F 2
Tools, Materials and Equipment If you want to use the Dell machines in L17, you require a 32 GB or larger USB 3.x storage device (a hard disk is recommended; formatted as NTFS or exfat) to back up your VM files at the end of each lab (for your own protection!) On the Dells in L17, you can install your VM onto the SSD (D: drive; create your own folder) choose the No Hyper-V windows installation at boot. CTEC1863 Lab 5 Guide 2018F 3
Ubuntu Summary of recommended minimum requirements: 2 GB RAM 1024 x 768 graphics resolution https://help.ubuntu.com/community/installation/systemrequirements CTEC1863 Lab 5 Guide 2018F 4
CTEC1863 VIRTUAL MACHINE (VM) SETUP CTEC1863 Lab 5 Guide 2018F 5
New Virtual Machine Example The following are actual screen shots from the installation on a PC in L17, which has an 8- core Intel i7 processor and 32 GB RAM. My VirtualBox version is 5.2.12. CTEC1863 Lab 5 Guide 2018F 6
New CTEC1863 Lab 5 Guide 2018F 7
Name and operating system Type in Ubuntu into the Name box Add your initials, to keep the name unique. VirtualBox will correctly set the Type and Version. Click on Expert Mode CTEC1863 Lab 5 Guide 2018F 8
Basic Settings: RAM Here, I added my initials. Choose an appropriate amount of RAM (min. 2 GB; in L17, 4 GB or even 8 GB will work.) CTEC1863 Lab 5 Guide 2018F 9
Basic Settings: Hard drive NOTE: 8 GB is the bare minimum size 12 GB or more is recommended Click on the browse button to save the virtual hard disk on the SSD (it will be faster.) I chose 15 GB so that both my Ubuntu and CentOS VMs can be backed up to a 32 GB flash drive. CTEC1863 Lab 5 Guide 2018F 10
VM Created Next, click on Settings to fine tune the VM. CTEC1863 Lab 5 Guide 2018F 11
Additional Settings: General CTEC1863 Lab 5 Guide 2018F 12
Additional Settings: Motherboard CTEC1863 Lab 5 Guide 2018F 13
Additional Settings: VRAM CTEC1863 Lab 5 Guide 2018F 14
Additional Settings: Storage Two tasks need to be completed here: 1. Choose the installation media as an IDE CD/DVD drive: either a.iso file or the "Host Drive" (DVD-R) I set this drive to "Primary Master" 2. Choose the VirtualBox Guest Additions.iso file as a second IDE CD/DVD drive: the file is called VBoxGuestAdditions.iso (you may need to locate it) I set this drive to "Secondary Master" CTEC1863 Lab 5 Guide 2018F 15
Additional Settings: Storage CTEC1863 Lab 5 Guide 2018F 16
Additional Settings: Storage Click on the Choose Disk button to find your Ubuntu ISO file. The VM will boot from this media to install Linux. CTEC1863 Lab 5 Guide 2018F 17
Additional Settings: Storage 2 3 1 Next, you are going to locate the VBoxGuestAdditions.iso file (part of the VirtualBox software), so that you can enable the clipboard, use available video resolutions, and other important operating system features. CTEC1863 Lab 5 Guide 2018F 18
Additional Settings: Storage 4 5 CTEC1863 Lab 5 Guide 2018F 19
Additional Settings: Storage CTEC1863 Lab 5 Guide 2018F 20
Additional Settings: Network By choosing Bridged Adapter, your VM will connect to the LAN directly (e.g., in L17, to the CIT network.) Also, get a new (unique) MAC Address. CTEC1863 Lab 5 Guide 2018F 21
Additional Settings: Shared Folders This feature allows the virtual machine (Guest) to access the native (Host) file system For example, in L17, I choose my scratch directory on the SSD: D:\Boldin_tmp It allows you to easily exchange files between the VM and your computer CTEC1863 Lab 5 Guide 2018F 22
Additional Settings: Shared Folders 1 2 3 CTEC1863 Lab 5 Guide 2018F 23
Additional Settings: Shared Folders 2 3 4 CTEC1863 Lab 5 Guide 2018F 24
After clicking OK to save the Settings, click on Start in the VirtualBox VM Manager to start the VM. It should boot from the installation media. VirtualBox will display two messages, which can be dismissed CTEC1863 Lab 5 Guide 2018F 25
Vbox (Annoying) Messages If you click on the X, the messages will go away once, and reappear during the next boot. If you click on the other button (message bubble with a slash through it), these messages will not be displayed again. * * Unfortunately, the DeepFreeze software on the L17 Applications/No Hyper-V Windows 10 installations prevents this from day-to-day. If it really annoys you, download and install the same VirtualBox software in L17 Open. CTEC1863 Lab 5 Guide 2018F 26
CTEC1863 UBUNTU INSTALLATION CTEC1863 Lab 5 Guide 2018F 27
Start CTEC1863 Lab 5 Guide 2018F 28
CTEC1863 Lab 5 Guide 2018F 29
CTEC1863 Lab 5 Guide 2018F 30
CTEC1863 Lab 5 Guide 2018F 31
Automatic disk partitioning Let the Ubuntu installer decide how much of the disk to use for swap space; the remainder will be used for the root directory CTEC1863 Lab 5 Guide 2018F 32
Select Time Zone Click on the map to find Toronto (the closest city that represents the EST5EDT time zone in Eastern Canada.) CTEC1863 Lab 5 Guide 2018F 33
You can resize the installer window CTEC1863 Lab 5 Guide 2018F 34
You can resize the installer window CTEC1863 Lab 5 Guide 2018F 35
Create User and Set Hostname CTEC1863 Lab 5 Guide 2018F 36
CTEC1863 Lab 5 Guide 2018F 37
CTEC1863 Lab 5 Guide 2018F 38
CTEC1863 Lab 5 Guide 2018F 39
CTEC1863 Lab 5 Guide 2018F 40
CTEC1863 Lab 5 Guide 2018F 41
CTEC1863 Lab 5 Guide 2018F 42
CTEC1863 Lab 5 Guide 2018F 43
CTEC1863 Lab 5 Guide 2018F 44
Installation Complete The installation may take around 15 minutes VirtualBox will boot from the virtual hard drive You can edit the VM Settings to remove the Ubuntu installation CD CTEC1863 Lab 5 Guide 2018F 45
VirtualBox will do this for you automatically just press Enter. CTEC1863 Lab 5 Guide 2018F 46
Virtual Machine CTEC1863 Lab 5 Guide 2018F 47
Ubuntu Boot Booting from virtual hard drive CTEC1863 Lab 5 Guide 2018F 48
Ubuntu Login Click on your user (or press Enter to log in) CTEC1863 Lab 5 Guide 2018F 49
Ubuntu Login Type in your password (it will not be shown) and press Enter CTEC1863 Lab 5 Guide 2018F 50
Ubuntu First Login CTEC1863 Lab 5 Guide 2018F 51
Ubuntu First Login The Livepatch feature is optional; you need to create an Ubuntu account to enable it. CTEC1863 Lab 5 Guide 2018F 52
Ubuntu First Login The Authenitication Required pop-up is similar to Microsoft s User Account Control (UAC) to do system administration tasks, you need to enter your password. CTEC1863 Lab 5 Guide 2018F 53
Ubuntu First Login I had already created a Ubuntu account in a previous term, so I had to reset my password (so many passwords!) CTEC1863 Lab 5 Guide 2018F 54
Ubuntu First Login Seems that everybody is doing this now! (Apple, Microsoft, Google, ) CTEC1863 Lab 5 Guide 2018F 55
Ubuntu First Login CTEC1863 Lab 5 Guide 2018F 56
Ubuntu Desktop CTEC1863 Lab 5 Guide 2018F 57
Ubuntu Desktop CTEC1863 Lab 5 Guide 2018F 58
Ubuntu Desktop CTEC1863 Lab 5 Guide 2018F 59
Applications CTEC1863 Lab 5 Guide 2018F 60
Applications CTEC1863 Lab 5 Guide 2018F 61
Applications CTEC1863 Lab 5 Guide 2018F 62
Software Updater From time to time, Ubuntu will automatically ask you to download updates You can also check manually 3 CTEC1863 Lab 5 Guide 2018F 63
Software Updater The update process usually takes a couple of minutes (depending on your Internet speed); sometimes you will be asked to reboot when it is complete. CTEC1863 Lab 5 Guide 2018F 64
Terminal Ctrl-Alt-T (from the desktop) CTEC1863 Lab 5 Guide 2018F 65
Custom Terminal Edit -> Preferences I prefer black text on a white background, with a larger font, and a large amount of scrollback lines. (Eventually, I will customize the shell prompt to correct the contrast issue of light green text on a white background.) CTEC1863 Lab 5 Guide 2018F 66
Preparing for Guest Additions The VirtualBox Guest Additions enable features like the shared clipboard, shared folders, USB, video modes, etc. The software builds itself, based on the current kernel version. On some versions of Ubuntu, development tools need to be installed. From the terminal, run the following commands: sudo sudo sudo sudo apt update apt install linux-headers-$(uname -r) apt install build-essential apt install dkms CTEC1863 Lab 5 Guide 2018F 67
Installing Guest Additions This error appears if you forget to install the prerequisites (see previous slide.) CTEC1863 Lab 5 Guide 2018F 68
Installing Guest Additions Change to the VBoxAdditions.iso virtual CD- ROM device. Use the Tab key to help complete the filename. For example: cd /media/mboldin/vbox_gas_5.2.12/ Then, run the Linux installer: sudo./vboxlinuxadditions.run Finally, restart Ubuntu. CTEC1863 Lab 5 Guide 2018F 69
Installing Guest Additions... CTEC1863 Lab 5 Guide 2018F 70
Installing Guest Additions from the Desktop (alternative method) CTEC1863 Lab 5 Guide 2018F 71
Restarting 1 2 3 This procedure is also used to properly shutdown (i.e., Power Off) the VM. CTEC1863 Lab 5 Guide 2018F 72
Changing System Settings 1 2 CTEC1863 Lab 5 Guide 2018F 73
Changing System Settings: Display Resolution 3 5 4 When you click on Apply, it will ask for a confirmation. CTEC1863 Lab 5 Guide 2018F 74
Custom Launcher Unlock apps you don t use right click and choose Remove from Favorites. Similarly, for new apps that you start and plan to use frequently (i.e., Terminal), you can right click and add them to the Launcher. CTEC1863 Lab 5 Guide 2018F 75
CTEC1863 SHARED FOLDER BETWEEN HOST AND GUEST CTEC1863 Lab 5 Guide 2018F 76
Accessing Your Shared Folder You need to add your username to the vboxsf group to access the shared host folder. To do this, edit the /etc/group file: sudo nano /etc/group Add your username to the end of the line containing vboxsf. For example: vboxsf:x:999:mboldin Ctrl-O will save; Ctrl-X exits the nano editor. CTEC1863 Lab 5 Guide 2018F 77
Accessing Your Shared Folder 1: use the down and right arrow keys to move the cursor 2: add your username to the end of the line 4 3: Ctrl-O to save CTEC1863 Lab 5 Guide 2018F 78
Accessing Your Shared Folder Logout and login again to activate the change. (You may need to reboot.) The shared folder is found in /media. The screenshot shows the contents of my Mac home directory. Directories (folders) are coloured blue, files green, and links (shortcuts) turquoise. CTEC1863 Lab 5 Guide 2018F 79
Accessing Your Shared Folder This slide also shows my customized Launcher. My shared folder is shown on the Desktop. Clicking on it will open the File Manager app. CTEC1863 Lab 5 Guide 2018F 80
CTEC1863 VM BACKUP CTEC1863 Lab 5 Guide 2018F 81
Backing Up The VM Shut down Ubuntu. The VirtualBox manager will show it to be Powered Off. A USB 3.x hard drive is recommended; USB flash drives tend to have very poor write performance! CTEC1863 Lab 5 Guide 2018F 82
Backing Up The VM: Method 1 This method simply copies the VM folder to an external drive. This method is very useful for transporting the VM to another computer. Once you stabilize the Settings for the VM on each computer, only the virtual hard disk file (.vmdk) needs to be backed up. CTEC1863 Lab 5 Guide 2018F 83
Backing Up The VM: Method 1 From a Command Prompt, I can view the VM folder. Here I am using the No Hyper-V Windows 10 installation in L17, so the SSD is mapped to drive E: VM settings (current) VM settings (backed up by VirtualBox) Virtual hard disk CTEC1863 Lab 5 Guide 2018F 84
Backing Up The VM: Method 1 My USB hard drive is mapped to drive J: -- I will use robocopy to backup the entire VM folder. CTEC1863 Lab 5 Guide 2018F 85
Backing Up The VM: Method 1 I only need the /E switch, the others are robocopy defaults. CTEC1863 Lab 5 Guide 2018F 86
Backing Up The VM: Method 1 The whole process took less than two minutes (it will get longer as the VM hard disk file grows ) CTEC1863 Lab 5 Guide 2018F 87
Adding the Backed Up VM VirtualBox This procedure applies to: 1. Using No Hyper-V in L17 (due to DeepFreeze); 2. Using another PC with VirtualBox. Simply copy the backed up folder from your USB drive to the computer s hard drive (or back to the L17 PC s SSD) into the VirtualBox VMs folder. CTEC1863 Lab 5 Guide 2018F 88
Adding an Existing VM to VirtualBox After restoring your backed-up VM folder, start VirtualBox and from the Machine menu, click Add CTEC1863 Lab 5 Guide 2018F 89
Adding an Existing VM to VirtualBox A dialog box opens. Browse to your VM folder and select the.vbox file (the type is VirtualBox Machine Definition ) CTEC1863 Lab 5 Guide 2018F 90
Adding an Existing VM to VirtualBox When you click Open, VirtualBox will add your VM (in a PoweredOff state). NOTE: You may need to tweak some settings (RAM, CPUs, and Network card) to get it to work but generally, this is done only once per PC or Mac. CTEC1863 Lab 5 Guide 2018F 91
Backing Up The VM: Method 2 Shut down Ubuntu. The VirtualBox manager will show it to be Powered Off. From the File menu, choose Export Appliance, and select your Ubuntu VM. This will allow to save the entire VM and its settings in a single.ova file, which is good as a backup and can be used to transfer your VM to another host. CTEC1863 Lab 5 Guide 2018F 92
Backing Up The VM : Method 2 In this example, my VM is called Ubuntu and I am backing up to drive H:. 1A: chose VM(s) -- after shutting down 1B CTEC1863 Lab 5 Guide 2018F 93
Backing Up The VM : Method 2 2A: choose a folder and filename 2B CTEC1863 Lab 5 Guide 2018F 94
Backing Up The VM : Method 2 3A: edit the description (optional) 3B CTEC1863 Lab 5 Guide 2018F 95
Backing Up The VM : Method 2 4: wait CTEC1863 Lab 5 Guide 2018F 96
Backing Up The VM : Method 2 5: copy to USB (3.x) storage CTEC1863 Lab 5 Guide 2018F 97
Backing Up The VM: Method 2 The process may take up to 10 minutes, depending on the speed of your processor (for compression) and the size of the VM virtual hard disk file. For example, when I did this example, my virtual hard disk file was 5.7 GB, the backup took around 6 minutes, and the resulting.ova file was 2 GB in size. If you lose or damage your VM, you can restore it from the File menu, and Import Appliance. CTEC1863 Lab 5 Guide 2018F 98