Setup RPi

RaspberryPi Setup

Buy a RaspberryPi 3
(Ebay affiliate link):

Raspberry Pi 3 Model B Quad Core 1.2GHz 64bit CPU 1GB RAM WiFi & Bluetooth 4.1


Turn RaspberryPi on and off

How to turn the unit on:

  • insert power supply

How to turn the unit off:

  • sudo poweroff

  • sudo halt -p

  • sudo shutdown -h now

The unit is off when only the red PWR led on the RPi  is on.

Note: Do not pull the power-connector while the unit is running.

Install SW

Download Raspbian

  1. Unzip downloaded file

  2. Write image to SD card (use: dd when Linux)

    1. Find SD-card device:  df -h

    2. Unmount SD-card(all partions): umount /dev/sdxx

    3. Format and install: dd bs=4M if=~/raspbianImage.img of=/dev/sdxx

  3. Raspbian default account: user=pi password=raspberry

Install packages

apt-get update

apt-get upgrade

apt-get install vim

apt-get install apache2

apt-get install php5

apt-get install zip

apt-get install xrdp  // remote desktop

apt-get install git-core

apt-get install arduino

apt-get install python-pip

apt-get install picocom

apt-get install tree

apt-get install python-rpi.gpio python3-rpi.gpio

Change password:

Command: passwd

user: pi  pswd: <your password>

Auto start application

Edit file:


Add line:  /var/www/bessvx/bessvx &  (This is an example)

Set system time

dpkg-reconfigure tzdata

Expand Memory Used on SD card

sudo raspi-config

Ubuntu Mate:

sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). (error message will occur - ignore)

Reboot the system, then issue:

sudo resize2fs /dev/mmcblk0p2

Start: rdesktop from another linux computer

rdesktop pi@ (example)

SCP without password


ssh-keygen -t rsa


Initial installation

apt-get install vim

Set keyboard layout

Edit /etc/default/keyboard

Change to ‘se’ (Swedish)

Install support for remote desktop:

sudo apt-get install xrdp

Enlarge disc usage SD card:

sudo raspi-config

Rename the device:

Edit file: /etc/hostname

Auto start of programs

Edit file: /etc/rc.local

Wifi Setup

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

Start Desktop from terminal

Type: startx

Install pyserial

apt-get install python-pip

pip install pyserial

Arduino from terminal


  • git clone git://

  • pip install ino

ino init -t blink

ino list-models

ino build -m nano328

ino upload -m nano328

Install libraries (OneWire etc) in directory:  your-project/lib


Create new file: “.vimrc” in home directory (root and pi). Edit file:

:syntax on

:set number


Copy Paste:   y (copy)  p(paste)

Python with RPi.GPIO

If RaspberryPi 2:

sudo apt-get update

sudo apt-get install python-rpi.gpio python3-rpi.gpio