
If you want to start with home automation and search for a suitable server system, you should look at Synology's DiskStation. Compared to the usual hardware suspects such as Raspberry PI, a DiskStation offers some advantages: real hard disks, if necessary with redundancy, higher performance and thus the possibility to run further services and for example also to store backups from other computers.Clearly, an entry version of DiskStation is slightly more expensive than a PI, but the additional benefits and higher reliability will pay off sooner or later. For those who already have a DiskStation, it is anyway a good idea to install the software for home automation on it.
Please note: older Diskstation models do not have a floating point unit (FPU). Oracle does not provide Java packages for processors without FPU. Therefore the following instructions will only work on Diskstations with FPU. You can check wether your Diskstation has an FPU in the list provided by Synology.
A ready-made package - comfort with drawbacks
One way to get openHAB on the DiskStation is to use the ready-made openHAB package. This has a clear advantage: it is extremely simple to install. However, it also has three disadvantages:
- You will later be less flexible with regard to the setup / configuration of openHAB
- You have to worry about how you get the other software for your home automation to run (it is usually not done with openHAB alone) and
- At least on my diskstation the start times and the performance of openHAB were much worse with the prebuilt package compared with the method, which I show you in this article.
Setting up OpenHAB in 2 steps
The DiskStation runs DSM as its operating system, which is a customized Linux. We use this as our advantage and install openHAB as follows:
- In addition to DSM we bring Debian Linux to the DiskStation
- We install openHAB in the Debian environment
Advantages: under Debian Linux, we can install any other programs that are useful to us. And we can set up openHAB exactly as we need it. Let's go.
Installing Debian on the DiskStation
There is a great package made by SynoCommunity, which is a current Debian that runs as a supplementary system to DSM (in a so-called chroot environment):
- Go to the Package Center in the DSM web interface and click Settings and select the Package Sources tab
- Add a new package source, enter SynoCommunity as name and http://packages.synocommunity.com/ as location
- Now you will find the Debian Chroot package at the Package Center, install it
From now on we move to the Linux command line. Use SSH to log into your diskstation (if you have never done that, don't worry, here is a brief guide and recommendations for Mac and Windows ). Please note: You must first log in as admin using your administrator password. Then you change to the user root (which has the same password) using the following command:
- sudo su -
Now you switch to the Debian environment of the DiskStation:
- /var/packages/debian-chroot/scripts/start-stop-status chroot
First, we update the newly installed Debian by updating information about software packages and then updating the software packages themselves:
- apt-get update
- apt-get upgrade
Next adjust your regional settings:
- apt-get install debconf
- apt-get install locales
- dpkg-reconfigure locales
If you are unsure which option to select, choose the UTF8 variant for your language. Now we have running Debian on the DiskStation with a base configuration. Of course you can set up and configure even more in Debian. But this is not necessary for openHAB at the moment, however if you are interested in it take a look at Mark's blog.
Now our basic system is ready and we come to our real goal: openHAB.
Installing openHAB in Debian
To run openHAB, we need Java. Therefore we add to our Debian system the source from which Java packages will be installed:
- echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
- echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Now we can easily install Java:
- apt-get update
- apt-get install oracle-java8-installer
- apt-get install oracle-java8-set-default
When this has finished, we briefly check that Java works:
- java -version
If everything went well, we get an output similar to this one:
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
Using the same pattern, we are now installing openHAB. First adding package sources and then installing the openHAB Debian package:
- wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | apt-key add -
- echo 'deb http://dl.bintray.com/openhab/apt-repo2 stable main' | tee /etc/apt/sources.list.d/openhab2.list
- apt-get update
- apt-get install openhab2
If you later need to install extensions for OpenHAB for your special SmartHome devices, they will be downloaded from the Internet as required. If you want to disconnect your system from the Internet, you can now install all extensions (usually you can skip this step):
- apt-get install openhab2-addons
Now we can start openHAB:
- service openhab2 start
[Ok] Starting openHAB2 server: openhab2.
The first start may take a while, even a few minutes. How to start openHAB automatically (e.g. when the DiskStation reboots or openHAB quits unexpectedly) I will show you in another article. You can check if openHAB is now running by opening a browser and going to http://<IP-address-the-diskstation>:8080 so eg http://192.168.172.50:8080 or if the diskstation can be addressed by name in your home network use http://diskstation:8080 . You should now see the following:

Now choose how you want to set up openHAB. I recommend choosing one of the following options (if you are unsure, choosing Standard won't be a mistake):
Standard - this is the version recommended for most users. It contains
- Paper UI for system administration, including device management
- Basic UI as a new modern user interface for mobile devices
- HABPanel as a dashboard for (eg wall-mounted) tablets
Additional extensions can be installed later via Paper UI or directly through the definition in addons.cfg .
Expert - all those who have previously used openHAB 1.x or all who see themselves as power users should choose this version. You will get
- Everything the Standard package contains
- Classic UI the web interface of openHAB 1.x
- HABmin a powerful administration interface, especially for Z-Wave users
- Interactive REST API with which the REST functions can be tested
- All transformations as they were in openHAB 1.x
That's it!

If you have also decided as I have for Standard , you will soon see the start page of openHAB. How do you start openHAP automatically on the diskstation eg after a reboot of the disk station or if openHAB was accidentally terminated, I show you in another article.
Don't want to miss anything?
Newsletter Subscribe Content
Hi, i got error:
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
What should i do to correct this?
Hi, these two steps should fix it
apt-get update
thenapt-get install debconf
, as root)dpkg-reconfigure locales
as rootdpkg-reconfigure tzdata
Hi,
When trying to install Oracle Java via Debian Chroot I got an error (see Note1 below)
I was able to install Oracle Java within Debian Chroot by following the instructions in https://www.filebot.net/forums/viewtopic.php?t=4079
After doing the steps in Note2, I was able to continue with the installation of openhab2
Cheers,
Avner
-------------------
Note1 - apt-get fails to install oracle java
apt-get install oracle-java8-installer
...
Preparing to unpack .../oracle-java8-installer_8u131-1~webupd8~2_all.deb ...
readelf: Error: '/proc/self/exe': No such file
dpkg: error processing archive /var/cache/apt/archives/oracle-java8-installer_8u131-1~webupd8~2_all.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/oracle-java8-installer_8u131-1~webupd8~2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Note2 - Steps to install Oracle Java within Debian Chroot without using apt-get
# 1. Check java version before installation of Oracle java
java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (IcedTea 3.3.0) (linux-gnu build 1.8.0_121-b13)
OpenJDK Zero VM (build 25.121-b13, interpreted mode)
# 2. Copy the tar file into the chroot environment
# From outside chroot, as root
cp \
/tmp/jdk-8u131-linux-arm32-vfp-hflt.tar.gz \
/volume1/\@appstore/debian-chroot/var/chroottarget/tmp/
# 3. Untar and copy the untarred directory
mkdir -p /tmp/tmp2
pushd /tmp/tmp2
tar -xzvf ../jdk-8u131-linux-arm32-vfp-hflt.tar.gz
cp -r /tmp/tmp2/jdk1.8.0_131/* /var/packages/Java8/target/j2sdk-image/
# 4. Set up paths
export LD_LIBRARY_PATH=/var/packages/Java8/target/j2sdk-image/jre/lib/arm/jli
# 5. Check java version after installation of Oracle java
root@DiskStation:/# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)
Problem: after installing "Debian Chroot", there is no directory /var/packages.