[Learning] Installing Kali Linux on a Raspberry Pi

[Learning] Installing Kali Linux on a Raspberry Pi
Photo by Vishnu Mohanan

Kali Linux is a powerful operating system designed for penetration testing, digital forensics, and security research. The Raspberry Pi, with its small size and flexibility, is an excellent platform for running Kali Linux. This guide will walk you through the process of installing Kali Linux on a Raspberry Pi, complete with the necessary commands and steps to achieve a successful installation.

1. Preparing Your Raspberry Pi

Before you begin, make sure you have the following:

  • Raspberry Pi Model: Kali Linux is compatible with most Raspberry Pi models, including Raspberry Pi 4, 3B+, 3, and 2.
  • MicroSD Card: At least 16GB in size (32GB recommended) with a high-speed rating (Class 10 or UHS-1).
  • Power Supply: A reliable power source suitable for your Raspberry Pi model.
  • Monitor, Keyboard, and Mouse: For initial setup and configuration.
  • Internet Connection: For downloading and updating packages.

2. Downloading Kali Linux

  1. Visit the Kali Linux ARM Images page and download the appropriate image for your Raspberry Pi model. Choose the 32-bit or 64-bit version based on your Raspberry Pi and your requirements.

  2. The downloaded file will be in .xz format. You will need to extract it to get the .img file.

    # Extract the image file (Linux/Mac)
    xz -d kali-linux-*-rpi-*.img.xz
    

    On Windows, you can use tools like 7-Zip to extract the .img file.

3. Flashing Kali Linux to the MicroSD Card

Next, you'll need to flash the Kali Linux image onto the MicroSD card.

  1. Use Etcher (Recommended):

    • Download and install Balena Etcher.
    • Insert your MicroSD card into your computer.
    • Open Etcher, select the Kali Linux .img file, choose your MicroSD card as the target, and click Flash.
  2. Using Command Line (Linux/Mac):

    # Identify the MicroSD card device
    lsblk
    
    # Use dd to flash the image (replace /dev/sdX with your SD card device)
    sudo dd if=kali-linux-*-rpi-*.img of=/dev/sdX bs=4M status=progress conv=fsync
    

    Be very careful with the dd command as it can overwrite any drive on your system if the wrong device is selected.

4. Initial Setup

  1. Insert the MicroSD Card:

    • Safely remove the MicroSD card from your computer and insert it into the Raspberry Pi.
  2. Connect Peripherals:

    • Attach a monitor, keyboard, and mouse to your Raspberry Pi.
  3. Boot the Raspberry Pi:

    • Connect the power supply to boot up the Raspberry Pi. Kali Linux should start up automatically.
  4. Login to Kali Linux:

    • Default Username: kali
    • Default Password: kali
    • It's recommended to change the default password immediately.
    passwd
    

5. Updating and Configuring Kali Linux

Once logged in, update your Kali Linux to ensure you have the latest packages and security patches.

  1. Update the Package List:

    sudo apt update
    
  2. Upgrade Installed Packages:

    sudo apt full-upgrade -y
    
  3. Reboot the System:

    sudo reboot
    

6. Configuring Wireless and Network Settings

If you need to connect to a Wi-Fi network:

  1. Scan for Available Networks:

    sudo iwlist wlan0 scan
    
  2. Configure Wi-Fi:

    • Open the Network Manager or edit /etc/wpa_supplicant/wpa_supplicant.conf directly.
    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    

    Add your network configuration:

    network={
        ssid="YourNetworkSSID"
        psk="YourNetworkPassword"
    }
    
  3. Restart the Network Interface:

    sudo ifdown wlan0 && sudo ifup wlan0
    

7. Installing Additional Tools and Software

Kali Linux on Raspberry Pi comes with a variety of pre-installed tools. However, you might want to install additional tools or software.

  1. Install Additional Tools:

    sudo apt install <tool-name>
    
  2. Install a GUI Desktop Environment (if using a minimal image):

    sudo apt install kali-linux-full
    

    Or install a specific desktop environment like XFCE:

    sudo apt install xfce4 xfce4-goodies
    
  3. Reboot to Apply Changes:

    sudo reboot
    

8. Optional: Enable SSH for Remote Access

If you want to control your Raspberry Pi remotely, enabling SSH is a good option.

  1. Enable SSH:

    sudo systemctl enable ssh
    sudo systemctl start ssh
    
  2. Access via SSH:
    On your local machine:

    ssh kali@<raspberry-pi-ip-address>
    

Your Raspberry Pi is now running Kali Linux, fully equipped with powerful penetration testing and security tools. This lightweight setup provides a portable and affordable platform for cybersecurity tasks, whether you’re conducting network assessments, exploring IoT vulnerabilities, or simply learning about Linux and security.