Difference between revisions of "Install an operating system on a Raspberry Pi"

From Parallel Library Services
Jump to navigation Jump to search
Line 11: Line 11:
* an SD card*
* an SD card*


*SD cards come in various capacities and speeds; choose something suitable for what you want to use the Pi for.
SD cards come in various capacities and speeds; choose something suitable for what you want to use the Pi for. For certain uses, such as [[Bibliotecha]], it needs to be at least 32GB in capacity.
 
My installation:
 
I used a SanDisk Ultra microSDHC UHS-I Card, in 32 GB capacity.


== Steps ==
== Steps ==

Revision as of 18:02, 23 October 2021

Setting up a Raspberry Pi single-board computer can be daunting if it's the first time. It's not too difficult though, especially with this guide. There are many operating systems you can use, but Raspberry Pi OS (formerly known as Raspbian) is an operating system based on Debian and optimised for use with Raspberry Pi. With this installed, you are able to use your Pi for a wide range of purposes.

Needful things

  • a Raspberry Pi computer & power cable
  • an internet connection
  • a computer (desktop or laptop) with an SD card burner (or dongle)
  • a HDMI cable
  • a monitor to connect to the Pi
  • a keyboard to connect to the Pi
  • an SD card*

SD cards come in various capacities and speeds; choose something suitable for what you want to use the Pi for. For certain uses, such as Bibliotecha, it needs to be at least 32GB in capacity.

My installation:

I used a SanDisk Ultra microSDHC UHS-I Card, in 32 GB capacity.

Steps

Flash an image on an SD card

Using an imager

The Raspberry Pi website offers operating systems for RPi, as well as an installer called "Raspberry Pi Imager". This installer allows you to "flash" (or copy) an "image" (the OS firmware, in this instance) on to an SD card in a streamlined, seamless process.

  1. Download the imager software to your computer and install it.
  2. Connect the SD card to your computer.
  3. Open the imager application, choose an operating system and find your SD card for storage
  4. Click Write. All your existing data will be overwritten, and a warning will pop up to tell you the same. If you are ok to go ahead, click yes.

The imager application will begin writing or "flashing" an operating system to your SD card.

Notes on my installation: I chose an operating system without a desktop environment. This is because I only intend to use the computer to run services and scripts and don't need a desktop, only a terminal. In my case, I installed Raspberry Pi OS Lite with no desktop environment)

Other software is also available for this purpose, called balenaEtcher.

Manual installation

You can also choose to manually install the OS by navigating to this page, and choosing and downloading from the list of operating system images. Once the image has been downloaded to your computer, you will still need to transfer it to the SD card, following these steps:

1. Unzip the downloaded OS

2. Stick SD Card in to your computer (not the Pi)

mac
  • First open terminal
  • Find the disk that you are going to write to
diskutil list

!!! Be careful that you find the right disk, you can overwrite the harddrive of your computer easily when you pick the wrong one !!! To make it easier, and to avoid wiping external drives, make sure you have nothing else plugged in aside from your SD Card.

  • Find the disk name that reads something like /dev/disk<number> that doesn't have a partition on it named something like Macintosh HD. For example /dev/disk2
  • You need to unmount the SD Card before imaging (replace <number> with the disk number found in the first step)
sudo diskutil unmountDisk /dev/disk<number>
  • Then to image the disk with your image put in the following command (replace the minibian.img with the full path to your downloaded image file, and the <number> with the disk number that you found in the 1st step)
sudo dd bs=4m if=minibian.img of=/dev/rdisk<number>

linux

  • Find the disk that you are going to write to, find its path, for example /dev/sdb/

You can do this using software like gparted or Disks (on Gnome), or use the command line tools df.

df -h

!!! Be careful that you find the right disk, you can overwrite the harddrive of your computer easily when you pick the wrong one !!! To make it easier, and to avoid wiping external drives, make sure you have nothing else plugged in aside from your SD Card.

  • Unmount this disk (notice that the command is "umount", not "unmount")
umount /dev/path/to/disk
  • Write the image to the disk
sudo dd bs=4M if=minibian.img of=/dev/sdc status=progress

3. Insert the SD card into the Raspberry Pi

4. Power the RPi, wait for crazy blinking to stop

The operating system should now be installed. Connect a screen and keyboard to the Pi, and you should be able to operate it under the default "Pi" account, with the default login "raspberry".

What next?

  • Add user accounts
  • Change password of Pi user
  • Enable SSH for remote access