Installing VirtualBox on Kali (Host)
You can install VirtualBox on Kali Linux, allowing you to use virtual machines (VMs) inside of Kali Linux. However if you are wanting to install Kali Linux as a VM, you want our Kali Linux Guest VirtualBox guide.
VMs are great. There are many upsides with using them. One of the being, able to run multiple Operating Systems (OSs) at the same time. You can have your host machine “untouched”, and then only interact with the guest VMs. Another is when something is going right, take a snapshot. When something goes wrong, revert back.
VirtualBox is free and open source. There are a few other software such as QEMU, KVM/Xen with virt-manager. Then there is also VMware Workstation & Fusion, which is a commercial software (there is VMware Player which is free but it is limited in features).
Before trying to install VirtualBox, please make sure your version of Kali Linux is up-to-date, and if required, reboot the machine.
[email protected]:~$ sudo apt update [...] [email protected]:~$ [email protected]:~$ sudo apt full-upgrade -y [...] [email protected]:~$ [email protected]:~$ [ -f /var/run/reboot-required ] && sudo reboot -f [email protected]:~$
The first thing we are going to do is import VirtualBox’s repository key.
[email protected]:~$ curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/oracle_vbox_2016.gpg [...] [email protected]:~$ curl -fsSL https://www.virtualbox.org/download/oracle_vbox.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/oracle_vbox.gpg [...] [email protected]:~$
We then move onto adding VirtualBox’s repository. We add this to a separate file, so it does not interfere with Kali Linux’s main repository. We also will be making sure to state where the keyring is at so the files can be properly signed. Our CPU architecture is amd64. You may need to alter the example below if yours is different.
[email protected]:~$ echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bullseye contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list [email protected]:~$
As we have altered our network repository, we need to re-build the cache.
[email protected]:~$ sudo apt update [...] [email protected]:~$
As VirtualBox has various kernel modules (e.g.
vboxnetadp), we need to make sure they are kept up-to-date when Kali Linux’s kernel gets updated. This can be achieved using dkms.
[email protected]:~$ sudo apt install -y dkms [...] [email protected]:~$
Now its time to install VirtualBox itself (along with its Extension Pack to expand VirtualBox’s advanced features).
[email protected]:~$ sudo apt install -y virtualbox virtualbox-ext-pack [...] [email protected]:~$
When prompted, read and accept the license.
You can now find VirtualBox in the menu or start it via the command line.
[email protected]:~$ virtualbox [email protected]:~$
If you now wish, you are able to install Kali Linux in a VirtualBox VM (on Kali Linux).
Updated on: 2022-Sep-19
Authors: g0tmi1k , Rclev4Sec