This article contains a list of steps and notes on installing Raspbian Lite on an SD card. I often document some tasks for future reference and I’ve just got five more Raspberry Pi’s for my new project, which means that installing Raspbian Lite might be a thing I’ll probably need to repeat from time to time.
Step 1: Downloading Raspbian Lite
Raspbian Lite can be downloaded from the official website: https://www.raspberrypi.org/downloads/raspbian/
Some people prefer to do it from the command line, but I’m not sure if this method is reliable. I’ve tried it a few times and it never succeeded. You may try it if you’re feeling lucky:
curl -o raspbian-lite-latest.zip https://downloads.raspberrypi.org/raspbian_lite_latest
The official website offers two download options: direct link and torrent link. I tried direct link first and it gave me about 200 kB/s, which is quite slow even for my modest 100 Mbit/s connection. Torrent option boosted the download speed to about 5 MB/s which is far more pleasant.
Direct download speed: 200,000 B/s Bandwidth: 10,125,000 B/s Bandwidth Utilization: 1.98%
Torrent download speed: 5,000,000 B/s Bandwidth: 10,125,000 B/s Bandwidth Utilization: 49.38%
Raspbian comes in heavily compressed form so we need to unzip the downloaded file in order to get an
.img image that we can write on SD cards:
-rw-r--r-- 1 igor igor 2.1G Sep 26 07:24 2019-09-26-raspbian-buster-lite.img -rw-r--r-- 1 igor igor 434M Nov 23 16:25 2019-09-26-raspbian-buster-lite.zip
Step 2: Writing Raspbian Lite Image on SD Card
First, you have to find the device name of your SD card. I have an internal card reader in my laptop, so it always appear at
/dev/mmcblk0 but it can be different if you’re using an external card reader. You should also make sure that the SD card is unmounted (
umount it, if necessary).
sudo dd status=progress \ if=2019-09-26-raspbian-buster-lite.img \ of=/dev/mmcblk0
Be patient, it can take a while. That’s why it’s good to use
status=progress, we can see the progress and be assured that
dd did not just hang and stuck in inactive state.
289411584 bytes (289 MB, 276 MiB) copied, 50 s, 5.8 MB/s ...
Finally, we should see something like that:
2247615488 bytes (2.2 GB, 2.1 GiB) copied, 396 s, 5.7 MB/s 4390912+0 records in 4390912+0 records out 2248146944 bytes (2.2 GB, 2.1 GiB) copied, 400.327 s, 5.6 MB/s
That should be it. Let’s check what do we have now on that SD card:
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT mmcblk0 ├─mmcblk0p1 vfat boot xxxx-xxxx 200.3M 21% /media/igor/boot └─mmcblk0p2 ext4 rootfs xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 633.1M 59% /media/igor/rootfs
It looks like we need two partitions: first one is used by Raspberry Pi to boot up and the second one hosts the operating system and all of the data owned by its users.
sudo fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 4390911 3858432 1.9G 83 Linux
Note that those partitions do not take up all of the free space on the SD card. The second partition will be expanded automatically once you boot up your Raspberry Pi.
Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p1 253M 52M 201M 21% /media/igor/boot /dev/mmcblk0p2 1.8G 1.1G 634M 64% /media/igor/rootfs
Step 3: First Run on a Raspberry Pi
Now you can plug your SD card into Raspberry Pi board and fire it up. The default log in credentials are:
User: pi Password: raspberry
The first thing you may want to look at is the
raspi-config utility. You can find more information here: https://www.raspberrypi.org/documentation/configuration/raspi-config.md
This program will help you to change your password, host name, enable Wi-Fi and SSH, and do many other things you may find necessary in order to fully utilize your Raspberry Pi.
Let’s see how our partitions look now:
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT mmcblk0 ├─mmcblk0p1 vfat boot xxxx-xxxx 199.6M 21% /media/igor/boot └─mmcblk0p2 ext4 rootfs xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 26.6G 4% /media/igor/rootfs
sudo fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 62333951 61801472 29.5G 83 Linux
Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p1 253M 53M 200M 21% /media/igor/boot /dev/mmcblk0p2 29G 1.3G 27G 5% /media/igor/rootfs
All fine, I guess we’re done here.
Raspbian Lite is a great system for running a server on a Raspberry Pi 4. It’s officially supported and it also has some unique features that are critical in order to make sure that you fully utilize your Raspberry Pi (primarily
rpi-eeprom-update). Raspbian Lite is pretty compact and easy to install and the steps above provide some details on how the installation process might look like.