I added Internet connectivity following the instructions here:
Check connectivity: `sudo nmcli d`
If disconnected: `sudo nmtui` > Edit a connection, select network interface and choose "Automatically connect".
`sudo reboot now`
Test: `ping www.google.com`
I added bzip2:
yum install bzip2
I also added GNOME GUI Desktop, according to these instructions:
yum group list
yum groupinstall 'Server with GUI'
systemctl enable graphical.target --force
Rebooted the Guest OS Oracle Linux 7.1
Next, to mount in the media folder, I entered:
mount /dev/sr0 /media;
This returns various files including VBoxLinuxAdditions.run. I ran
./VBoxLinuxAdditions.run, which returned "Kernel headers not found for target kernel":
uname -r and
rpm -q kernel-devel indeed show different versions.
yum install kernel-headers-$(uname -r) kernel-devel-$(uname -r) couldn't find the packages. I then ran
yum distro-sync in the hope to synchronize the versions. But there were still 2 different versions.
However, booting up the VM there now was a new option available: "Oracle Linux Server 7.6, with Linux 3.10.0-957.12.2.el7.x86_64" rather than "Oracle Linux Server (4.14.35-1818.3.3.el7uek.x86_64 with Unbreakable Ent" that I normally selected the virtual box boot menu.
I choose this option and kernel-headers and kernel-devel now were the same versions!
yum install kernel-headers-$(uname -r) kernel-devel-$(uname -r) returned "already installed and latest version". It was using the same versions, so that was no longer the problem.
./VBoxLinuxAdditions.run now returned "This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution.".
yum install build-essential gcc make perl dkms. And then after
sudo reboot now it successfully installed Guest Additions!