I just happen to need to do a re-install of my Kali VM so it’s just the right time for a step-by-step tutorial on how to Install Kali Linux on VirtualBox with Guest Additions!I always run Kali on a VM. Even on my hackbook. Why? Because you can always use a snapshot to revert the VM’s state back to a freshly installed period when you mess something up badly – and trust me, it happens.
Corrupted databases, weird errors when trying to modify configs and things along those lines are mostly responsible for my Kali install to stop working, if that happens I simply go back to a working state with a snapshot, within 2 mouse clicks and a few seconds.
I use the free VirtualBox for that, works very well, although I also use VMware Workstation on a different machine, which is just a tad bit better if you are willing to spend the money.
Let’s dive right in.
Step 1– Downloading Kali
Head over to the Kali Website and choose your flavor. For this tutorial, we use the 64-bit ISO.
Step 2– Creating a new Virtual Machine
In VirtualBox click on New. Enable the Expert Mode.
Version: Linux 2.6 / 3.x /4.x (64-bit)
Memory Size: 1024 MB or more. I usually allocate 2048.
Select Create a virtual hard disk now and click on create.
Choose a location for your VM and specify the size.
I usually am fine with 20 GB and allocate it Dynamically.
As a type I choose VDI.
You can increase the size later if needed.
Click on create.
Now it’s time to start the installation process.
Step 3– Installing Kali Linux
Select you’re just created Kali VM and click on Start.
Now navigate to your download folder and select the Kali Linux.ISO file you downloaded earlier.
Install Kali Linux on VirtualBox with Guest Additions
On the boot-screen choose: Graphical Install.
Follow through the Language steps by yourself, also assign a Keymap and select your Location. Give your VM a Hostname, whatever you like and enter a Root password. Once you are done with all that, we have to partition our disks. We are going to choose Guided – use entire disk.
Confirm that all files on the disk will be deleted.
Select All files in one partition at the Partition disks window.
Answer Yes to the question if you want to write changes to disks.
After the installation is done, answer Yes if you want to use a Network mirror. Click continue if you don’t use a proxy. If you do, enter it here.
Select Yes to the question if you want to install the GRUB boot loader on a hard disk.
Choose the correct hard disk and click continue.
Now Kali will restart into your new installation. Log in with root and your password.
Next, we will install VirtualBox Guest Additions.
Step 4– Installing VirtualBox Guest Additions
Open a Terminal Window.
First, we want to make sure everything is up to date, so we type:
apt-get update && apt-get upgrade -y
The -y at the end automatically confirms the prompt that asks you if you want to download a certain amount of files necessary for the update. This can take a long time.
Now we also want to check if there is a new kali release available, unlikely tho because we just downloaded it freshly.
apt-get dist-upgrade -y
UPDATE ON 12/20/2017 from Ceos3c:
It seems like in newer versions the process was simplified a bit, I just tested this and it works fine.
This only applies for VirtualBox Version 4.2.xx or higher, if you have a lower VirtualBox version continue below the red line, if you just downloaded VirtualBox after March 2018, just run the following code and continue with Step 5:
apt-get update apt-get install -y virtualbox-guest-x11 reboot now
Now in some other guides (even in the official Kali documentation), the next step is running the following command:
apt-get install linux-headers-$(uname -r)
I assume this should automatically choose the right kernel of your Linux installation, however for me it didn’t work.
I had to use the command:
apt-get install linux-headers-4.9.0-kali4-amd64
Where 4.9.0 indicates the version of my kernel. Now this, of course, will change as version numbers move forward.
You can simply find the newest version by typing the command until:
apt-get install linux-headers- and now hitting the tab key for auto-completion.
Now you will get a list of all available versions, if you just upgraded everything as in the steps above, you should be fine by installing the newest version number. Also be careful to choose amd64 for 64bit.
Reboot your system by typing:
sudo reboot now
Back logged in, open another terminal window.
Now in your VirtualBox window click on Devices -> Insert Guest Additions CD image…
In your terminal window type:
cp /media/cdrom/VBoxLinuxAdditions.run /root/Desktop/ cd /root/Desktop/
Now adjust the privilege level of the file and run it.
chmod 755 /root/Desktop/VBoxLinuxAdditions.run ./VBoxLinuxAdditions.run
I got an error here during this step and had to reboot and run it again, in case of you having the same error: sudo reboot now and do it again.
In case it worked just fine, type:
sudo reboot now
After the reboot is finished everything should be working fine. You can check it by maximizing your window, Kali should now automatically adjust to the Window Size, meaning Guest Additions have been successfully installed.
Now that we got everything set up so nicely, we want to take a snapshot in case we mess things up, so we can always come back to our freshly installed state with just a few mouse clicks.
Step 5– Taking a Snapshot
In VirtualBox select your Kali VM, click on Snapshots in the upper right corner and click on the small camera symbol indicated by the number 3.
Give it a descriptive name and hit OK. Voíla, you are set and done.
The next thing I usually do now is to install Guake Terminal, can’t and won’t work without it anymore. This concludes the Install Kali Linux on VirtualBox with Guest Additions tutorial.