Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Lab #5 Guide:
Installing Ubuntu as a
Virtual Machine
CTEC1863/2019F
Operating SystemsMike Boldin
Tools, Materials and Equipment
• Oracle VirtualBox software– official site:
https://www.virtualbox.org/wiki/Downloads
• Ubuntu 18.04.3 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 or SSD
CTEC1863 Lab 5 Guide 2019F 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 NTFSor 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 (E: drive; create your own folder) –choose the No Hyper-V windows installation at boot.
CTEC1863 Lab 5 Guide 2019F 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 2019F 4
VIRTUAL MACHINE (VM) SETUPCTEC1863
CTEC1863 Lab 5 Guide 2019F 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 6.0.10.
• Follow these slides to set up your own VM.
CTEC1863 Lab 5 Guide 2019F 6
New
CTEC1863 Lab 5 Guide 2019F 7
Name and operating system
CTEC1863 Lab 5 Guide 2019F 8
Type in“Ubuntu” intothe Name box –Add yourinitials, to keep thename unique.
VirtualBox will correctlyset the Typeand Version.
Click on Next.
Basic Settings: RAM
CTEC1863 Lab 5 Guide 2019F 9
Choose an appropriate amount of RAM (min. 1 GB; I chose 2 GB; in L17, 4 GB or even 8 GB will work.)
Basic Settings: Hard drive
CTEC1863 Lab 5 Guide 2019F 10
NOTE:10 GB is the bare
minimum size –
12 GB or more is recom-
mended
Basic Settings: Hard drive
CTEC1863 Lab 5 Guide 2019F 11
We are using only VirtualBox; the default file type is .vdi.
Basic Settings: Hard drive
CTEC1863 Lab 5 Guide 2019F 12
Dynamically allocated is good enough; Fixed size will take slightly longer to create
Basic Settings: Hard drive
CTEC1863 Lab 5 Guide 2019F 13
The drive will be created on the SSD (it will be faster.)
I chose 12 GB so that both my Ubuntu and CentOS VMs can be backed up to a 32 GB flash drive.
VM Created
CTEC1863 Lab 5 Guide 2019F 14
Next, click on “Settings” to fine tune the VM and complete the setup.
VM Settings: General
CTEC1863 Lab 5 Guide 2019F 15
Categories are on the left; some setting categories have additional tabs.
Additional Settings: General
CTEC1863 Lab 5 Guide 2019F 16
The Bidirectional Clipboard will allow you to copy-and-paste to and from Windows, Ubuntu, and even other VMs
Additional Settings: Motherboard
CTEC1863 Lab 5 Guide 2019F 17
The Ubuntu .isofile will be set up as an Opticaldrive; we need the VM to be able to boot from it.
Additional Settings: VRAM
CTEC1863 Lab 5 Guide 2019F 18
Additional Settings: Network
CTEC1863 Lab 5 Guide 2019F 19
(Skipping "Storage" for now…)
By choosing “Bridged Adapter”, your VM will connect to the LAN directly (i.e., in L17, to the CIT network.)
Additional Settings: Storage
CTEC1863 Lab 5 Guide 2019F 20
1
4
3
2
Next, you are going to locate the Ubuntu .iso file and set it as your Primary Master Optical Drive. Step 3 is a "browse" button, that will pop up a window so that you can find the file.
Additional Settings: Storage
CTEC1863 Lab 5 Guide 2019F 21
Here, I copied the .iso file into E:\MB .before I started creating my VM…
It can go anywhere, VirtualBox will remove it from the VM settings after Ubuntu is installed.
Additional Settings: Storage
CTEC1863 Lab 5 Guide 2019F 22
Optical Drive is set up.
Additional Settings: Shared Folders
• This feature allows the virtual machine (Guest) to access the native (Host) file system
• It allows you to easily exchange files between the VM and your computer
• For example, in L17, I choose my ”personal” directory on the SSD: E:\MB
• It will be accessible in Ubuntu as /host
CTEC1863 Lab 5 Guide 2019F 23
Additional Settings: Shared Folders
1
CTEC1863 Lab 5 Guide 2019F 24
2
3
4
5
67
VM Created
CTEC1863 Lab 5 Guide 2019F 25
UBUNTU INSTALLATIONCTEC1863
CTEC1863 Lab 5 Guide 2019F 26
CTEC1863 Lab 5 Guide 2019F 27
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…
Vbox (Annoying) Messages
CTEC1863 Lab 5 Guide 2019F 28
If you click on the “X”, the messages will go away once, and re-appear 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 2019F 29
CTEC1863 Lab 5 Guide 2019F 30
You can resize the installer window…
CTEC1863 Lab 5 Guide 2019F 31
You can resize the installer window…
CTEC1863 Lab 5 Guide 2019F 32
CTEC1863 Lab 5 Guide 2019F 33
CTEC1863 Lab 5 Guide 2019F 34
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 2019F 35
Select Time Zone
CTEC1863 Lab 5 Guide 2019F 36
Click on the map to find Toronto(the closest city that represents the “EST5EDT” time zone in Eastern Canada.)
Create User and Set Hostname
CTEC1863 Lab 5 Guide 2019F 37
Use your BB username; add your initials to the computer name; a strong password will prevent others from getting into your files…
CTEC1863 Lab 5 Guide 2019F 38
There is an eight-slide presentation while Ubuntu installs (progress bar at the bottom of the window)…
CTEC1863 Lab 5 Guide 2019F 39
CTEC1863 Lab 5 Guide 2019F 40
CTEC1863 Lab 5 Guide 2019F 41
CTEC1863 Lab 5 Guide 2019F 42
CTEC1863 Lab 5 Guide 2019F 43
CTEC1863 Lab 5 Guide 2019F 44
CTEC1863 Lab 5 Guide 2019F 45
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 2019F 46
CTEC1863 Lab 5 Guide 2019F 47
VirtualBox will now boot from the hard disk…
First Boot
Windows is the "Host"; Ubuntu is the "Guest"
CTEC1863 Lab 5 Guide 2019F 48
Press the right Ctrl key to give control of the keyboard and mouse back to Windows…
Ubuntu Login
CTEC1863 Lab 5 Guide 2019F 49
Click on your user (or press Enter to log in)
Ubuntu Login
CTEC1863 Lab 5 Guide 2019F 50
Type in your password (it will not be shown) and press Enter
Ubuntu Login
CTEC1863 Lab 5 Guide 2019F 51
If you get your password wrong, Ubuntu will tell you. If you forget your password, there is a way to "break in"… (only because I have "physical" access!)
Ubuntu First Login
CTEC1863 Lab 5 Guide 2019F 52
Ubuntu First Login
CTEC1863 Lab 5 Guide 2019F 53
The ”Livepatch” feature is optional; you need to create an Ubuntu account to enable it.
The system updates itself and you will be shutting down at the end of lab periods anyway…
Ubuntu First Login
CTEC1863 Lab 5 Guide 2019F 54
Seems that everybody is doing this now! (Apple, Microsoft, Google, …)
Ubuntu First Login
CTEC1863 Lab 5 Guide 2019F 55
Ubuntu Desktop
CTEC1863 Lab 5 Guide 2019F 56
Ubuntu Desktop
CTEC1863 Lab 5 Guide 2019F 57
Ubuntu Desktop
CTEC1863 Lab 5 Guide 2019F 58
Applications
CTEC1863 Lab 5 Guide 2019F 59
Applications
CTEC1863 Lab 5 Guide 2019F 60
Applications
CTEC1863 Lab 5 Guide 2019F 61
Software Updater
3
CTEC1863 Lab 5 Guide 2019F 62
• From time to time, Ubuntu will automatically ask you to download updates
• You can also check manually
Software Updater
CTEC1863 Lab 5 Guide 2019F 63
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.
Authenticate for System Administration Tasks
CTEC1863 Lab 5 Guide 2019F 64
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.
Software Updater
CTEC1863 Lab 5 Guide 2019F 65
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. You can click on "Details" to watch what is being updated…
Software Updater - Details
CTEC1863 Lab 5 Guide 2019F 66
Various software packagesare listed…
(Ubuntu uses the Debian package manager system.)
Software Updater – Kernel
CTEC1863 Lab 5 Guide 2019F 67
From time to time, the Linux kernelis updated, too. (It is usually installed last and then the boot loader configurationis updated.)
This usually requires a restart…
Software Updater - Restart
CTEC1863 Lab 5 Guide 2019F 68
You can also select "Restart Later" and continue working (the system will remain stable and, unlike some other operating systems, not "nag" you to restart – the updates will simply take effect next time Ubuntu starts…)
Terminal
• Ctrl-Alt-T (from the desktop)
CTEC1863 Lab 5 Guide 2019F 69
Becoming "root"• a.k.a., the System Administrator
CTEC1863 Lab 5 Guide 2019F 70
The "prompt character" changes from $ to #. To exit, press [Ctrl]+[D], enter the exit command, or simply close the Terminal window.
Custom Terminal
• Edit -> Preferences
CTEC1863 Lab 5 Guide 2019F 71
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.)
Software Management from the Terminal -- apt
CTEC1863 Lab 5 Guide 2019F 72
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, as root:
apt install linux-headers-$(uname -r)apt install build-essentialapt install dkms
CTEC1863 Lab 5 Guide 2019F 73
Preparing for Guest Additions
• Article for installing Guest Additions:
https://www.tecmint.com/install-virtualbox-guest-additions-in-ubuntu/
CTEC1863 Lab 5 Guide 2019F 74
Installing Guest Additions
CTEC1863 Lab 5 Guide 2019F 75
You should reinstall Guest Additions whenever the VirtualBox software is updated.
Inserting Guest Additions
CTEC1863 Lab 5 Guide 2019F 76
This will launch a new Terminal window…
Installing Guest Additions - FAIL
CTEC1863 Lab 5 Guide 2019F 77
This error appears if you forget to install the prerequisites (see slide 73 “Preparing for Guest Additions”)
CTEC1863 Lab 5 Guide 2019F 78
Installing Guest Additions – from the Terminal
When I run the apt command(s) to install the pre-requisites, itshows all thepackages, andthen waits for meto confirm…
CTEC1863 Lab 5 Guide 2019F 79
Installing Guest Additions – from the Terminal
To find out whereLinux installed theVBGA CD-ROM, Irun the mountcommand. Then Ilook for “VBox_GAs…”
Installing Guest Additions – from the Terminal
• Change to the VBoxAdditions.iso virtual CD-ROM device. Use the Tab key to help complete the filename. For example:
sudo ./VBoxLinuxAdditions.run
• Then, run the Linux installer:
cd /media/mboldin/VBox_GAs_6.0.10/
• Finally, restart Ubuntu.CTEC1863 Lab 5 Guide 2019F 80
CTEC1863 Lab 5 Guide 2019F 81
Installing Guest Additions – from the Terminal
Here are both the cd and GA installer commands… SUCCESS!!!
Installing Guest Additions
CTEC1863 Lab 5 Guide 2019F 82
. . .
Installing Guest Additions from the Desktop (alternative method)
CTEC1863 Lab 5 Guide 2019F 83
Restarting
CTEC1863 Lab 5 Guide 2019F 84
1
2 3
This procedure is also used to properly shutdown (i.e., Power Off) the VM.
Changing System Settings
CTEC1863 Lab 5 Guide 2019F 85
1
2
Changing System Settings: Display Resolution
CTEC1863 Lab 5 Guide 2019F 86
3
4
5
When you click on Apply, it will ask for a confirmation.(If you don’t see the “Apply” button, you can manually widen the window.)
Changing System Settings: Display Resolution
CTEC1863 Lab 5 Guide 2019F 87
There will be a confirmation pop-up… and then the Desktop will look much better! (For example, I used 1152x864 on the Viewsonic monitor in L17.)
Custom Launcher
CTEC1863 Lab 5 Guide 2019F 88
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.
SHARED FOLDER BETWEEN HOST AND GUEST
CTEC1863
CTEC1863 Lab 5 Guide 2019F 89
Accessing Your Shared Folder
• You need to add your username to the vboxsfgroup to access the shared host folder. To do this, edit the /etc/group file:
vboxsf:x:999:mboldin
• Add your username to the end of the line containing vboxsf. For example:
sudo nano /etc/group
• Ctrl-O will save; Ctrl-X exits the nano editor.CTEC1863 Lab 5 Guide 2019F 90
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
3: Ctrl-O to save4
CTEC1863 Lab 5 Guide 2019F 91
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 2019F 92
Accessing Your Shared Folder
CTEC1863 Lab 5 Guide 2019F 93
My shared folder is shown on the Desktop.
Clicking on it will open the File Manager app.
This slide also shows my customized Launcher.
VM BACKUPCTEC1863
CTEC1863 Lab 5 Guide 2019F 94
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 2019F 95
Backing Up The VM
• 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(.vdi) needs to be backed up.
CTEC1863 Lab 5 Guide 2019F 96
Backing Up The VM
CTEC1863 Lab 5 Guide 2019F 97
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
Backing Up The VM
CTEC1863 Lab 5 Guide 2019F 98
My USB hard drive is mapped to drive J: -- I will use robocopy to backup the entire VM folder.
Backing Up The VM
CTEC1863 Lab 5 Guide 2019F 99
I only need the /E switch, the others are robocopy defaults.
Backing Up The VM
CTEC1863 Lab 5 Guide 2019F 100
The whole process took less than two minutes (it will get longeras the VM hard disk file grows…)
Adding the Backed Up VM VirtualBox
CTEC1863 Lab 5 Guide 2019F 101
• 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 VirtualBoxVMs folder.
Adding an Existing VM to VirtualBox
CTEC1863 Lab 5 Guide 2019F 102
After restoring your backed-up VM folder, start VirtualBox and from the Machine menu, click Add…
Adding an Existing VM to VirtualBox
CTEC1863 Lab 5 Guide 2019F 103
A dialog box opens. Browse to your VM folder and select the .vbox file (the type is “VirtualBox Machine Definition”)…
Adding an Existing VM to VirtualBox
CTEC1863 Lab 5 Guide 2019F 104
When you click Open, VirtualBoxwill 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.