Installation on FreeBSD
NB Small warning, this is only for the more technically versed as it requires patching and recompiling openHAB
There are currently two known problems with running openHAB on FreeBSD out of the box.
- The serial package that is used by openHAB does not support FreeBSD. Fortunately it is not difficult to compile it, but it does require a number of steps.
- There is a "bug" (missing feature, the jury is out on that :)) in that the FreeBSD IP stack does not support mapping IPv4 multicast addresses inside IPv6 addresses. This problem occurs when setting up multicast, and impacts quite a bit of functionality. The workaround for this problem is fortunately very simple.
This procedure was tested on FreeBSD 10.2 with openHAB 1.8.0.
- Install openjdk8 and git on FreeBSD: pkg install openjdk8 git
- Install maven via ports (otherwise it's going to download jdk7 for some reason)
- cd /usr/ports/devel/maven33
- make install clean
- Get the openHAB sources for 1.8.0, see also IDE Setup. You can skip the parts about setting up eclipse, just get the sources and use maven to compile. Pay special attention to also cleaning before building the sources, this is required every time! Say the location for the openhab sources is $(OHSRC)
- Get the nrjavaserial sources from https://github.com/NeuronRobotics/nrjavaserial
- You'll also need gradle, so install that as well, again as port:
- cd /usr/ports/devel/gradle
- make install clean
- Apply the patches from the thread https://groups.google.com/forum/?pli=1#!topic/openhab/fLAs5NdLwpw. I haven't installed the patches automatically (as described in the thread), but applied them one by one by hand. It may still work, but YMMV.
- Build nrjavaserial (basically do 'make freebsd')
- Get the resulting library (for version 3.11.0) from build/libs/nrjavaserial-3.11.0.jar and copy it to $(OHSRC)/bundles/io/org.openhab.io.transport.serial/lib/
- Change the version number in $(OHSRC)/bundles/io/org.openhab.io.transport.serial/build.properties and $(OHSRC)/bundles/io/org.openhab.io.transport.serial/META-INF/MANIFEST.MF
- cd $(OHSRC)
- mvn clean
- mvn package
- wait 10 minutes
- The new distribution files are in $(OHSRC)/distribution/target
- Install openHAB as usual, see also Manual installation
- Edit start.sh and add the following define: -Djava.net.preferIPv4Stack=true
- Edit configurations/openhab.cfg and set the serial port to /dev/ttyU0 (or adapt if your usb device shows up on a different device)
Regarding the multicast problem
For those interested in more background, it seems the FreeBSD IP stack does not support mapping IPV4 multicast addresses inside IPV6 addresses. Here is a link to the corresponding bug report:
It turns out to be a non-trivial amount of work to fix this, and the use case is apparently not entirely clean, so resolution of the bug fix is still pending. Fortunately there is also a work-around. Adding the following define to start.sh makes it work: