Covered in this tutorial:
- Creating a proper Virtual Machine for Kali Linux
- Installing Kali Linux to a hard disk inside the Virtual Machine
- Install VirtualBox Guest Addition Tools in Kali Linux
- Setting up shared folders in VirtualBox with your Kali Linux installation
Although each platform of VirtualBox has slight aesthetic differences, this method should work on any VirtualBox platform.
Creating the Virtual Machine:
- When you launch VirtualBox you will be presented with the Virtual Machine Manager. From this screen you can create a new virtual machine by clicking 'New' in the upper left corner.
- The next screen will ask you to provide a Name, OS Type and Version. You can provide any name you would like for the virtual machine. Set the Type to 'Linux' and the Version to 'Debian.' VirtualBox offers both 32 and 64 bit options, please make sure to choose the proper version for your architecture. Once completed, click the continue button to move on with the setup.
- The next portion allows you to configure the amount of memory to allocate to your new virtual machine. It is best to provide as much as can be spared, but as a minimum allocate 2048MB. Once completed, click the Continue button.
- The next step is creation of the virtual machine hard drive, The default is to 'Create a virtual hard drive now.' Accept the default and click the Create button in the lower right portion of the window.
- In this step, VirtualBox allows you the option to pick your hard drive file type. The default is VDI (VirtualBox Disk Image), however you can create any other type. For example, creating a VMDK will allow you to use this hard drive with VMWare as well as VirtualBox. Once you have selected your file type, click the Continue button.
- The next step asks if you would like to allocate the entire amount of disk space at once, or dynamically allocate as hard drive space is needed. For example, if you specify a hard drive of 20GB, the initial size of the install may only be 10GB, but will grow as required until it hits the maximum size allocated. Either option is acceptable and is clearly user preference. Once you have made your selection, click the Continue button.
- The next step is for creation of the hard drive file location and size. For location, it will always install in the default directory and only needs to be changed if desired.
- The base install of Kali Linux will take up approximately 8GB of disk space. It is good practice to provide roughly 4 times that amount in order to ensure proper space as you add to and update the installed system with tools and files. Once you have provided the desired size, click the Create button.
You have now created your virtual machine in VirtualBox.
Although your virtual machine is created, there are a few steps to complete before starting it. With your newly created Kali Linux virtual machine selected, click the 'General' link in the right portion of the Manager window. This will launch a window that allows for additional configuration settings.
Here you can make any changes you need to your new virtual machine. There are at least two changes that should be made during this step, the amount of processors to allocate to the Kali Linux VM and the attachment of the Kali Linux iso for first boot and installation.
To change the amount of processors, select the System option and the Processor tab. As a default, the machine is granted only 1 VCPU. You can provide the VM as many processors as you like, but at least 2 are recommended.
Next, select the Storage option to attach your Kali Linux ISO image. In the Storage Tree window, select your CD-Rom controller. Then within the Attributes pane click the CD-Rom Icon and 'Choose a virtual CD/DVD disk file' from the pop up menu. This will open a window to browse the host system for your Kali Linux ISO file. Once selected, click the Open button and then click the OK button to save all your changes you will be returned to the VirtualBox Manager.
Your VirtualBox Virtual Machine is now ready for initial startup and Kali Linux Installation. You can now click the Start Button to launch the VM and begin the Kali Linux installation process.
Kali Linux Installation
The tutorial for installing Kali Linux can be found
here. Once installation is complete, you will need to install the VirtualBox Guest Addition tools.
Installing VirtualBox Guest Additions in Kali Linux
In order to have proper mouse and screen integration as well as folder sharing with your host system, you will need to install the VirtualBox Guest additions.
Once you have booted into your Kali Linux virtual machine, open a terminal window and issue the following command to install the Linux Kernel headers.
Code:
apt-get update && apt-get install -y linux-headers-$(uname -r)
NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'
Once this is complete you can now attach the Guest Additions CD-Rom. This can be done by selecting 'Devices' from the VirtualBox Menu and selecting 'Install Guest Additions.' (In addition you can use the shortcut Host key+D.) This will mount the virtual CD Drive to your Kali Linux virtual machine. When prompted to autorun the CD, click the Cancel button.
From a terminal window copy the VboxLinuxAdditions.run file from the Guest Addition CD-Rom to a path on your local system and then run the file.
Code:
cp /media/cd-rom/VBoxLinuxAdditions.run /path/to/copy/file
Code:
./VboxLinuxAdditions.run
NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'
Reboot the Kali Linux VM to complete the Guest Additions installation. You should now have full mouse and screen integration as well as the ability to share folders with the host system.
Creating Shared Folders with the Host System
- In order to share folders on your host system with your Kali Linux VM, there are a few short steps that need to be completed.
- From the VirtualBox Manager, select your Kali Linux VM instance and click on the 'Shared Folders' link in the right window pane. This will launch a pop up window for adding shared folders. Within this window click the icon to add a folder (the icon is a Folder with a '+' on it).
- In the Folder Path text box, provide the path to the folder you would like to share, or click the drop-down arrow to browse your host system for the path. Select the check boxes that allow for 'Auto-mount' and 'Make Permanent' and click the OK button both times when prompted.
Your shared folders will now be available in the media directory. You can create a bookmark or link for easier access to the directory.