Super-quick guide to installing OpenHAB 3 on OpenSUSE Leap 15.3 on Raspberry Pi 4

Introduction

Here’s a quick guide to getting OH3 up and running on a Raspberry Pi 4 with OpenSUSE Leap 15.3.

If you are not using a Raspberry Pi or another ARM-based device, in theory most of these instructions should still be applicable, except for the installation Java SDK method – x86_64 platforms have RPMs available so you would add the relevant repository (e.g., by first installing the zulu-repo package) and then use zypper install to download the SDK. I have not tried this.

This is based on my installation notes and may be missing a step or two but should get you most of the way there. This is current as of 2021-07-01. Mind the natural evolution of all the relevant bits.

Install OpenSUSE

Clear and concise instructions are given on the OpenSUSE site itself.

The only thing to keep in mind is that the links given in that page may lead to a 404 in between rebuilds as the new versions propagate through the mirrors – in that case, do follow the advice to ‘please check the general download directory for the images.’

As a general comment, getting OpenSUSE up and running on the Pi is super easy. Just burn the image into an SD card, pop it into the Pi and off you go.

Gather the bits

You will need the Java 11 version recommended by OpenHAB, plus the OpenHAB binaries themselves. There is also a minor bit of faffing with permissions and some easy configuration changes to do.

Install Azul Zulu Java JDK

Unless otherwise implied by the presence of an su command, all the instructions below assume the root user.

Get the latest *.tar.gz for ARM-64 from here: Java Download | Java 8, Java 11, Java 13 - Linux, Windows & macOS

cd /tmp
wget "https://cdn.azul.com/zulu-embedded/bin/zulu11.48.21-ca-jdk11.0.11-linux_aarch64.tar.gz"
su
cd /opt
tar -xzvf /tmp/zulu-embedded/bin/zulu11.48.21-ca-jdk11.0.11-linux_aarch64.tar.gz

# Cleanup
rm /tmp/zulu-embedded/bin/zulu11.48.21-ca-jdk11.0.11-linux_aarch64.tar.gz

# This lets OpenSUSE find Java
ln -s /opt/zulu-embedded/bin/zulu11.48.21-ca-jdk11.0.11-linux_aarch64.tar.gz /usr/java

Add the OpenHAB repository

There are ways and ways to do this, but:

cat <<EOF >openhab.repo
[openHAB-Stable]
name=openHAB Stable
baseurl=https://openhab.jfrog.io/artifactory/openhab-linuxpkg-rpm/stable
gpgcheck=1
gpgkey=https://openhab.jfrog.io/artifactory/api/gpg/key/public
enabled=1
autorefresh=1
EOF

zypper ar ./openhab.repo
zypper refresh

# Cleanup
rm ./openhab.repo

Install packages

Calling directly for openhab-addons will drag openhab itself as a dependency.

zypper install openhab-addons

Optional: ffmpeg

Consider also installing ffmpeg if you will be adding an IP camera.

If you want to use the full set of codecs, including possibly patent-encumbered ones, see the OpenSUSE site for the latest instructions to adding the Packman repos. If you’re happy with fully open codecs, proceed straight on.

zypper install ffmpeg

Tidy things up

Add the user openhab to the lock group

If you will be using RFXCOM or anything else serial-looking, the openhab user should be a member of dialout – the installer should have taken care of this – but also a member of lock so that it can write to /run/lock.

The command line for that is:

usermod -a -G lock openhab

Note: I actually use Yast2 for almost all configuration and admin. This is in my opinion what sets OpenSUSE apart from anything else out there, so might as well take advantage of it.

This will be under Security and UsersUser and Group Management, Set Filter to System Users, select openhab, EditDetailsAdditional Groups.

Yes, it is a lot of clicking, but probably quicker than reading the man page for usermod, the corresponding command-line instruction, for an operation I have to do once every couple of years.

Tell OpenHAB where to find Java

There might be a better way to do this, for instance by making Java available at a location other than /usr/java, but what I’ve done is edit /etc/defaults/openhab and somewhere in there I added:

JAVA_HOME=/usr/java

If you will be using serial-based Things, you might have come across instructions on the Internet that advise to also edit EXTRA_JAVA_OPTS in that file. In fact, that should not be necessary as OpenHAB will look for common patterns automatically.

Enable and start the service

/bin/systemctl daemon-reload
/bin/systemctl enable openhab.service
/bin/systemctl start  openhab.service

Connect to your newest OpenHAB installation

If all went well, now you should be able to connect to your OpenHAB via HTTP on port 8080 and follow the rest of the instructions in the tutorial.

Acknowledgements

With many thanks to:

  • @rlkoshak for pointing out that specifically Java 11 is required, and not a later version.
  • @Kai for administrative help. :+1:
  • @Benjy for feedback and the advice not to populate EXTRA_JAVA_OPTS.
  • @rpwong for pointing out that the instructions could be generalised to non-ARM platforms.
2 Likes

Nice! Opensuse is my go to Linux dist. :+1:.
Tend to run openhabian for openhab though.

Nicely put! Thanks for taking the time to write it up!

I had a couple of suggestions:

dialout – the installer should have taken care of this – but also a member of lock so that it can write to /run/lock.

That sounds like something the installer should do, so would be happy to add lock to the list of memberships that the installer handles. Just out of interest, on the distributions I use, /run/lock is writeable by users and groups. Is this openSUSE specific?

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0

You shouldn’t need to do this, in-fact setting this parameter makes openHAB more restrictive - see: Testers wanted - Removing the "Dgnu.io.rxtx.SerialPorts" recommendation

This is the best way to do this if your default Java is different to the one that openHAB needs, otherwise setting JAVA_HOME as an environment variable or symlinking the Java executables to /usr/bin/ would be a typical way of doing this.

1 Like

Good stuff! Is there anything in your guide that’s actually specific to the Raspberry Pi? If not, I’d suggest removing that from the title and just pointing out in the text that you’re using an RPi4 as your server. That would make this more broadly applicable to anyone who wants to use OpenSUSE (regardless of hardware).

1 Like

Sounds like a good idea. :+1:

Just out of interest, on the distributions I use, /run/lock is writeable by users and groups. Is this openSUSE specific?

This blog suggests that this might also be applicable to RHEL-based distros, but I have no personal experience with that.

You shouldn’t need to do this, in-fact setting this parameter makes openHAB more restrictive

Thanks! I’ve updated my post accordingly so as not to add to the confusion with outdated info.

The Java installation method – and possibly the need to modify JAVA_HOME, depending on where the RPM installs the Java SDK. I have added a note to the effect at the beginning of my post.

Thanks for the comments.