Installing VirtualBox on Linux Mint & RHEL 8 for RHEL8 – RHCE Certification

First of all we need to switch to root. We then add the virtualbox repo, with the below commands.

sudo dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

su - 
yum install VirtualBox-6.0

For the exercises i have been following as part of RHEL 8 certification, by https://github.com/rdbreak/rhcsa8env i will also be installing the virtualbox extension pack, which is a requirement of these exercises

wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack

Virtualbox is now installed, you can start virtualbox by typing “virtualbox” or via the GUI

For the purpose of the exercise i am going to install the relevant dependencies for the lab.

vagrant plugin install vagrant-guest_ansible ; sudo dnf install -y git binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms libvirt libvirt-devel ruby-devel libxslt-devel libxml2-devel 

Before VirtualBox would start i had to install the below depencies.

yum install elfutils-libelf-devel
yum install  kernel-devel kernel-devel-4.18.0-80.11.2.el8_0.x86_6

I then needed to configure the virtualbox vagrant kernel driver.

sudo /sbin/rcvboxdrv setup

Installing on Linux Mint

*NOTE* Virtualbox 6.0 is not supported by Vagrant if you install you will see the below error *

As part of the RHEL RHCE certification. I will be working through some labs created by the awesome rdbreak the labs can be found at.

https://github.com/rdbreak/rhcsa8env

When i initially installed the latest version of Virtualbox for the Labs i had an error code below when running.

vagrant up --provider=virtualbox

The error was

dean@dean:~/Downloads/rhcsa8env$ vagrant up --provider=virtualbox
The provider 'virtualbox' that was requested to back the machine
'system' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download

To get around this i removed Virtual Box 6.0 and installed 5.2 with the below commands. A newer version of Vagrant for my OS was not available.

dean@dean:~/Downloads/rhcsa8env$ sudo apt remove VirtualBox-6.0
Reading package lists... Done
dean@dean:~/Downloads/rhcsa8env$ sudo apt install VirtualBox-5.2
Reading package lists... Done
Building dependency tree  

The labs are built using virtualbox and created using a Vagrant file, an ansible playbook is also used to build the lab environment.

If we have a look inside the vagrant file we can view what will be built along with the ip addressing scheme for the lab.

VAGRANTFILE_API_VERSION = "2"
VAGRANT_DISABLE_VBOXSYMLINKCREATE = "1"
file_to_disk1 = './disk-0-1.vdi'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use same SSH key for each machine
config.ssh.insert_key = false
config.vm.box_check_update = false
config.vm.define "system" do |system|
  system.vm.box = "rdbreak/rhel8node"
#  system.vm.hostname = "system.eight.example.com"
  system.vm.network "private_network", ip: "192.168.55.151"
  system.vm.network "private_network", ip: "192.168.55.175"
  system.vm.network "private_network", ip: "192.168.55.176"
  system.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
  system.vm.provider "virtualbox" do |system|
    system.memory = "1024"

    if not File.exist?(file_to_disk1)
      system.customize ['createhd', '--filename', file_to_disk1, '--variant', 'Fixed', '--si$
    end
    system.customize ['storagectl', :id, '--name', 'SATA Controller', '--add', 'sata', '--po$
    system.customize ['storageattach', :id,  '--storagectl', 'SATA Controller', '--port', 1,$
  end

This will build three virtual machines they can be accessed via SSH which is my preferred method, as i will be accessing the labs from a different machine. The labs build the below machines

repo.eight.example.com
ipa.eight.example.com
system1.eight.example.com
TASK [Welcome to the RHCSA 8 Study/Test Environment!] **************************
ok: [system.eight.example.com] =>
  msg:
  - System 1 is currently rebooting, give it a couple seconds before accessing
  - 'Accessing The Systems:'
  - '- IPA - 192.168.55.150'
  - '- System 1 - 192.168.55.151'
  - '- Username - vagrant'
  - '- Password - vagrant'
  - ' ---------------------------------------------------------------------'
  - '- Access example - `ssh vagrant@192.168.55.151` or `vagrant ssh system`'
  - '- Happy Studying!'

PLAY RECAP *********************************************************************
ipa.eight.example.com      : ok=19   changed=17   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  
repo.eight.example.com     : ok=17   changed=15   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  
system.eight.example.com   : ok=23   changed=20   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  

More can be found at https://github.com/rdbreak/rhcsa8env

I am now ready to take the exercises and work towards my RHCE Certification.

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *