Kali in VirtualBox

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
348
Reaction score
389
Credits
12,246
If you experiment with VirtualBox and Linux distros, then I'm sure you have tried Kali as a Virtual Machine.

With Kali 2023.2, there are special virtual machines (VM) made for downloading that have impressive performance.

VM Files

The Kali site includes Virtual Machine files for VMware, VirtualBox, Hyper-V and QEMU. There are weekly builds as well as 32-bit and 64-bit versions. In this article I will cover setting up the VirtualBox version, you can add the 64-bit and 32-bit the same way to VirtualBox, and Docker.

To start, you need to go to 'https://www.kali.org/get-kali/#kali-virtual-machines'. You'll see your possible downloads, as seen in Figure 1.


Figure 1.JPG

FIGURE 1

There are six sections below this that are all for Kali and are:

  1. Options to customize the VM
  2. Downloads for ARM systems, such as the Raspberry PI
  3. Mobile devices, such as tablets
  4. Cloud based installs, such as Digital Oceans
  5. Containers, like Docker
  6. Live boot images
  7. Windows Subsystem for Linux (WSL)

Let's look at the Virtual Machine download and setup, as shown in Figure 1. In my case, I am selecting the VirtualBox VM for 64-bit. Once downloaded, you need to extract the two files from the compressed file you downloaded. There should be two files extracted, a '.vbox' and a '.vdi' file. The Virtual Disk Image (VDI), stores all the data in the image. The '.vbox' file is simply a configuration file for the Virtual Machine. You can place these files in a the 'Virtual VMs' folder. Open 'File → Preferences' in VirtualBox to see the location of the Virtual Machines.

To show the contents of the '.vbox' file, you can open it in an editor. Near the beginning, you'll see the two items:

Username: kali
Password: kali


This is all a description to show the default username and password to log into Kali after it is running.

Open up VirtualBox. At the top of the left pane, there is a button labeled 'Tools'. Click on 'Tools' and the options should option up on the right side. Select 'Add' from the right-side. A window should open to allow you to locate the '.vbox' file you just extracted.

Once you add the VM, there should be a new item in the left pane for 'kali-linux' as shown in Figure 2.

Figure 2.JPG

FIGURE 2

Select the newly added VM and you can change the right pane for the VM.

For improved performance, give the VM a minimum of 8 GB of RAM if you have the resources. Also, bump up the Processors from two if you can. The VM should default to two processors if your system has the hardware to allow it. Check to box to 'Enable 3D Acceleration'. Change the Network Adapter from 'NAT' to 'NAT network'.

After you have changed the 'Settings', click on the 'Start' icon to run the VM. Kali should boot, as shown in Figure 3.

Figure 3.JPG

FIGURE 3

Once it boots, it will prompt you for the Username and Password. Use 'kali' for both the Username and Password. Kali should start, as shown in Figure 4.

Figure 4.JPG

FIGURE 4

To change the Display Settings, click on the menu box in the top left corner, then select 'Settings → Display'. Under 'Settings', you can also change the 'Power Management' so the system doesn't go back to the logon screen after 10 minutes elapse.

As I mentioned before, the VM should be very responsive, but this depends on how much RAM and the number of CPU cores you can use for the VM. It also depends on the drive speed where you store the '.vdi' file. Use SSD or NVMe for better performance.

Docker Files

On the Kali link given above, scroll down to the section for Containers, or select 'Containers' from the menu at the top of the site. Click on ‘Docker Containers’ and the browser should redirect you to 'https://hub.docker.com/u/kalilinux'.

NOTE: The Docker version will be a Command-Line Interface (CLI) and not a Graphical User Interface (GUI).

You can see the listing in Figure 5. Choose the option you want to load as a Docker container. For example, let's try the 'Rollling' version at 'kalilinux/kali-rolling'.

Figure 5.JPG

FIGURE 5

Open Docker, you can refer to the 'DCA' articles, which cover the usage of Docker.

In the Terminal, you need to pull the Kali image with the command 'docker pull kalilinux/kali-rolling'. We should pull the image from the 'kalilinux' repository.

Next, we need to start the container with the command 'docker run -ti --name kali kalilinux/kali-rolling /bin/bash'.

You should now have Kali running as a Docker Container.

When you are done with the container, you can enter the command 'exit' to quit the container. If you want to remove the image, you can use the command 'docker image rm -f kalilinux/kali-rolling'.

Conclusion

The methods I covered make it easier to try Kali without dedicating a whole machine to try it and get the performance you want.

The ready-made Virtual Disk Images help make performance much better. Give this a try to see if Kali works for you.
 

Staff online


Top