openHAB installation on Raspberry Pi

I had a lot of problems finding the correct information and installing openHAB2 (OH2) on a Raspberry Pi Compute Module so I thought I would document it here. I have tried installing using both the SD card image and via individual packages.

One thing to note that I found is that depending on which Compute Module you are using - the login and password are different - I believe this is due to in my case the installation on a Compute Module V1.1 failed to complete so the password change in the installation script didn’t fully work - but with a Compute Module V3+ (CM3+) the installation completes…still I found a discrepancy between what the openHAB website says and what I found. I found that with the CM3+ the login:password was pi:raspberry, but on the CMV1.1 the login was openhabian:openhabian. Anyway - just something to keep in mind if you use the openHAB image file.

It’s best to have the Compute Module IO board connected to a display for the initial setup so you can see what is going on as viewing the Log in the recommended http://openhab location did not work very well in my case so by connecting to a display you will be able to see better if there are problems. It can take a very long time for the initial setup to complete - depending on your internet speed.

I also found there is slightly different instructions for the installation to Raspberry on the Downloads page and the Raspberry Pi Installation pages - which caused some confusion. Below is the technique that I found worked well for me - it is what is shown on the Downloads page if you select Raspberry Pi > Stable and then scroll down.

The openHAB documentation recommends installing ZULU Java, but although I tried many things I was unable to find the correct version that would successfully install. So I chose to install Oracle Java. You must install Java 8 as OH2 is still not compatible with newer versions.

sudo apt-get install openjdk-8-jre

Add the repository key

wget -qO - ‘Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog’ | sudo apt-key add -

Add the HTTPS transport for APT

sudo apt-get install apt-transport-https

Add the repository

echo ‘deb https://dl.bintray.com/openhab/apt-repo2 stable main’ | sudo tee /etc/apt/sources.list.d/openhab2.list

Update the package lists

sudo apt-get update

Install the openHAB distribution package

sudo apt-get install openhab2

(Optional) Install the add-ons for offline use

sudo apt-get install openhab2-addons

Navigate with a web browser on another PC to http://ip-address:8080 (where ip-address is the address of the Raspberry Pi), or if working directly on the Pi - http://localhost:8080

I don’t recommend that you select the ‘Demo’ option in the first selection page as there is no easy way to go back and select another option unless you delete some configuration files.

After I had it up and running I also had a lot of problems getting started, so I will be adding more tutorials on how to use it - I found a lot of varying information out there, much of it dealing with openHAB V1.x versions which are a lot different than the more recent version.

OH2 is a very nice and versatile way to deal with Automation using Modbus or Bacnet - but there is a fairly steep learning curve, or at least that’s what I found. If anyone has any suggestions or recommendations please don’t hesitate to post a comment.