Kali Linux is a Debian-based Linux distribution with a focus on penetration testing and security auditing. With over 600 penetration testing tools, this distribution brags of being the best security-testing platform we have in the market today. There are several ways you can have Kali running on your PC. You can decide to install it as the main operating system, run it in a dual/multi-boot or install it as a virtual machine. In this post, we will discuss the latter - How to install Kali Linux on Virtualbox.
Virtualbox is a free and open-source hosted hypervisor developed by Oracle and used for Virtualization. Running Kali as a Virtual Machine (VM) is considered safer since it’s completely separated from the host OS and allows you to interact with other VMs, Networks, and the Host itself. In case of any issues with the kali system, you can decide to delete it and create a new Kali VM or revert to a particular snapshot.
Different ways to install Kali Linux on VirtualBox
We will look at two ways of installing Kali Linux on Virtualbox.
- Install Kali Linux natively on VM - (Bare Metal Image)
- Use pre-made Kali Linux Virtualbox Images.
Pre-requisites
Since you will be running Kali Linux as VirtualBox on a Physical Host, so your Host needs some specific amount of resources to be able to run Kali Linux seamlessly:
- Host must support virtualization. You can enable this in your BIOS/UEFI based on your Host's Operating System
- Minimum of 30GB free disk space in your host's hard disk as we will allot 20GB to Kali Linux. Since we will allot the storage dynamically, which means entire 20GB will not be allocated and this size will be filled based upon usage.
- Minimum of 8 GB RAM is recommended as we will allot 2GB to Kali Linux. This can also be increased depending upon the number of processes you plan to execute in Kali Linux.
- Download Kali Linux ISO File and keep it ready on your host machine
- Download and Install Virtual Box on the System.
Method 1: Install Kali Linux on Virtualbox - (Bare Metal image)
Currently, Kali Linux is available for various platforms.
- Bare Metal: Meant for Single or multi-boot. Perfect for inbuilt WIFI and GPU.
- Virtual Machines: Customized to run as Virtual Machine
- ARM: Deigned for Small Board Computers like the Raspberry Pi.
- Mobile: Designed for Android devices.
If your host OS is a Debian-based distribution like Ubuntu, you can quickly install Virtualbox from the Terminal using the command below.
$ sudo apt install virtualbox
Step 1: Create a Kali Linux Virtualbox Container Wizard
After successfully installing Virtualbox, launch it from the applications menu. You will see a window similar to the one below. Click New to start creating a virtual machine.
A window will open, and you will be required to enter the Name of your new Virtual Machine, the location you want the virtual machine to be stored (Machine Folder), OS Type, and Version. Luckily, after entering the Name of your Virtual machine (say Kali Linux), Virtualbox will automatically fill the other Fields - Type and Version. Click Next when done.
In the next window, you will need to set the memory size (RAM) you want to allocate the virtual machine in the next window. Some tools available in Kali can be pretty resource-intensive, and the more RAM, the better. However, be careful! If you assign too much RAm and leave very little for your Host machine, the overall system might lag or hang. In this post, we will allocate Kali 2GB of memory. Click Next when done.
On the next screen, we will need to create a new virtual hard disk (VHD). Select the option “Create a virtual hard disk now” and click Create.
Next, you will need to select the Hard disk file type you want to use. There are three options:
- VDI (Virtualbox Disk Image) by Oracle
- VHD (Virtual Hard Disk) by Microsoft
- VMDK (Virtual Machine Disk) by VMware
If you don’t plan to use the Virtual machine with other Virtualization software, select VDI. Click Next.
On the next screen, you will need to choose whether the created Virtual hard disk should grow as it is being used (dynamically allocated) or created in exact size now (Fixed Size). For this post, we will use the Dynamically allocated option. Click Next.
Next, we need to set the Size of our Virtual Hard Disk. The size will entirely depend on what you intend to do with Kali Linux. If you plan to use it for some time and download files and install additional tools in the process, then at least 20GB of storage would be reliable. Click Create.
After clicking “Create,” you come to the end of the wizard. Now we need to customize our newly created Virtual Machine even further. Click on the Settings button.
In the General menu, select the Advanced tab and set both the Shared Clipboard and Drag ‘n’ Drop to Bidirectional.
In the System menu, click on the Motherboard tab, and in the boot order menu, drag Hard Disk to be the first option, followed by Floppy.
Still, on the System menu, select the Processor tab. Set the number of processors to two and also enable the PAE/NX to enable Extended features.
Finally, click on the Display menu and select the Screen tab. Set the Video memory to 128 MB. Also, ensure 3D acceleration is disabled as most users have reported issues with that feature.
When done, click Ok to save and apply the new configurations.
Step 2: Starting the Kali Linux Virtual Machine
Up to this point, we have all our configurations ready. Click on the Start button to start our virtual machine.
The first time you click “Start,” you will need to select the start-up disk. Click on the file icon to add our Kali Linux ISO file.
This action will open the Optical Disk Selector window. Click on Add and select the Kali Linux ISO file you downloaded to add it to the start-up disk. After adding it, select the ISO file and click Choose.
You will be taken back to the Select Start-up disk screen. Click Start to boot your Kali Linux OS.
Step 3. Install Kali Linux
After booting up Kali Linux, you will be greeted by the Kali Linux installer menu. Here you will need to choose the installation method that you want to use. For this post, we will use the Graphical installation method. Use the arrow keys to scroll and hit Enter.
After a few minutes of starting up the Linux kernel, you will see the Select Language Screen Choose the language that you wish to use during the installation and hit Enter.
Next, select your Location and proceed to set the desired Keyboard layout. Press Enter when done. You will be required to set the Hostname that identifies your system on the Network. It can be any name. Click Continue.
The next screen will give you an option to set the Domain name. It should be something that ends either with a ‘.com,’ ‘.edu,’ etc. Alternatively, just leave the field empty and click Continue. Next, you will be required to Enter the Full name of the user. Click Continue.
You will see an option to set a username for your account. The name should start with a lowercase letter. Click Continue when done. You will now need to set the login password of your newly created user.
You will see an option to choose your Timezone. Select one from the list and hit Enter to proceed to disk partitioning. The installer will give you four different standard schemes for installing Kali on your VM.
- Guided - Use entire disk
- Guided - Use entire disk and set up LVM
- Guided - Use entire disk and set up encrypted LVM
- Manual
In this post, we will stick to the “Guided - Use entire disk option” since we will only install a single operating system in the VM container. If you were performing a dual-boot or multi-boot on Bare metal, we would use the Manual option. Click Continue.
Next, you will need to choose the partition scheme. Select “All files in one partition” Click Continue.
On the next screen, you will see a list of the configurations performed on your disk. Select the “Finish partitioning and write changes to disk” option. Click Continue. You will see a prompt whether you want to write changes to disk. Select “Yes” and hit Enter.
The base system installation process will start.
That might take a while. Please be patient. After some time, you will get to the Software Selection window. Here, you will need to select software to install during the kali system installation process. Make your selection and click Continue.
This process will also take some time as some features will need to be downloaded from the internet. After a while, you will see an option to install the Grub boot loader. Click Yes and select your Harddisk (/dev/sda). Click Continue. When the installation completes successfully, you will see an option to reboot the system.
After rebooting, you will get to the log-in screen. Log in with the password you set during the installation process. That’s it! You have successfully installed Kali Linux as a virtual machine.
As a rule of thumb, launch the system and update the system with the commands below.
$ sudo apt update $ sudo apt upgrade
Method 2. Use pre-made Kali Linux Virtualbox Images
If you don’t want to use the Kali Linux Bare Metal ISO, you can opt for the pre-made Kali Linux Virtualbox Images. These images are customized to run on your Virtualization software, and they are available for free on the official Kali Linux website. This method is much faster as all the configuration and installation are already done for you. Think of it as a Plug ‘n’ Play scenario.
After downloading the Kali Linux Virtualbox Image, Launch Virtualbox, click on the File menu and select the Import Appliance button.
A window will open, and you will provide the file path where you have the Kali Linux Vbox file. It comes with an OVA extension. Once done, click Next to import the appliance. You will see a window listing all the pre-configured settings. You can decide to change this depending on your system resources.
Once done, just hit Start, and the Virtual Machine will boot the Kali Linux OS. Earlier versions of Kali use the default username as root and password as toor. However, since January 2020, the default username and password is kali. After logging in to the system, you will be greeted by the beautiful Kali XFCE Desktop Environment.
That’s all! You now have a working Kali Linux virtual machine on Virtual Box, and you can proceed to perform your penetration testing tasks. This method is way faster compared to the Bare Metal installation.
Conclusion
I believe this post has given you a clear guide on installing Kali Linux as a virtual machine. If you encounter any issues during installation, please leave a comment below, and we will get in touch as soon as we can.
During the virtualbox installation, there is NO mention of what the “network” settings should be, nor any discussion about what options in the “network” settings do. Is there anything you can disclose about that?
You can choose your preferred networking option. Here are some articles which covers different networking option available in VirtualBox
How to configure port forwarding in VirtualBox for NAT Networking
How to connect virtual machine to internet connection in VMware/VirtualBox
How to add Network Adapter in Oracle VirtualBox
Will the virtual file (.ova) act as a persistent storage (will the files that I save will be saved and all the updates) ? Kindly reply. And also which one is better …
I actually don’t recall checking the disk configuration and I don’t have the setup any more. But you can execute df command to check the disk layout and if required add an extra HDD which you can use to store your data. But ideally even the default root filesystem should be persistent, it is just that it may not have even free space.