Introduction
Kali Linux is a powerful and widely used operating system for cybersecurity professionals and ethical hackers. While some may prefer to install Kali Linux directly on a physical machine, running Kali in a virtual machine (VM) offers significant advantages. It allows users to try out Kali Linux without affecting their primary operating system and hardware. Virtualization enables the creation of a safe and isolated environment to test and experiment with various tools and techniques.
In this article, we will guide you step by step through the process of setting up Kali Linux in a virtual machine. This setup works with popular virtualization software like VirtualBox and VMware, both of which are widely used for running Kali Linux on Windows, macOS, or Linux-based systems.
Prerequisites
Before starting the installation of Kali Linux in a virtual machine, you will need:
-
A Computer with Virtualization Support: Ensure that your system supports virtualization (most modern processors do). You can check this in the BIOS/UEFI settings and enable Intel VT-x (Intel Virtualization Technology) or AMD-V (AMD Virtualization).
-
Download Kali Linux ISO:
-
Head to the official Kali Linux website and download the Kali Linux ISO. For VM installation, the Installer ISO is recommended.
-
-
Virtualization Software:
-
Sufficient RAM and Storage:
-
For a smooth experience, allocate at least 2 GB of RAM (4 GB recommended) and 20 GB of storage space for the Kali Linux virtual machine.
-
Step 1: Install Virtualization Software
Install VirtualBox (Windows/Linux/macOS)
-
Download VirtualBox from the official site.
-
Run the installer and follow the on-screen instructions to complete the installation.
-
After installation, launch VirtualBox.
Install VMware Workstation Player (Windows/Linux)
-
Download VMware Workstation Player from the official site.
-
Install the software by following the instructions in the setup wizard.
-
Open VMware Workstation Player after installation.
Step 2: Create a New Virtual Machine
For VirtualBox:
-
Open VirtualBox and click New to create a new VM.
-
Name the VM: Type "Kali Linux" or any name you prefer, and select Linux as the operating system type, with Debian (64-bit) as the version.
-
Allocate RAM: Choose at least 2 GB of RAM (4 GB recommended) to allocate for Kali Linux.
-
Create a Virtual Hard Disk: Select Create a virtual hard disk now and click Create.
-
Choose VDI (VirtualBox Disk Image) as the disk file type.
-
Select Dynamically allocated (this option allows the VM to use disk space as needed up to the allocated limit).
-
Set the disk size (20 GB is recommended for Kali Linux).
-
-
Finish the VM Setup: Click Create to finalize the virtual machine creation.
For VMware Workstation Player:
-
Open VMware and click Create a New Virtual Machine.
-
Choose Installer Disk Image File (ISO): Browse and select the Kali Linux ISO file you downloaded earlier.
-
Select Operating System: Choose Linux and select Debian 10.x 64-bit as the version.
-
Name and Location: Name your virtual machine "Kali Linux" and specify the location where you want to store it.
-
Allocate RAM: Set the memory to at least 2 GB (4 GB recommended).
-
Set Disk Size: Allocate at least 20 GB of storage and choose Store virtual disk as a single file.
-
Finish the VM Setup: Click Finish to complete the virtual machine creation.
Step 3: Configure Virtual Machine Settings
Before starting the installation process, you may need to adjust the VM settings for optimal performance.
For VirtualBox:
-
Select your Kali Linux VM in VirtualBox and click Settings.
-
Adjust Memory: Ensure you have allocated at least 2 GB of RAM (4 GB is better).
-
Configure Storage:
-
Under Storage, select Empty under the Controller: IDE section.
-
Click the disk icon next to Optical Drive and select your Kali Linux ISO file to mount it.
-
-
Enable Virtualization:
-
Go to System > Processor and ensure Enable PAE/NX is checked.
-
If your CPU supports it, you can allocate more CPUs under the Processor tab.
-
-
Network Adapter: Ensure the Network Adapter is set to Bridged Adapter or NAT, depending on your network configuration.
-
Save Settings: Click OK to save your settings.
For VMware Workstation Player:
-
Select your Kali Linux VM in VMware and click Edit virtual machine settings.
-
Adjust Memory: Ensure you allocate at least 2 GB of RAM (4 GB recommended).
-
Configure Storage:
-
Check that the Virtual CD/DVD (IDE) is set to your Kali Linux ISO.
-
-
Network Adapter: Select NAT or Bridged for internet access, depending on your preference.
-
Save Settings: Click OK to save your settings.
Step 4: Install Kali Linux in the Virtual Machine
Now that the virtual machine is set up, you can proceed with the installation of Kali Linux.
-
Start the VM: Click Start (or Power on in VMware) to begin the installation.
-
Select Installation Mode: Once Kali Linux boots up from the ISO, you will see the Kali boot menu.
-
Select Graphical Install for an easy installation experience.
-
Alternatively, you can use Install for a text-based installation.
-
-
Language and Region Selection: Select your preferred language, location, and keyboard layout.
-
Network Configuration: Enter a hostname for your machine (e.g., "kali") and configure network settings.
-
Set Up User Account: Choose a user account (you can opt for the default root or create a standard user account).
-
Partitioning:
-
Select Guided - Use entire disk to automatically partition the virtual disk.
-
Since this is a virtual machine, all data on the virtual disk will be erased, so you don't need to worry about data loss.
-
-
Choose Disk: Select the virtual disk for Kali Linux installation and proceed.
-
Install GRUB Bootloader: Ensure that the GRUB bootloader is installed, allowing you to boot into Kali Linux.
-
Finish Installation: After the installation process completes, the system will prompt you to reboot.
Step 5: Reboot and Log in to Kali Linux
Once the installation is finished:
-
Reboot the Virtual Machine: When prompted, reboot the virtual machine.
-
Login: After rebooting, you should see the Kali Linux login screen. Enter your credentials (the ones you set up during the installation process).
-
Update Kali Linux: Open a terminal and run the following commands to ensure that your Kali Linux system is up to date:
-
Install Additional Tools: Depending on your needs, you can install additional penetration testing tools using:
Step 6: Install VirtualBox Guest Additions (Optional)
For better performance and integration (such as improved graphics, seamless mouse pointer integration, and shared folders), you can install VirtualBox Guest Additions.
-
In VirtualBox, go to Devices > Insert Guest Additions CD Image.
-
Mount the CD image and install the Guest Additions package:
-
Restart the virtual machine after installation.
Step 7: Test Kali Linux VM
Once Kali Linux is installed and running, you should test its functionality:
-
Ensure that Internet is working in the virtual machine (check network settings if needed).
-
Open a terminal and try to ping a website to test the connection:
-
Verify that the virtual machine runs smoothly without performance issues.
Conclusion
Installing Kali Linux in a virtual machine is an excellent way to explore its features and tools without compromising your primary operating system. Virtualization offers an isolated environment where you can safely experiment with penetration testing tools and cybersecurity techniques.
By following this guide, you’ve set up Kali Linux in a VM using either VirtualBox or VMware. With Kali Linux running smoothly in your virtual environment, you can now proceed with your penetration testing and security research in a safe, non-invasive manner.