Tutorial: Install OpenHAB

Robert Andresen Internet of things, Tutorials 1 Comment

OpenHAB is a automation software for your home. OpenHAB is open source and supports a huge list of bindings to control all types of smarthouse-gadgets from different suppliers.

In this tutorial I will install OpenHAB 1.5.1 with the OpenHAB demo files, on an Ubuntu server 14.04.

Note: After installing I found that you could also install it with apt-get. See wiki here: https://github.com/openhab/openhab/wiki/Linux—OS-X

Requirements before you start:

  • Installed Ubuntu server
  • Beer

 

Prepare the Ubuntu server

To make this more simple, I will enable root user and allow root to login with SSH. This is not recommended on a production server, but I’ll take the risk for testing purposes.

First, log in on your server.

Enable root user

$ sudo passwd root
[sudo] password for robert:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Login as root

robert@openhab:~$ su root
Password:

 

To make it simple of downloading OpenHAB and just copy it to the server with WinSCP, we have to allow root login on SSH. If not, you have to set permission on folders for your user.

# vi /etc/ssh/sshd_config

Push «a» to edit. Change “PermitRootLogin without-password” to “PermitRootLogin yes”.

Make it look like this:

# Authentication:
LoginGraceTime 120
<span style="color: #339966;">PermitRootLogin yes</span>
StrictModes yes

Push “esc” than just write “:wq” to write and quit.

 

Install OpenHAB

You can also follow the Getting started guide on OpenHAB webpage: http://www.openhab.org/gettingstarted.html

 

Download OpenHAB runtime

You can also download the «Demo setup» to the right at the same time.

openhab_01_download

 

 Copy files to server

Download WinSCP: http://winscp.net/eng/download.php

Log in with root user (or another user if you have set permissions).

Create folder /opt/openhab

Copy the downloaded and extracted OpenHAB-files into the folder you have created.

Do this for the «Demo setup» also – extract it and just copy it into the /opt/openhab/.

 

openhab_02_copy_openhab

 

 

Start OpenHAB

# sh start.sh
Launching the openHAB runtime...
start.sh: 16: start.sh: java: not found

 

Looks like we need java….

NOTE: If your not logged in as root, like me, you need to use the sudo -prefix  in front of the commands.

 

apt-get update

Check if java is already installed (not necessary):

java -version
# java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: apt-get install &lt;selected package&gt;

 

Install java

apt-get install default-jre

Takes a couple of minutes… Go get a new beer!

 

 

When java is installed, try to start OpenHab again.

# sh start.sh

Launching the openHAB runtime...
osgi&gt; 21:05:30.776 WARN  o.o.c.core.ConfigDispatcher[:172] - Main openHAB configuration file 'configurations/openhab.cfg' does not exist.
21:05:30.787 INFO  o.o.c.internal.CoreActivator[:61] - openHAB runtime has been started (v1.5.1).
21:05:32.561 INFO  o.o.i.s.i.DiscoveryServiceImpl[:72] - mDNS service has been started
21:05:33.625 INFO  o.o.io.rest.RESTApplication[:143] - Started REST API at /rest
….
….

 

 

When running, you should be able to open OpenHab in your browser:

http://192.168.1.134:8080/openhab.app?sitemap=demo (CHANGE THE SERVER IP WITH YOUR OWN)

 

openhab_03_openhab_demo