Raspberry pi

From SubSurfWiki
Jump to navigation Jump to search

This isn't about the subsurface, but it is a handy place to drop some notes about setting up my raspberry pi.

I got my raspberry pi from Newark.com. You might find them elsewhere, but beware of markup. The device should cost $35.

Note that the pi board is just that — a board. No cables, no input devices, no power supply. It has two USB ports. You need at least:

  • A micro-USB cable and a 5V power source (eg another computer, or a plug adapter)
  • A USB keyboard
  • A USB mouse, if you want to use the X11 environment
  • An ethernet cable or USB Wi-Fi adapter (if you have a spare port)
  • A way to plug the HDMI-out into a display (panel display, projector, whatever) — you might need adapters or special cables if you don't have HDMI input
  • An SD card with Linux image on it

Preparing the Linux image

I did this on my Mac (also looked at this):

  • Download the distribution you want from [1]
  • Extract the image in the Finder or terminal:
unzip ~/Downloads/2013-02-09-wheezy-raspbian.zip
  • Insert the SD card and from the terminal do
df -h
  • Record the device name of the SD card, e.g. /dev/disk1s1
  • Unmount the partition so that you will be allowed to overwrite the disk:
diskutil unmount /dev/disk1s1
  • Using the device name of the partition work out the raw device name for the entire disk, by omitting the final "s1" and replacing "disk" with "rdisk", e.g. /dev/disk1s1 becomes /dev/rdisk1
  • In the terminal write the image to the card with this command, using the raw disk device name from above:
sudo dd bs=1m if=~/Downloads/2013-02-09-wheezy-raspbian.img of=/dev/rdisk2
  • Note that dd will not give any information until it is finished, and it takes a few minutes; disk will re-mount and prompt will return when complete
  • After the dd command finishes, eject the card:

diskutil eject /dev/rdisk1

  • Remove the card. Yay.

Booting

Most of this is adapted from the Quick Start Guide. It worked beautifully, first time.

  • Put the prepared SD card in the slot on the bottom of the raspberry pi
  • Plug in everything except the power
  • Plug in the micro-USB providing the power
  • On first boot you will come to the Raspi-config window
    • Change settings such as timezone and locale if you want
    • Then select the second choice: expand_rootfs
    • Apply and accept
    • Then select Finish and say ‘yes’ to a reboot
  • The Raspberry Pi will reboot and you will see raspberrypi login: type pi
  • Password: raspberry
  • You will see the prompt:
pi@raspberry ~ $
  • If you want, start the desktop by typing:
startx
  • You will find yourself in a familiar-but-different desktop environment.
  • Experiment, explore and have fun!

Environment

  • Start the X11 environment with
startx
  • Shutdown from the command line with
sudo shutdown -h now