Robert Cudmore    archive    tags    search    software

Installing Raspian Jessie on a Raspberry 2/3

If you are Microsoft Windows based, have a look here for a good install guide.

Download image

As of May 21, 2016 the image was named 2016-05-10-raspbian-jessie. Download here

Copy image to SD card

Follow an installation guide here.

On Mac OS

#Insert SD card and format as Fat32
diskutil list # find the /dev/disk<n>, mine was /dev/disk3
diskutil unmountDisk /dev/disk3 #unmount disk
# copy .img file to disk
sudo dd bs=1m if=/Users/cudmore/Downloads/2016-05-10-raspbian-jessie.img of=/dev/rdisk3

First boot of the Pi

Connect Pi to a router with an ethernet cable and boot

Find IP address using router web interface, usually

Login via ssh

ssh pi@
#password is raspberry

Run configuration utility

sudo raspi-config

Selecting Boot Options -> Console is important. IT seems Raspbian ships with X-Windows on by default.

Update the system

sudo apt-get update  #update database
sudo apt-get upgrade #update userspace
sudo rpi-update      #update firmware (requires reboot)
sudo reboot          #reboot

AFP / Netatalk / Avahi

Once netatalk is installed, the Raspberry will show up in the Mac Finder ‘Shared’ section

sudo apt-get install netatalk

When you mount the pi on OSX, it will mount as ‘Home Directory’ and the space ‘ ‘ will cause problems. Change the name to something like ‘pi3’.

See this blog post to change the name of the mount point from ‘Home Directory’.

Change the default name of your Pi in netatalk

# stop netatalk
sudo /etc/init.d/netatalk stop

# edit config file
sudo nano /etc/netatalk/AppleVolumes.default

# change this one line

# By default all users have access to their home directories.
#~/                     "Home Directory"
~/                      "pi50"

# restart netatalk
sudo /etc/init.d/netatalk start

Setup the network

Configure /etc/network/interfaces

The stock install of Raspian should already have this.

sudo pico /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Edit wpa_supplicant.conf

At Hopkins you want to follow these instruction

sudo pico /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


# "hopkins" wireless for JHU

Tell your router to assign an ip based on MAC address of wifi adapter

ifconfig wlan0

The MAC address is listed as ‘HWaddr’ and in this case is ‘00:0b:81:89:11:8a’.

wlan0     Link encap:Ethernet  HWaddr 00:0b:81:89:11:8a  
          inet addr:  Bcast:  Mask:
          RX packets:1112 errors:0 dropped:837 overruns:0 frame:0
          TX packets:348 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:253265 (247.3 KiB)  TX bytes:56154 (54.8 KiB)

Make the Pi send email with IP on boot

Create an executable python script to send en email with IP. An example

mkdir code
cd code
chmod +x

Make sure the first line in the .py code is #!/usr/bin/python.


Set the email parameters in

to = ''
gmail_user = ''
gmail_password = 'ENTER_YOUR_PASSWORD_HERE'

Run crontab as root and append one line @reboot (sleep 10; /home/pi/code/

sudo crontab -e

Add this to end (sleep 5 does not work!!!!)

@reboot (sleep 10; /home/pi/code/

Now, when pi boots it will send an email with it’s ip. Try it with

sudo reboot

Install screen

sudo apt-get install screen

Any code run inside a screen session will continue to run even after ou logout of the system.

screen #start a screen session
python #start some code
#detatch from screen with ctrl+a then d
#log back in
screen -r #resume your screen session and you will see your code is still running
#don't forget to detatch again with ctrl+a then d
Tags: raspberry, linux

©2017. Robert Cudmore.