Openhab installation

at the moment im using a Raspberry pi for the home automation project i started. In this tutorial i will setup a fresh install of Raspbian Debian Wheezy. on top of that an Openhab installation with automatic start script. I followed some tutorials elsewhere and created one tutorial guide of it. i assume you know how to setup a Rpi with Raspbian Wheezy. If not i will create another tutorial for that later on.

Raspberry Pi B+ 512MB
OS: Raspbian Debian Wheezy (2014-09-09)
Openhab version: 1.6.1
MicroSD: 16GB

1. make sure you’re Rpi is completely up to date

#: sudo apt-get update
#: sudo apt-get upgrade

* a note when installing Rpi is to make sure you have set your locale settings. Otherwise you will get some errors when creating the automatic start script for openhab. The solution is given in the trouble shooting area though ;).

2. Create a directory for Openhab

#: sudo mkdir /opt/openhab

in here we will get the software needed.

#: cd /opt/openhab

3. Time to download the needed files

Runtime: these are the core files
Addons: various addons which can be used within openhab.
Demo configuration: this can you give a good head start with can be deleted afterwards.
make sure you are in the /opt/openhab directory:

/opt/openhab#: sudo wget
/opt/openhab#: sudo wget
/opt/openhab#: sudo wget

4. unzip the core (runtime)

/opt/openhab#: sudo unzip

This will unzip all the files in the directory

5. unzip the addons
First go to the directory addons:

#: cd /opt/openhab/addons


/opt/openhab/addons#: sudo unzip


** NOTE. for demonstration it’s ok to copy all addons. for production its best to only add the addons you need. so keeping the addons unzipped in your home directory is best. To add an adddon you only have to copy/paste the .jar file in the /opt/openhab/addons directory and restart openhab to actually load the addon.

on reboot it can take quite some time to load all the addons. even when you only use a 10th of them.

6. unzip the demo configuration files
These will overwrite an addon. I didn’t get this notice before, but in this case i let the demo configuration overwrite an addon (http binding)

#: cd /opt/openhab
/opt/openhab#: sudo unzip


replace addons/org.openhab.binding.http-1.6.1.jar? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: addons/org.openhab.binding.http-1.6.1.jar
inflating: addons/org.openhab.binding.ntp-1.6.1.jar
inflating: addons/org.openhab.persistence.rrd4j-1.6.1.jar
inflating: addons/org.openhab.persistence.logging-1.6.1.jar
inflating: addons/org.openhab.persistence.exec-1.6.1.jar
inflating: configurations/items/demo.items
inflating: configurations/persistence/db4o.persist
inflating: configurations/persistence/exec.persist
inflating: configurations/persistence/logging.persist
inflating: configurations/persistence/rrd4j.persist
inflating: configurations/rules/demo.rules
inflating: configurations/scripts/demo.script
inflating: configurations/sitemaps/demo.sitemap
inflating: README.TXT

7. Time to clean up the installation zip files:

#: sudo rm /opt/openhab/ /opt/openhab/ /opt/openhab/addons/

8. by default the start script of openhab isn’t executable. So time to fix that.

#: sudo chmod +x /opt/openhab/

From this point the first installation and demo configuration is done. Time to add an automatic start script for openhab. This script also makes it easier to start/stop/restart openhab

i didn’t create this script. So credits go to the writer of this topic: (

9.Openhab automatic start script
download the file

/home/pi#: sudo wget

unzip the file to a new directory

/home/pi#: sudo unzip -d openhab_startscript

Time to move the script to the /etc/init.d/  directory

/home/pi#: sudo cp openhab_startscript/ /etc/init.d

The file has to have the right permissions to be executable

#: chmod +x /etc/init.d/

Update the rc.d to be able to use the script on reboot

#: sudo update-rc.d defaults

10. usage openhab start script

you can use these commands to run it manually

#: sudo /etc/init.d/ start
#:  sudo /etc/init.d/ stop
#: sudo /etc/init.d/ restart

You can use the one below to check the status of openhab

#: sudo /etc/init.d/ status

example manual reboot of openhab:

#: sudo /etc/init.d/ restart

[ ok ] Stopping system openhab daemon:.

[ ok ] Starting system openhab daemon:.

11. Log files
To read some logfiles of openhab you can use the commands to tail them after reboot or restart

#: tail -f /opt/openhab/logs/events.log
#: tail -f /opt/openhab/logs/openhab.log

Or just simply use cat /opt/openhab/logs/events.log / openhab.log to check the files for errors.

Reboot your rpi to check if everything is coming back up.

openhab link: https://your-rpi-ipaddress:8080/

From here i will create some tutorials to create your own sitemap.

Trouble shooting:

A. Openhab Start Script: after i run the update.rc command i receive this error: (in my case the dutch language i haven’t set)


pi@rpi /etc/init.d $ sudo update-rc.d defaults

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = “nl_NL.UTF-8”,
LC_TIME = “nl_NL.UTF-8”,
LC_NAME = “nl_NL.UTF-8”,
LANG = “en_GB.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
update-rc.d: using dependency based boot sequencing

A. Solution:
Fix your locale settings.

#: sudo locale -a  // to check your current locale settings
#: locale -a


So yes. i don’t have the NL settings in it. edit the file below and comment out the nl_NL.UTF-8 line

#: sudo vi /etc/locale.gen // to edit the locale settings file

In my case i commented out the nl_NL.UTF-8 line and save the file

Now its time to rebuild the locale settings

#: sudo /usr/sbin/locale-gen

Generating locales (this might take a while)…

en_GB.UTF-8… done
nl_NL.UTF-8… done

after this when you set the command again, the errors should be fixed

#: sudo update-rc.d defaults


– automatic Startscript Openhab: Openhab Startscript
– basic setup openhab/Rpi: Setup openhab Rpi
– openhab software:

You may also like...

0 0 votes
Article Rating
Notify of

Newest Most Voted
Inline Feedbacks
View all comments
9 years ago

Just had to say that this is a good walkthrough.. i’ve attempted 2 or 3 times without success.. There were a few mistakes and tripping points in this but nothing that wasn’t overcome with a little thought. Thanks for the work. i’m looking forward to the tut on making sitemap!

8 years ago

Thanks for this! First time playing with OpenHab and wanted it to start automatically. Your script worked great for me.