Sean McManus

Raspberry Pi For Dummies


Скачать книгу

1-6: The Raspberry Pi 4 Case Fan.

      Downloading the Operating System

      IN THIS CHAPTER

      

Introducing Linux

      

Using Raspberry Pi Imager to set up your microSD card

      

Choosing an operating system for your Raspberry Pi

      Before you can do anything with your Raspberry Pi, you need to provide it with an operating system (OS). The operating system software enables you to use the computer’s basic functions and looks after activities such as managing files and running applications, like word processors or web browsers. Those applications use the operating system as an intermediary to talk to the hardware, and they won’t work without it. This concept isn’t unique to the Raspberry Pi. On your laptop, the operating system might be Microsoft Windows or macOS. On iPads it’s iPadOS, on iPhones it’s iOS, and on other devices it might be Android.

      In this chapter, we introduce you to Linux, the operating system most frequently used on the Raspberry Pi, and we show you how to create a microSD card with an operating system on it. You’ll need to use another computer to set up the microSD card. It doesn’t matter whether you use a Windows, macOS, or Linux machine, but the computer needs to be able to write to microSD cards, and must have a connection to the Internet.

      The operating system used on the Raspberry Pi is GNU/Linux, or often just Linux. The Raspberry Pi might be the first Linux computer you’ve used, but the operating system has a long and honorable history.

      Richard Stallman created the GNU Project in 1984 with the goal of building an operating system that users were free to copy, study, and modify. Such software is known as free software, and although this software is often given away, the ideology is about free as in “free speech” rather than free as in “free beer.” Thousands of people have joined the GNU Project, creating software packages that include tools, applications, and even games. Stallman aimed to make his operating system compatible with Unix, an operating system that was created by AT&T’s Bell Labs and that started to gain popularity in the 1970s. That would make it easy for existing Unix users to switch to using the GNU Project.

      In 1991, Linus Torvalds released the central component of Linux, the kernel, which acts as a conduit between the applications software and the hardware resources, including the memory and processor. He still works on the Linux kernel, sponsored by the Linux Foundation, which is the nonprofit consortium that promotes Linux and supports its development. The Linux Foundation reports that 1,730 different organizations contributed to the kernel between 2007 and 2019.

      GNU/Linux brings together the Linux kernel with the GNU components it needs to be a complete operating system, reflecting the work of thousands of people on both the GNU and Linux projects. That so many people could cooperate to build something as complex as an operating system, and then give it away for anyone to use, is a modern miracle.

      Because GNU/Linux can be modified and distributed by anyone, lots of different versions of it exist. They’re called distributions, or distros, but not all of them are suitable for the Raspberry Pi. The recommended distribution of Linux for the Raspberry Pi is Raspberry Pi OS. Software created for one version of Linux usually works on another version, but Linux isn’t designed to run Windows or macOS software.

      Strictly speaking, Linux is just the kernel in the operating system, but as is commonly done, we refer to GNU/Linux as Linux in the rest of this book.

      

Older Raspberry Pi models use SD cards instead of microSD cards. When we say “microSD card” in this book, the same applies to an SD card.

      It’s possible to buy a microSD card with Raspberry Pi OS already installed. If you’ve already got a microSD card, you can skip to Chapter 3 now.

      If you want to use a different operating system on your microSD card, or want to reuse an old microSD card that has no software on it yet, you’ll need to set it up first.

      To set up a microSD card for your Raspberry Pi, there are two steps. You carry these out on another computer, not your Raspberry Pi.

       Download the image file of the operating system you want to use. The image file is a special format that describes all the different files that need to be created on the microSD card.

       To convert the image file into a microSD card that will work on the Raspberry Pi, you need to flash the card. You can’t just copy the file across. (Flashing is a process for copying an operating system onto the microSD card. During the process, the many files required by the operating system are extracted from the single image file you download.)

      Raspberry Pi Imager is simple software that downloads the operating system and flashes it to the microSD card for you. It’s available for the Windows, macOS, and Ubuntu operating systems. You can download it from www.raspberrypi.org/software and install it in the same way as any other software for your computer.

      

If you press Ctrl+Shift+X on Windows, you can open the advanced settings. Here, you can set up the Wi-Fi for your new SD card, enable SSH for remote access to the Raspberry Pi, set the hostname for the Pi on your local network, and change the locale settings (time zone and keyboard layout). On macOS, press Cmd+Shift+X to access options to disable overscan, set the hostname, and enable SSH.

Snapshot of the Raspberry Pi Imager software.

      Sean McManus

      FIGURE 2-1: The Raspberry Pi Imager software.

      1 Click Choose OS.Here you choose which operating system you’d like to use. We offer advice on your choice in the next section. If you’re eager to get started straight away, click Raspberry Pi OS (other), and choose Raspberry Pi OS Full, including recommended applications. This will give you the software you need for the rest of this book. Your operating system is stored (or cached) on your computer, so it can be flashed to another card later without needing to download it again.

      2 Click Choose Storage.You need to tell your computer where your SD card is. Take care here: The selected drive will be wiped, and the software can show options that include USB drives that are plugged in or even your watch when it’s plugged in to charge. To be safe, you could disconnect other drives you’re not using. Select your microSD card. Remember to eject or unmount the drives before disconnecting them to avoid losing data.

      3 Click Write.The operating system is downloaded (if necessary) and written