Install Ubuntu in Virtualbox from USB 2018 with dual boot
Linux is an operating system like Windows 10 or Mac OS. Similar to other operating systems, it has capabilities such as communicating and receiving instructions from users, reading/writing data to the disk drive and executing software applications. The important part of any operating system is the kernel.
In GNU/Linux system, Linux (Linux.org) is the kernel component. The rest of the components are applications developed by the GNU Project (www.gnu.org/home.en.html).
The Linux based OS are inspired from the Unix operating system. The Linux kernel is capable of multitasking in multiuser systems. The good thing is that GNU/Linux is free to use and open source. Users have full control of the operating system, which makes Linux ideal for computer hackers and geeks.
Linux is vastly used in servers. The popular Android operating system runs in a Linux kernel. There are many distributions, or flavors, of Linux, which basically uses the Linux kernel as the core component; there are differences in the graphical interface. Some of the most popular Linux distributions are Ubuntu, Debian, and Fedora. The Linux- based operating systems are among the most popular in the world.
What Is Ubuntu?
Ubuntu is a popular Linux distribution based on the Debian architecture (https://en.wikipedia.org/wiki/Debian). It is freely available for use, and it is open source, so it can be modified according to your application.
Ubuntu comes with more than 1,000 pieces of software, including the Linux kernel, a GNOME/KDE desktop environment, and standard desktop applications (word processing, a web browser, spreadsheets, a web server, programming languages, integrated development environment (IDE), and several PC games).
Ubuntu can run on desktops and servers. It supports architectures such as Intel x86, AMD-64, ARMv7, and ARMv8 (ARM64). Ubuntu is backed by Canonical Ltd, a UK-based company.
Why Ubuntu for Robotics?
The software is the heart of any robot. A robot application can be run on an operating system that provides functionalities to communicate with robot actuators and sensors. A Linux-based operating system can provide great flexibility to interact with low-level hardware and provide provision to customize the operating system according to the robot application.
The advantages of Ubuntu in this context are its responsiveness, lightweight nature, and a high degree of security. Beyond these factors, Ubuntu has great community support and there are frequent releases, which makes Ubuntu an updated operating system.
Ubuntu also has long-term support (LTS) releases, which provides user support for up to five years. These factors have led the ROS developers to stick to Ubuntu, and it is the only operating that is fully supported by ROS.
This section discusses how to install Ubuntu 16.04 LTS. The procedure for installing any Ubuntu version is almost the same. Like any other operating system, a PC should have the recommended system requirements to install Ubuntu. Here are the recommended requirements needed for your PC. After that, you can see the detailed procedure of the Ubuntu installation.
Recommended PC Requirements
2GHz dual-core processor or better
2GB system memory
25GB of free hard drive space
a DVD drive or a USB port for the installer media
Internet access is helpful
You can take a look at all Ubuntu releases at Ubuntu Releases. The DVD image is less than 1GB. It is named ubuntu-16.04.X-desktop- amd64.iso. By default, the ISO image is 64-bit architecture; if your PC RAM size is less than 4GB, you can use a 32-bit architecture.
After downloading the desired Ubuntu image, there are two options for installing Ubuntu.
Install on a real PC. This can be done using one of two methods. You can burn the image to a DVD or to a USB drive.
Install in VirtualBox (www.virtualbox.org) or VMWare
Workstation (https://my.vmware.com/web/vmware/ downloads). With this method, you have to first install VirtualBox software, and then install Ubuntu on top of it. In this post, we prefer this method because it is safe to work with VirtualBox. Installing on a real PC may cause data loss if you don’t do it properly. As a beginner, you can experiment with Ubuntu inside VirtualBox.
VirtualBox is a virtualization software that allows an unmodified operating system
(with all of its installed software) to run in a special environment on top of your existing operating system.
This environment, called a virtual machine, is created by the virtualization software by intercepting access to certain hardware components and certain features. The physical computer is called the host, and the virtual machine is called the guest. The guest can run on the host computer, which thinks that it’s running on a real machine.
You can install VirtualBox on a host PC running Windows, Linux, OS X, or Solaris (Downloads - Oracle VM VirtualBox). In this post, we install it on a Windows PC. You can choose the Windows platform from a list and install it on your Windows PC. The installation of VirtualBox is easy; you may not have any confusing issues. During installation, you are asked to install virtual drivers. You can accept the driver installation.
If you are working in OS X or Linux, choose the platform accordingly. The installation instructions can be found at Oracle VM VirtualBox
The first step in installing Ubuntu in VirtualBox is to create a new virtual machine.
If you already installed VirtualBox on your system, you can create the virtual machine by going through the following steps.
Step 1 Adding a New Virtual Machine
After installing VirtualBox on your PC, open it. You see the window.
You can click the Add button to create a new virtual machine.
Step 2 Naming the Guest Operating System
After adding the virtual machine, the next step is to name the guest operating system that we are going to create. Set the type as Linux, and the version as 32/64 bit. The naming is just for the information; it is not associated with any settings. After entering the name, press the Next button to continue to the next step.
Step 3 Allocating RAM for the Guest OS
In this step, we allocate the RAM for the guest OS. This step is important because if the RAM allocation is too low, the guest OS may take a lot of time to boot, and if the allocation is too high, the RAM for the host OS will also allocate for the guest OS, which may slow down the host OS. So, the RAM allocation should be optimized so that both operating systems get better performance.
Based on the RAM size of your host PC, the wizard will show the safety limits of RAM size for the virtual OS in green. The RAM allocation of the guest should be within the safety limits.
Step 4 Creating a Virtual Hard Disk
After allocating the RAM, the next step is to create a virtual hard disk for the guest OS. In this step, you can use an existing virtual hard disk file or create a new one. These virtual hard disk files are portable, so you can copy the virtual hard disk to any PC and set up the same virtual machine on that PC.
In this step, you can select the type of virtual hard disk that you want to create. The default option is VDI (VirtualBox disk image), which is the native virtual hard disk of VirtualBox. VHD (virtual hard disk) is developed by VMWare, which is also supported in VirtualBox.
The third option is VMDK (virtual machine disk) , which is the Microsoft Virtual PC virtual hard disk type. You can get more information from www.virtualbox. org/manual/ch05.html. In this post, we are selecting the native hard disk format or VDI.
Step 5 Configuring the Type of Virtual Disk
In this step, we have to configure the mode of storage. There are two modes: dynamically allocated and fixed size. If we select fixed size, a virtual hard disk is created with a fixed size. That size can be set in the next step. After creating this virtual hard disk, it will consume that much physical disk size.
With a dynamically allocated disk, you can use the maximum hard disk size, and it will only use the physical hard disk space when it fills up.
The time taken to create a fixed hard disk is higher than dynamically allocated, but once it is created, it can perform much better than a dynamically allocated mode. In this post, we are going to use a fixed size with a maximum size of 20GB.
You can also browse the location to save the virtual hard disk file. When you finish the virtual disk configuration, it will take some time to build those configurations.
After creating the virtual hard disk, you can see the newly created virtual machine. But where do we put the Ubuntu image in the virtual machine? Well, that is the next step that we are going to do.
Step 6: Choosing Ubuntu DVD Image
In the Settings window, navigate to the Storage option on the left.
After inserting the Ubuntu image
, configure the video configuration. In this setting, you can allocate the video memory of the guest os . After configuring the Display settings, we have to configure the System settings. In the System settings, you can allocate the number of CPUs for the guest OS.
The Shared Folders settings may be useful when working with Ubuntu. Using this option, you can share the host operating system folder inside the guest operating system. This option is useful for accessing files and folders from the host operating system. After completing these settings, you can start the virtual machine.
You can launch the virtual machine by pressing the Start button. This will boot the virtual machine and bring you to the Ubuntu live desktop. On the live desktop, you can explore the Ubuntu features without installing it.
You also have the option to install Ubuntu in the live mode. In the next section, we will see how to install Ubuntu in VirtualBox. The steps are the same if you install it on a real PC.
Installing Ubuntu on VirtualBox
When the virtual machine boots up, you get the window, which asks you to Try Ubuntu or Install Ubuntu. If you want to use Ubuntu before installing it, select Try Ubuntu, but if you want to directly install Ubuntu, select Install Ubuntu. Here we choose the Install Ubuntu option.
After selecting the Install Ubuntu option, the next window allows you to select options such as updating Ubuntu during installation and updating third-party applications and drivers.
If you are working in VirtualBox, you can ignore this, but if you are installing on a real PC that has graphics cards like NVIDIA or ATi Raedon, you can select these options.
It can search for an appropriate graphics driver and install it during the Ubuntu installation; otherwise, you may need to manually install it. However, there is no guarantee that we will get a proper drive for our graphics card.
After configuring, press Continue to move onto the next step. This step is very important because we are going to partition the hard disk to install Ubuntu on it.
You have to be careful when selecting the partition option. The first option, Erase disk and install Ubuntu, erases all the drives on the hard disk and installs Ubuntu. If you are willing to do this, you can proceed with that option.
If you installed Ubuntu in VirtualBox, this option will be fine, but if you are planning to install Ubuntu along with Windows, select the Something else option.
The Something else option gives us the option to format the desired drive and install Ubuntu on it. If you are installing Ubuntu in VirtualBox, you don’t need to worry much about this because there is only one hard disk. If you are going to install on your real PC, you have to find a partition for installing Ubuntu before booting into Ubuntu.
In the partition manager, you can identify the drive by checking the size of the partition. If the disk is not formatted, you see the disk drive as /dev/sda. The first option is to create a partition table, which you do by clicking the New Partition Table button. After doing this, the disk drive shows free space.
You can modify the existing partition with the button on the left. There are three buttons. The button with the + symbol is for creating a new partition from a free space; the button with the – symbol is for deleting an existing partition; and the Change button is for converting an existing partition into another format or changing its size.
Here we are going to create a new partition, so click the + button. You see another window, which asks for information about the new partition.
Basically, to install Ubuntu, we need to set up two partitions. One is a root partition and the other is a swap partition. The Ubuntu OS is installed in the root partition, the primary is the type for the root partition, and the format of the file system is Ext4Journaling. You have to set the mount point of root partition as /.
The swap partition is a special kind of partition that is used for storing inactive pages when your physical memory (RAM) is approaching maximum usage. If your RAM is large enough, let’s say greater than 4GB, the swap partition can be ignored; otherwise, it is a good idea to have a swap partition. You can allocate 1GB or 2GB to the swap partition.
After creating both partitions, click the Install Now button, which installs Ubuntu to the selected partition. During installation, you can set the time zone, keyboard layout, and username and password.
You can click your country to set the time zone. The country name will be visible when you click the map. After setting the time, the next step is to set up the keyboard layout. Use the default keyboard layout (i.e., English (US)).
Next, enter the Ubuntu login information.
In this step, we set the PC name, login name, and password. If you don’t want to log in using a username and password, you can enable the Log in automatically feature. This logs in directly to the Ubuntu screen without prompting for a username and password.
After assigning the login information, the installation procedure is almost over. After installing the files, you need to reboot. Press Reboot to restart the virtual machine/PC.
During this time, you can remove the DVD image from the VirtualBox menu. Select Devices ➤ Optical Drives ➤ Remove disk from the VirtualBox drop-down menu. After rebooting, you see the Ubuntu desktop.
Congratulations. You have successfully installed Ubuntu on VirtualBox. If you are planning to install it on a real PC, you may need to know the following things to boot Ubuntu on a PC.
Installing Ubuntu on a PC
Basically, there are two ways to boot Ubuntu on a PC. The first method is direct: burn the DVD image you downloaded to a DVD, and then boot it from the DVD. The other method is to boot from a USB drive, which is easier and faster than a DVD installation.
A tool called UNetbootin burns the DVD image to a USB drive. It can be downloaded from https://sourceforge.net/projects/unetbootin/. You can browse the DVD image from this tool. Press OK to start the copying process.
You can select the Linux distribution and browse the DVD image. After selecting the DVD image, select the type of drive, which is USB Drive. Next, select the drive letter. Then, press the OK button.
It takes time to copy the DVD image to the drive. When it is complete, reboot the PC and set the first boot device as USB drive. Now it will boot from the USB drive. You can follow the installation procedures described earlier. More instructions are at UNetbootin - Homepage and Downloads.
If you have any trouble installing the OS using UNetbootin, try Rufus which is another application for the same purpose.
Ubuntu Graphical User Interface
On the Ubuntu desktop, there is a panel on the left of the screen called Unity, which is a graphical shell built on the top of GNOME, the default desktop environment of Ubuntu. It is a free, open-source application. The other desktop environments are KDE and LXDE.
The Unity Launcher, which helps to quickly launch and search Ubuntu applications. Click each app to make it pop up. You can also search by application name. These GUI tools can save your time in finding an application. On the right side of the Unity panel, there are options to adjust the volume and power of the system.
The launcher is called the Unity Launcher. The search utility in the launcher is called the Dash. There is an indicator panel to show the network connection, volume, and other notifications.
Similar to Windows and OS X, there are many options in Ubuntu for customizing the desktop environment. If you are interested in configuring your Ubuntu desktop, refer to the Compiz Settings Manager at help.ubuntu.com/community/CompositeManager#Compiz
To learn more about Ubuntu, download the PDF from ubuntu-manual.org/downloads.
The Ubuntu File System
Like the C drive in a Windows operating system, Linux has a special drive for storing system files. It is called the root file system, which we created during the installation of Ubuntu. We assigned / for the file system. You can explore the file system by choosing File Manager from the Unity Launcher.
The following describes the uses of each folder in the file system.
/bin and /sbin: Contains system applications similar to the C:\ Windows folder
/etc: Contains system configuration files
/home/your username: This is equivalent to the C:\Users folder in Windows
/lib: Contains library files similar to .dll files in Windows
/media: Removable media is mounted in the directory
/root: Contains root user files (not the root user file system; root user is the administrator of the Linux system)
/usr: Pronounced user, it contains most of the program files (equivalent to C:\Program Files in Microsoft Windows)
/var/log: Contains log files written by many applications
/home/your username/Desktop: Contains Ubuntu desktop files
/mnt: The mounted partitions are shown here
/boot: Contains the files required to boot
/dev: Contains Linux device files
/opt: The location for optionally installed programs (ROS is installed to /opt)
/sys: Holds the files containing information about the system
Managing Running Processes
As you work with multiple applications, you’ll find that Ubuntu handles multitasking very well in general. When your system slows down or a single application begins to freeze, you may need to look at what processes are running and how much of your computer’s resources they are taking up.
While you saw a useful command-line tool called a top in the previous post, GNOME System Monitor provides a powerful, easy-to-use graphical version, and it offers additional information about your system resources.
A process is an application (program) or part of an application. When you run an application, Ubuntu loads the program data into memory and begins scheduling it to run. Ubuntu will manage how much time and memory each application receives so that many programs running at once are able to share the available resources. GNOME System Monitor summarizes how your computer is being utilized. You can launch it from the Dash.
When System Monitor appears, it will show the “Processes” tab, which operates much the same way as the top does. This gives you an overview of the currently running processes on the computer. They are identified by name, icon where available, and the user that started them, the amount of CPU time they are using, their process ID (PID), the amount of memory they are utilizing, and their priority.
By default, System Monitor will only display the processes that are being run by the currently logged-in user. The column headers can be used to sort the list; for example, clicking the “% CPU” header will sort the list to show which processes are using the most CPU time. Clicking a header will toggle between sorting by ascending or descending order.
You can also use the hamburger menu at the right of the toolbar to switch between “Active Processes,” which shows only processes which are not sleeping or suspended; “All Processes,” which shows all processes running on the system regardless of which user is running them; or “My Processes,” which shows processes that are being run by the current user.
Because an application can be split into several processes or utilize other programs, the “Dependencies” option is a toggle that sorts related processes by the master process that owns them and can give further insight into CPU or memory use.
Right-clicking a process brings up several different options related to process management. Most of these mirror the operations we discussed in post 5. Stopping a process suspends it so that it stops running until it receives a signal to continue. Ending a process sends a request to the process to finish up and cleanly exit, whereas killing a process causes Ubuntu to stop executing the process and clear its memory for other use.
As before, it’s better to end a process unless it’s completely unresponsive and doesn’t react to end requests, because killing a running process can lead to lost or corrupted data. Changing a process’s priority will instruct Ubuntu to schedule more or less CPU time for it when system resources are limited.
You can use this to make a process run faster or to ensure a long-running process such as a video conversion doesn’t slow down the rest of the system if you don’t mind the time it takes to finish a task.
The “Resources” tab gives you a graphical overview of how your system has been performing over the past 60 seconds. The CPU History graph is nice because it shows you how each CPU is being utilized. Ubuntu will try to schedule different applications to run on separate CPUs to maximize your system’s resources.
It also shows how your memory has been used over time. Memory is physical RAM used to keep programs running smoothly, and swap memory shows disk space that is used to temporarily store memory data on the disk when a program isn’t actively running and other running programs can benefit by using extra RAM.
In general, the more memory being used is better, and the less swap being used is better, since Ubuntu will use spare memory to speed up access to recently accessed programs and files but will stop using it when it’s needed by a running program. You can use this graph to see how opening and closing programs affect your computer’s memory resources.
Network history likewise gives you an overview of recent bandwidth usage. You can use it to judge how all running programs are using your network if you suspect slower-than-usual transfer speeds.
Sometimes several applications uploading or downloading at once can add up very quickly. This only shows network traffic that is coming to and from the computer, however, so it can’t account for heavy network usage by other computers and devices on the same network.
The “File Systems” tab shows you a quick overview of the file systems that are mounted and in use. From their device name and mount point to their size and a breakdown of available and used capacity, this can be a quick look at what disks and partitions are being used and how much space you have available.
GNOME System Monitor gives you an up-to-the-second look at how your computer is being used and how your resources are being utilized. You can use this information to close programs you aren’t using to speed up your system, change the priority of running programs, or decide whether you need to buy extra memory or storage space for your computer.
This system utility will keep you in the know for when you want a comprehensive overview of your computer’s performance.
You will be able to use Ubuntu to read and write to most disks you use with your computer, but sometimes you will need to set up a blank disk or repartition or reformat a disk. Ubuntu makes this easy with Disks utility.
This utility provides a way to view the layout of each drive in your computer, manage file systems and formats, and view the status and health information of each drive.
You can launch “Disks” from the Dash. When it appears, it will list all connected drives on the left side of the window and will show specific information about the selected drive on the right side of the window.
The gear button in the top right of the window has various features that can be performed on the entire disk. You can use this to perform a full disk format that replaces the drive’s partition table, to create or restore full disk images, or to run a benchmark test that determines the speed of the drive.
If an optical drive or external drive is selected, an “Eject” or “Power off” button will appear beside the Gear button, respectively.
This menu also lets you open the SMART Data & Self-Tests window, which shows the current health of the drive and lets you start the drive’s internal self-tests.
The Drive Settings option lets you change power saving preferences that can affect the energy usage of your drive as well as performance. You should not change these settings from the defaults unless you understand each option and its effects clearly.
The “Power Off…” option saves any data waiting to be written to the selected to disk and disconnects the drive, telling it to power itself off. You can safely remove an external drive once it disappears from the Devices list on the left.
Partitions are displayed as rectangles proportionate to their size, but very small partitions are not shown to scale. Any partition that is mounted (in use) will have a small “play” icon that looks like a triangle in the bottom right-hand corner.
System boot partitions will also have a small star icon in the corner. You should not unmount or edit these partitions while the system is running. If you do need to change or resize these partitions, you can boot from your Ubuntu install media and use Disks to make any necessary changes.
Underneath the partition map, you may see a “Mount selected partition” (triangle) or “Unmount selected partition” (square) icon, a “Create partition in unallocated space” (plus) icon or “Delete selected partition” (minus) icon, and a “Additional partition options” (double gear) icon. Select a partition by clicking it.
If the partition contains a file system, you can use the mount and unmount icons to change whether the file system is available to use. If the file system is not in use, you can delete the partition or use the “Additional partitions” button to edit the file system or format the partition.
Formatting allows you to choose between four file system formats. FAT is compatible with practically all devices and operating systems, but no single file can be over 4.3 GB.
NTFS is used by Windows and lacks the file size limitation of FAT but cannot be written to by OS X without additional software. Ext4 is compatible with most Linux systems, and the “Encrypted” option creates an Ext4 file system inside a LUKS container.
Ubuntu will prompt you for the decryption password each time you mount the encrypted file system. You can use the “Custom” option to specify a specific file system type if you need something different for a special purpose.
Disks display your computer’s attached disks and enable the most common disk operations as well as a large number of very technical options, such as complex formatting, changing file system mount parameters, and adjusting performance characteristics.
While caution should be used when working with drives containing important data, Disk is a powerful tool that can be used for anything from simple formatting to working on a computer while booted from the Ubuntu install media.
Using Multiple Workspaces
Monitors feature much higher resolutions than in days gone by. The advent of high-definition television has made a resolution of 1,920 by 1,080 pixels fairly standard. Just 20 years ago 640 x 480 and 800 x 600 were far more common.
Special features, such as “virtual desktops” were developed to help deal with limited screen space. In Ubuntu, this feature is also called “workspaces,” and is an optional feature that can be enabled.
When you run graphical applications, they display in one or more windows. As you arrange windows on the screen, they fill up your computer’s desktop. You can set up a desktop to work for a specific task, but when you switch to a different task, you need to rearrange your windows again.
This can be inefficient if you are constantly rotating between tasks. Using workspaces gives you four virtual desktops that you can assign each window to and arrange independently of the others.
To enable workspaces, click the Gear Menu ➤ System Settings…, then click on the Appearance applet. On the Behavior tab, you’ll see various settings that change the behavior of the Unity interface. Check “Enable workspaces” to add a workspace switcher icon to the Unity Launcher and enable multiple workspaces.
Once enabled, you will have four workspaces that you can arrange windows on. Everyone has a favorite way to use multiple workspaces, but one popular use is to use each workspace to perform different tasks.
For example, if you’re planning a day of working at the computer, you might set up one workspace with your word processor and web browser, a second workspace with your email and instant messaging windows, a third workspace with Rhythmbox for background music, and the last workspace with Solitaire or Mines for your periodic breaks.
With each workspace focused on a different activity, you can take a break by switching to one workspace, and when you’re ready to resume another task, all your applications are running and arranged just the way you had them when you switch back.
This can greatly increase your productivity—as long as you’re honest about the time you spend on your “work break” desktop! Don’t forget that there’s no need to use every workspace just because they’re there. You can use only two or three if you like.
Using workspaces is fairly simple. When you launch an application, it appears on your current workspace, and you can switch to a different workspace whenever you like. The easiest way to switch is to click the “Workspace Switcher” icon on the Unity Launcher or use the shortcut key Super+S. Your view will zoom out and show all four workspaces.
The current workspace is highlighted in orange and the others are dimmed. You can select a new workspace by clicking it with the mouse, or by using the arrow keys and pressing Enter. Your view will zoom back into your new workspace and you’ll be able to work with those windows.
Tip The “Workspace Switcher” icon also shows you which workspace is active. The darker quadrant with two window icons is your current workspace. The Unity Launcher will show all running applications, but the Alt+Tab application switcher and Super+W window spread features will only show applications on your current workspace.
You can identify which applications are running on a different workspace because the pips are hollow. Clicking the Launcher icon for an application on another workspace will automatically switch you to its active workspace, with an animation that indicates which workspace you are now on.
This gives you a nice balance: workspaces simplify Alt+Tab switching as you focus on a task, while the Launcher gives you instant access to everything running on your computer.
You can also move an application to other workspaces. There are several ways of doing this. When you click the “Workspace Switcher” or press Super+S, you can drag individual application windows from any workspace to another. You can also right-click the title bar of any window and choose from several options.
“Always on Visible Workspace” will place the window in the same location on all workspaces. “Only on This Workspace” is the default setting. “Move to Another Workspace” lets you specify a specific workspace to move a window to.
This is a good way of setting up workspaces when you’ve already been working in a single workspace for a while but want to change your workflow to start using the others.
Once you get accustomed to working with multiple workspaces, you can switch between them even faster by holding Ctrl and Alt and pressing an arrow key. Ubuntu will show a small thumbnail of your workspaces as your view slides to the new one. You can switch to any workspace instantly, even pressing two arrow keys at once to move diagonally.
Once you let go of Ctrl and Alt, you will be on your new workspace. Holding Shift while you press Ctrl and Alt will slide the active window with you to the new workspace.
This keyboard shortcut is a little more obscure but can be useful when moving a window around after your workspaces are set up. When workspaces are enabled, holding the Super key will show these shortcut keys under the “Workspaces” section.
Workspaces are an advanced feature that you can use for even greater productivity on Ubuntu. Not only do they simply application switching and multitasking, but they can help you optimize your workflow as you move from task to task—making you more efficient as you focus on work and reducing your downtime between tasks.
Installing Alternate Desktop Environments
One of the most compelling things about Ubuntu and Linux, in general, is the amount of customization that is available. By installing different software on top of the kernel, you can create an operating system that suits your needs perfectly.
Even the default Ubuntu graphical interface is just one option out of dozens that you can change to suit your personal preferences. Ubuntu is available in the form of several “flavors” that share a core Ubuntu system but have different desktop environments built on top.
Each desktop flavor has a different interface and default application selection suited for various preferences or tasks. While a brief overview of many of the officially supported desktop flavors is available in post 1, you can use Ubuntu Software to add software from any desktop environment to an Ubuntu system. All applications run in all desktop environments, and each user can choose a different desktop environment.
Installing a new desktop environment is as easy as running a command in Terminal. Ubuntu will download and configure the additional software and you can choose which desktop you wish to run on the login screen. Because Ubuntu flavors are made up of a lot of packages, it’s best to search for the main package for that flavor.
Ubuntu GNOME with Unity
Kubuntu KDE Plasma Workspace
Xubuntu XFCE Desktop Environment
Ubuntu GNOME GNOME with GNOME
Ubuntu MATE MATE Desktop Environment
Edubuntu GNOME with Unity and educational
Ubuntu Studio XFCE with media creation tools
For example, to add the KDE desktop environment to an Ubuntu system, you would open Terminal, then type “sudo apt install Kubuntu-desktop”, enter your password and press Enter, and then press Enter again at the confirmation prompt.
Ubuntu will download and install all additional programs that were included on the Kubuntu install media. Approximately 1.4 GB of additional software is needed on top of a standard Ubuntu system.
Once additional desktop environments have been installed, they can be selected on a per-user basis at Ubuntu’s login screen. To the right of the username is an Ubuntu logo. Clicking this logo brings up a menu that displays all installed desktop environments. Clicking “Plasma” will choose that new desktop environment and return you to the user and password entry prompts.
The Ubuntu logo will be replaced with a stylized KDE logo to indicate your selected desktop environment. Once you enter your password and log in, the KDE Plasma Workspace will be your active desktop environment. Ubuntu will remember your choice until you change it again.
All installed software is available regardless of which desktop environment you run, so you can experiment to see which interfaces you prefer. You may even want to install several desktop environments, evaluate them, and then perform a clean install of that Ubuntu flavor on your system. Regardless, changing your desktop interface and the entire look and feel of your Ubuntu system is as simple and straightforward as installing any other software.
Installing Software from the Command Line
One of the best things about Ubuntu is that it includes thousands and thousands of software packages. Even software that isn’t included in a default install can be quickly and easily added to an existing system and receive updates through Ubuntu’s Software Updater utility. This is one of Ubuntu’s greatest strengths because a default installation can be customized yet easily kept up to date.
It’s been shown that many programs leverage the strengths and capabilities of other programs, and Ubuntu Software is no different. Ubuntu is built using a software packaging system that was created for Debian long ago.
And while all of the software in the Ubuntu archives has been compiled specifically for Ubuntu, the tools used to install and manage the installed software on an Ubuntu system are the same: dpkg and apt.
An even newer technology used in Ubuntu is snap packages. Snap packages allow you to install software in a safe, confined manner that is separate from your main Ubuntu system without any additional effort on your part.
Snaps are an especially safe and convenient way to try new software because they have security confinement and automatic updates but do not carry the risk of conflicting with pre-installed software.
But as exciting as this new technology is, it is still receiving frequent updates and enhancements. For the latest information on working with snaps on the command line, visit https://www.ubuntu.com/desktop/snappy.
Understanding Ubuntu’s Software Collection
The Debian package tool (dpkg) is used to install and uninstall Debian packages on a Debian-based operating system like Ubuntu. However, the Advanced Package Tool (apt) also manages to keep track of what packages are installed on the system, checking for updated packages, downloading newer packages and any additional packages they need to run, and downloading them from the Internet and making sure they haven’t been tampered with.
Then it runs dpkg to do the actual installation. The end result is that we can learn how to use apt instead of working with dpkg directly.
We would normally use Ubuntu Software to install software from the Ubuntu archives. But installing software on the command line is especially efficient.
While the end result is identical, it is much easier to explain how to install software on the command line. For that reason, it is extremely common to see command-line instructions given in online tutorials. That makes it important to understand what is happening when an article or online solution asks you to open a terminal window and run commands to install software.
Ubuntu software is contained in a variety of software repositories. A repository is a list of available software packages and their relationship to other packages, along with the packages themselves. Ubuntu can use this list to download and install new software packages as well as determine when installed packages have been updated.
Ubuntu software is separated into various groups: main, restricted, universe, and multiverse. The “main” group contains the core Ubuntu software that is directly supported by Canonical. This includes the default desktop as well as the most important server software.
The “restricted” group has firmware and other software that isn’t Free software or open source and is distributed by Ubuntu and Canonical to help ensure that Ubuntu can run on a variety of hardware. The “universe” group is filled with community-supported software, and “multiverse” is software that may not be fully redistributable because of the software license or patent issues.
Each Ubuntu release has three repositories. One uses the release’s shortcode name (for example, “xenial” for 16.04 LTS), which is an archive of Ubuntu as it existed at the moment of that release. The matching repository, “xenial-updates,” contains any packages that have been updated since 16.04 LTS was released.
The last repository, “xenial-security,” contains updated packages that have been updated because of security issues. Each repository contains software from all four groups. Because apt combines these lists of software packages into one database, you can use apt to install and upgrade any software that is included in Ubuntu regardless of where it comes from.
Tip While most online instructions use apt-get, apt-cache, and other tools, this post prefers the apt command—introduced in Ubuntu 14.04 LTS—because it has color-coded output and a progress bar that is easier to read for command-line newcomers. The two commands produce the same end result, although apt-get has more advanced options.
Keeping Software Up to Date
Before you search for or install a software package, you should ensure Ubuntu’s software index is up to date. By default, Ubuntu updates its software list once per day, but you can manually update the index by running “apt update.” This will download the current list of packages from the Ubuntu repositories. Because this modifies system files, you must run it with sudo and type your password, followed by pressing
Enter: sudo apt update
Ubuntu will check each of its repositories and only download package lists that have changed since the last time the command was run. Once this is finished, you can upgrade or install new software.
The Ubuntu updates repository only keeps the latest couple of updates to any single package, so if an upgrade or install fails with a “Package not found” error on a computer that hasn’t been turned on in a while, running apt update before repeating the upgrade or install command will often succeed.
With an updated package list, Ubuntu knows which packages are available and can replace older software on your system. The command to do this is apt upgrade. If you run this with sudo, apt will list all updated and new packages and ask whether you wish to proceed with the upgrade. Here is an example of an upgrade where Ubuntu’s Linux kernel will be updated:
Steve@ubuntu-post:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed: Linux-headers-3.13.0-61 Linux-headers-3.13.0-61-generic Linux-image-3.13.0-61-generic Linux-image-extra-3.13.0-61-generic
The following packages will be upgraded:
linux-generic Linux-headers-generic Linux-image-generic Linux-libc-dev
4 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 62.3 MB of archives.
After this operation, 271 MB of additional disk space will be used.
Do you want to continue? [Y/n]
“Y” is the default option, so pressing Enter will begin the upgrade. Ubuntu will download all of the listed packages from its software repositories, and install them, with a progress bar printed at the bottom of the screen. Once it is complete, your system will be up to date.
Occasionally, apt will say that certain packages are being held back. This happens when certain packages must be removed and replaced with newer versions with new names. This isn’t common but occasionally happens with certain system libraries. You can run “sudo apt full-upgrade” or “sudo apt-get dist-upgrade” to install the held-back packages.
Searching for Software
There are over 80,000 software packages in Ubuntu 16.04 LTS, and finding new software to install can be difficult. Sometimes a package name is the same as the application title, such as “firefox” or “Inkscape.”
But sometimes a package name is different, such as “Nethack-console.” Using the command line to install an application is the quickest method when you know the exact package name, but apt can also be used to find software as well.
Every package has a name and a short and long description, which is part of the information stored in the Ubuntu repositories. Using the command “apt search” plus space and a search term will search the names and descriptions in the package database on your computer and will print a list of package names and their short descriptions.
For more information on any package, you can run “apt show” followed by a space and a package name. This displays a lot of information, including the installed size and the package’s long description, which allows you to narrow down a package name for software you wish to install. Using the command line to search for applications is more bare-bones, but it is much faster than using Ubuntu Software.
You can also use “apt policy” to find out more information about the installation status and availability of a package. If I run “apt policy firefox”, for instance, I see the following:
Steve@ubuntu-post:~$ apt policy firefox
*** 53.0+build6-0ubuntu0.16.04.1 500
500 http://mirrors.us.kernel.org/ubuntu/ xenial-updates/main amd64 Packages
500 http://mirrors.us.kernel.org/ubuntu/ xenial-security/main amd64 Packages
\\ /var/lib/dpkg/status 45.0.2+build1-0ubuntu1 500
\\ http://mirrors.us.kernel.org/ubuntu/ xenial/main amd64 Packages
I can clearly see from the “Installed” field that Firefox 53.0 is installed. The “Candidate” field tells me the latest version that Ubuntu wants to install.
Because it’s the same as the installed version, I know that my browser is the latest available in the Ubuntu repository. The version table shows me that Firefox 53.0 was included in xenial-updates and xenial-security.
Because it is in xenial-security, I know it has fixed security issues since the release of Ubuntu 16.04 LTS and I should install it unless I have a good reason not to. And I can also see from the last line that Ubuntu 16.04 LTS originally shipped with Firefox 45.0.2.
Even when a package is not installed, “apt policy” provides the same information. Using the Chromium browser as an example shows the following:
Steve@ubuntu-post:~$ apt policy chromium-browser chromium-browser:
500 http://mirrors.us.kernel.org/ubuntu/ xenial-updates/universe amd64 Packages
500 http://mirrors.us.kernel.org/ubuntu/ xenial-security/universe amd64 Packages
500 http://mirrors.us.kernel.org/ubuntu/ xenial/universe amd64 Packages
The “Installed” field clearly indicates with “(none)” that Chromium is not installed on the computer, and that using apt or Ubuntu Software to install it will result in Chromium 58.0.3029.96 being installed.
Installing New Software
Installing software from the Ubuntu repository is simple on the command line. If you know exactly what you want to install, you can start the process in mere seconds. The command “apt install” will automatically download the latest version of a package along with any additional packages it requires, and install them in the most efficient order.
Because it modifies system files, “apt install” must be run with “sudo”, along with the name of the package you wish to install. Then apt will determine what needs to be installed and if the package can be installed by itself, it will begin the download and installation immediately.
If the package requires additional packages that you did not specify, it will pause after printing a summary and wait for your response. Pressing Enter will begin the install. Installing Chromium browser looks like this:
Steve@ubuntu-post:~$ sudo apt install chromium-browser Reading package lists... Done Building dependency tree
Reading state information... Done
The following extra packages will be installed:
webaccounts-chromium-extension unity-chromium-extension adobe-flashplugin
The following NEW packages will be installed:
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 67.8 MB of archives.
After this operation, 279 MB of additional disk space will be used.
Do you want to continue? [Y/n]
This tells us that the extra package “chromium-browser-l10n” will be installed. Pressing Enter will begin the download and installation. If you wanted to know more about the additional package, you could type “n” and press Enter, then run “apt show chromium-browser-l10n”.
Using “apt show” reveals that this is the language data for the browser. apt also listed three other suggested packages that work with Chromium or offer additional functionality.
Suggested packages are not installed by default, but they can offer additional functionality and you can install them manually. If installing a package would require the removal of software, those package names would also be listed.
Altogether, apt will download 55 MB of packages, and once they are uncompressed, installed, and configured, they will use 218 MB of disk space. This also takes into account any software that may be upgraded or replaced by apt.
Installing more than one package at a time is as easy as listing more than one package on the command line. When I install Ubuntu on a new computer, one of the first things I do is run “sudo apt install gimp Inkscape vlc ubuntu-restricted-extras”.
By directly asking Ubuntu to install these packages, I save a lot of time over opening Ubuntu Software, searching for each one by name, and clicking “Install.”
Occasionally, you may want to download packages now but not install them until later. You can do this by running “apt -d install [packagename]” or “apt -d upgrade”. The “-d” option tells apt to download the packages but skip installing them.The next time you run a command to upgrade or install those packages, they will not be downloaded again unless a newer version has been released.
Removing software is just as simple as installing it. The command “apt remove [packagename]” uninstalls software packages and frees up disk space. When you run this command, it deletes the application and associated system files.
It doesn’t typically delete any configuration data in your home folder. This means that you can still back up this information, and should you reinstall the software again in the future, your old settings will still be used.
If you want to completely remove a package and its configuration files, you can use the command “apt purge [packagename]”. This will leave no trace of the specified software on your computer.
Ubuntu’s basic software management tool apt is an easy-to-use and powerful way of managing your computer’s software at all steps: searching, downloading, installing, upgrading, and removing.
This technology lays a foundation for Ubuntu’s ease of use and reliable security and bug fixes. By working with these tools directly, you can save yourself time and quickly install and remove software so that you can get to work.
Expand Your Software Options
Ubuntu comes with a wide array of software—over 80,000 packages at your disposal thanks to large software repositories. Sometimes, it’s not enough. Ubuntu’s update policy means that major versions of software are locked in a couple of months before release and the Ubuntu repositories only see minor maintenance or security updates to ensure stability.
LibreOffice 5.1.3 was included in Ubuntu 16.04 LTS and received updates up to 5.1.6. Ubuntu won’t receive further updates of LibreOffice even though the current version is 5.3.2. Other software was not able to be packaged for Ubuntu for various reasons.
Some weren’t available or stable enough to include during Ubuntu 16.04 LTS’s development cycle. Others are released directly by third-party software manufacturers. When an application makes an Ubuntu package repository available, you can add the repository to your system and gain access to the included software.
A third-party Ubuntu repository will have two components. The first is a link to the repository, and the other is a GPG encryption key to sign the packages and ensure a package hasn’t been corrupted or tampered with. With this information, you can add the repository to your software sources and interact with it using Ubuntu Software and apt.
Ubuntu’s Launchpad project also offers a feature called “Personal Package Archives (PPA).” This service allows developers to create Ubuntu packages for testing or updates outside the Ubuntu release process and is slightly easier to add because Ubuntu can import the signing key automatically.
Some third-party software, such as Google’s Chrome installer and Valve Software’s Steam installer, add themselves to the software list during the install, allowing Ubuntu to automatically detect and download updates.
To manually add a repository, launch “Software & Updates” from the Dash and click on the “Other Software” tab. You will see any optional repositories that have been added to your system, as well as a checkbox indicating whether each source is enabled or disabled.
To add a repository, click the “Add…” button. Ubuntu will ask you for the “APT” line that describes the repository. This usually begins with the word “deb.” To use Oracle’s VirtualBox repository as an example, Oracle provides repository information on its website in the VirtualBox downloads page at https://www.virtualbox. org/wiki/Linux_Downloads. Following the instructions on that page, in the “APT line:” field you would enter:
deb Index of http://download.virtualbox.org/virtualbox/debian xenial contrib
Once you’ve entered that into the field, click “Add Source.” Ubuntu will ask you to enter your password to confirm your request. Once you click the “Authenticate” button, Ubuntu will add the repository to your system.
Next, you will need to add the repository’s signing key. If the repository maintainer uses one, it should be available in the same place as the repository information. For example, Oracle provides a link to the signing key on the Linux download page as part of repository setup instructions. Download this key with your web browser and go back to the Software & Updates window and click the “Authentication” tab.
Click the “Import Key File…,” select the .asc file you downloaded, and click “OK.” Ubuntu will add the key and when you click “Close,” you will receive a prompt that says “The information about available software is out-of-date.” Click the “Reload” button and Ubuntu will update its software list, including the new source you just added.
Once the Software & Updates window closes, you can install packages in the new repository using Ubuntu Software, Software Updater, or apt just like any other package. VirtualBox is now available in an additional “VirtualBox-5.1” package that can be installed. If Ubuntu 16.04 LTS’s older “VirtualBox” package containing version 5.0 was installed before, VirtualBox-5.1 will replace the older software so that they do not conflict.
Caution When you add a software source to Ubuntu, you are giving the source maintainer full control of your computer because the setup scripts in the packaging run with superuser rights and malicious software could be masquerading as something useful. Make sure you trust the source before adding it to your computer.
When you upgrade to a new major release of Ubuntu, these additional software sources are automatically disabled because there is no guarantee that they are compatible with the newer version of Ubuntu.
You can contact the repository maintainer or carefully test the software on the newer version of Ubuntu and re-enable each source on an individual basis. Sometimes you can use the “Edit” button to update the release name, from “xenial” to “zesty,” for instance, if you were upgrading to Ubuntu 17.04.
If the new source is not available for the newer version of Ubuntu, the currently installed packages will remain installed but will not update until their availability changes.
Ubuntu is able to receive updates to the software it provides but is also flexible enough to receive updates from other sources as well. Used with caution, this is the perfect way to keep up with updates to Chrome, Steam, VirtualBox, and many other software projects.
Creating Application Launchers for Programs
Sometimes you might have written a script or found an interactive command-line application that you want to be able to launch using the Unity Dash or pin to the Launcher. While some command-line applications (such as Elinks) are available in the Dash after installation, the vast majority of command-line applications do not show up in the Unity Dash.
Other software that isn’t available through Ubuntu’s package management, such as Minecraft, run in place but without a desktop launcher. Most software without a launcher will never be missed, but if you want to set up a custom icon, you can do so by creating a “.desktop” file.
A .desktop file is a text configuration file that describes a program to a desktop environment. Most modern desktop environments automatically detect .desktop files in either a system folder or a per-user folder. To demonstrate, let’s create a script named “space drive” that generates a pulsing white noise similar to a starship engine. Then, we’ll create an application launcher file so we can run it using Unity instead of the command line.
First, install the package “sox.” This small sound file utility can convert sound files but can also be used to generate sound effects. To install SoX, open “Terminal” via the Dash, or press Ctrl+Alt+T. Then type
sudo apt install sox
Press Enter, enter your password, and press Enter again. You’ll be prompted to confirm the software installation. Press Enter to accept the default of “Yes.” Ubuntu will download and install SoX and a general MIDI sound font.
Next, click Files in the Launcher and create a new folder named “bin” in your home folder if it does not already exist. If you just created “bin,” you should log out and log back in. Ubuntu will automatically add “~/ bin” to your system path if it exists, but only when you log in. Then, launch Text Editor from the Dash and enter the following into a new file:
echo -n "\033]0;spacedrive\007"
/usr/bin/play -n -c1 synth white noise lowpass -1 120 lowpass -1 120 lowpass -1 120 gain +14
Save that in your ~/bin folder with the name “space drive”. In Files, open the “bin” folder and right-click “space drive,” then choose Properties from the pop-up menu.
Click the “Permissions” tab, and click the “Allow executing file as program” checkbox until it has a dash or a check mark in it, and then close the “space drive Properties” window.
If you have created this script correctly, you can launch Terminal from the Dash and type “space drive” and press Enter. You should hear gently pulsing white noise with a status and volume indicator. This will continue to play until you press Ctrl+C in the Terminal window.
Once this works, go back to Text Editor and click the “Create a new document” icon in the toolbar. In the new text file, enter the following with no blank lines at the top:
Comment=Engages your starship's engines for relaxing background noise.
Save this to your Desktop folder with the name “space drive.desktop.” On your desktop, you will see the file appear. If you try to run it, you will receive an error that says the application launcher has not been marked as trusted.
Right-click the file and choose “Properties,” and go to the “Permissions” tab and allow the file to be executed as a program as you did with the “space drive” script.
The icon file the file will change to an image of a NASA space shuttle, and the label will change from “space drive.desktop” to “space drive.” The file name has not actually changed, but its appearance on the desktop has. You have now created an application launcher.
To make the file available in the Unity Dash, you can move it to the ~/.local/share/applications folder. It will immediately be available in the Dash, and you can even drag it to your Launcher at the left side of the screen. Once the script is running, pressing Ctrl+C or closing the terminal window will end the sound effect.
The .desktop file follows a specific format, but you should be able to modify the space drive.desktop file to suit your own needs. The “Name” line will be the way your application appears in the Dash and Launcher, and the “Comment” line is used for extra search keywords by Unity and often shows up as a tooltip when hovering your mouse over a menu item in other desktop environments.
The “Exec” line should be the exact path and filename you use to run the script or command from a command prompt. If the application is in your path (such as applications installed by the package manager or items in your “bin” folder), you can specify just the name, but if they are outside your path you must give the full path, for example, “/home/Steve/bin/space drive”.
The “Icon” line is optional and can point to any file. If no path or file extension is given, Ubuntu looks in /usr/share/pixmaps for a matching file and adds the right extension.
The “Terminal” line indicates whether or not to display a terminal window, and can be either “true” or “false.” If the application is graphical or runs without interaction, you will probably make this “false.” If you need to interact with the script or command, you will want to make this “true.”
The line “Type” needs to be “Application” in order to function as a launcher, and “Categories” should be one of the main categories in the specification. You can use semicolons (;) to separate additional categories on the same line as in the example.
A list of valid categories to use on this line are available at https://standards.freedesktop.org/menu-spec/1.0/apa.html
There are some additional sections you can add, both advanced features of the application launcher and Unity-specific features as well. If you are interested in adding right-click actions to application launchers that are in the Launcher, for example, you can read more details and examples at the following online documentation: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles
Having a shortcut for a favorite command or script can be a huge convenience. Using simple .desktop files can allow for custom launchers that range from the simple to the complex, and come in handy— especially when you are working between with software that doesn’t use Ubuntu’s software management.
Working with Virtual Machines
Finding the best software to suit your workflow can be fun but challenging. And in the end, you might find that you enjoy software that is only available on other operating systems. You may also want to experiment with different operating systems or software changes while keeping your primary computer usable.
Dedicating a computer to one operating system or dual booting a single system is one option, but moving between computers or stopping work to reboot into another operating system is inconvenient.
Other times you may just want to test something temporarily. The best way to do this is to create a virtual machine where your changes don’t affect your primary computer.
There are many virtualization technologies, and Ubuntu supports many of them. VirtualBox is very popular, as is the VMware family of commercial products. KVM support is used in a lot of cloud computing solutions, and in fact there are many commercial virtual server providers such as DigitalOcean and ChunkHost.
All of these solutions have their uses, but VirtualBox is one of the most user-friendly ways for a beginner to work with virtual machines.
A virtual machine is a simulated computer that runs like a program. Once created, it behaves just like a real computer. You can define how much memory it has, create virtual disks and define their size, and connect virtual and real hardware to the virtual machine. While a virtual machine uses your computer’s CPU, memory, and disk space, it is isolated from the rest of your computer.
In fact, the first thing you do after you turn on a new virtual machine for the first time is installed an operating system—just like a new physical machine. Because of the way they share resources, the computer running VirtualBox is called the “host” computer and the virtual machine inside VirtualBox is called the “guest” machine.
To work with VirtualBox, you can install it from Ubuntu Software, or use apt to install the package
“VirtualBox.” If you want to use the latest version available from Oracle, you can look at the earlier section, “Expand Your Software Options,” as a guide to adding Oracle’s VirtualBox repository to your system.
When this post was written, “VirtualBox-5.1” was the latest version of VirtualBox, but check the official website at https://www.virtualbox.org/ for updated instructions.
Only members of the “VirtualBox” group on your system will be able to run VirtualBox. The install process will automatically add your user account to the group, but you will need to manually add other users to this group before they can run VirtualBox, too.
The first time you install VirtualBox on an Ubuntu computer, you will need to log out of Ubuntu and log back in so that the “VirtualBox” group permissions take effect. Then you will be able to launch VirtualBox through the Dash.
Creating a Virtual Machine
The first time you run VirtualBox, you’ll see a welcome screen. This screen gives instructions for creating your first virtual machine. Click the “New” button on the toolbar and the “Create Virtual Machine” wizard will appear. The wizard explains each step in detail.
On the first page, you can give your machine a friendly name that will appear in the machine list, and select your target operating system from the drop-down menus. When you hit “Next,” you’ll be prompted for the amount of memory installed in the virtual machine.
The important thing to remember is that when the virtual machine is running, it takes all of the allocated memory from the host operating system. The recommended memory size is based on the minimum requirements for the operating machine you specified, but you can choose any size you like.
Smaller sizes can cause poor guest performance, and larger sizes can cause poor host performance that affects the entire computer and running virtual machines. When the virtual machine is powered down, it doesn’t use any memory.
Next, you can create a virtual hard drive for the machine. The recommended size is once again based on the minimum requirements of the virtual machine. Once you choose whether to create a new virtual hard drive, a “Create Virtual Hard Drive” wizard appears and guides you through the process.
Unless you have a specific need for a different format, you can safely create a VDI (VirtualBox Disk Image) format disk. If you create a “dynamically allocated” drive, then the drive file size will start at 2.1 MB regardless of the virtual capacity and will only grow when written to. A “fixed size” virtual drive file will be as large as the capacity you choose on the next screen.
It can be useful if you are working with a virtual machine that will save a lot of data because it can be faster to write to. Once you create the disk drive, the wizard will close and you will be back at the main VirtualBox window with the details of your new virtual machine displayed on the right of the window.
Some operating systems rely on 3D acceleration to display their user interface. Both Windows Vista and later along with Ubuntu 12.10 and later will be much faster with 3D acceleration enabled. You can select a virtual machine and click the “Display” settings header, then enable the “Enable 3D Acceleration” feature. If you will install Windows on the virtual machine, you can also select “Enable 2D Acceleration.”
Once you install the VirtualBox Guest Additions, your virtual machine will function much more smoothly. See “Installing Guest Additions” for more details.
Running Your Virtual Machine
Selecting a virtual machine and clicking the “Start” button on the toolbar will virtually power on the machine. A display window will appear which will serve as the virtual machine’s monitor.
You can type and use the mouse inside the window. Both the Ubuntu and Windows installers recognize the virtual mouse, so you’ll be able to click inside the display window at any time.
If you are not running an operating system that supports the virtual mouse, the virtual machine will “capture” the mouse when you click inside the window. This can also happen with the keyboard. To free both the mouse and the keyboard, press the Right Ctrl key.
A new virtual machine will have a blank hard drive. The first time you start a virtual machine, VirtualBox will ask you to select the location of your operating system install media. You can choose an optical drive on the host machine or an ISO disc image if you have it in your files.
Clicking “Start” will insert the disk into the guest’s virtual optical drive and power on the virtual machine. At that point, you will proceed to install your guest operating system as you would on a physical computer.
Once you have installed an operating system, a virtual machine is almost identical to using a physical machine. You can close the virtual machine window to power off the virtual machine, although if the guest operating system allows for an automatic shutdown, you should always use it instead of forcing a power off.
Your virtual machine has audio, video, and network, and storage hardware, and if the guest operating system supports USB, you can connect USB devices plugged into your host machine directly to the guest machine’s USB ports by using the Devices ➤ USB Devices menu and clicking the desired device.
Once your guest machine is finished with the device, you can detach the device from your virtual machine the same way. It automatically attaches to your host machine.
VirtualBox has a dizzying array of options and features, and if you are used to building computers, you can customize much of the virtual hardware. In the main VirtualBox window, you can right-click a virtual machine and choose “Settings” from the pop-up menu.
Most settings have a tooltip that appears when you hover your mouse over them. These tips not only explain the option but often offer advice on avoiding configuration problems.
The VirtualBox manual is comprehensive and explains all of the settings and considerations when installing specific guest operating systems, and will help you get the most out of this highly complex software. Clicking the “Help ➤ Contents” menu item will bring up the manual.
Installing Guest Additions
The guest operating system in a virtual machine is isolated from the host operating system and runs completely independently. This is both a great advantage and a disadvantage.
Only virtualized hardware and devices can be used on the guest machine, and features like 3D acceleration and the clipboard and folders cannot be shared. VirtualBox comes with a set of guest additions that can be installed on the guest operating system to add virtualized hardware drivers that allow the guest machine to communicate with the host machine and better share resources.
Once you have installed a guest operating system in your virtual machine, you can insert the Virtual Guest Additions CD into the virtual machine. This is not a physical CD but can be inserted with the “Devices ➤ Insert Guest Additions CD image…” menu item when the operating system is running.
The guest operating system should ask if you want to run the software on the CD. Choose yes, authorize the system changes, and the installer will appear. On Windows guests, this will look like a typical program installer and you will be able to choose whether to install 3D acceleration. Follow the on-screen prompts to install the guest additions.
On Ubuntu and other Linux operating systems, a terminal window will appear and show the installation progress. Once the installation has completed, you can eject the CD and restart the guest machine to fully enable the guest additions.
More detailed and up-to-date instructions for installation and guest operating system compatibility are available in the VirtualBox manual. When VirtualBox is upgraded, the guest additions should be updated, too.
Your guest operating system will notify you if a newer update is available, and you can simply repeat the installation process. The installer will remove the old additions and replace them with the new ones.
Guest additions offer many benefits. The keyboard and mouse will no longer be “captured” by the virtual machine, and your virtual machine will have access to more graphics modes, including the ability to automatically adjust to the virtual machine window being resized.
On Windows and Linux, you can also enable “Seamless Mode,” which removes the guest operating system’s desktop background. This allows you to work with the guest application windows as though they were running on your host system.
While this has some restrictions, it can greatly simplify switching between applications on the host and guest machines. Guest additions even allow for the sharing of clipboard data and folders between the host and guest, and VirtualBox 5.0 adds direct drag-and-drop support for small- to medium-sized files. Once again, the VirtualBox manual will have more details as well as the latest updates on functionality.
For operating systems that rely on 3D acceleration to display their user interface, you should ensure that 3D acceleration is enabled in the virtual machine settings. While the virtual machine is powered off, select the virtual machine and click the “Display” settings header, and then enable the “Enable 3D Acceleration” feature.
For Windows guest machines, you can also select “Enable 2D Acceleration.” Graphics acceleration will speed up the interface and also allow you to play many 3D accelerated games inside the virtual machine.
VirtualBox allows you to work in multiple operating systems at the same time. With the installation of guest additions, you can expand those operating systems to provide better access to your physical hardware and offer extra convenience features that make working with wildly different software much more pleasant.
VirtualBox gives you a computer in a window. In fact, you can run as many virtual machines as your physical computer’s hardware resources can accommodate. The possibilities are truly endless.
\\ You can try different operating systems. If you wanted to work with Windows, or a different flavor of Ubuntu, you can safely test the install process and user experience by trying it in a virtual machine first. If you love Ubuntu but have one or two Windows applications that won’t run under Wine, you can run them in Windows with a virtual machine without having to dual boot.
\\ You can run older or newer operating systems. Do you have old DOS games or are you just feeling nostalgic? You can create a virtual machine and install MS-DOS or FreeDOS. Do you want to see what Ubuntu looked like a decade ago?
You can install Ubuntu 6.06 LTS as a guest operating system. The computer this post was written on always ran the latest versions of Ubuntu during writing, but two virtual machines running Ubuntu 16.04.2 LTS and Windows 10, respectively, helped ensure that all screenshots and instructions were taken from a clean, freshly installed operating system that will match your experiences.
\\ You can experiment. Snapshots save your machine’s state so you can revert if things go wrong. Test upgrades or recovery processes. You can build a virtual machine with extra storage, or floppy drives, or two network cards.
\\ You can learn. Ever wanted to run an Ubuntu server? You can use a virtual machine to install Ubuntu Server and use your host operating system’s web browser to look up learning and reference material. You can run two virtual machines side by side to communicate. You can write programs and run commands and upgrade operating systems without risking your data or your computer’s stability.
\\ Being able to create and destroy virtual computers in seconds is the ultimate power user tool. Whether you set up different virtual machines to handle various tasks or you occasionally create machines to test something before deleting them, the only limit is your imagination.