Getting started with Raspberry Pi

From ICO wiki
Revision as of 20:07, 5 September 2015 by Lvosandi (talk | contribs)
Jump to navigationJump to search

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 if=ubuntu-14.04.3-desktop-amd64.iso 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 [1]. 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 address. 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

While connected via USB-UART bridge add your private key to Raspberry Pi as follows:

mkdir -p /root/.ssh
cat - >> /root/.ssh/authorized_keys
# Paste now
# Press Ctrl-D

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