I have now created a script that automatically installs Openhab2 for you on an Odroid C2 and includes setting up Java for you. It can be found here:
For those that are not familiar with the Odroid C2, it is similar to the PI3 with the advantages that it has double the ram, true 1000mbps network, and more than twice the CPU grunt. I opted to not purchase the Odroid XU4 (which is more powerful yet again) due to there being some reported issues with JVM running on the big/little cores which some people have reported and may have solved here.
The C2 is also one of the best budget devices to run KODI on due to the devs using it for testing and it supporting H265 playback at 4K 60 FPS (Pi3 can not do h265). You can have multiples of them around your house as spare parts running KODI set top boxes. For more info see https://libreelec.wiki/
The steps below are tested to work on the ready made Ubuntu Minimal 18.04 LTS image which can be found here:
These steps should work on any Ubuntu/Debian system running an ARM64 processor including the XU4, but note that this will install the 32bit zulu JVM, as this is the recommended version for Openhab currently. If you see guides on how to install with apt-get, they currently do not work due to the Zulu repos reporting they do not support ARM64, hence why this is a little more involved.
dpkg --add-architecture armhf sudo apt-get update && sudo apt-get upgrade -y sudo apt install -y nano build-essential libc6:armhf software-properties-common mkdir /usr/lib/jvm wget http://cdn.azul.com/zulu-embedded/bin/zulu188.8.131.52-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz tar xvzf zulu184.108.40.206-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz -C /usr/lib/jvm/ /usr/lib/jvm/zulu220.127.116.11-ca-jdk1.8.0_212-linux_aarch32hf/bin/java -version
The last line should test the java and you should get some output reporting the version. If you do continue on…
rm zulu18.104.22.168-ca-jdk1.8.0_212-linux_aarch32hf.tar.gz sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu22.214.171.124-ca-jdk1.8.0_212-linux_aarch32hf/bin/java 1101 sudo update-alternatives --config java
The last line allows you to change between any installed JRE on your system, if you have more than 1 installed select the zulu, and now you can type in ‘java -version’ from any location to check the version.
To set JAVA_HOME as a variable, do the following as this method will auto change the JAVA_HOME if you change the selected java using the above command…
add this to file and save
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
Type this into the shell to reload the changes and then test…
. /etc/environment echo $JAVA_HOME
It should then report the path when you enter the last line.
After doing this you are ready to install Openhab2.