Kali on VirtualBox: Start to Done

A few months ago I wrote an article called Kali on Hyper-V: Start to Done. I teach a lot of cybersecurity classes, and Kali Linux is a distro that includes most of the tools that so many cybersecurity professionals will use on a daily basis.

When I wrote the article I was not thinking that so many end users are using Windows 10/11 Home Edition, which does not include the Hyper-V feature. That does not mean they will be left out, it simply means that we need to do it another way. In this article I will outline the steps to building the same virtual machine on the Oracle VirtualBox platform, which is a free hypervisor that anyone can use. I want to note here that VirtualBox is also available for Mac OS, and I suspect the steps to create the VM will be the same. Obviously there will be differences in installing the hypervisor.

Prerequisites

Before you get started, there are three downloads that you will need.

Oracle VirtualBox: We can download the executable for Oracle VirtualBox from this link: Downloads – Oracle VM VirtualBox

Microsoft C++ 2019 Redistributable: If you have not already had to do so for another application, you will need to download these bits (which are also free) from Microsoft. The installation of this will require you to reboot your computer. You can download the installer from this link: Latest supported Visual C++ Redistributable downloads | Microsoft Learn

Kali Linux: You obviously need the bits to install Kali Linux, which you can download from here: Get Kali | Kali Linux

**NOTE: Because we are working on a 64-bit operating system, and we want to install the 64-bit Kali, when there is a choice between the X86 or X64, we are going to select the X64.

**NOTE: From the Kali download page you actually have the option of downloading the installed bits, or a pre-built virtual machine. As there is no Hyper-V option in the image downloads I did not mention this in my previous article, but there is one for both VMware and for VirtualBox. If you are going to use this option make sure you click on the download button, and not the torrent button, which then requires a torrent tool. For the sake of this article, we are going to use the installer image for Kali Linux 2023.1.

Installing the Hypervisor

Before we even install VirtualBox, let’s take a minute to install the Virtual C++ Redistributable. the filename as of this writing is VC_redist.x64.exe, and you should find that in the Downloads directory. Double-click the icon to run it. When the window pops up, check the box to agree to the license terms and then click Install. You will receive a User Account Control (UAC) prompt asking if you are sure you want to go ahead with the installation. If your account does not have elevated privileges then you will have to get permission from one that does by entering those credentials.

It is likely that you will have to reboot your computer for the installation to complete. Go ahead and do that now. Don’t worry, we’ll be waiting right here when you come back! Just to be safe, you should bookmark this page in case we get lost.

Ah, there you are! Good. Now let’s go ahead and install the actual hypervisor, Oracle VirtualBox. The filename for the version I downloaded is VirtualBox-7.0.8-156879-Win.exe, but do not fret if the numbers for your version are for a later build. Double-click that icon in the Downloads folder. Again, you will have to accept a UAC prompt that you need to accept in order to proceed.

image

When you see this window, click Next >

image

On this screen you can select to install all of the components, or pick and choose the ones that you want. A lot of people will install all of the components, but for our purposes we are going to choose to not install the VirtualBox Python Support so click on the box next to that and select Entire feature will be unavailable. You can also change the installation location if you want to. When you are ready, click Next >

image

When we install our hypervisor it is going to take over your network interface card (to allow your virtual machines to connect to the network), and when it does, it resets the NIC for a moment. I have installed VirtualBox while attending online video meetings, and I hardly noticed a blip. If you are worried, make sure you are not doing anything that relies on persistent network connectivity while you install. Click Yes.

image

If you are ready, you should click Install on this screen. The installation will not take long at all, and when you see the next screen, you can click Finish. Unless you uncheck the box, Oracle VirtualBox will run automatically.

image 

Creating the Virtual Machine

You should now see the Oracle VirtualBox application on your screen.

image

There are several customizations required for the Kali VM, and failing to do any of them might cause problems. Be careful to follow these steps until you are comfortable enough to know what all of the options are.

1) Click the big blue star that says New. The guided Create Virtual Machine appears. For our Kali machine we need to click on the button that says Expert Mode.

image

In the expert mode you will see four blades, with the first one (Name and Operating System) expanded. We are going to work in three of the four blades in order from top to bottom. Notice that I have filled in the following information:

Name and Operating System

  • Name: Kali Linux 2023.1 (you can name your VM however you like).
  • Folder: C:\Users\MitchGarvis\VirtualBox VMs (feel free to change the location as you like, but this will be the default folder within your profile).
  • ISO Image: C:\ISOs\kali-linux-2023.1-installer-amd64.iso (note that I have already moved the ISO to another location. By default, you will find yours under your Downloads folder).
  • Type: Linux
  • Version: Debian (64-bit) (This is important!)

Hardware

image

  • Base Memory: 4096 MB (The default is 2048 MB but I like to give it a little more).
  • Processor: 1 CPU (Kali does not need multiple processors).

Hard Disk

image

While you are free to change the file location, the only change I make on this screen is to allocate a full 80 GB to the drive (the default is 20 GB).

When you have made all of your changes, click Finish to close the Create Virtual Machine window.

Customizations

Before we start, there are a few changes we need to make to the virtual machine itself. From the Oracle VM VirtualBox Manager, make sure the newly created VM is selected on the left, and in the main window click General.

image

In the Advanced tab of the General window, change both Shared Clipboard and Drag/n/Drop to Bidirectional.

image

In the left navigation bar, click the System blade. change the boot order of the drives to correspond to what is shown in the above screen capture (Hard Disk first, Optical second, all other options deselected).

image

In the Processor tab of the System blade, select the checkbox next to Enable PAE/NIX

image

In the left navigation bar, select the Display blade. Adjust the Video Memory to 128 MB. As there is no need for it in Kali, make sure the checkbox next to Enable 3D Acceleration is deselected.

Click OK.

image

Your settings should now look identical to what you see in the screen capture above. If it does, then you can click the green Start arrow at the top.

When the VM appears, select the View menu, then click Scaled Mode. This will allow you to resize the window and the VM will adjust with your changes.

Installing Kali Linux

**NOTE: With the exception of a couple of screen shots which I have updated, a as a number of differences such as the virtual hard drive type, the rest of the instructions are copied straight from my article on installing Kali in Hyper-V.

You should now have a window on your screen that looks like this:

image

Press Enter to proceed with the Graphical install. You will be asked a series of questions (language, location, keyboard… a lot of things that will remind you of the Windows OOBE). Press Continue on each screen, unless you feel the need to make changes. At the end of the first series of questions, Linux will do some hardware and network detection. If you do not have a DHCP Server available, you might need to set your IP Address manually.

If you are at a level where you are creating a Kali-Linux VM on a virtual machine, you should know how to find an IP Address and configure the subnet mask and gateway. Unless you have a domain you are working with in your lab, leave that blank. Pick a username for yourself, and set your password. When prompted, select your time zone.

The first really foreign concept you should encounter is that of the disk partitioning. Linux does not use drive letters like Windows. An advanced user might set up different virtual hard disks for all of the requirements, but I do not want to confuse anyone just yet. When prompted on the Partition Disks page, select Guided – use entire disk, and click Continue. On the next screen it will confirm the disk (in most cases it should read SCSI1 (0,0,0) (sda) – 85.9 GB ATA VBOX HARDDISK if you followed my instructions). Click Continue.

The next screen gives us options to use different partitions for different mounts. I recommend you select All files in one partition (recommended for new users) and click Continue.

The next screen will ask you to select Finish partitioning and write changes to disk. Click Continue.

You will then be asked to confirm what we just set up, and to write the changes to the disk. select Yes and then click Continue.

Your Kali Linux is now installing, and it will take a few minutes to complete. After a few minutes, you will be asked for your Software Selection. For most, the defaults should suffice. Click Continue. This will take several more minutes.

When the software installation is finished, you will see a screen about installing the GRUB boot loader. Ensure that Yes is selected and then click Continue. On the next screen (still installing the GRUB), change the option from Enter Device Manually to the drive (something like /dev/sda (ata-VBOX_HARDDISK_VBae40cdf2-a0a8c9d0) and click Continue.

Once it is done, you should receive a message that Installation is complete. Press Continue to reboot.

It should not take too long for you to receive a screen that looks like this in your VM:

image

You are ready to go! Okay, you are not… there are a bunch of gotchas in Kali Linux that are possible (or probable) stumbling blocks. I was joking a few days ago that it seems that several changes made to the most recent versions of Kali seem to have been made to frustrate Windows people who know a little bit of Linux. I have figured out most of them and so will you. It will take time, and you will be smarter for it.

Conclusion

I have said for years that IT should not be about religion, but about the best tool for the job. Integrating a Linux VM into your Windows environment is a good way to get the best of both worlds without having to spend more money. Most of my readers are likely long-time Windows users, as I am. It is not a crime to love the Windows environment and ecosystem, while recognizing that some tools are either better or at least more readily available in non-Windows environments.

I cannot imagine that I am ever going to live in the Linux space. I find too many of my Microsoft tools comfortable, and in the business (and personal) productivity space, Microsoft 365 wins hands down. For some things like cybersecurity, Kali Linux provides the right environment, with most of the tools pre-installed and ready to use. Why would I try to shoehorn those tools into a system where they do not belong and are not comfortable, when Kali in a virtual machine gives me the best of all worlds? More importantly, why would you?

Leave a comment