Tuesday, October 21, 2014

Starting up

Let's start from the very beginning... I know that many people already know how to start with a Raspberry Pi, but for beginners this could be somehow difficult.

In this post I will try to explain the various steps to follow in order to have a Raspberry Pi that is usable without problems.

All my future posts will be based on these steps, unless stated differently. Also I use Windows on my computer to perform some of the steps, so if You need to start from a different system You can go here to find more info about starting from Mac OS or Linux.

First of all You need to put the system on an SD card. A 4GB card should be enough for many projects, but You can surely use a bigger one.

Download Raspbian (debian for RPi) from Raspberry Pi site and unzip it on You pc. Than insert the SD into a card reader and use Win32DiskImager to write the downloaded image to the card.

After few minutes the process is completed and You can remove the SD and insert it into the RPi.

Now You can proceed in two ways:
  • connect the RPi to a TV and a USB keyboard
  • use the RPi headless, trying to connect using SSH (just for models B and B+)

If You wish to connect by SSH, the RPi must be connected to the LAN with a cable and just hope that in the current Debian image SSH is enable. If You can't (or just don't wish to) connect to the LAN (surely with model A You cannot) You have to use the TV and USB keyboard.

To find the address You can look for it inside Your router where You should find a list like the following:


The address with a red underline is the one of my new RPi.

Now You can use any SSH client to connect and proceed. I usually work with Putty.
Now the steps will be the same regardless from which connection method You chose before.

The first thing I do is to set a fixed IP address. This way I can connect without searching for RPi address every time. Also, if needed, I set the wi-fi connection.

Login using the default user/password (pi/raspberry). Edit the file /etc/network/interfaces using the statement:

sudo nano /etc/network/interfaces

or using any other text editor You like and change it like the following:

auto lo
auto eth0
auto wlan0

iface lo inet loopback

iface eth0 inet static
address 192.168.0.45
netmask 255.255.255.0
gateway 192.168.0.1

allow-hotplug wlan0
iface wlan0 inet static
wpa-ssid "wifi_name"
wpa-psk "wifi-pass"
address 192.168.0.46
netmask 255.255.255.0
gateway 192.168.0.1

lo is the loopback connection and should be left untouched.

eth0 is the cable connection. I usually put it in auto and set the static address. Just modify the address, netmask and gateway following Your network specs.

wlan0 is the wi-fi connection. If You don't need a wireless connection, just remove the auto wlan0 and the whole wlan0 section, otherwise You have to change also the wpa-ssid and wpa-psk data to match You wireless LAN, along with the address.

After modifying this file, You can reboot the RPi and connect just using SSH if a wi-fi usb key is inserted or network cable is plugged in.

Now We are going to set the last things. Let's invoke raspi-config using the following command:

sudo raspi-config

Select the first item: Expand Filesystem. This will expand the Debian partition to the maximum extend permitted by the SD card (expansion will be performed on the next boot).

It would be a good idea to change the default password for the user (second menu item). If Your RPi is connected to internet there is always a danger (small or big depending on several parameters).

If You wish to boot using the GUI just select the third menu item. I never use it and sometimes I also remove it from the system. That's up to You.

Finally, in the Internationalization Options You can set all the parameters for Your place, like language, timezone and keyboard layout.

Select the Finish item and let the RPi reboot.

To end our setting up, We need to update Debian and RPi firmware. Just write the following statements:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

And wait for the processes to complete (sometimes Your intervention could be required to proceed).

Now the last reboot and Your Raspberry Pi is ready!

No comments:

Post a Comment