Koha on a Raspberry Pi 3 B+

These instructions cover setting up the latest version of Koha 17.11 on a Raspberry Pi 3 B+.
This is not a step-by-step guide, but hopefully this will help you get Koha installed.
It is still a work in progress - some items are marked as TO DO!
Notes:
* All commands are run as sudo (the default Raspbery Pi user is pi and the password is raspberry)
* An alternative is to type sudo su so that you become the root user.
* This sets up an experimental system, not something for production.
== Overview ==
Stages for installing Koha on a Raspberry Pi 3 B+:
* Install Raspbian Lite (a port of Debian Stretch minimal version)
* Start the SSH server
* Set the language and locale (if required)
* Add the Koha package source information
* Install Koha
* Enable Plack
* Enable memcache
== Install Raspbian Lite (a port of Debian Stretch - minimal version) ==
You need to have a working install of Raspbian Lite, which is a minimal Debian Stretch install. It should work with Raspbian (the full desktop version), but this may affect performance.
Refer to the Raspberry Pi website - they have some good documentation.
1. Format an SD Card as FAT32 (on Ubuntu 17.11 - insert into SD Card slot or adapter, use the Drive utility to format and partition the SD Card).
2. Download the latest NOOBS (2.8.0 at time of writing) from https://www.raspberrypi.org/downloads/noobs/
3. Unzip NOOBS.
4. Copy the NOOBS files to the SD Card.
5. Insert SD Card into Raspberry Pi, connect network cable, HDMI cable, and USB keyboard and mouse.
6. Connect to power using a micro USB connector with power charger.
7. Follow instructions for installing Raspbian Lite (or Raspbian for the desktop version).
Login as user pi with the password 'raspberry
== Start the SSH server ==
Start the SSH server: sudo service ssh start
Check that you can login from another computer using the ip address assigned to the Raspberry Pi: ssh pi@xxx.xxx.xxx.xxx
To find the ip address: sudo ip a
Note: If you have assigned your Raspberry Pi a fixed ip address or a domain name, then use that instead.
== Set the language and locale (if required) ==
Your language and locale needs to be set correctly, otherwise there is an error when enabling Plack (a later step).
The easiest way to do this is to use the Raspberry configuration utility: sudo raspi-config
1. Select option 4 - Localisation options.
2. Choose I1 Change locales
3. Reconfigure locales to suit your requirements (use the space bar to select or unselect). (In my case this was unselecting en_GB (using the space bar) and selecting en_NZ.)
4. Select OK.
5. Choose the default locale.
6. Select OK.
You may also want to set the correct time zone as well.
== Add the Koha package source information ==
1. Add the source information for the Koha package:
 echo deb [arch=i386] http://debian.koha-community.org/koha stable main | sudo tee /etc/apt/sources.list.d/koha.list
2. Add the key:
 wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -
3. Update the list of packages:
 $ sudo apt-get update
Note: there should be no error or warning messages, if there are you will need to fix them.
4. Update any packages that need updating:
 $ sudo apt-get upgrade
5. Clear the local repository of retrieved package files to save disk space:
 $ sudo apt-get clean
== Install Koha ==
This is just a truncated version of the normal Koha installation instructions.
1. Install the Koha packages:
 $ sudo apt-get install koha-common
 
Note: This will take a while as it downloads and installs all the packages required for Koha.
 
2. Install a database server (unless you are connecting to a remote database server):
 $ sudo apt-get install mariadb-server
 
Note: as an alternative you can install MySQL - $ sudo apt-get install mysql-server
3. Edit the Koha configuration file your domain name or ip address: /etc/koha/koha-conf.xml
4. Create a Koha instance
5. Configure the Apache web server:
* option: use an ip address
* option: use a server name
[TO DO]
* https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages#Appendix_A:_Named-based_vs._IP-based_installations
* https://www.bibliotechzw.com/blog/solved-how-to-install-koha-on-ubuntu-server-16-04-lts/
Update ports - edit ports.conf and add Listen <port-number], for example: Listen 8080
7. Access the configured ip address or domain name to start the Koha web installer.
 
== Enable Plack ==
Plack speeds up page requests and makes a significant improvement to performance.
 $ sudo koha-plack --enable <instance>
 $ sudo koha-plack --start <instance>
 $ sudo service apache2 restart
 
Reference: https://wiki.koha-community.org/wiki/Plack
== Enable memcache ==
[TO DO - this is not yet finished or tested]
1. Install the memcached server: sudo apt-get install memcached
2. Enable memcache in /etc/koha/koha-sites.conf: change USE_MEMCACHED="no" to USE_MEMCACHED="yes"
3. Restart Apache web server: sudo service apache2 restart.
4. Check the about page to see if memcache is correctly configured.
Notes:
* Does this have to be done before or after you create the Koha instance?
* https://wiki.koha-community.org/wiki/Performance#Memcache
* https://wiki.koha-community.org/wiki/Troubleshooting_memcached
* http://www.bloovis.com/2017/01/18/koha-on-linode.html
== General reference ==
Raspberry Pi community:
* https://www.raspberrypi.org/
Raspberry Pi Guides:
* https://www.raspberrypi.org/learning/software-guide/quickstart/
Previous instructions:
* https://wiki.koha-community.org/wiki/Koha_on_a_Raspberry_Pi
* https://wiki.koha-community.org/wiki/Koha_on_a_Raspberry_Pi_2
Apache web server commands:
* Show Apache modules installed and enabled: apache2ctl -M
* Restart Apache: service apache2 restart
Change to root user (not recommended - use sudo instead):
* Change to the root user: sudo su