This is second Part of my RAC lab series guiding me and you step by step in the process of building of a fully usable RAC environment for tests and learning. I need to gather this information in one place as my memory is really shitty, my blog helps me to repeat some activities after few months without digging again in the documentation.
RAC lab Part 1 – Installing the Ubuntu 16.04 desktop
RAC lab Part 2 – Virtualbox installation and configuration
RAC lab Part 3 – VMs configuration
RAC lab Part 4 – Installing the Openfiler software
RAC lab Part 5 – Installing OEL 7.x on VM
RAC lab Part 6 – OEL 7.x configuration for Oracle 12c GI & RAC DB installation
RAC lab Part 7 – Openfilers configuration and cloning
RAC lab Part 8 – OEL 7.x prepare storage
RAC lab Part 9 – Clone first RAC node as 2nd node and prepare config.
RAC lab Part 10 – Installing Grid Infrastructure
RAC lab Part 11 – Installing Database Software
RAC lab Part 12 – Creating a Container Database
One can download Virtualbox directly from url:
https://www.virtualbox.org/wiki/Linux_Downloads
As you can see on that page it is possible to download .deb package for Ubuntu 16.4, then you can use tools like gdebi to install this package with required dependencies.
If you scroll down a little there is a better way described on how to do it. I am gonna configure repository for apt related to Virtualbox and use apt-get to install.
What we need to do first is adding the following line to /etc/apt/sources.list
deb http://download.virtualbox.org/virtualbox/debian xenial contrib
Xenial is the code name of Ubuntu 16.04
Now we need to download Oracle public key for apt-sec application in order to use secure connection to the repo. Download first file as it is related to our Ubuntu Xenial. Place the file in the /tmp directory. The file name is oracle_vbox_2016.asc.
Now let’s add the public key file with
maciek@macieksrv.dba24.pl ~ $ sudo apt-key add /tmp/oracle_vbox_2016.asc OK
Update apt with the Virtualbox repository contents
aciek@macieksrv.dba24.pl ~ $ sudo apt-get update Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:2 http://pl.archive.ubuntu.com/ubuntu xenial InRelease Get:3 http://download.virtualbox.org/virtualbox/debian xenial InRelease [7894 B] Hit:4 http://pl.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:5 http://pl.archive.ubuntu.com/ubuntu xenial-backports InRelease Hit:6 http://archive.canonical.com/ubuntu xenial InRelease Hit:7 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu xenial InRelease Get:8 http://download.virtualbox.org/virtualbox/debian xenial/contrib amd64 Packages [1483 B] Get:9 http://download.virtualbox.org/virtualbox/debian xenial/contrib i386 Packages [1492 B] Fetched 10,9 kB in 5s (1859 B/s) Reading package lists... Done
Check if you can now see Virtualbox ready to be downloaded and installed with the desired version
maciek@macieksrv.dba24.pl ~ $ sudo apt-cache search Virtualbox|grep 5.1 virtualbox-5.1 - Oracle VM VirtualBox maciek@macieksrv.dba24.pl ~ $ sudo apt-cache show virtualbox-5.1 Package: virtualbox-5.1 Version: 5.1.8-111374~Ubuntu~xenial Architecture: amd64 Maintainer: Oracle Corporation <info@virtualbox.org> Installed-Size: 154040 Pre-Depends: debconf (>= 1.1) | debconf-2.0 Depends: libc6 (>= 2.15), libcurl3 (>= 7.16.2), libdevmapper1.02.1 (>= 2:1.02.97), libgcc1 (>= 1:3.0), libgl1-mesa-glx | libgl1, libpng12-0 (>= 1.2.13-4), libpython2.7 (>= 2.7), libqt5core5a (>= 5.5.0), libqt5gui5 (>= 5.3.0) | libqt5gui5-gles (>= 5.3.0), libqt5opengl5 (>= 5.0.2) | libqt5opengl5-gles (>= 5.0.2), libqt5printsupport5 (>= 5.0.2), libqt5widgets5 (>= 5.2.0), libqt5x11extras5 (>= 5.1.0), libsdl1.2debian (>= 1.2.11), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 5.2), libvpx3 (>= 1.5.0), libx11-6, libxcb1, libxcursor1 (>> 1.1.2), libxext6, libxinerama1, libxml2 (>= 2.7.4), libxmu6, libxt6, zlib1g (>= 1:1.1.4), psmisc, adduser Recommends: libasound2, libpulse0, libsdl-ttf2.0-0, kmod | kldutils | module-init-tools, linux-headers-generic | linux-headers-generic-pae | linux-headers-686-pae | linux-headers-amd64 | linux-headers-2.6-686 | linux-headers-2.6-amd64 | linux-headers, linux-image, gcc, make | build-essential | dpkg-dev, binutils, pdf-viewer, libgl1 Conflicts: virtualbox, virtualbox-guest-additions-iso, virtualbox-ose Replaces: virtualbox Provides: virtualbox Priority: optional Section: contrib/misc Filename: pool/contrib/v/virtualbox-5.1/virtualbox-5.1_5.1.8-111374~Ubuntu~xenial_amd64.deb Size: 65225770 SHA256: 66d8900d5428aad7e7c955971153d45a2ddb65c113002c33dfa31f80b7f92ec0 SHA1: 78648eb646b0488c01f69f52be89e04e80541db2 MD5sum: ad328e1a7fb5f1e087b145dbcaff7f4e Description: Oracle VM VirtualBox VirtualBox is a powerful PC virtualization solution allowing you to run a wide range of PC operating systems on your Linux system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD and others. VirtualBox comes with a broad feature set and excellent performance, making it the premier virtualization software solution on the market. Description-md5: 914c1338bb9a4b67fae39e48412d76f8 Python-Version: 2.7
Install Virtualbox
maciek@macieksrv.dba24.pl ~ $ sudo apt-get install virtualbox-5.1 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libsdl-ttf2.0-0 The following NEW packages will be installed: libsdl-ttf2.0-0 virtualbox-5.1 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 65,2 MB of archives. After this operation, 158 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://pl.archive.ubuntu.com/ubuntu xenial/universe amd64 libsdl-ttf2.0-0 amd64 2.0.11-3 [15,0 kB] Get:2 http://download.virtualbox.org/virtualbox/debian xenial/contrib amd64 virtualbox-5.1 amd64 5.1.8-111374~Ubuntu~xenial [65,2 MB] Fetched 65,2 MB in 23s (2824 kB/s) Preconfiguring packages ... Selecting previously unselected package libsdl-ttf2.0-0:amd64. (Reading database ... 229281 files and directories currently installed.) Preparing to unpack .../libsdl-ttf2.0-0_2.0.11-3_amd64.deb ... Unpacking libsdl-ttf2.0-0:amd64 (2.0.11-3) ... Selecting previously unselected package virtualbox-5.1. Preparing to unpack .../virtualbox-5.1_5.1.8-111374~Ubuntu~xenial_amd64.deb ... Unpacking virtualbox-5.1 (5.1.8-111374~Ubuntu~xenial) ... Processing triggers for systemd (229-4ubuntu11) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ... Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ... Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ... Processing triggers for desktop-file-utils (0.22-1ubuntu5) ... Processing triggers for mime-support (3.59ubuntu1) ... Setting up libsdl-ttf2.0-0:amd64 (2.0.11-3) ... Setting up virtualbox-5.1 (5.1.8-111374~Ubuntu~xenial) ... Adding group `vboxusers' (GID 130) ... Done. Processing triggers for libc-bin (2.23-0ubuntu4) ...
Virtualbox has been installed sucessfully. The docs say also:
“Ubuntu/Debian users might want to install the dkms package to ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next apt-get upgrade. For Debian it is available in Lenny backports and in the normal repository for Squeeze and later. ”
The dkms package can be installed through the Synaptic Package manager or through the following command
maciek@macieksrv.dba24.pl ~ $ sudo apt-get install dkms Reading package lists... Done Building dependency tree Reading state information... Done dkms is already the newest version (2.2.0.3-2ubuntu11.3). dkms set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
DKMS package was installed together with OS, nothing to do here.
The last thing yet to be done is installation of an Extension Pack. VirtualBox Extension Pack provides support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. See this chapter from the User Manual for an introduction to this Extension Pack.
I am really interested on how the VRDP works as well as remote USB – you can display Guest screen on a remote host or use remote’s host USB on the Guest.
The Extension Pack binaries are released under the VirtualBox Personal Use and Evaluation License (PUEL). You need to install the extension pack with the same version as your installed version of VirtualBox.
Download the pack for 5.1.8 VB from the following url:
http://download.virtualbox.org/virtualbox/5.1.8/Oracle_VM_VirtualBox_Extension_Pack-5.1.8-111374.vbox-extpack
VirtualBox extension packages have a .vbox-extpack file name extension. To install an extension, simply double-click on the package file and a Network Operations Manager window will appear, guiding you through the required steps.
So first of all find your downloaded package file in the File Manager and double click on it. Choose install when the wizards asks .
Installation in progress….
To view the extension packs that are currently installed, please start the VirtualBox Manager (see the next section). From the “File” menu, please select “Preferences”. In the window that shows up, go to the “Extensions” category which shows you the extensions which are currently installed and allows you to remove a package or add a new one.
Alternatively you can use VBoxManage on the command line to list installed packs:
maciek@macieksrv.dba24.pl /dev/net $ VBoxManage list extpacks Extension Packs: 1 Pack no. 0: Oracle VM VirtualBox Extension Pack Version: 5.1.8 Revision: 111374 Edition: Description: USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption. VRDE Module: VBoxVRDP Usable: true Why unusable:
It is also a good idea to read the installation chapter of the User manual to get accustomed with the files, groups and configs the installation process of the Virtualbox implements 2.3. Installing on Linux hosts
Another good idea isto read Chapter 10. Technical background to get to know technical details of Virtualbox installation on Linux like services, files and so on.
After installation has been finished you can check there are some services already running:
maciek@macieksrv.dba24.pl ~ $ systemctl |grep vb vbox\x2drepo1.mount loaded active mounted /vbox-repo1 vboxautostart-service.service loaded active exited vboxautostart-service.service vboxballoonctrl-service.service loaded active exited vboxballoonctrl-service.service vboxdrv.service loaded active exited VirtualBox Linux kernel module vboxweb-service.service loaded active exited vboxweb-service.service
Virtualbox successfully installed on Ubuntu. Now we need to configure dedicated user account and directories for Virtualbox
So, let’s create an owner of our VMs. Let’s call it vboxuser1.
The Linux Virtualbox installer creates the system user group vboxusers during installation. Any system user who is going to use USB devices from VirtualBox guests must be a member of that group.
maciek@macieksrv.dba24.pl ~ $ sudo useradd -s /bin/bash -m -g vboxusers vboxuser1 maciek@macieksrv.dba24.pl ~ $ sudo -u vboxuser1 -i vboxuser1@macieksrv:~$ id uid=1001(vboxuser1) gid=130(vboxusers) groups=130(vboxusers) vboxuser1@macieksrv:~$ pwd /home/vboxuser1
Create directories for metadata and virtual disks and change their owner to vboxuser1
maciek@macieksrv.dba24.pl /dev/net $ sudo mkdir /vbox-repo1/metadata maciek@macieksrv.dba24.pl /dev/net $ sudo mkdir /vbox-repo1/disks maciek@macieksrv.dba24.pl /dev/net $ sudo chown vboxuser1 /vbox-repo1/metadata maciek@macieksrv.dba24.pl /dev/net $ sudo chown vboxuser1 /vbox-repo1/disks
Switch to vboxuser1 and try if xclock works, we are gonna need Virtualbox Manager in future, so X-server display must be available.
vboxuser1@macieksrv:~$ xclock No protocol specified Error: Can't open display: :0
Uuups, after some googling it turned out that I need to copy MAGIC COOKIE from another user like my own “maciek” where xclock works and add it to the vboxuser1 .Xauthority file. It is required to be able to authorize to the X-Server.
maciek@macieksrv.dba24.pl ~ $ xauth list $DISPLAY macieksrv/unix:0 MIT-MAGIC-COOKIE-1 b11fc7aeb8ed5bec741419a05d27600f vboxuser1@macieksrv:~$ xauth add macieksrv/unix:0 MIT-MAGIC-COOKIE-1 b11fc7aeb8ed5bec741419a05d27600f xauth: timeout in locking authority file /home/maciek/.Xauthority vboxuser1@macieksrv:~$ env|grep XA XAUTHORITY=/home/maciek/.Xauthority
Wow, At first it looks stupid, isn’t it?. It should grasp the vboxuser1 home directory, but because I am logged into the Unity Desktop as maciek, it can be the reason. As I don’t want to relog to Unity with another user than mine, I will set XAUTHORITY explicitly in the .bashrc of vboxuser1 by adding the line below as the last one in the file
XAUTHORITY=/home/vboxuser1/.Xauthority
Remember to relog at the end. I have additionaly added my PS1 settings to show domain, system type etc. you know the drill…
After relogging check if XAUTHORITY env has been set and create empty .Xauthority file in the users’ home directory
maciek@macieksrv.dba24.pl ~ $ sudo -u vboxuser1 -i vboxuser1@macieksrv.dba24.pl ~ $ env|grep XA XAUTHORITY=/home/vboxuser1/.Xauthority vboxuser1@macieksrv.dba24.pl ~ $ touch /home/vboxuser1/.Xauthority
Add MAGIC COOKIE again and test
vboxuser1@macieksrv.dba24.pl ~ $ xauth add macieksrv/unix:0 MIT-MAGIC-COOKIE-1 b11fc7aeb8ed5bec741419a05d27600f vboxuser1@macieksrv.dba24.pl ~ $ xauth list macieksrv/unix:0 MIT-MAGIC-COOKIE-1 b11fc7aeb8ed5bec741419a05d27600f vboxuser1@macieksrv.dba24.pl ~ $ xclock
Virtualbox has now been successfully installed and configured on Ubuntu 16.04 LTS and the next part of the series will guide us through guest creation and configuration processes.
To be continued soon, stay tuned…

About the author

Maciej Tokar
An Oracle technology geek and crazy long distance runner, DBA24 Owner
Senior Oracle DBA / Consultant / [OCP10g, OCP12c, OCE RAC 10g] / [experience: 9y+]
Currently working for Bluegarden (Oslo Norway) by Miratech Group
Past: Mastercard / Trevica by Britenet, Citi International PLC, PZU

