Oracle VirtualBox and Linux Tutorial
What is Oracle VirtualBox
Oracle VM VirtualBox is a software package that allows you to run another operating system from your host system. VirtualBox software is installed on what is known as the host operating system, then from this software you can install additional Guest Operating systems (Guest OS). Each Guest OS runs in its very own environment. Each running Guest OS shares the main hosts resources. CPU, Memory, peripherals, storage and network are all shared. VirtualBox can be installed on many host systems such as Linux, Mac OS X and Microsoft Windows.
The advantage of running a different OS in a virtualised environment allows you to run software for different platforms without having to reboot your PC. You can try out different operating systems without having to configure your system as a multi boot device. Many vendors now ship pre-built images that run software that is dedicated to a specific function such as an email server. You can also use the virtualised environment for developing and testing Disaster Recovery procedures (Business Continuity) without having to touch any live production environment.
To download the VirtualBox software for your Operating System, visit the Oracle Vm VirtualBox website: Oracle VirtualBox
The official Oracle VM VirtualBox manual can be downloaded from the following location: VirtualBox Manual
Oracle VirtualBox Start Screen
Assuming you have installed the software for your operating system, you will be presented with a screen similar to the screen shot below. It is from this screen that you can Start or pause your Guest Operating systems. System resources from the host operating systems are defined from the various menu options available. Here you can add additional disk to a system, increase or reduce resources such as memory or CPU. In the example below you can see that I have multiple versions of various Linux operating systems installed. These can literally be started by highlighting the chosen system and clicking on the "start" icon from the upper menu.
Example of adding a new guest operating system
To create a new Guest Operating system you first need to have downloaded an "iso" image for your relevant operating system or have a CD or DVD that contains the necessary installation media. The majority of Linux operating systems can be downloaded from the internet for free or for evaluation purposes. Assuming that you have your installation media ready we can now start the procedure for creating our Guest OS.
Step 01 - Creating a name for your VM (Virtual Machine)
Our first task is to click on the "New" icon located in the upper centre section of the screen.
You will now be asked to provide details about the Operating System you are about to install. You will need to specify the OS type (Linux, Windows etc..). You need to provide a name for your system. In the example I have used "CentOS_8_Minimal", I have also selected that we are going to create a Linux virtual machine based around the Red Hat operating system.
Step 02 - Allocate Memory Resources
In this step we allocate some of our hosts memory to our Guest OS. How much memory you allocate does depend on the Operating System you are planning to install and more importantly how much available memory your host system has available. In the example I have only assigned 4096MB, however, you may need more or less depending on the system you are installing. Most operating systems recommend a minimum amount of memory that should be needed to run their OS. This information is normally available on most vendors websites.
Step 03 - Creating a New Virtual Hard Disk
At this menu, you are asked to either create or use an existing disk as your boot disk. In most cases, you will be creating a new virtual hard disk. The recommended size of a boot disk is 8GB, however, this does depend on what operating system you are installing and what software you wish to install on this new Guest OS.
Step 04 - Select Hard Disk Storage Type
From this menu you must choose which type of storage to use for your installation. The two available options are:
Dynamically Expanding Storage
Dynamically Expanding Storage initially occupies a very small amount of space on your Physical Hard Disk. It will grow dynamically (up to the size specified) as the Guest OS claims disk space. In most cases this option can be used as it initially uses less space and is faster to setup.
Fixed Size Storage
Fixed Size Storage does not grow. It is stored in a file of approximately the same size as the size of the virtual hard disk you select. The creation of a Fixed Size storage may take a long time depending on the storage size and the write performance of your host's hard disk.
Step 05 - Virtual Disk Location and Size
From this menu you need to specify where your storage file will be located and what name you would like to use to identify the file. From this menu you are also required to specify the size of the Virtual Disk that you are about to create.
Step 06 - Create Virtual hard Disk Now
Click on create to initiate the creation of your hard disk to be used for installing your new guest OS to.
Defining system resources
Now that we have created our virtual disk and allocated our memory we can now configure some of our other settings.
From the main screen , you need to right click the name of your guest OS and select "Settings". From here, a pop up menu will be displayed with various options that can be modified.
From this menu you can modify any of the following sections: "General, System, Display, Storage, Audio, Network, Serial Ports, USB, Shared Folders and User Interface."
In this example I'am going to configure the network connection to be "Bridged Adapter"
Overview of Settings
Below are a brief description of each of the headings and what their basic functionality.
From the system menu we can modify the boot order of our system. "Boot first from CD/DVD then hard disk etc..", you can also alter the base memory settings and increase the allocated CPU resources providing your host system has the capacity.
This section allows you to allocate how much video memory your system can use. The amount you allocate will depend on how much capacity your host system has available. In this example I have allocated 64MB of memory. Here you can also enable "3D Video Acceleration". Many newer operating systems will need this option to be checked.
This section shows an overview of your current allocated storage resources. You can also add additional virtual disks from this menu. This can be useful if you wish to experiment with Linux's LVM storage system.
This section deals with the audio settings for your current configuration. In most cases this area will be populated automatically with the relevant information.
This next section is important as this will define how our Guest Operating system is going to communicate on your network and access the internet. The most common options are "NAT" and "Bridged Adapter".
Network Address Translation (NAT). NAT is the default option. If you only want to browse the internet, download ﬁles and view your email inside the Guest OS, then using NAT should be more than adequate for your needs.
Bridged networking is generally for more advanced networking situations. When this option is chosen, VirtualBox will connect to one of your installed Network Interface Cards and exchanges network packets directly. If you are using a router with DHCP, you will be leased an IP address in the same range as your host's IP address. This functionality is very useful as it allows you to communicate with other devices/systems on the same network. (My personal preference is to use a bridged connection.)
Internal network can be used to create a software based network which is visible to selected Virtual Machines, but not to applications running on the host or to the outside world.
Host only Network
This option is used to create a network containing the host and a set of Virtual Machines, without the need for the host’s physical network interface. Instead, a virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.
In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection.
Starting your installation
Now that that you have defined your system resources and network settings it is time to start the installation process. For this part of the setup process we will be using the "iso" image downloaded or an image that you have available on a CD or DVD.
Highlight you Guest OS. In this example this will be the entry called "CentOS_8_Mininal". Next click on the "Start" icon from the upper menu of the main screen. (The Green arrow).
You will now see a screen asking you to Add/Select your iso image. If your iso image is not showing, you will need to click on the "Add" option and continue to the next step.
Select your iso
Browse to the location where you have your installation media (iso) image, then click highlight your entry and click on "open"
Select Start-up disk
The iso image you selected in the previous steps should now be selected. To initiate the installation, click on the start button. Your guest OS should now start to install.
At this stage, you can follow the on screen instructions for installing your Guest OS. For instructions on how to install various Linux operating systems, use the "Install Guides" link from the top of the page.