How-to Build a Raspberry Pi

Introduction

This document describes how to assemble a Raspberry Pi 3 Model B kit and install the CentOS Linux operating system on a Micro SD card. There are a variety of kits available but this document refers to a Vilros Raspberry Pi 3 kit. To prepare the Micro SD card for the operating system these instructions are written for a Mac computer and Mac utility software. You will need to use the Mac Terminal to perform command line operations.

Raspberry Pi Hardware Requirements

The Raspberry Pi 3 kit comes with the required AC power supply that supports 2.5A (amps). The AC power supply included in your kit might refer to 2500mA which is milliamps. There are 1000 milliamps in 1 amp so the conversion of 2500mA equals 2.5A.

The Raspberry Pi kit includes two heat sinks of different sizes that dissipate heat. The heat sinks are silver, metallic objects that attach to the board’s processors. Your kit will include the necessary adhesive to attach the heat sinks.

Before you begin, verify that you have the required parts to build your Raspberry Pi system.

Raspberry Pi Parts List
Raspberry Pi 3 Model 3 Raspberry Pi Case
Micro SD card (4GB – 32GB) SD card Adapter
2.5A AC Power Supply AC power outlets and optional surge protector
Keyboard Heat Sinks
Monitor HDMI cable

Assemble the Raspberry Pi Case

The kit includes a case with four pieces: top, bottom, left side, right side. The case is designed so that the pieces fit together one way. No tools are needed to assemble the pieces, rather, they snap together and you will hear a click when a piece is attached.

  1. To pick up the Raspberry Pi board, grasp the Ethernet and USB ports.
  2. Place the board into the case’s bottom piece and align board’s holes with the posts in the case.
  3. To attach the top of the case insert the beveled tabs into the slots on the bottom piece.
  4. Press downward near the arrowed tabs of the top piece until it snaps into place.
  5. Align the side piece labeled as HDMI with the HDMI port of the board and snap it into place.
  6. Align the side piece labeled as GPIO with the board’s 40-pin connection and snap it into place.

Disassemble the Case

The case can be disassembled as needed. You must disconnect any cables that are attached to the Raspberry Pi. Remove the Micro SD card from the board before it is removed from the case.

  1. To remove the side pieces, grasp the curved top edge and pull away from the device.
  2. To remove the top, hold the bottom of the device and then press the arrowed tabs on the top piece and pull upward.
  3. After the top piece is loose, pull it away from the device so that the beveled tabs release from the cases’ bottom piece.
  4. To remove the board, grasp the Ethernet and USB ports and pull upward so the board releases from the posts in the case’s bottom piece.

Download the Operating System

The next step is to download the CentOS Linux operating system files and verify the files integrity.

  1. From your Mac computer, open a browser and navigate to the CentOS download website.
  2. In the section named AltArch Releases locate the armhfp (Arm32) image.
  3. To download the image, click Minimal image for Raspberrypi2/3.
  4. On the right-side of the page, click the Email link to obtain the sha256 checksum for the downloaded file. This code is used to verify the files integrity.
  5. Open a Terminal session and navigate to the directory where you saved the download file. For example, Downloads.
  6. Use the shasum to display the checksum:

    shasum -a 256 CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw.xz

  7. Compare the shasum command output to the output in the Email link. The codes must be an exact match.

    shasum output:
    962264b4387a10cfd058b12b7ed1490fd3f65c9276c10a37c6746ffaabcc83f2
    ./CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw.xz

    Email link output:
    CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw.xz
    962264b4387a10cfd058b12b7ed1490fd3f65c9276c10a37c6746ffaabcc83f2

Extract the Operating System Image

The downloaded operating system file is compressed. To use the operating system you need to extract the image from the compressed file.

  1. Open a Terminal session and navigate to the directory where you saved the download file. For example, Downloads.
  2. Use the gunzip command to extract the operating system image:

    gunzip -vk ./CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw.xz

  3. After the command line returns to a prompt use the :command:ls command to display the raw image file.

    CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw

Prepare the Micro SD Card

The Raspberry Pi uses a Micro SD card to store the operating system and files. To prepare the card you use the Mac Disk Utility. As you work with the Micro SD card and SD adapter, their labels should be visible and face upward. This procedure will delete any data on the Micro SD card.

  1. Slide the Micro SD card into the SD card adapter.
  2. Insert the SD adapter into the Mac computer’s SD card reader.
  3. Go to Applications, Utilities, Disk Utility.
  4. From the Disk Utility click on the SD card.
  • The utility displays an icon that looks like an SD card adapter.
  1. Click Erase.
  • Type a name for the card.
  • Select the format MS-DOS (FAT).
  1. To confirm the action, click Erase.
  2. Wait for the message that the Erase process is complete.
  3. Use the Disk Utility to unmount the Micro SD card but do not remove it from the card reader.

Install the Operating System

In this section you will use the command line to copy the operating system image to your Micro SD card. This procedure will overwrite the Micro SD card. Before you copy the image to the card, verify you are working with the correct media and that it is not mounted.

  1. From your Terminal session type the following command:

    diskutil list

  2. Verify the disk number for your Micro SD card. In this example the card is /dev/disk2.

    /dev/disk2 (internal, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: FDisk_partition_scheme *31.9 GB disk2
    1: DOS_FAT_32 PICARD 31.9 GB disk2s1

  3. To copy the image to the Micro SD card use the :command:rdisk command:

    sudo dd bs=1m if=CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1804-sda.raw of=/dev/rdisk2

    After the image is copied you are returned to a command prompt and the output will look similar to this:

    2712+0 records in
    2712+0 records out
    2843738112 bytes transferred in 217.383215 secs (13081682 bytes/sec)

  4. Use the Disk Utility to unmount the Micro SD card and remove it from the computer’s card reader.

Boot the Raspberry Pi to the Operating System

To complete the set up you will install the Micro SD card into the Raspberry Pi card reader and power on the device.

  1. Remove the Micro SD card from the SD adapter.
  • Hold the SD adapter, use your fingernail to catch the notch on the Micro SD card and slide the card out of SD adapter.
  1. With the Micro SD card label face down, insert the card into the Raspberry Pi card reader.
  2. Connect the cables for your USB keyboard and HDMI monitor to the Raspberry Pi.
  3. Plug-in the AC power adapter to a power outlet.
  4. Connect the Micro USB power cable to the Raspberry Pi.
  • The device will power on and boot the operating system.
  1. At the login prompt use the default credentials to log in to the operating system:
  • Username: root
  • Password: centos

Change the Password

The root account has complete access to your system. It is a best practice to change the root account’s default password.

  1. Login with the default credentials.
  2. Change the root password with the passwd command.
  • The command will prompt you to enter a new password and then confirm that password.
  1. Log out with the logout command or the exit command.
  2. Log in with the new root password.

Shut Down the System

When you are finished with your work you can shut down the operating system and power off the device.

  1. Login as root and use the shutdown command:

    shutdown -h now

    Messages are displayed as the operating system shuts down.

  2. Disconnect the Micro USB power cable from the Raspberry Pi.

Conclusion

You now have a functional Raspberry Pi system enclosed with a case to protect the device. The CentOS Linux operating system image was copied to your Micro SD card. And, the default root login credentials were changed to improve your system’s security.


Information Sources
Raspberry Pi
Raspberry Pi – download Raspian or NOOBS
Raspberry Pi – format the Micro SD card
Raspberry Pi – install images
CentOS Linux
CentOS Linux on the Raspberry Pi 3
ConvertUnits.com