Raspberry Pi configuration

From ChemWiki
Revision as of 12:02, 20 September 2019 by Jbettenc (Talk | contribs)

Jump to: navigation, search

This page records the process of configuration of the Raspberry Pi computers (presently version 2 model B) used on the Measurement Science labs in 1st and 2nd year.

The goal is to setup an operating system image which will be made available via an NFS server, and all Pi computers will run this identical image.

The process starts by booting a Raspbian Buster Lite image from an SD card.

Most of the process is done on the command prompt with command lines starting with an '$' . Many of the commands require extended privileges to run and therefore need to be preceded by the command sudo.

Changing default password

The default configuration includes the user with login 'pi' and password 'raspberry'. We will keep this local user but change the default password. This can be done by running the utility raspi-config and choosing 'Change user password'.


Changing the network configuration

The default configuration allows for the Pi to connect to the College network out of the box. Nevertheless, the default configuration runs a DHCP daemon which is not needed, only a DHCP client is needed to obtain an IP address from the College DHCP servers.

Add the following 2 lines at the end of the /etc/network/interfaces file

auto eth0
iface eth0 inet dhcp

And uninstall the DHCP daemon

$ apt purge dhcpcd5


Installing packages

Change archive mirror

This is not strictly necessary, but a much greater bandwidth is accessible by downloading packages from the University of Oxford mirror. In /etc/apt/sources.list change the line starting with deb to read

deb http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/ buster main contrib non-free rpi

To start with an updated system run the following commands

$ apt update
$ apt upgrade


Trimming down the image

This is again not necessary, but while the Raspbian Lite image is rather small, still it contains bits of software which are not needed and can be trimmed further. For example, the Raspberry Pi 2 board does not have wireless or bluetooth capability, and these are not needed for the labs, therefore related packages can be removed

$ apt purge pi-bluetooth bluez wireless-tools wpa_supplicant iw crda

The different firmware packages installed can also be removed.

For our purposes all Python 2 (but not Python 3) packages can be removed.

There are several daemons that are running in the default installation and that are not needed. This includes the ssh server and the triggerhappy deamon.

$ apt purge openssh-server triggerhappy


Installing a graphical environment

For ease of use we want to install a graphical environment.

$ apt install --no-install-recommends raspberrypi-ui-mod lxde pi-greeter pishutdown raspberrypi-artwork rpi-icons rpi-wallpaper xserver-xorg-video-fbturbo

Let us add to that a web-browser and a pdf reader

$ apt install --no-install-recommends epiphany-browser xpdf

Also an office productivity suite:

$ apt install --no-install-recommends libreoffice-calc libreoffice-writer libreoffice-math libreoffice-draw


ImageJ

ImageJ is an imaging processing software that is used in some experiments. Installing will also install the necessary Java machinery.

$ apt install --no-install-recommends imagej


IPython and Jupyter notebooks

To get an ipython shell and a useful scientific python environment

$ apt install --no-install-recommends ipython3 python3-numpy python3-matplotlib python3-scipy python3-pandas python3-sympy

The last two packages are not critical, but can still be useful.

Additional, to get Jupyter notebooks running you need a Javascript able web-browser and to install the following packages

$ apt install --no-install-recommends jupyter-notebook jupyter-nbformat jupyter-nbconvert


Login with College credentials

We want to setup the system to use the College LDAP directory such that users can login using the College login and password. Also the home directory should be the College H: drive share and not a local directory on the computer or the NFS image.

Login setup

First we need to install some packages

$ apt install --no-install-recommends libpam-ldapd libnss-ldapd nscd ldap-utils

A prompt will show up asking for the LDAP server URI, use

ldap://unixldap.cc.ic.ac.uk/

In the following prompt about the name search base, use

ou=everyone,dc=ic,dc=ac,dc=uk

When asked about the services for which to use LDAP lookups, select 'passwd', 'group' and 'shadow'.


Mount H: drive as home directory

This will create a directory /home/'username' and mount the H: drive as a CIFS (aka Samba) file system there. First we need to install some packages:

$ apt install --no-install-recommends libpam-mount libpam-mount-bin cifs-utils

We now need to edit the file /etc/security/pam_mount.conf.xml.


Other configurations

Configure College time servers

In order to keep time accurate we can configure the system to synchronized the clock with the College time servers. Edit the file /etc/systemd/timesyncd.conf to include the lines

[time]
NTP=time1.ic.ac.uk time2.ic.ac.uk time3.ic.ac.uk


Configuring printing

The server jbe-nfssever.ch.ic.ac.uk has a configured print server that the Pis can point to. To do this, install

$ apt install --no-install-recommends cups-client

Create the file /etc/cups/client.conf, with the following line in it

ServerName jbe-nfssever.ch.ic.ac.uk