Installing Raspbian via Linux

This section contains a description for installing Raspbian on a micro SD card using with a Linux computer, using the commandline interface.

Download Raspbian

With the following curl command you can download the latest Raspbian release into the "Downloads" of your home directory "~". The file size is around 3 GB, so you will need a good internet connection and some patience.

curl --location https://downloads.raspberrypi.org/raspbian_full_latest > ~/Downloads/raspbian-latest.zip

Afterwards, the downloaded file needs to be unzipped.

unzip ~/Downloads/raspbian-latest.zip -d /tmp
mv /tmp/*-raspbian-*.img /tmp/raspbian-latest.img (1)
1 With this mv command the IMG file with the Raspian system will be renamed to a filename which doesn’t include its version number.

Locate SD Card

After plugging in the SD card, you need to find out its device name. This can be done with the help of the lsblk command.

lsblk -p

One way to determine the correct device name is to find the value matching with the micro SD card in the "SIZE" column.

device name
Figure 1. Example output for device overview

Now you can store the correct device name in a variable which can the be used in the following steps.

DEVICE_NAME=/dev/sdx

With the help of the grep command you can double check that you have entered the correct value.

lsblk -p | grep $DEVICE_NAME
check device name
Figure 2. Example output for check if correct device name was selected

Unmount micro SD card

If the device is mounted into your file system tree, you need to unmount it now with the umount command.

umount $DEVICE_NAME* (1)
1 The asterisk after the variable is a wildcard character which will lead to the execution of the command for all the partions on the device.

Copy image to micro SD card

The following step will overwrite all existing data on the target device. If you have entered a wrong value in the variable DEVICE_NAME, it may lead to a undesired data loss.

Finally, you can copy the Raspbian image on the micro SD card with the dd command. This needs to be prefix with the sudo command to give dd the necessary permissions.

sudo dd bs=4M if=/tmp/raspbian-latest.img of=$DEVICE_NAME status=progress conv=fsync

After this is done, you can unplug the micro SD card.

Installing Raspbian via Windows

Download zip file

Here you can download the ZIP file with the latest Raspbian version:

Unzip image

The downloaded ZIP file can be extracted with the help of the Windows system tools.

Write image to disk

The extracted "*.img" file can be written on the micro SD card with the help of https://www.balena.io/etcher/.

Resources