Raspberry Pi Setup

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"greg@udon.org", "url"=>""} on March 17, 2016 · 4 mins read

Here are my setup steps for a new Raspberry Pi. I assume Raspbian has been installed. The setup file associated with this post are available on GitHub.

Expand Filesystem

Before we start the process, check the filesystem size and expand if there's additional space on the SD card that you want to use.

df -k

Run raspi-config and choose the first option to expand the root filesystem:

sudo raspi-config

Reboot the Pi after you've run the re-size.

Setup Script

Since I first wrote this, I've now created a script to do these tasks and I have the script send me an SMS message at various points using textbelt to let me know the status. In addition, I copy the following config files:

/etc/wpa_supplicant/wpa_supplicant.conf
/home/pi/.conkyrc
/etc/X11/Xsession.d/80autostart

Here's a direct link to the setup script.  You can stop here but if you want more information on some of the installation read on.

Update Pi

First step is to apply updates to Raspbian if you haven't done that recently:

sudo apt-get update -y

WiFi

I like setting up WiFi via the command line and this comes in handy if you want the Pi to be preconfigured for multiple WiFi locations. You can scan the available WiFi networks using the command:

sudo iwlist wlan0 scan

To configure multiple WiFi networks, edit the /etc/wpa_supplicant/wpa_supplicant.conf file and enter a block like this for each WiFi you want the Pi to search for:

network={
    ssid="testing"
    psk="testingPassword"
}

Within a few seconds your Pi should connect to the WiFi when it sees the change to the wpa_supplicant.conf file. You can manually restart the interface with these commands:

sudo ifdown wlan0
sudo ifup wlan0

xrdp

RDP is much faster than VNC. This command installs xrdp and starts the daemon

sudo apt-get install xrdp

You should now be able to connect to your Pi with an RDP client and login as the pi user.

Latest Chromium

To install the latest release of Chromium (another location of the Chromium arm distributions can be found here).

wget https://dl.dropboxusercontent.com/u/87113035/chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb
wget https://dl.dropboxusercontent.com/u/87113035/chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
wget https://dl.dropboxusercontent.com/u/87113035/chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb

Chromium should now be installed.

Conky

I like Conky to be displayed on the desktop showing key system information. Install Conky

sudo apt-get install conky

Create the /home/pi/.conkyrc file. Here's my conkyrc and what it looks like on my desktop:

ConkyScreenShot

emacs

Gotta have emacs:

sudo apt-get install emacs

LXDE

I referred to configuring LXDE in a previous post but I now setup the LXDE configuration via an autostart file in /etc/X11/Xsession.d. I use the script because I want to set some of the values in the LXDE file dynamically. In my case, I'm use this configuration to setup the Pi as a Kiosk. I call this file /etc/X11/XSession.d/80autostart:

echo "@lxpanel --profile LXDE-pi" > /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@pcmanfm --desktop --profile LXDE-pi" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@xscreensaver -no-splash" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@sh ${HOME}/.config/lxsession/LXDE-pi/autokey.sh" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@xset s off" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@xset -dpms" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@xset s noblank" >> /home/pi/.config/lxsession/LXDE-pi/autostart
echo "@conky -c /home/pi/.conkyrc" >> /home/pi/.config/lxsession/LXDE-pi/autostart

CPU=`cat /proc/cpuinfo | grep Serial | cut -d ':' -f 2 | sed -e "s/ //g"`
HW=`cat /proc/cpuinfo | grep Hardware | cut -d ':' -f 2 | sed -e "s/ //g"`
REV=`cat /proc/cpuinfo | grep Revision | cut -d ':' -f 2 | sed -e "s/ //g"`
URL=http://display.news/kiosk/#/${CPU}/${HW}/${REV}

echo "@chromium-browser --noerrdialogs --kiosk --incognito --disable-restore-session-state ${URL}" >> /home/pi/.config/lxsession/LXDE-pi/autostart