Installing OpenHAB2 on Raspberry Pi

Introduction: Installing OpenHAB2 on Raspberry Pi

Please keep an eye out as we add more connect to our YouTube channels as well as here at Instructables.

John's DIY Playground at YouTube

My YouTube Channel

openHAB Community

This is an adaptation from the site as I show you how to install OpenHAB onto your Raspberry PI via the openHAB package repository. This will be a multiple part series as we (John Wills) and I (Joshua Abramson) partner on a internet of things project. The goal is to provide a guide that will produce a secure IOT implementation at your home or work.

Because of it’s low price, it’s small form factor and the low energy consumption, the Raspberry Pi is a quite popular platform for openHAB.


  • Raspberry Pi Generation 2 or newer with Raspbian installed and running with at least a 8GB SD card.
  • PuTTY- a free SSH and telnet client for Windows. (if your are using windows)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: A Little Raspbian House Cleaning

Connected via SSH, execute the Raspbian configuration menu by running sudo raspi-config. Go through the following steps:

  • Expand the file system
  • Change your password(Change the host name if you wish, e.g. “openhabpi”)
  • From the advanced menu, change the memory split for the GPU to “16”
  • Restart

As a good practice, run a full upgrade and install packages you like or need (a set of helpful packages is given as an example):

sudo apt-get update 
sudo apt-get upgrade
sudo apt-get install screen mc vim git htop

Raspbian in the latest full versions already includes the required Oracle Java 8. If you are using “Raspbian Lite” you need to install it:

sudo apt-get install oracle-java8-jdk

Step 2: Package Repository Installation

Installation through a package repository is the recommended choice on Debian/Ubuntu derivatives. Alternatively resort to the manual installation approach.

Choose between the latest Beta release or a Snapshot with all incoming contributions, rebuild on every change. As openHAB 2 is still in an evolving state, the snapshot may be the preferred choice.

The repository URLs will be stored in the file /etc/apt/sources.list.d/openhab2.list. Be careful to not have conflicting repositories in your sources list.

Decide between two options: (We are proceeding with Snapshot instead of Beta)

Snapshot Release

Add the openHAB 2 Snapshot repositories to your systems apt sources list (will overwrite your existing openhab2.list):

**Updated 11-27-16** Thanks webcompanion

echo 'deb /' | sudo tee /etc/apt/sources.list.d/openhab2.list
echo 'deb /' | sudo tee --append /etc/apt/sources.list.d/openhab2.list

Additionally, you need to add the openHAB 2 Snapshots repository key to your package manager:

wget -qO - '' | sudo apt-key add -

Note: CloudBees provides the openHAB 2 repositories through HTTPS. If your system fails at the next step, install the missing dependency:

sudo apt-get install apt-transport-https

**Updated 11-27-16** Some are reporting an error after the command above; however, it appears to work after the second attempt.

*Added 11-27-16** Scan the newly added repository and resynchronize the package index:

sudo apt-get update

Finally install openHAB 2 as either offline or online distribution. The offline distribution is full blown and comes with all add-ons, the online distribution will install additional add-ons on request from the internet. We are going with offline here.

sudo apt-get install openhab2-offline

If everything went well, start openHAB and register it to be automatically executed at system startup: Linux init systems based on sysVinit (e.g. Debian 7 / Ubuntu 14.x and earlier):

sudo /etc/init.d/openhab2 start
sudo /etc/init.d/openhab2 status
sudo update-rc.d openhab2 defaults

The first start may take up to 15 minutes, this is a good time to reward yourself with hot coffee or a freshly brewed tea!

Step 3: OpenHab First Run Test

You should be able to reach the openHAB 2 portal at http://openhab-device-ip:8080 at this point.

To get the openhab-device-ip type this command


You could also capture the openhab-device-ip from the IP given as you SSH into the Raspberry PI at first login of Putty. In my case the IP is, therefore I will check to see if openHAB is running by going to in my favorite browser.

Step 4: OpenHAB As a Service

In my case the openHAB did not setup as a service which allows openHAB to auto-start as the Raspberry Pi boots up. Here are the steps if you experience the same issue.

The following instructions are intended for a Linux init system based on systemd (e.g. Debian 8 / Ubuntu 15.x and newer). This will allow you to register openHAB as a service, so that it runs at startup and automatically restarts if openHAB crashes. The service will be running with the privileges of the user “openhab” and expects the openHAB files under /usr/share/openhab2.

Check to make sure the file /lib/systemd/system/openhab2.service exists

sudo nano ./usr/lib/systemd/system/openhab2.service

If not, create the file /lib/systemd/system/openhab2.service with the following content:

Description=The openHAB 2 Home Automation Bus Solution

ExecStart=/usr/share/openhab2/ server
ExecStop=/bin/kill -SIGINT $MAINPID


Next, enable the service to be executed on system startup, start the service and retrieve status information:

# initialize the new service (execute only once)

sudo systemctl daemon-reload 
sudo systemctl enable openhab2.service

#start and retrieve status

sudo systemctl start openhab2.service
sudo systemctl status openhab2.service

The output of status after a successful execution should be similar to:

openhab2.service - The openHAB 2 Home Automation Bus Solution Loaded:
loaded (/lib/systemd/system/openhab2.service; enabled)
Active: active (running) since Thu 2016-08-14 01:16:00 GMT; 18h ago

Step 5: Playing With Demo (To Get That Instant Gratifcation for All Your Hard Work)

This tutorial will stop at this step..... for now.

I'll add more as John and I progress through this project.

The demo package consists of example configuration files and samples of add-ons and UIs. In order to install the demo, you must edit the file ‘/etc/openhab2/services/addons.cfg’. Uncomment the line package= and set it to demo as shown below:

 sudo nano /etc/openhab2/services/addons.cfg
# The base installation package of this openHAB instance (default is "standard") 
# Valid options:
# - minimal : Installation only with dashboard, but no UIs or other addons
# - standard : Typical installation with all standards UIs
# - demo : A demo setup which includes UIs, a few bindings, config files etc.
#package = standard
package = demo

Step 6: Watch the Video.

1 Person Made This Project!


  • Finish It Already Speed Challenge

    Finish It Already Speed Challenge
  • Arduino Contest 2020

    Arduino Contest 2020
  • First Time Author Contest

    First Time Author Contest

11 Discussions


3 years ago

I've updated the tutorial based on your comments. Thank you for taking your time to post this.


Reply 3 years ago

Hi, thanks for the intractable but again the package openhab offline is not available:

Unable to locate package openhab2-offline

Can you update your procedure?

Thank you


3 years ago

Yes, it looks like things have moved on recently. I used:

echo 'deb stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list

to use the current stable release of openHab2. Then:

sudo apt-get update

They have also changed online/offline. For on- or off-line, use the following:

sudo apt-get install openhab2

For an offline installation, also do this, to download all the add-ons upfront:

sudo apt-get install openhab2-addons

Found this info here:


3 years ago

Apparently, the files have been moved from cloudbee to bintray

I was getting W: Failed to fetch HttpError404

I found the updated path at

echo 'deb unstable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
wget -qO - '' | sudo apt-key add -
sudo apt-get update

then to offline install...


3 years ago

After the following line:

wget -qO - '' | sudo apt-key add

I get the following error:

gpg: no valid OpenPGP data found

Please help


3 years ago

Every thing worked perfectly. I am up and running in demo mode. I can't wait for the second part of the video. Well done. I finally figured out how to cut and paste the command lines and that made all the difference in the world.


3 years ago


I ran into the following error (on a freshly installed raspberry 4.1.19-v7+) when following your instructions:

pi@raspberry:~$ sudo apt-get install apt-transport-https
E: Malformed entry 1 in list file /etc/apt/sources.list.d/openhab2.list (URI parse)
E: The list of sources could not be read.
E: Malformed entry 1 in list file /etc/apt/sources.list.d/openhab2.list (URI parse)
E: The list of sources could not be read.

Can you please tell me what is going wrong and maybe update your instructions?

kind regards


Reply 3 years ago

I experienced the same error as you jamesdelelio. What I did to fix it was a little weird, I just put the same command into the console, "sudo apt-get install apt-transport-https" and then for some reason the command works the second time. And actually the system (I'm using a Pi3) reports that nothing is upgraded or installed, it's just checking to upgrade and nothing is actually done.


Reply 3 years ago

So now I edit the openhab2.list file manually using "sudo nano /etc/apt/sources.list.d/openhab2.list"

I edit the lines of code to look like this:

deb /

deb /

Save and close.  Retry command "sudo apt-get install openhab2-offline".  Error says Unable to locate package openhab2-offline.

For kicks, doing a "sudo apt-get update" and then "sudo apt-get upgrade".  Looks like it is going to to check cloudbees during the update command.  Nothing changes for "upgrade".  Reboot.

Now after reboot, issue the command "sudo apt-get install openhab2-offline".  It works!!!!!!

Reply 3 years ago

Post updated.. Thanks