LFCS OS in VirtualBox

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
336
Reaction score
361
Credits
11,504
Instead of having a dedicated system to each Operating System (OS) for the LFCS certification you can install both OS's in VirtualBox. VirtualBox allows you to run another OS inside your current OS.

VirtualBox Download and Installation

To get VirtualBox go to https://www.virtualbox.org/wiki/Downloads. VirtualBox is available for the following:

  • Windows
  • OS X
  • Linux
  • Solaris

You will also see the Extension Pack, you can download it as well, or wait until after VirtualBox is installed.

Download VirtualBox for your OS type and install it. Once installed, you can select to download the Extensions and you should be prompted to download the file and it will be opened with VirtualBox. Open the Extensions in VirtualBox as prompted and the Extension Pack will be added to VirtualBox.

The Extension Pack is installed as part of VirtualBox and is necessary to allow for:
  • Support for USB 2.0 and USB 3.0 devices
  • VirtualBox RDP
  • Disk encryption
  • NVMe and PXE boot for Intel cards

NOTE: Be sure to install the Extension Pack with the same version number as VirtualBox. Do not install a newer version of the Extension Pack on an older version of VirtualBox. If you upgrade VirtualBox then you should upgrade the Extension Pack to the same version number.

Prepare for Virtual OS Installation

To install CentOS 7 and Ubuntu 14.04 you need to download the ISO files as directed in previous articles. If your system is a 64-bit system and it supports Virtualization (in the BIOS) then you can use 64-bit OS's in VirtualBox. For all other systems use 32-bit ISO files to install the Linux OS.

Before adding a virtual system a few settings need to be set in VirtualBox. Open VirtualBox and select File → Preferences. Under General set the 'Default Machine Folder'. The folder you specify is where all of the Virtual disks will be saved by default. Select 'Network' in the left pane and in the right pane you can add a NAT Network. The name should default to 'NatNetwork', but you can change it if needed. Once you use it on a Virtual Machine you may not want to change it later. Click on the 'Host-Only Networks' tab. Add an adapter here as well and it should default to 'VirtualBox Host-only Ethernet Adapter'. These two adapters are how the virtual machines will access the network of the physical system. Select 'Display' in the left pane. In the right pane set the 'Maximum Guest Screen Size' to 'Hint'. Set the Width and Height to match your system's video resolution. The setting is what is sent to the installed OS in the virtual machine after the Guest Additions are installed.

CentOS 7

Now, create a new machine and name it CentOS 7. The type and version should be automatically filled in. Otherwise, the Type is Linux and the Version is Red Hat (32- or 64-bit). Next, set the Memory Size to the highest it will allow while staying in the green section. Next, create a Virtual Hard Disk (any type you wish, but make it at least 8 GB and Dynamic). The Machine should now be created so use the following settings to fine tune it:

  • General Tab:
    • Name: CentOS 7
    • Type: Linux
    • Version: Red Hat (32- or 64-bit)
  • System:
    • Motherboard:
      • Base Memory: The highest you can get and not be in the pink area
      • Boot Order: Optical
Hard Disk
  • Chipset: PIIX3
  • Pointing Device: PS/2 Mouse
  • Extended Features: Enable I/O APIC (checked)
Hardware Clock in UTC Time (checked)
    • Processor:
      • Processors: Set to highest number of processors allowed
      • Execution Cap: 100%
      • Extended Features: Enable PAE/NX (checked)
  • Display:
    • Screen:
      • Video Memory: 128 MB
      • Monitor Count: 1
      • Scale Factor: 100%
      • Acceleration: Enable 3D Acceleration (checked)
  • Storage:
    • Storage Tree:
      • Optical: Set to CentOS 7 ISO file
      • Hard Drive: Set to an 8 GB+ Virtual Disk (any type should work, set it as dynamic)
  • Audio: Set as you need for your system
  • Network:
    • Adapter 1: Enable Network Adapter (checked)
      • Attached to: NAT Network
      • Name: NatNetwork (should be filled in for you from previous setting)
    • Adapter 2: Enable Network Adapter (checked)
      • Attached to: Host-only Adapter
      • Name: VirtualBox Host-Only Ethernet Adapter (should be filled in for you)
The rest of the items should be left alone for now.

Press the 'Start' icon to begin the virtual machine to load CentOS. Perform the install as directed in a previous article 'LFCS Install CentOS 7'. Once done with install remove the ISO from the optical drive under the 'Storage' section in VirtualBox for the CentOS machine.

Ubuntu 14.04

Now, create a new machine and name it Ubuntu 14.04. The type and version should be automatically filled in. Otherwise the Type is Linux and the Version is Ubuntu (32- or 64-bit). Next, set the Memory Size to the highest it will allow while staying in the green section. Now, create a Virtual Hard Disk (any type you wish, but make it at least 8 GB and Dynamic). The Machine should now be created, so use the following settings to fine tune it:

  • General Tab:
    • Name: Ubuntu 14.04
    • Type: Linux
    • Version: Ubuntu (32- or 64-bit)
  • System:
    • Motherboard:
      • Base Memory: The highest you can get and not be in the pink area
      • Boot Order: Optical
Hard Disk
  • Chipset: PIIX3
  • Pointing Device: PS/2 Mouse
  • Extended Features: Enable I/O APIC (checked)
Hardware Clock in UTC Time (checked)
    • Processor:
      • Processors: Set to highest number of processors allowed
      • Execution Cap: 100%
      • Extended Features: Enable PAE/NX (checked)
  • Display:
    • Screen:
      • Video Memory: 128 MB
      • Monitor Count: 1
      • Scale Factor: 100%
      • Acceleration: Enable 3D Acceleration (checked)
  • Storage:
    • Storage Tree:
      • Optical: Set to Ubuntu 14.04 ISO file
      • Hard Drive: Set to an 8 GB+ Virtual Disk (any type should work, set it as dynamic)
  • Audio: Set as you need for your system
  • Network:
    • Adapter 1: Enable Network Adapter (checked)
      • Attached to: NAT Network
      • Name: NatNetwork (should be filled in for you from previous setting)
    • Adapter 2: Enable Network Adapter (checked)
      • Attached to: Host-only Adapter
      • Name: VirtualBox Host-Only Ethernet Adapter (should be filled in for you)
The rest of the items should be left alone for now.

Press the 'Start' icon to begin the virtual machine to install Ubuntu. Perform the install as directed in a previous article 'LFCS Install Ubuntu'. Once done with the install remove the ISO from the optical drive under the 'Storage' section in VirtualBox for the Ubuntu machine.

Post Installation

For things to work with VirtualBox you need to get things ready to use the Guest Additions. The Guest Additions are installed inside the individual virtual machines. For example, if you have a virtual machine for Ubuntu and another for CentOS then you would install the Guest Additions twice. The following will allow the Guest Additions to be installed and function, but they cannot be installed until a Graphical User Interface (GUI) is installed. The GUI installation is covered in the next LFCS article.

So, to prepare for the Guest Additions in CentOS 7, you need to perform the following commands on the command line:

  1. yum update
  2. yum groupinstall “Development Tools”
  3. yum install kernel-devel
  4. yum install kernel-headers
The first command is used to update all installed packages. Line 2 is used to install programs to compile software. Lines 3 and 4 are used to install kernel information to use when compiling the kernel.

So, to prepare for the Guest Additions in Ubuntu 14.04 you need to perform the following commands on the command line:

  1. sudo apt-get install dkms
  2. sudo apt-get update
  3. sudo apt-get upgrade
  4. sudo apt-get install build-essential module-assistant
  5. sudo m-a prepare

The first line installs the Dynamic Kernel Module Support to handle compiling a kernel. Line 2 and 3 are used to update the APT database and then perform an upgrade with the updated database. The fourth line installs required packages for the Guest Additions. The last line prepares the system for building kernel modules.

The Guest Additions cannot be installed from a terminal only. To get the Guest Additions installed you need a GUI as mentioned previously. For now, your system should be ready to install the Guest Additions in the next article when the GUI is installed.

NOTE: Be sure to remember that the CentOS 7 must be a 64-bit version for the MATE Desktop to work.
 




Top