Difference between revisions of "Install Raspbian OS on a Raspberry Pi"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
(Added installation guide for windows.)
Line 1: Line 1:
== Summary ==  
== Summary ==  


Install Raspbian OS on a Raspberry Pi using a 16 GB SD card and Ubuntu
Install Raspbian OS on a Raspberry Pi using a 16 GB SD card


== Requirements ==
== Requirements ==


* PC with SD card reader
* PC with SD card reader
* Operating system: Ubuntu 18.04 bionic amd64
* Operating system: Ubuntu 18.04 bionic amd64 / Windows 10




== Description ==
== Description ==
 
=== Ubuntu ===
=== Check device id ===
==== Check device id ====
Insert the SD card in the SD card reader and determine the devices on the machine by issuing following command in a terminal
Insert the SD card in the SD card reader and determine the devices on the machine by issuing following command in a terminal


Line 26: Line 26:
     umount /media/<username>/<dev-id>
     umount /media/<username>/<dev-id>


=== Download image ===
==== Download image ====


Download newest raspbian desktop from https://www.raspberrypi.org/downloads/raspbian/
Download newest raspbian desktop from https://www.raspberrypi.org/downloads/raspbian/
The current version at time of the documentation was 2019-09-26-raspbian-buster-full.zip
The current version at time of the documentation was 2019-09-26-raspbian-buster-full.zip


=== Unzip and install ===
==== Unzip and install ====


* Copying a zipped image to the SD card and showing the progress by using following command
* Copying a zipped image to the SD card and showing the progress by using following command
Line 41: Line 41:
     6811549696 bytes (6,8 GB, 6,3 GiB) copied, 569,647 s, 12,0 MB/s
     6811549696 bytes (6,8 GB, 6,3 GiB) copied, 569,647 s, 12,0 MB/s


=== Verify image [optional] ===
==== Verify image [optional] ====
This is done by copying back the image with dd from the SD card into another file and compare that file to the original image with diff.
This is done by copying back the image with dd from the SD card into another file and compare that file to the original image with diff.


Line 63: Line 63:
   diff -s 2019-09-26-raspbian-buster-full.img from-sd-card.img  
   diff -s 2019-09-26-raspbian-buster-full.img from-sd-card.img  
   Files 2019-09-26-raspbian-buster-full.img and from-sd-card.img are identical
   Files 2019-09-26-raspbian-buster-full.img and from-sd-card.img are identical
=== Windows ===
Download your prefered image from the [https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit offical raspberrypi website].
For this guide we're going to use the Raspberry Pi Imager. You can download it [https://www.raspberrypi.org/software/ here].
Start Raspberry Pi Imager. Select your OS from the harddisk, SD-Card and press write. After the Imager is done you can plug the SD-Card in your Raspberry Pi.
The standard login for raspbian is:
Username: pi
Password: raspberry
'''Note:''' The raspbian uses the english keyboard layout.


== Hardware ==
== Hardware ==

Revision as of 17:32, 1 March 2021

Summary

Install Raspbian OS on a Raspberry Pi using a 16 GB SD card

Requirements

  • PC with SD card reader
  • Operating system: Ubuntu 18.04 bionic amd64 / Windows 10


Description

Ubuntu

Check device id

Insert the SD card in the SD card reader and determine the devices on the machine by issuing following command in a terminal

   lsblk
   NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
   sda           8:0    0   477G  0 disk 
   ├─sda1        8:1    0   953M  0 part 
   ├─.....
   mmcblk0     179:0    0  14,6G  0 disk 
   └─mmcblk0p1 179:1    0  14,6G  0 part 

SD card is device mmcblk0 which contains a partition mmcblk0p1, in the case this partition is autmatically mountet unmount the partition with

   umount /media/<username>/<dev-id>

Download image

Download newest raspbian desktop from https://www.raspberrypi.org/downloads/raspbian/ The current version at time of the documentation was 2019-09-26-raspbian-buster-full.zip

Unzip and install

  • Copying a zipped image to the SD card and showing the progress by using following command
   unzip -p 2019-09-26-raspbian-buster-full.zip | sudo dd of=/dev/mmcblk0 status=progress conv=fsync 
   6799950336 bytes (6,8 GB, 6,3 GiB) copied, 555 s, 12,3 MB/s
   13303808+0 records in
   13303808+0 records out
   6811549696 bytes (6,8 GB, 6,3 GiB) copied, 569,647 s, 12,0 MB/s

Verify image [optional]

This is done by copying back the image with dd from the SD card into another file and compare that file to the original image with diff.

  • The output of the first copying dd command shows the number of written blocks, so you need only to copy this number
  xxx+0 records in
 
  • then copy these xxx=13303808 blocks from the image to a new file
  sudo dd bs=4M if=/dev/mmcblk0 of=from-sd-card.img count=13303808
  • Unzipp the original image
  unzip 2019-09-26-raspbian-buster-full.zip
  
  • truncate to the other size
   sudo truncate --reference 2019-09-26-raspbian-buster-full.img from-sd-card.img
  • and compare
  diff -s 2019-09-26-raspbian-buster-full.img from-sd-card.img 
  Files 2019-09-26-raspbian-buster-full.img and from-sd-card.img are identical

Windows

Download your prefered image from the offical raspberrypi website. For this guide we're going to use the Raspberry Pi Imager. You can download it here.

Start Raspberry Pi Imager. Select your OS from the harddisk, SD-Card and press write. After the Imager is done you can plug the SD-Card in your Raspberry Pi. The standard login for raspbian is: Username: pi Password: raspberry

Note: The raspbian uses the english keyboard layout.

Hardware

Kingston 16GB micro SD-HC class 10 Accessory Raspberry Pi 3 Model B+


References