Initial Raspberry Pi Setup

From Domoticz
Jump to: navigation, search

Installation

  1. Use a Class 10 SD card
  2. Make sure you are using a Class 10 SD card ! And a good one! This is important.
  3. Download the latest Raspbian Jessie Lite SD card image. https://www.raspberrypi.org/downloads/raspbian/
  4. Write the image to your SD card (follow these instructions if you need help) Windows,Mac OS X, Linux.
  5. Because ssh is disabled by default, place an empty file name 'ssh' on the SD-card to enable ssh on boot
  6. The Raspberry Pi should be unplugged from power.
  7. Put the SD card in your Pi and connect a mouse, keyboard, Ethernet cable and monitor. Finally plug in the micro USB power supply. This action will turn on and boot your Raspberry Pi.

First time startup

The default username and password are pi and raspberry

Get IP address with local access

The Raspberry Pi image is configured with DHCP, meaning, it will get an IP Address from your router.
If you connect to your router you should see a section with 'DHCP' and see the IP Address assigned to the Raspberry Pi.
Otherwise connect the Raspberry Pi to a monitor and keyboard to gain local access.
Turn on the Raspberry Pi and the monitor and you should see the commandline interface.
Login with the default username and password (pi/raspberry) and issue the following command:

 ifconfig


Using SSH to access the Raspberry Pi (Recommended)

Once you know the IP Address of the Raspberry Pi, you can use a SSH Client (Putty for example) to connect to the Raspberry Pi.
When you are using the ssh command line client in Linux or on Mac OS, you have to add the userid to the ssh command:

 ssh [email protected]<ip-address>


Change the Time Zone and Expand file system

raspi-config

Once you are logged in, issue the following command:

 sudo raspi-config
  • Select the option to expand the root file system
  • We recommend changing the password.
  • Change the timezone to match your locale. Timezone settings is under Internationalization Options
  • Optionally disable ssh. The settings is under Advanced Options
  • Select Finish and choose reboot


Additional setup information

Set Fixed IP address

There are two different alternatives depending on version of SD image.

Version 3530 and earlier (Debian Weezy)

Log in localy or by ssh. Open the network configuration file:

 sudo nano /etc/network/interfaces


And change the code to your liking

iface eth0 inet static
address 10.0.1.10 # << change to an ip address in your network
netmask 255.255.255.0
gateway 10.0.1.1 # << change to your gateway

The interface file could look like

auto lo
iface lo inet loopback
  
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
  
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicat/wpa_supplicant.conf
iface default inet dhcp

Version 4834 and later (Debian Jessie)

Log in localy or by ssh. Open the network configuration file:

 sudo nano /etc/dhcpcd.conf


And add the following code to the beginning, adapted to your adresses

interface eth0
static ip_address=192.168.1.4/24 # << change to an ip address in your network
static routers=192.168.1.1 # << change to your gateway
static domain_name_servers=192.168.1.1   # << change to your DNS 

After closing and saving the file, issue the following commands:

 sudo reboot

Maintaining and updating your system

Keep your OS up to date!

It is always good to keep your system in good shape.
This can be done by logging in local, or by ssh and issuing the following commands:

 sudo apt-get update
 sudo apt-get upgrade

Shutdown properly

I would like to stress out, that you do NOT turn off a system by unplugging the power cable!
This is especially NOT good for Unix systems, and will in the end result in a broken/damaged file system.

To turn off the system, login via SSH (or localy via Keyboard/Mouse/HDMI) and issue:

 sudo poweroff