Oracle VirtualBox Cheatsheet
3ORACLE VIRTUALBOX CHEATSHEET Here are some of the things I had to look up at some point when using Oracle's VirtualBox hypervisor.
INSTALL GUEST ADDITIONS
To install the Guest Additions into your CentOS VM:
-
First we install necessary packages
sudo dnf install epel-release sudo dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms sudo dnf groupinstall "Development Tools" sudo dnf update systemctl reboot
-
After rebooting and getting to the terminal/GUI in the VM, we must inject the Guest Additions CD image into the VM.
- Goto the "Devices" pulldown menu in VirtualBox, and select "Insert Guest Additions CD Image"
- VirtualBox will request to download the CD image, allow it to do so
- After download, it will ask to attach it to the VM, allow it to do so
- You will now have a CD image attached to the system. The CD has been built to autorun the appropriate installer. So, for example, in GNOME, you can double click on the CD desktop icon.
- You will have a terminal window open that will start the installation process.
-
After installation process, you must reboot
systemctl reboot
-
Each time you install a new version of VirtualBox, or the kernel in a VM, you will need to repeat this step
-
To mount your shared drive:
-
On the fly, in the terminal
sudo mount -t vboxsf SHARENAME MOUNTPOINT
-
In /etc/fstab
SHARENAME MOUNTPOINT vboxsf defaults 0 0
-
Sample setup
sudo mkdir /mnt/host-downloads sudo mount -t vboxsf host-downloads /mnt/host-downloads
-
-
References
EL8/EL9 REPO
To install on EL:
-
Install dependencies
sudo dnf install epel-release sudo dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms sudo dnf groupinstall "Development Tools" sudo dnf update
-
Install repository
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc sudo rpm --import oracle_vbox.asc
-
Install VirtualBox
sudo dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo sudo dnf install VirtualBox
-
Reboot (necessary)
sudo systemctl reboot
-
Add user to "vboxusers" group
sudo usermod -a -G vboxusers YOURUSERNAME newgrp vboxusers
FEDORA REPO
-
Install dependencies
sudo dnf install kernel-devel kernel-headers dkms sudo dnf groupinstall "Development Tools" sudo dnf update
-
Install repository
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc sudo rpm --import oracle_vbox.asc
-
Install VirtualBox
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo sudo dnf install VirtualBox
-
Reboot (necessary)
sudo systemctl reboot
-
Add user to "vboxusers" group
sudo usermod -a -G vboxusers YOURUSERNAME newgrp vboxusers
UBUNTU 17.10+ REPO
-
Install dependencies, update system, and reboot
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms sudo apt update sudo apt upgrade sudo systemctl reboot
-
Install Repository
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - sudo sh -c 'echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
-
Install VirtualBox
sudo apt install virtualbox