The Raspberry Pi is a great little device that can be used for hardware hacking, environment monitoring, electrical engineering, media center and anything else one can imagine. But, the Raspberry Pi does not come with an Operating System. So first things first, we need to install one. The absolute most popular distribution is Raspbian, based on Debian Wheezy.
Write ImageRaspbian comes as a disk image, which needs to be downloaded and written to a SD card. The SD card needs to be at least 4 GB and at least a class 4 (speed). The SD card will then be inserted into the Raspberry Pi and finally powered on. I will be using Linux to write the disk image to the SD card. If you are using Windows, you can use the "Win32DiskImager" tool (See Connecting to the Pi).
The following will download Raspbian and write it to the SD card. At the time of this writing, the latest version of Raspian is 2013-09-25-wheezy-raspbian.zip. Adjust the file name if latest has changed. The disk image is about 600 MB so be patient as it downloads. Writing a 600 MB image to an SD card is also slow (about 7 minutes), so additional patience will be needed here as well.
# wget http://downloads.raspberrypi.org/raspbian_latest # unzip 2013-09-25-wheezy-raspbian.zip # sudo dd if=2013-09-25-wheezy-raspbian.img of=/dev/sdh bs=1M
The /dev/sdh is the device node my USB SD card reader/writer appeared as. I used dmesg, after connecting the USB device, to determine this.
Now that we have the image written to the SD card, we can plug it into the Raspberry Pi and power it on. To make life easier one should connect an HDMI (or RCA video) to both the Raspberry Pi and a TV, connect a USB keyboard and mouse (optional), connect network via Ethernet (optional), connect finally connect power through a USB Micro cable. The Raspberry Pi will now begin to boot, and you should see the boot process, with a little raspberry image logo, on your TV.
raspi-configOn the first boot, you will be presented with the text dialog based raspi-config tool.
This tool can be used to configure a variety of features, but for now it is important to just "Expand Filesystem". This will take our 600 MB image and expand it out to the full size of our SD card, which can vary in size.
The other 3 options I like to change at this point are User Password, Boot to Desktop, Time Zone (found under Internationalization Options), Hostname (under Advanced Options), and Memory Split.
If you would like to announce to the world your usage of the Raspberry Pi, select the Add to Rastrack option, which will add this Pi to the online Raspberry Pi Map. Others can then see your Pi on the Rastrack map.
If you need to modify these configurations at a later time, the raspi-config tool can be rerun with:
# sudo raspi-config
The raspi-config tool can also be run over SSH, if that is more convenient.
Once you are happy with your changes, quit out of raspi-config. It will ask if you would like to reboot, if needed, and you should.
Desktop vs HeadlessThere are two modes the Raspberry Pi is commonly run in: desktop and headless. Raspbian defaults to booting to headless mode.
With desktop, one is interested in interacting with the Pi through a GUI with mouse and keyboard. Within raspi-config, you will want to set the "Boot to Desktop" option and also modify the "Memory Split" to the 64 MB default, or higher. The "Memory Split" determines how much memory is allocated to the GPU.
With headless, (Raspian's default) one is interested in interacting remotely with the Pi through SSH or a web interface. You will want to set the "Boot to Console" option and drop the "Memory Split" to a minimal 16 MB.
Default LoginRaspbian is setup with a default user by the name of "pi". The default password for user pi is "raspberry", unless this was changed within raspi-config.
NetworkingThe Raspberry Pi is far more useful with network access. Simply connect an Ethernet cable to Raspberry Pi and it should acquire an IP address on boot. To determine your IP address, run the "ifconfig" command.
# sudo ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:28:ea:55 inet addr:10.10.10.47 Bcast:10.10.10.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ...
With the IP address, you can now connect to the Raspberry Pi over SSH, which opens a world of possibilities.
Wireless access is also possible, but you will need to purchase a WiFi dongle and modify some configuration files.
System UpdateLastly, there are constantly changes being made to the packages installed. Raspbian (Debian based) uses APT for package management. To keep your system updated, you should occasionally run the following commands:
# sudo apt-get update # sudo apt-get upgrade # sudo apt-get dist-upgrade # (optional)
APT Package ManagementA quick overview of APT package management... (I use the package "screen", a terminal multiplexer, in this example
To install a package: (apt-get install [package])
# apt-get install screen
To uninstall a package: (apt-get remove [package])
# apt-get remove screen
To search for a package: (apt-cache search [package])
# apt-cache search screen
To see package informaiton: (apt-cache show [package])
# apt-cache show screen