Creating a virtual machine (VM) with VirtualBox and installing Kali Linux on it involves several steps. Below is a detailed guide to help you through the process:
Step 1: Download and Install VirtualBox
- Download VirtualBox:
- Visit the VirtualBox website and download the latest version for your operating system (Windows, macOS, or Linux).
- Install VirtualBox:
- Run the installer and follow the on-screen instructions to complete the installation.
Step 2: Download Kali Linux ISO
- Download Kali Linux:
- Visit the Kali Linux official website and download the latest version of the Kali Linux ISO file.
Step 3: Create a New Virtual Machine in VirtualBox
- Open VirtualBox:
- Launch VirtualBox on your computer.
- Create a New VM:
- Click the “New” button in the VirtualBox Manager to start creating a new virtual machine.
- Name and Operating System:
- Name: Give your VM a name (e.g., “Kali Linux”).
- Type: Select “Linux”.
- Version: Choose “Debian (64-bit)” (Kali Linux is based on Debian).
- Memory Size:
- Allocate memory (RAM) to the VM. A minimum of 2 GB (2048 MB) is recommended, but more is better if your host system allows it.
- Create a Virtual Hard Disk:
- Choose “Create a virtual hard disk now” and click “Create”.
- Hard Disk File Type: Select “VDI (VirtualBox Disk Image)” and click “Next”.
- Storage on Physical Hard Disk: Choose “Dynamically allocated” to save disk space and click “Next”.
- File Location and Size: Set the size of the virtual hard disk. A minimum of 20 GB is recommended. Click “Create”.
Step 4: Configure the Virtual Machine
- Select the VM:
- Click on the VM you just created in the VirtualBox Manager and click “Settings”.
- System Settings:
- Go to the “System” tab.
- Motherboard: Ensure “Floppy” is unchecked, and “EFI” is unchecked (Kali Linux usually does not require EFI).
- Processor: Allocate 2 or more processors if available.
- Display Settings:
- Go to the “Display” tab.
- Increase the “Video Memory” to 128 MB or more.
- Storage Settings:
- Go to the “Storage” tab.
- Under “Controller: IDE,” click the “Empty” disk icon.
- Click the disk icon next to “Optical Drive” and select “Choose a disk file”.
- Browse to and select the Kali Linux ISO you downloaded.
- Network Settings:
- Go to the “Network” tab.
- Ensure “Attached to” is set to “NAT” for internet access, or “Bridged Adapter” if you want the VM to be part of your local network.
- Audio, USB, and Shared Folders (Optional):
- Configure other settings like Audio, USB, and Shared Folders if needed.
Step 5: Start the Virtual Machine and Install Kali Linux
- Start the VM:
- Click the “Start” button in VirtualBox to boot the VM.
- Boot from ISO:
- The VM should boot from the Kali Linux ISO. If prompted, select the option to “Install” or “Graphical Install”.
- Choose Installation Settings:
- Language, Location, and Keyboard: Select your preferred language, location, and keyboard layout.
- Network Configuration: Enter the hostname (default: kali) and domain name (if applicable).
- Set Up Users and Passwords: Set up a root password or create a new user with administrative privileges.
- Disk Partitioning:
- Choose “Guided – use entire disk” to automatically partition the virtual hard drive.
- Confirm the partitioning scheme and write changes to disk.
- Software Selection:
- Choose the default software selection or customize it as needed.
- Install GRUB Bootloader:
- Choose “Yes” to install the GRUB bootloader to the master boot record. Select the virtual hard disk (usually /dev/sda).
- Complete the Installation:
- After the installation is complete, the system will prompt you to remove the installation media (ISO). Just press “Enter” to reboot the VM.
Step 6: Log in to Kali Linux
- Log In:
- After the VM reboots, you will be presented with the Kali Linux login screen. Enter the username and password you created during the installation.
- Post-Installation Setup:
- Update and upgrade your system by opening a terminal and running:
sudo apt update && sudo apt upgrade -y
Step 7: Install Guest Additions (Optional but Recommended)
- Install Dependencies:
- Open a terminal and run:
sudo apt install -y dkms build-essential linux-headers-$(uname -r)
- Insert Guest Additions CD:
- In the VirtualBox menu, go to “Devices” > “Insert Guest Additions CD image”.
- Mount the CD:
- If it doesn’t automatically mount, run:
sudo mount /dev/cdrom /mnt
- Run the Installation Script:
- Run the Guest Additions installer:
sudo /mnt/VBoxLinuxAdditions.run
- Reboot the VM:
- After the installation is complete, reboot the VM.
Step 8: Optimize the Virtual Machine (Optional)
- Enable 3D Acceleration:
- Go to “Settings” > “Display” > “Screen” and enable “3D Acceleration”.
- Adjust Display Resolution:
- Go to “Settings” > “Display” > “Screen” and adjust the resolution or enable “Auto-resize Guest Display” in the VirtualBox menu for better display management.
- Shared Clipboard/Drag and Drop:
- Go to “Settings” > “General” > “Advanced” and enable “Shared Clipboard” and “Drag’n’Drop” if needed.
You now have a fully functional Kali Linux installation on a VirtualBox VM. This setup allows you to perform penetration testing, ethical hacking, and security research in a controlled environment.