Getting started with Raspberry Pi
Raspberry Pi is a credit-card sized single-board computer which can be used for variety of purposes. The official operating system for Raspberry Pi is Raspbian. Rasbian and Ubuntu both are derived from Debian, providing seamless access to thousands of software package ready to go via Advanced Packaging Tool. Compared to other similar single-board computers Raspberry Pi has vibrant community and plenty of code examples that you can run out of the box. Before you continue make sure you're comfortable with basic command-line usage, if that's not the case take a look at CodeAcademy track for learning command line.
Preparing SD card
Before you continue make sure you have backed up any important data on the SD-card
Download and uncompress Raspbian:
wget https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/2015-05-05-raspbian-wheezy.zip unzip 2015-05-05-raspbian-wheezy.zip
For Linux there is no need to fetch extra tools to write the image to a SD card, simply use dd
:
sudo dd bs=4M if=2015-05-05-raspbian-wheezy.img of=/dev/mmcblk0
If you're running on Windows, you can use Win32 Disk Imager to write the image to the SD card.
Powering up
Use USB-UART bridge to power up Raspberry Pi and gain access to the command-line.
Accessing command-line
For Linux there are variety of programs for connecting to serial port:
screen /dev/ttyUSB0 115200 picocom /dev/ttyUSB0 -b 115200 minicom -b 115200 -o -D /dev/ttyUSB0
For Windows you need to install driver for your USB-UART bridge first. Then you can use built-in HyperTerminal, PuTTY or KiTTY for connecting to the virtual serial port.
Setting up network
Raspbian as Debian attempts to request IP address using DHCP on the Ethernet port.
This assumes a functioning DHCP server on the network, which is the case most of the time.
If you want to connect your laptop directly to the Raspberry Pi you can set up manual IP addresses.
The networking configuration is stored in /etc/network/interfaces,
remember to issue service networking restart
after you've tweaked the configuration.
Remote shell
For more convenient access to command-line SSH is recommended. You can start by installing OpenSSH server on Raspberry Pi:
apt-get install openssh-server
Assuming Raspberry Pi sits on an DHCP enabled network you can use following on your Linux laptop to connect to remote shell:
ssh pi
Otherwise determine the IP address of your Raspberry Pi, for example with ip addr list
:
ssh 192.168.x.x
Make your life easier by setting up public key authentication. Note that while you are connected via USB-UART bridge you can add your public to Raspberry Pi as follows:
mkdir -p /root/.ssh cat - >> /root/.ssh/authorized_keys # Paste now # Press Ctrl-D
Beyond installation
Once you are comfortable with Raspberry Pi command line and SSH you can do a lot of cool stuff:
- Set up PulseAudio network sink and use Raspberry Pi as wireless speakers.
- Set up motion and use Raspberry Pi with USB webcam as a IP camera.
- Set up hostapd and [1] and turn your Raspberry Pi into a wireless hotspot.