Raspberry Pi - First Time Configuration

"sudo make me a sandwich"

On this page

Booting Up The First Time

  1. Download the latest Raspbian image if you haven't already.
  2. Use Win 32 Disk Imager to write the image to your SD card (follow these instructions if you need help).
  3. Put the SD card in your Pi and connect a mouse, keyboard, and screen. Connect a power adapter last.
  4. If everything went well, you should see text appear on the screen as your Pi is booting up.

A Little Bit About Linux

Raspbian is an Operating System based on Linux (Debian) but optimized for the Raspberry Pi. While it comes with a Graphical User Interface (GUI), we won't be using it. Everything can and will be done using the console only.

If you have never worked with Linux before, it may seem a bit intimidating. That's okay. The trick to mastering Linux is to pretend you know what you're doing and when you've been doing that for long enough you will no longer need to pretend.

For now, three things you should know:

  1. Many commands start with sudo. This is a way to tell Linux "do this as an administrator". If you get an error message that sounds like "permission denied", odds are you can repeat your command with "sudo" at the start to make it work.
  2. You can paste text into MobaXterm. This way you don't have to worry about retyping a command exactly as you see it here. Just copy the text to clipboard, and in the terminal you right-click where you would type and select "Paste".
  3. nano is a simple text editor for linux. You'll be using it a lot when working with configuration files. If you're a masochist, you can replace "nano" with "vi" whenever you see it for a different text editor.


pasting text in MobaXterm

Raspi-Config

  • If you downloaded Wheezy then the first time you boot up your pi it will automatically open raspi-config.
  • If you downloaded the newer Jessie then you can open up a Terminal window and type "sudo raspi-config" (and press enter).
  • If you downloaded Jessie-lite then you can type "sudo raspi-config" at the prompt (and press enter).

If you're asked for a login, the default is "pi" with password "raspberry".

Here's what you should configure the first time:

  1. Expand the file system (to make sure the OS can access the entire SD card)
  2. Change the user password (and don't forget it!)
  3. Under Enable Boot to Desktop/Scratch or Boot Options, make sure Console is selected, so you don't have to deal with that silly GUI
  4. Internationalisation Options: change the timezone to where you live (eg. US - Eastern)
  5. Under Advanced Options, go to SPI (A5) and enable it (we'll need this later when we connect things to the GPIO pins)


raspi-config

Use the right arrow to select Finish at the bottom and reboot (if it doesn't ask you to reboot, just type sudo reboot and press enter). When it asks for your username, enter "pi". The password is the one you just set in the second step.

Change Your Pi's Host Name

By default your Pi will be called "raspberrypi". If you want to change it to something more descriptive, or to avoid confusion if you have multiple Pi's, you can change its hostname.

You'll need to edit 2 files. In both files, replace "raspberrypi" with the hostname of your choice. In the "hosts" file, the name will be on the line with "127.0.0.1":

sudo nano /etc/hosts
sudo nano /etc/hostname

Then you can commit the change (only necessary if you're ahead in this guide and already connected to the Internet) and reboot:

sudo /etc/init.d/hostname.sh
sudo reboot

Next

And for our next trick, we will connect to the Internet.

Raspberry Pi - The Internet