Читать книгу Raspberry Pi For Dummies - McManus Sean - Страница 11

Part 1
Setting Up Your Raspberry Pi
Chapter 2
Downloading the Operating System
Creating a NOOBS Card

Оглавление

The easiest way to get started with the Raspberry Pi is to use the NOOBS software. NOOBS is short for new-out-of-box software, although it’s also a pun on the term noob, sometimes used to describe beginners in any field of computing. Don’t underestimate the power of this software, though, especially if you’re a more experienced user: NOOBS is easy to copy to the SD or MicroSD card, but provides you with a simple menu for installing a number of different operating systems, including different versions of Linux and the Kodi media center software. The options are described in more depth in Chapter 3.

As we say in Chapter 1, you can buy a card with NOOBS already on it, and that might be the quickest way to get started. If you’ve got one of these, you can skip ahead to Chapter 3 – but maybe read through this chapter while you’re waiting for the OS to install. It’s useful to know how to create your own NOOBS cards: It means you can get started with a new card in about 20 minutes, rather than having to wait for the postman to deliver one to you.

You can also find links to download a specific operating system (including Raspbian) at the Raspberry Pi website and install that OS on the SD or MicroSD card. In that case, the download is in a special format (an image file) that describes all the different files that need to be created on the SD or MicroSD card. To convert the image file into an SD or MicroSD card that will work on the Raspberry Pi, you need to flash the card, and you can’t just copy the file across. (See the section on flashing your card at the end of this chapter.)

Downloading NOOBS

In your web browser, visit www.raspberrypi.org/downloads/noobs. Two versions of NOOBS are available: The main version of NOOBS includes Raspbian, the officially supported operating system, so you can use it even if you don't have a network connection on your Raspberry Pi; NOOBS also includes a menu for choosing other operating systems to download and install from the Raspberry Pi, if you have a network connection. We recommend you download NOOBS for your first operating system.

NOOBS Lite leaves out the Raspbian software download and includes a menu to download whichever operating system you want to use. It's a smaller initial download, and it's ideal if you don't plan to use Raspbian. It needs a network connection on your Raspberry Pi to download an operating system, though.

Formatting the SD card

For best results, you need to format the SD or MicroSD card. You can use a program, available from the SD Association, called SD Card Formatter on Mac and Windows, and you can find it at www.sdcard.org/downloads/formatter_4. You need to read and accept the license agreement before you can download.

If you’re using Linux, you can use GParted to format the card, as we will show you.

Earlier models of the Pi used a physically larger SD card, but later ones use a MicroSD card. Make sure you have the right sort. The MicroSD cards often come with a holder to make them look and work like SD cards. (Refer to Figure 1-3, in Chapter 1.) You might have to plug the MicroSD card into this holder to format it on your desktop or laptop computer.

Whichever computer you’re using, you need to be extremely careful in doing this. When you format an SD or MicroSD card, its previous contents are completely erased, so make copies of any files or photos you might need from the card before you begin. Make sure you have a backup of your hard drive, and disconnect any removable disks before you start, to minimize the potential damage from accidentally formatting the wrong disk.

Using Windows

The Windows SD Card Formatter software downloads as an executable (.exe) file, so double-click it to run the installation program. Click Next to work through the steps. The program suggests where to install SD Card Formatter, but you can change this location if you want. Finally, click the Install button. You may receive an alert from Windows telling you that a program is trying to make changes to your computer and asking whether this is allowed.

After installing SD Card Formatter, you can use the Windows Search feature to find it and run it. On Windows 10, click in the box on the taskbar in the bottom left of the screen to start the search. If you’re using Windows 8.1, move the mouse to the top-right corner and click the magnifying glass to open the search. In either version of Windows, type SD and then click the program name when it appears. (On older versions of Windows, run SD Card Formatter from the Start menu in the bottom left of the screen.) When you run the program you might be prompted to confirm it is allowed to make changes to your computer.

Figure 2-1 shows the SD Card Formatter software on Windows. Where it says Select card, select the drive that contains the SD or MicroSD card. If no drive is shown, try clicking Refresh. Check the drive displayed here, and double-check it as often as you need to, because SD Card Formatter erases everything on this drive. It’s a sensible precaution to disconnect USB drives and any other removable storage devices, to protect them from accidental deletion before you go any further.


FIGURE 2-1: SD Card Formatter, used to format the SD or MicroSD card, on Windows.


The Quick Format option is fast but not secure, so you’ll receive a warning that data might still be recoverable after formatting. (Don’t count on being able to do so, though!) Click OK to start the formatting. On Sean’s computer, this took a few seconds.

Using a Mac

The Mac version of SD Card Formatter downloads as an installation package. Double-click this package to install the software. The software installs by default into the Applications folder. Note: You will need to enter your Mac’s password to do this, and also every time you run this utility.

Insert the SD or MicroSD card into your Mac’s slot, or into a card reader connected to your Mac, and then double-click the SD Card Formatter icon in the Applications folder. When the software opens, the main screen looks like Figure 2-2.


FIGURE 2-2: SD Card Formatter, used to format the SD or MicroSD card, on a Mac.


Make sure the Select Card drop-down menu shows the SD or MicroSD card you want to use. This is the drive that will be wiped, so check this as often as you need to for you to be certain. If the right card isn’t shown, use the drop-down menu to choose the right one.

Next, click the Overwrite Format option to select it. Click the Format button, and SD Card Formatter starts to format the card. Note that there is no need to enter anything into the Volume Label box. That will be completed automatically.

This is a great time to have a cup of tea, because the card takes about half an hour to format. You can still use your Mac while the process is running, although it might take a bit longer to format if you do. When the formatter is finished, you see the icon of the SD or MicroSD card on the desktop. Note that if the SD card has been formatted before or comes preformatted, clicking the Quick Format option will save you some time.

Using Linux

We’re using Ubuntu, the most popular desktop distribution, so you might see some variations if you prefer a different distribution. These steps should give you the guidance you need in any case.

Because this process involves completely erasing a disk (the SD card), make sure you have a recent backup of your computer before you proceed, just in case you accidentally wipe the wrong disk.

Follow these steps:

1. You use a utility called GParted to set up the SD card on Ubuntu. If you don't already have it installed, start by installing it from the terminal. Enter the following commands:

sudo apt-get update

sudo apt-get install gparted

You can open a terminal window by using Dash Home in Ubuntu, the applications menu in your distribution, or a keyboard shortcut (Ctrl+Alt+T in Ubuntu).

2. You use a utility called GParted to set up the SD card on Ubuntu. It needs to be run with root permissions, so start it by issuing a command from the terminal. Enter the following:

sudo gparted

Figure 2-3 shows GParted running on the desktop.

3. Click in the top right to choose the correct disk, the SD card.

Take particular care here. You can cause serious damage to your hard drive if you choose the wrong disk. We know this is our SD card because it’s showing a capacity of 7.4GB and our hard drive has a capacity of 500GB.

4. The main window shows the partitions on the card. You want to delete them, so click them in turn and then click the Delete icon on the toolbar.

The Delete icon looks like a No Entry sign, or the international No symbol. This won’t take effect yet: You queue up the actions you want to carry out and then trigger them all when you’ve finished. (If you can’t set a partition to delete because it has a Key icon beside it, right-click the partition and choose Unmount from the menu that appears.)

5. Click the unallocated partition and click the Add Partition button (the one on the toolbar that has a picture of a blank page with a plus sign on it).

The pop-up window, which you can see in the foreground in Figure 2-3, appears.

6. Click the menu to change the file system to fat32, and then click the Add button.

Again, this doesn’t take effect yet.

7. Click the tick (or check mark) button on the toolbar to carry out the actions you’ve queued up – removing the existing partitions and adding a single new FAT32 partition.

FIGURE 2-3: GParted, running on the Ubuntu desktop.


Copying NOOBS to the SD or MicroSD card

You should now have a formatted SD or MicroSD card and the .zip file for NOOBS that you downloaded from the Raspberry Pi website. To install NOOBS on the SD or MicroSD card, you simply copy the files inside the .zip file to the card.

On a Windows PC, double-click the NOOBS .zip file to open it, select all the files in it, and then copy them to the formatted SD card. You can do this by using Ctrl+A to select the files and Ctrl+C to copy them, navigating to the SD card, and then using Ctrl+V to paste them.

On a Mac, double-click the NOOBS .zip file and you will see a folder containing all the files you need. From the Edit menu, choose Select All and drag all the files onto the SD Card icon on the desktop. It takes about 15 minutes to copy everything across. When it’s finished, eject the SD card by dragging it into the trash can, which has now transformed into an Eject icon.

On Linux, you can use the desktop environment (where available) to copy the NOOBS files to the SD card. In Ubuntu, you can simply go to the NOOBS .zip file, double-click it to open it, select all the files in it, and drag them to the SD card to copy them across.

Alternatively, you can follow these steps to unzip and copy the files using the Linux command line:

1. Remove and reinsert the card so that it mounts automatically.

2. Open a terminal window.

You can do this by using Dash Home in Ubuntu, the applications menu in your distribution, or a keyboard shortcut (Ctrl+Alt+T in Ubuntu).

3. Enter sudo fdisk – l, where the last character is the letter l.

This gives you a list of available disks, as shown in Figure 2-4.

4. Study this list to find the SD or MicroSD card.

In Figure 2-4, the screen lists two disks, with the information about each one starting with the word Disk. The file size is usually a good indicator of which is the SD card. The first one (Disk /dev/sda) is 500.1GB, which is a hard drive. The second one (Disk /dev/sdd) is just 7948MB. That’s roughly 8GB, so that’s the SD card. Note the card’s partition name, which in this case is sdd1.

5. Find out where the card is mounted.

Use the mount command and search for the directory where the card has been mounted in the file system. In this case, the card’s partition name is sdd1, so enter the following:

mount | grep – i sdd1

Figure 2-4 shows the output from this, which tells you where the card is mounted. In this case, it’s mounted on /media/65E8-9564.

6. Use cd to go to the directory where the card is mounted:

cd /media/65E8-9564

7. Unzip the NOOBS download onto the card.

This NOOBS download was stored in the folder /home/ubuntu/Downloads, so we can unzip it onto the SD card using this command:

unzip /home/ubuntu/Downloads/NOOBS_v2_3_0.zip

You can usually type the first couple of characters of each part of the path and then tap the Tab key on the keyboard to have Linux complete it for you, so you don’t have to remember the whole filename. It might take five minutes or so to unzip and copy the files across to the card.

FIGURE 2-4: A list of available disks.


Raspberry Pi For Dummies

Подняться наверх