Lately I’ve been doing some projects with the Raspberry Pi. The Raspberry Pi is a small computer on a single circuit board using an SD card as it’s hard drive. I decided to share some of the things I’ve done with mine starting in this post with how I set up the operating system.
Note that there are different ways to install an OS on the Raspberry Pi as well as different OSes. I chose to install Raspbian, a variant of Debian Linux. In all cases an SD card is needed as that’s the storage mechanism.
First we’ll set up the SD card:
- Format a new SD card (minimum 4GB in size) as FAT. I used the Mac OS X DiskUtility (Erase” with “MS-DOS” format). Windows users can use the SD Association’s Formatting Tool. Be sure to set the “FORMAT SIZE ADJUSTMENT” option in the “Options” menu to “ON”.
- Download the latest version of NOOBS.
- Unzip the contents of the .zip file.
- Copy the contents of the .zip file to the root of the SD card. (This can be done using the dd command on a Mac or Wind32 Disk Imager on Windows.)
Now that our SD card is set up we’re ready to move over to the Pi.
- Eject the SD card from the Mac or PC and insert it into the Raspberry Pi.
- Set the Raspberry Pi up with an HDMI monitor, keyboard and mouse.
- Power up the Raspberry Pi.
- Once the Raspberry Pi has completed booting you will be in the NOOBS interface. Click the Raspbian checkbox and click the ‘Install’ button.
- When the confirmation pops up click the ‘Yes’ button. (This confirmation is warning you that any existing data on the SD card will be overwritten.)
Raspbian will now install. The progress bar at the bottom of the install dialog will let you know how far along the install process is. It may take a while.
When the install completes a dialog will appear letting you know your OS is installed. Click OK. The Pi will now re-boot, complete some housecleaning for the OS to run and launch the GUI for Raspbian.
Now it’s time to set up our WiFi adapter. This can be done either from the GUI or the command line. We’ll do this via the GUI since we’re already there.
- Click the Network icon in the taskbar and select your wireless network from the list that appears.
- Type your WiFi password into the dialog that appears and click the ‘OK’ button
Now we will set a few preferences:
- From the Menu select Preferences->Raspberry Pi Configuration.
- In the System tab change the ‘Boot’ preference from ‘To Desktop’ to ‘To CLI’. This will make the Pi boot to the command line without loading the GUI. (The GUI can always be loaded from the command line by typing ‘startx’.)
- Go to the ‘Localisation’ tab.
- Click the ‘Set Locale’ button, select your Language and Country and click the ‘OK’ button. A message will appear saying ‘Setting Locale’. Once this completes you can continue.
- Click the ‘Set Timezone’ button.
- Select your Area and Location then click the ‘OK’ button.
- A message will appear saying ‘Setting Timezone’. Once this completes you can continue.
- Click the ‘OK’ button in the ‘Raspberry Pi Configuration’ dialog.
- In the ‘Reboot needed’ dialog click the ‘Yes’ button to reboot. Upon rebooting you should be at the command line.
If things went correctly you should now have WiFi access. Type the following:
sudo ping 188.8.131.52
If you get a response then you have an internet connection. Hit CTRL-C to end the ping.
You should also have SSH functionality. To see if this is working do the following:
- From the command line type the following command and hit enter:
This will show your current network configuration. Find your wireless connection (it will probably be wlan0) and find the ‘inet addr:’ setting (it’s probably the first setting on the second line).
- Now go to a terminal window on another computer (Terminal on Mac, Putty on Windows) and SSH to the IP address found in step 1 using the username pi and password raspberry.
If you’re connected then you have ssh access to your Pi.
Now you’re ready for whatever else you want to do with your pi.