Raspberry Pi Setup – Quick and Simple

After a couple months of playing around with the Raspberry Pi and having to reinstall everything a couple of times for several reasons, we thought it would be useful to document what commands we were running, packages we were installing, and throwing in a couple tips along the way. *the initial install and backup instructions are for OS X, if you would like windows instructions for the initial Raspberry Pi setup, check out their wiki

Installing Wheezy:

Start off by getting Raspbian Wheezy here: http://www.raspberrypi.org/downloads

Open up Terminal in OS X and insert your SD card.

Run df -h look for a device that is the same size a. Record the device name of the filesystem’s partition, for example, /dev/disk3s1. If you are unsure which is the correct device, you can run the df -h command with and without the card inserted, that should make it more obvious.

Unmount the partition so that you will be allowed to overwrite the disk:

sudo diskutil unmount /dev/disk3s1

(or: open Disk Utility and unmount the partition of the SD card (do not eject it, or you have to reconnect it) (What is the sudo command?)

For the next steps you are going to be referencing that disk, but with a slightly modified name. You get rid of the s1 and add an r before disk#.

For example, /dev/disk3s1 => /dev/rdisk3

In the terminal install the image to the card with this command. Make sure that you use the modified name from the previous step and that you are using the correct SD card. (What is the dd command?)

sudo dd bs=1m if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/rdisk3

*now be patient, this could take a couple minutes with no output, just a blank link in the terminal until it is complete.

After the dd command finishes, eject the card:

sudo diskutil eject /dev/rdisk3

— now that it is installed, set it up

plug the SD card into your Raspberry Pi and power it up. Your default username and password are ‘pi’ and ‘raspberry’.

Your first boot will show a menu to allow for quick configuration options. If you are dedicating your SD card to the raspi, we recommend expanding the SD partition that you created when installing the OS to the full size of the card (it will make a 2GB partition by default). To do that, either select it from the menu on first boot, or do the following:

sudo raspi-config


If you are on a network already, but if not this could prove very useful.. especially if you are running the Raspberry Pi without a monitor.

I initially connect with a serial usb console cable so that i can run things head-lessly, this DOES requre a USB wifi dongle however. If you would like to connect to a wifi network quickly and without much hassle, run the following: (not SSID is the network you are connecting to and PASSWORD is the network password

wpa_passphrase SSID PASSWORD

This will spit out some copy which is what you need for your wifi configuration, copy the output to the /etc/network/interfaces as follows :

sudo nano /etc/network/interfaces/
  • paste at the bottom

hit ctrl X to finish editing the file, ‘y’ to save, and ‘enter’ to approve the name.

Now you should just be able to reboot (sudo reboot) and be connected to your network.

It is always a good idea to make sure that everything you are working with is up to date. In Linux a lot of the packages that you are going to need rely on the latest and you use a command called apt (Aptitude) to install and update them. So the first thing you should do is update all of your packages.

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install raspberrypi-bootloader

Here are some other packages that are quite useful, and we needed to work through a lot of the stuff with the Mindwave Mobile.

sudo apt-get install git-core

sudo apt-get install -y mercurial gcc libc6-dev

This is a nice way to quickly adjust the name of your device. It can actually be quite useful if you have multiple Raspberry Pi’s running on the same network.

sudo nano /etc/hostname

change ‘raspberrypi’ to a name of your choice

save and close (ctrl X, y, enter)

sudo nano /etc/hosts

replace raspberry with your new name from the previous step

::1 raspberry localhost6.localdomain6 localhost6 raspberry

sudo reboot

Now that you are a little bit customized, updated and online, its time to start installing the more interesting packages. The following will install VNC/Bonjour/Avahi which will make connecting to your Raspberry Pi a LOT easier over the network, just go through (line-by-line and do the following)

sudo apt-get install netatalk

sudo apt-get install avahi-daemon

sudo update-rc.d avahi-daemon defaults

sudo nano /etc/avahi/services/afpd.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->

<!DOCTYPE service-group SYSTEM "avahi-service.dtd">


  <name replace-wildcards="yes">%h</name>





sudo /etc/init.d/avahi-daemon restart

sudo apt-get install tightvncserver

This will initialize your VNC Server, you will need to run this every time you want to be able to connect (unless added to a startup script)

vncserver :1

— enter password, no to read only

If you are planning to use bluetooth devices with your Raspberry Pi, and you have a dongle already; the following will get that setup for you. The patch listed was required to pair with the Mindwave Mobile and would probably not be needed if you are just setting on a keyboard or mouse.

sudo apt-get install bluetooth bluez-utils blueman

*this will take a little while to install, feel free to step away but make sure you hit “y” to allow it to install.

Reboot your Raspberry Pi.

Patch the /usr/bin/bluez-simple-agent script. Replace “KeyboardDisplay” with “DisplayYesNo”.ls

Once you have your dongle connected and the library from above is setup, it is time to find and install the device(s). Make sure that your device is detectable and run:

hcitool scan

You will get a list of devices that are available for your bluetooth connection. Make not of the MAC address for the next steps.

These commands will pair your raspi with the bluetooth device, and then will allow it to auto connect to the device. Note that XX:XX:XX:XX:XX:XX is the MAC address that you made a note of in the previous step.

sudo bluez-simple-agent hci0 XX:XX:XX:XX:XX:XX

sudo bluez-test-device trusted XX:XX:XX:XX:XX:XX yes

Our last suggestion is that you create a backup of a fully updated and setup Raspberry Pi.  To do this, shutdown your Raspi and take out the SD card.  Put the SD card back into your computer and launch terminal again.  To backup the SD card, you need to use DD just like you did to install the OS originally:

sudo dd if=/dev/deviceid of=/home/username/backup.img

Now, you might need to restore that image at some point.  To do that, you can use the following:

sudo dd if=/home/username/backup.img of=/dev/deviceid

That’s all for now, check out our Glossary of Terms for Linux / Raspberry Pi if you are a little confused about anything that you read, we will be updating some of the terms over time as needed. Also stay tuned for future posts about connecting your Raspberry Pi with the Mindwave Mobile and with Arduino.

Lets not forget to give a little credit to the many great forums and blog posts that helped us through a lot of issues when starting up.







7 Replies to “Raspberry Pi Setup – Quick and Simple”

  1. Thanks a million for the great tutorial. However, I’m having a small problem I’m hoping you might know something about. I’ve followed all of the instructions to the letter and have installed all of the packages. But mysteriously, when i run read_mindwave_mobile.py i get an import error “No module named bluetooth”. I do have bluez installed. I also have a bluetooth dongle attached and have successfully gotten the mac address of the mindwave.

    I’m so stoked to have gotten this far and i’m only one step from crossing the finishing line, if it wasn’t for this tiny issue. I would be eternally grateful for any help.

    1. Hey Garth, sorry for the slow response.. we have been getting dumped on with random spam comments. did you adjust the MAC address in your mindwave config? I think that i had the same issue and it was potentially related to the bluetooth either not being installed correctly or explicitly looking for a keyboard.

    2. have you installed pybluez?
      sudo apt-get install python-bluez

      If that resolves it, I will updated the tutorial to reflect that. So please let me know if that does the job for you.

Leave a Reply to Richard Cancel reply

Your email address will not be published. Required fields are marked *