To start off, I would like to get OpenHAB running on my Linux based laptop. The assumption is that Java will be available on the end system that will eventually host the OpenHAB server.
Clone the latest version of OpenHAB source from GitHub. This is fairly simple.
git clone https://github.com/openhab/openhab.git
Installing Build System
OpenHAB is built and managed using Maven build system. It performs automatic resolution of all the dependencies present in your workspace. If you don’t have Maven yet, get it first.
sudo apt-get update
sudo apt-get install maven
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “3.2.0-67-generic”, arch: “amd64”, family: “unix”
Please note that Maven requires that Java home to be setup properly. I use OpenJDK 7 on a 64 bit, and hence my JAVA_HOME is setup as,
JAVA_HOME = /usr/lib/jvm/java-7-openjdk-amd64/
If JAVA_HOME is incorrectly set, Maven will not be able to build anything.
Go to the newly cloned OpenHAB repository and perform a clean build,
mvn clean install
Please remember that Maven will take a lot of time for the first build since it downloads all the libraries. This will happen if you perform a clean everytime. To avoid this and to enforce Maven to use the locally cached libraries and dependencies, use the -o option
mvn install -o
If the build is successful, you will have the OpenHAB distribution zipped under ./distribution/target/. You should be expecting to see these packages,
Of interest are the following distributions,
distribution-1.6.0-SNAPSHOT-runtime.zip : Contains the core OpenHAB modules
distribution-1.6.0-SNAPSHOT-addons.zip: Contains support for bundles that provide support for various types of devices.
distribution-1.6.0-SNAPSHOT-demo.zip: Provides demo configurations and sitemaps.
For a quick check, copy the above 3 distributions into a separate location and follow the below 4 steps,
1. Unzip the runtime distribution first.
2. Unzip the demo distribution and say yes to any overwrite prompt.
3. Move the addons distribution into the addons directory and unzip it there. Say yes to any overwrite prompt.
mv distribution-1.6.0-SNAPSHOT-addons.zip addons/
4. Go back to the parent directory and then to configuration directory. Make a copy of OpenHAB default configuration as a running configuration. This is good enough to run in the demo mode.
cp openhab_default.cfg openhab.cfg
Now OpenHAB is ready to run in demo mode. Go back to the parent folder and you will find couple of start shell scripts. Run the start.sh and wait for a few seconds. Now go to the demo URL [ http://localhost:8080/openhab.app?sitemap=demo ] offered by OpenHAB server on your localhost, and have the first look at the GUI in the demo mode. You will be able to play around and change the state of some devices.
Now I cannot wait to toggle an LED with this web interface on my RaspberryPI.