The first step in installing Kali Linux onto our Raspberry Pi 3 is to prep the microSD card. For Kali Linux, we need to have at least 8 GB of capacity. For best performance, we'll try to make sure that the microSD card is a class 10. We want to make sure that with all of that new power and speed from the Quad core CPU, we won't get slowed down by a slow microSD card. It also helps to ensure that any separately purchased SD cards we may be considering are compatible or suitable, as some SD card brands and product lines work better than others. A great resource for checking this is the eLinux website (http://elinux.org/RPi_SD_cards).
Tip
Be sure to check out the SD Associations website to get a better understanding of the class speeds of the SD cards and where to locate them. This holds true for all types of SD cards, including the microSD cards, which are used on Raspberry Pi 3.
The SD card that comes with our Raspberry Pi may have software on it already. Ours came with NOOBS on it, which is handy if we are not sure what distro we are looking for, as we can choose from several options in the menu within NOOBS. Because we knew we wanted Kali Linux on our Raspberry Pi, we formatted the microSD card to start fresh and installed our own operating system on it. It is always a good idea to copy the existing content of the microSD card to another place before blowing it away. This way, we have the initial version of NOOBS in case we need to use that in the future. With the Ultimate Starter Kit, we received a USB-based microSD adapter. This is a very handy adapter, as most computers do not have a microSD card slot on them, including Apple devices. We plugged in our 32 GB microSD card into the adapter and then into our computer; then, we were ready to rock.
The following image shows the USB-based microSD adapter that we used in our lab:
Getting the right image of Kali is important for proper operation. When we browse https://www.kali.org/, we can find all the options available for Kali Linux. Since we are using an ARM processor on the Raspberry Pi, we will need to install the Raspberry Pi-specific image. The link will redirect us to the Offensive Security site (https://www.offensive-security.com/kali-linux-arm-images/) for a custom Kali image. We should note that there are lots of different ARM options depending on the hardware platform we are using. Since we are using Raspberry Pi 3, we will choose the version that works with that platform. We'll make sure that we note where our image gets downloaded to, so we don't have to go searching later. The ARM image is specifically designed for the Raspberry Pi hardware versus the full-blown image. Again, let's verify that we download the correct image.
Tip
It's a best practice to compare the SHA1 sum of your downloaded file to the SHA1 sum posted on the website. This way you can make sure that your image hasn't tampered with prior to installation.
Now that we have the image downloaded and ready to install, we need to write it to the microSD card. How we do this will depend on the operating system that we are using. For Windows, we can use the Win32DiskImager
. This utility is available at the following URL:
https://sourceforge.net/projects/win32diskimager/
Once the utility is downloaded and opened, we are ready to proceed with imaging the SD card. We will first need to unzip the Kali image. We can use a program such as 7-Zip to unzip the image. When we unzip the file, we will be left with a folder, where we will find the .img
file. We then need to select the image file in the Win32DiskImager
utility, as well as the correct drive letter for the microSD card we want the image to go on. Let's click on Write, and let it do its job. This process can take some time, so be patient. When it's complete, press the Exit button.
The following screenshot is of the Win32DiskImager
utility. It's a great little utility that is very easy to use:
If we are using a Mac or Linux machine, we can use the built-in dd
utility to do the writing of the image.
The process on the Mac is as follows:
We'll first open up a terminal window on the Mac.
We will need to unzip the image. We used a utility named
xz
. We can also use popular tools such as Keka and The Unarchiver:xz -d kali-2.1.2-rpi2.img.xz
We then need to unmount the microSD card. To determine which device to refer to, we can use the
diskutil list
command. We can tell which disk is the correct one by either the size or by doing a preceding and following and seeing what disk has shown up:Once we have the correct device, we can unmount the microSD card by typing the following command, where disk-specified matches our device mount:
diskutil unmountDisk /dev/disk2
Once we have unmounted the microSD drive, we can begin to copy the image over using
dd
. Let's type the followingdd
command to write the Kali Linux image to the microSD card. We need to make sure that we select the correct input file, as well as the correct output disk. This process can take some time, so we shouldn't feel as though it is not doing anything. On our computer, it took just over 10 minutes, but that time may vary. If we get impatient, we can press Ctrl + T to see the how much of the copy has completed:sudo dd if=kali-2.1.2-rpi2.img of=/dev/disk2 bs=1m
Tip
Make sure that your current working directory contains the Kali Linux image. It will make it easier in your
dd
command if you can just specify the file.The following screenshot shows our machine performing those commands. We can see that we pressed Ctrl + T a couple times along the way to make sure that
dd
was still working:Finally, we'll cleanly unmount the microSD card. We can use the following command:
diskutil eject /dev/disk2
Our image should be all set, and we are ready to install the microSD card into our Raspberry Pi:
Once we remove the USB-based microSD adapter from our computer, we'll take out the newly setup microSD card and place into Pi. We can then hook up the power and watch it boot.
Note
The microSD slot on Raspberry Pi 3 is not spring loaded like Raspberry Pi 2. Because of this, be careful when plugging the microSD card in. It may feel strange when you don't get that locked-in feeling - just don't overdo it when pushing it into the slot. We were actually contacted by CanaKit confirming this change, so we didn't break our Raspberry Pi trying to get the microSD card to click into place.
Booting time on Raspberry Pi 3 is pretty quick due to the nice bump in hardware compared with previous versions. Once Kali Linux boots up, it should be at a login prompt within the GUI. Here, we can log in the first time with the following credentials:
User: root
Password: toor
We'll click on Log In, enter our default credentials, and we should be logged into Kali Linux now, ready to get started. This is where the fun begins!