Skip to content

Installation

Florian Quirin edited this page Dec 14, 2018 · 26 revisions

Installation

Raspberry Pi 3

Quick-start for experienced makers/tinkerers:

  • Install the latest Raspbian lite (this doc was made for Raspbian Stretch)
  • Login to your RPi (e.g. remotely via SSH), install Java 8 (or higher) and add these packages: ntpdate (to updated server time), ca-certificates, git, software-properties-common, nginx (optional). You can use the install script below to make life easier.
  • (Optionally:) Go to your router, fix your RPi IP and forward port 20726 to your RPi.

Starting from scratch

Installing a fresh Raspbian

  1. Get the latest Raspbian lite (no desktop version): downloads.raspberrypi.org
  2. Get Etcher (portable) to flash Raspbian to your Micro-SD card (it's really easy): etcher.io
  3. Open Etcher, select the Raspbian Zip-file you've downloaded, select your Card-reader with your Micro-SD card as target and start flashing.
  4. After flashing finished remove your Micro-SD from the reader and put it back in (to reload the new file-system) then open the Micro-SD card (should be called "boot") and create an empty file called "ssh" (no file ending). This will make sure that you can login via SSH to your Pi later.
  5. Optionally you can add access to your Wifi (not-recommended for this server), here is a good blog-article about it on Medium or you can deactivate Wifi and Bluetooth to save some resources (recommended). For the latter look for a file called config.txt on your Micro-SD and add (or replace) these lines:
# Disable Wifi
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
  1. Put the Micro-SD in your Raspberry Pi 3 and plug it in (network and power).

Interlude: Setting up your router (optional)

NOTE: OPENING A CONNECTION TO YOUR PRIVATE NETWORK CAN RAISE SECURITY CONCERNS. PLEASE CONTINUE WITH THIS STEP ONLY WHEN YOU'VE INFORMED YOURSELF ABOUT THE RISKS (you can start here).

Sometimes you want to reach your RPi from outside your private network. For these situations you need to tell your router to forward certain requests directly to your RPi. This part depends a bit on the type of your router, but you should be able to find additional info if you get stuck doing a web-search for "port forwarding [my router name]" and "set fixed static IP for a device in router". This article is a good instruction as well: How to forward ports on your router. Here are the common steps:

  1. Login to your router (e.g. via fritz.box, o2.box, 192.168.0.1, etc...)
  2. Look for settings called "My/Local/Home Network" (or something similar) where you get an overview of all connected devices
  3. Look for "raspberrypi" in the devices list and write down the IP address, we need this to login via SSH.
  4. Now we want to fix this IP so you can always reach your Pi at the same address in your network. There should be a setting nearby called "fix/static IP addresses" were you can tell your router to connect the IP with the MAC address of your Raspberry Pi. This step might require a bit of try-and-error depending on your router, sorry for that.
  5. Final step here is to set-up port-forwarding to make our Pi reachable from outside. This will be necessary later to secure the server with a SSL certificate and make the SEPIA client work when you leave home. When you've found the router settings forward the port 20726 (default SEPIA port, can be changed) to the IP of your Raspberry Pi. Remember what you did here because we might want to return later ;-)

Setting up Raspbian to run SEPIA

  1. Remember your Raspberry Pi IP from the previous step? Good :-) If you don't you can try to use "raspberrypi.local" as address (this is the default RPi "hostname" and will point to the IP on most networks). We will use it now to connect to the RPi via SSH. To do this you'll need a SSH tool. UNIX systems like MacOS and Linux have one available out-of-the-box, Windows 10 seems to have one as well, but if you are running Windows I recommend to download Putty.
  2. Windows: Open Putty, type pi@[my-IP-I-remember] into the "Host Name" field (Port stays 22) and click "Open".
    Mac/Linux: Open a terminal an type ssh pi@[my-IP-I-remember].
  3. You should see a password prompt now. Type "raspberry" (the default password of the Pi) and your are connected :-)
  4. First we finish the configuration. Type sudo raspi-config and the Raspbian config tool will open.
  5. Use the tool to:
    • Define a new and secure password (and remember it!)
    • Expand the file system (Advanced Options -> Expand ...)
    • Since we need every bit of memory go to Advanced Options -> Memory Split and set the memory to 16MB (we don't have a display anyway ^^)
    • Finish and reboot
  6. Wait for the reboot then login to your Pi again via SSH (with your new password).
  7. We will install Java 8 now and a few additional packages. To make life easier there is a script in the SEPIA-Home bundle that will help you set up your environment. Download it to a temporary folder using wget:
mkdir ~/tmp
cd ~/tmp
wget https://raw.githubusercontent.com/SEPIA-Framework/sepia-installation-and-setup/master/scripts/install-environment-raspbian.sh
  1. Run the script with sh install-environment-raspbian.sh and follow each step in the menu (optionally skipping some if you know what you are doing ^^). Make sure everything completes without errors especially the part with Java, SEPIA download and SEPIA extract.
  2. Continue with step 3 (setup) of the SEPIA quick start guide. When you are done return here.
  3. Finally we take care that everything restarts properly when the Raspberry Pi boots up. To do that we add a cron-job:
crontab -e
@reboot sleep 60 && ~/SEPIA/on-reboot.sh;

Optionally we can add another cron-job (line below) that restarts the server every 2nd day at 4:30am:

30 4 1-31/2 * * ~/SEPIA/restart-sepia.sh > ~/SEPIA/restart.log

If everything worked out well you should have your own SEPIA Server now, reachable from within your private network (or everywhere via Ngrok if you followed the "next steps" part in the custom-bundle guide as well) 😃 🤖

... to be continued (with a tutorial on how to set up NGINX, Let's Encrypt and Duck-DNS to get a full-fledged SEPIA web-server with SSL)

Services

API-Keys

Certain services require an API-key to work like the weather forecast for example. All integrated services usually offer a free API-key for a certain number of calls. Once you've obtained such a key you need to put it inside the config file of the SEPIA assist-server and restart the server to activate it (a more convenient way using the admin web-tools is under consideration). Check out the details here: API-keys.