Raspberry Pi setup for dummies

Recently, I’ve been wanting to learn more about cyber security. So I bought a Raspberry Pi and installed Kali Linux on it.

This is a walkthrough of how to buy and setup a Raspberry Pi and install a Linux distribution of your choice on it.

What you’ll need

I’ll leave you with more details further down the post, but to follow these instructions you’ll need:

  • A Raspberry Pi 4 B (although the instructions might work just as well with the Raspberry Pi 3), including:
    • A power supply compatible with the Raspberry Pi
    • A monitor you can plug the Pi into
    • Some way to connect your Pi to the monitor. The Raspberry Pi has two micro HDMI ports, so a HDMI to micro HDMI cable or adapter is usually a good option.
    • A USB keyboard and mouse for the installation process
  • A micro SD card
  • A computer capable of flashing the SD card - you’ll most probably need a micro SD card to SD card or USB adapter

Also, you might want:

  • A case for the Raspberry Pi (for protection)

Equipment I bought
This is the equipment I bought: The Raspberry Pi, a power supply, a clear case, a micro SD card with an SD card adapter, and a HDMI to micro HDMI cable

How much RAM do you need?

As of writing this post, the Raspberry Pi comes with either 2, 4 or 8 GB of RAM. The more memory, the higher the price of the Pi.

If you know for sure what you’ll be using the Pi for, you could check the RAM requirement for those purposes. If not, I would recommend going for the top option of 8 GB RAM if you can afford it. Even though the 4 GB choice probably is enough for most activities, more RAM is usually better. 8 GB will give you more options for repurposing your Pi later on, and it should be easier to sell at a second hand market.

The Raspberry Pi 4 B 8GB RAM
I went with the 8 GB RAM version of the The Raspberry Pi 4 B

How much storage do you need on the SD card?

As with RAM, more storage is usually better, but comes at a premium in cost. If you know what you’ll be using the Pi for, check the requirements for that activity. If not, here are some general guidelines:

The minimum requirements for most operating systems are about 15 GB (although you can find lightweigh operating systems that only need 3-4 GB). Thus, I would say that you’ll need an SD card of 30 GB at the very least.

As I plan on downloading some large files to the Pi I went with a 128 GB option. This also gives me plenty of options for repurposing later on. The micro SD card I bought also came with as micro SD card to SD card adapter. As I have a computer capable of reading SD cards I got everything I need for flashing the SD card using this adapter. If your computer lacks this ability, you should consider buying a micro SD card to USB adapter.

A 128 GB micro SD card with an SD card adapter
I went with a 128 GB micro SD card with an SD card adapter

Other

Apart from this, I went with the standard power supply and a clear case from the Raspberry Pi team, plus a HDMI to micro HDMI cable.

The default power supply from the makers of the Raspberry Pi
The default power supply from the makers of the Raspberry Pi

A clear case from the makers of the Raspberry Pi
A clear case from the makers of the Raspberry Pi

A (far too long) HDMI to HDMI micro cable
A (far too long) HDMI to HDMI micro cable

Download the Linux disk image

Now that we have the equipment we need, it’s time to download the version of Linux we want to install.

Which Linux Distro to choose for the Raspberry Pi?

As Linux is open source, there are plenty of versions of Linux (Linux Distributions, or “distros”) to choose from. Each distro has pros and cons, and choosing might be a daunting task for new users. Underneath are some good options:

  • For a general purpose Raspberry Pi, you’d probably be best of with the Raspberry Pi OS (formerly known as Rasbian), as it is the official OS for the Pi and is optimized for the Raspberry Pi hardware.
  • For a desktop computer my personal favorite is Pop!_OS, which is based on one of the most popular Linux distros, Ubuntu. However, I’m not sure how well either of these run on the Raspberry Pi. Several sources recommend Ubuntu MATE as a great Ubuntu based OS for the Raspberry Pi.
  • For a Linux Server Ubuntu Server is a good option.
  • Kali Linux from Offencive Security is generally considered the best Linux distro for cyber security and ethical hacking.
  • Other than this, there are specific distros for several purposes, such as retro gaming, using your Pi as a NAS, media server or even a crypto currency miner. Too keep this post short I’m not going to list recommendations for all. You should do a web search for “Best Linux distro for <your purpose>”.

DistroWatch is a great site for reading reviews of Linux Distros before choosing. You can also take a look at their list of distros that work well on the Raspberry Pi here.

As mentioned in the introduction, I want to learn more about cyber security. So I went to Offensive Security’s official site for downloading Kali Linux Images and downloaded the disk image for the 64-Bit Raspberry Pi 4:

I downloaded the image from the bottom link here
I downloaded the image from the bottom link here

Remember where you saved the disk image.

Flash the SD card

Now it’s time to flash the disk image to the micro SD card.

Format the SD card

If your SD card is above 32 GB - like mine - then it will be formatted with a file system called exFAT (Extensible File Allocation Table). Unfortunately, the Raspberry Pi 4 B only understands the FAT file system formatting. Therefore, we need to reformat the SD card.

If you have access to a Mac or a Linux based computer this is very easy. For Windows computers it might be a bit more cumbersome. I’ll leave you with this article if you need use a Windows computer, while I’ll explain how to reformat the SD card with a Mac or Linux underneath.

Reformat SD card on a Mac

  1. Insert your SD card into your Mac
  2. Open “Disk Utilities”
  3. Locate the correct disk in the menu on the left (“NO NAME” on the picture underneath)
  4. Press “Erase” in the top menu
  5. Give the disk a name of your choosing, and make sure that you select “MS-DOS (FAT)” as the format

Press “Erase”, wait for it to finish, and that’s it!

Illustration for Mac. This was another micro SD card I had lying around, which was already formatted as FAT
Illustration for Mac. This was another micro SD card I had lying around, which was already formatted as FAT

Reformat SD card on Linux

In the demonstration underneath, I’ll be using the Linux distro Pop!_OS, but the process should be quite similar on most other distros. If you are unsure, Google how to do this on your specific flavour of Linux.

  1. Insert your SD card into your computer

  2. Open “Disks” Open Disks

  3. Locate the correct disk in the menu on the left (“SD Card Reader” on the picture underneath) The Disks program

  4. Select the main partition of the disk (“Filesystem Partition 1 128 GB exFAT” on the picture above)

  5. Press the three dots to the top right and select “Format Disk…”

  6. Give the disk a name of your choosing, and make sure that you select “For use with all systems and devices (FAT)” as the type.

    • I usually choose to erase the disk as well, just to make sure that it’s clean. But do notice that this will take extra time, especially if the SD card is large. It took me about an hour to erase the 128 GB card.

    Reformat the disk

Press “Next”, wait for it to finish, and that’s it!

Download Etcher and flash the SD card

Now the SD card has a format the Raspberry Pi can read, and we can burn the Linux disk image to the card. To do this we will use the free software Etcher from Balena.

  1. Download Etcher from this link, and install it
  2. Open Etcher, and press “Flash from file”. Locate the Linux disk image you downloaded earlier Flash from file
  3. Press “Select target” Select target
  4. Select the SD card (it should show up with the name you gave it when you formatted it). It is very important that you choose the right disk - the SD card you are trying to flash. If you chose your computer’s internal storage disk you might overwrite your computer.
    Select disk
    Select the correct disk - the SD card
  5. Press “Flash!”. You might need to accept a warning that the target is unusual large for an SD card. This is because this SD card will also work as our Raspberry Pi’s internal storage. Flash

The flashing might take 5 to 15 minutes, depending on your system. When it’s finished, you can eject your SD card we should be ready to assemble the Pi!

Start the Raspberry Pi

Now we can assemble and start the Raspberry Pi.

  1. If you bought a case for your Raspberry Pi you can place the Pi in it now. Depending on your case you might need to twist or slide it into place, but you should not need to use excessive force. Also, be wary of static electricity when handling the Raspberry Pi.
    Unpack Pi
    Unpack your Raspberry Pi and handle it carefully
    Insert into case
    Insert it into the case, if you have one
    Close case
    Close the case
  2. Turn the Pi over, and insert the micro SD card Insert micro SD card
  3. Connect the Raspberry Pi to a monitor
  4. Plug a USB mouse and keyboard into the Pi
  5. Plug the Raspberry Pi into a power outlet (the Pi will automatically start)
  6. Follow the installation process on the screen

Voilà!

You just assembled your first Raspberry Pi and installed Linux on it - congratulations!

Next steps

There are plenty of things you can do now, but some natural first steps are to update the software on your Raspberry Pi with the following commands in the terminal (given that you have a Debian/Ubuntu based OS):

~$ sudo apt-get update
~$ sudo apt-get upgrade

This might take some time and your might need to reboot your Pi, depending on your OS and what updates are available.

Further, you should change the default password, unless you created your own during installation of the OS:

~$ passwd <username>

And that’s about as general as I can be without knowing your OS. I always Google “what to do after installing <your distro>” after a fresh install of a new distro.

I hope you have enjoyed this walkthrough!

Jan Petter Iversen
Jan Petter Iversen
Consultant

Data analytics consultant from Bergen, Norway.

comments powered by Disqus