Beginning at the Beginning: Setting up a Raspberry Pi

Posted by on Oct 23, 2013 in documentation, making | No Comments

[Big thanks to Shiv Setlur for helping me through this process!]

Want to explore the world of Raspberry Pi? Curious about how to get started? Below you will find a list of the most basic hardware and software I used to get my first Pi up an running.

Step 1: Gather the Hardware

For the most basic setup you’ll need 5 things:

  1. A computer with an ethernet port and an SD card reader
  2. A raspberry pi
  3. A USB  cable and power adaptor
  4. An SD card (4GB minimum)
  5. An ethernet cable

Once you’ve gathered these materials you’re ready to move on to the next step.

Step 2: Install the Operating System

The Raspberry Pi is a computer, and like any computer it needs an operating system to do its thing. On all Pis the operating system is stored on an SD card, which can be slid into the SD card slot that’s built into the Pi. This is pretty handy because if you have multiple SD cards you can easily work with multiple operating systems just by switching out the cards. You can install many different operating systems on a Pi, but for noobs like you and me your best bet is to go with a Linux distribution (or “distro”). This will save you many, many precious hours and some bits of sanity.

Knowing that you’re in the Linux game, it’s now time to pick your distro. The standard Raspberry Pi Linux distro is Raspbian, but there are many others out there. Again, if your a n00b, like me, Raspbian will likey be the easiest to work with. Raspbian probably has the best documentation, the most users (and therefore the most blog/discussion board posts), and it’s very likely that most of the projects you will want to try out will be built for this platform. So go Raspbian!

Once you’ve decided on your OS and distro you have to get that distro onto your SD card. This isn’t necessarily a complicated process but it does involve several steps. Ada fruit has a very comprehensive and easy to follow tutorial outlining different ways to get  Raspbian onto a SD card. There’s also a lot of good information on setting up an SD card available via eLinux. If you have a look at these resources you’ll see that there are a lot of way to get a distro onto a card. Below you will find the exact process that I used to get Raspbian onto my Pi. To set up the card I used a Macbook Pro running OS 10.8.5. This step-by-step guide should be useful for a Mac user who is comfortable-ish using the terminal to execute commands. Don’t be afraid of the terminal, even if the commands may seem  impenetrable!

1. Download Raspbian. I used the Raspbian raw image (zip).
Note: Depending on your internet connection this download could take several hours. Be patient and don’t let your computer fall asleep;

2. Unzip the Raspbian package;

3. Put your SD card into your card reader;

4. Find your card’s BSD Name. To do this:

  1. Click on the apple icon in the top left corner of the screen;
  2. Click About This Mac;
  3. Click More Info…;
  4. Click  System Report…;
  5. If you’re using a built-in card reader click Card Reader; if you’re using a USB card reader click USB;
  6. Locate the card in the list and find Find the BSD Name item. It will probably be something like disk1s1, but your numbers may be different. Write this number down.

5. Open Terminal. Do this by clicking on the magnifying glass in the top right corner of the screen and searching for the word “terminal.” In the terminal window enter the following 3 commands. Make sure you press enter after each line.

diskutil list
diskutil unmountDisk/dev/disk1

Do not cut and paste the command listed below as it is written here. You need to replace the text between the triangular brackets with the path to your .img file. If you don’t know the path to the unzipped .img file, no worries. Just drag the file from the Finder into the terminal and it will fill in the path for you. Confused? Watch a video to see what this means. Also, please note that this example presumes that your BSD Name is disk1s1. If you have a different number you’ll have to replace “1” with that number.

sudo dd if=<path to the unzipped .img file you unzipped> of=/dev/rdisk1 bs=1m

6. The image will now load onto the card. This may take several minutes. Be patient.

7. Once it’s finished loading, open a Finder window and you’ll see that the card has mounted.

8. Eject the disk.  Congratulations! You’ve got Raspbian on your SD card. 

Step 3: Set-up the Pi

To make sure everything works properly you have to make sure you put the Pi together in this order:

  1. Put the SD Card loaded with Raspbian into the card slot on the Pi;
  2. Plug in the USB power adaptor. The lights on the Pi should light up;
  3. Plug one end of the the ethernet cable into your computer’s ethernet port  and the other into the Pi.

Step 4: Log Into the Pi

There are two ways to login to Raspbian. The first and probably easiest method is to plug a monitor, keyboard and mouse into the Pi and use it like you would your regular computer. You need to have a monitor with an HDMI cable to do this. If you don’t have a monitor and/or are comfortable using commands you can use the terminal to log into your Pi. Since the monitor method is pretty straight forward, below you’ll find instructions on using the terminal. If you’re using a monitor skip this step and go right to Step 5: Configure Raspbian.

1. Find your Pi’s IP address. Write down this number. I did this by downloading a free app called IP Scanner.  This program works well, but the free version will only show you the first six devices on your network. If you have more than six devices you may not be able to get your IP address this way. You can also log into your router to see what devices are connected, and grab the IP from this list.

2. Open up a terminal window and enter

ssh pi@192.168.0.xx

Note: be sure to replace “192.168.0.xx” with whatever your Pi’s IP address is.

3. You will get a message asking if you want to continue, type yes to continue.

4. Then you’ll be prompted to type in the password. The default password is raspberry. You can change this later.

5. Then type the following command into the terminal:

sudo apt-get install avahi-daemon

6. You will get a message noting that this action will take up some space on your card. Type Y, for yes, to continue the process. Some packages will be installed on your Pi. This may take a few minutes. Be patient.

7. When the installation is complete type the following command into the terminal:

 sudo reboot

This will reboot the pi. It will shut down and the lights will go off. When the lights come back on you’re ready to proceed to the next step.

8. In the terminal type:

ssh pi@raspberrypi.local

9. Then type:

sudo raspi-config

This will take you into the blue configuration screen

Step 5: Configure Raspbian

In the blue configuration screen:

1. Select Expand File System, and follow the on screen prompts. This will allow you to use all the available space on your SD card.

2. Select Change User Password. This will allow you to set your own password for your Pi.

3. Select Internationalisation Options, then select Change Locale. Here you can select your preferred language, your country and your preferred encoding.

  • You can scroll through this list using your up and down arrows. It may not look like it, but it’s a long list. To select an option press the space bar. If you’re using a Mac you want to make sure you select a UTF-8 option, it’s the most interoperable.
  • FYI, I’m in Canada and want to use English so I selected: en_CA. UTF-8 UTF-8

4. Select Internationalisation Options, then select Change Time Zone. Select your time zone.

5. (optional) You can give your Pi a custom name by changing the host name. Click on Advanced Options, then on Hostname.

  • If you change the hostname you will have to log into your Pi using that name, for example, in the terminal you would type: ssh pi@customname.local

6. Select Finish on the main screen to complete your configuration.

7. Reboot the Pi by typing:

sudo reboot

Leave a Reply