Setting Up Your Own Kali Linux Virtual Machine

Setting Up Your Own Kali Linux Virtual Machine

Objective

Learn how to set up a Kali Linux virtual machine (VM) using VirtualBox. This lab covers downloading Kali Linux, configuring VirtualBox, and installing the OS on your virtual machine.


Prerequisites

  1. VirtualBox Installed on Your System:
  2. Kali Linux ISO or Virtual Machine Image:
  3. Sufficient System Resources:
    • Ensure your host system has at least:
      • 4 GB of RAM (8 GB recommended).
      • 20 GB of free disk space.
      • A 64-bit processor with virtualization support enabled in the BIOS.

Step 1: Setting Up VirtualBox

  1. Open VirtualBox and click New to create a new virtual machine.
  2. Configure the VM settings:
    • Name: Enter a name for your VM (e.g., Kali Linux).
    • Type: Select Linux.
    • Version: Choose Debian (64-bit).
  3. Click Next and allocate memory:
    • Assign at least 2 GB of RAM (2048 MB). More is better if your system can handle it.
  4. Click Next to create a virtual hard disk:
    • Select Create a virtual hard disk now and click Create.
    • Choose VDI (VirtualBox Disk Image) and click Next.
    • Select Dynamically allocated and click Next.
    • Set the disk size to at least 20 GB and click Create.

Step 2: Configuring the VM

  1. Select your newly created VM and click Settings.
  2. Configure the following:
    • System:
      • In the Processor tab, allocate at least 2 CPUs.
      • Enable Hardware Virtualization if available.
    • Display:
      • Increase Video Memory to at least 64 MB.
    • Storage:
      • Click the Empty disk under Controller: IDE.
      • Click the disk icon on the right and choose Choose a disk file.
      • Select the downloaded Kali Linux ISO file.
    • Network:
      • Set Attached to to NAT for internet access.
  3. Click OK to save the settings.

Step 3: Installing Kali Linux

  1. Start the VM by clicking Start in VirtualBox.
  2. The Kali Linux boot menu will appear. Select Graphical install and press Enter.
  3. Follow the on-screen installation steps:
    • Language: Choose your preferred language.
    • Location: Select your location.
    • Keyboard: Choose your keyboard layout.
    • Network:
      • Configure the hostname (e.g., kali).
      • Set a domain name if applicable.
    • User Account:
      • Create a non-root user and password.
    • Disk Partitioning:
      • Choose Guided - use entire disk.
      • Select your virtual disk and choose All files in one partition.
      • Confirm the partitioning changes and write them to the disk.
  4. Wait for the installation to complete and reboot the VM when prompted.

Step 4: Post-Installation Setup

  1. Log in to your new Kali Linux installation using the credentials you created.
  2. Update the system:
    sudo apt update && sudo apt upgrade -y
    
  3. Install VirtualBox Guest Additions for improved performance:
    • Mount the Guest Additions ISO:
      sudo apt install virtualbox-guest-dkms virtualbox-guest-x11
      
    • Reboot the VM:
      sudo reboot
      

Step 5: Networking and Shared Folders (Optional)

Enable Bridged Networking

  1. Shut down the VM and go to Settings > Network.
  2. Change Attached to to Bridged Adapter.
  3. Start the VM to connect it directly to your host’s network.

Set Up Shared Folders

  1. In Settings > Shared Folders, click the + icon.
  2. Add a folder from your host system and select Auto-mount.
  3. Access the shared folder in Kali Linux:
    sudo mount -t vboxsf <folder_name> /mnt
    

Step 6: Troubleshooting Common Issues

  1. Slow Performance:
    • Increase RAM and CPU allocation.
    • Enable Virtualization in your BIOS settings.
  2. No Internet Access:
    • Ensure the network adapter is set to NAT or Bridged.
  3. Screen Resolution Issues:
    • Install VirtualBox Guest Additions as mentioned in Step 4.
  4. ISO Not Detected:
    • Recheck the storage settings and ensure the ISO is correctly attached.

Additional Tips and Insights

  1. Snapshots:
    • Use snapshots in VirtualBox to save the current state of your VM before making major changes.
  2. Tool Installation:
    • Kali Linux comes pre-installed with many tools. Use kali-linux-large or kali-linux-everything metapackages to install additional tools.
  3. Regular Updates:
    • Keep your Kali Linux system updated to access the latest features and security patches.
  4. Use in a Lab:
    • Combine Kali Linux with other VMs in VirtualBox for a controlled penetration testing lab.

Key Takeaways

  1. Setting up Kali Linux in VirtualBox provides a secure and flexible environment for penetration testing and learning.
  2. Understanding basic VM configurations ensures smooth installation and operation.
  3. Regular updates and proper resource allocation are crucial for an optimal experience.

Explore Next

How to SSH into a Server from a Linux Machine

Other Projects