OpenHAB2 Installation on Ubuntu Server (16.04)

Ubuntu and OpenHAB

openHAB Logo In my last post about the installation of Zulu JDK to Ubuntu 16.04 server, I covered how to do so and was required so that OpenHAB can run on my server. This post is in the line of my last post and is about the installation of OpenHAB to ubuntu 16.04 server. This post is all about installing OpenHAB to Ubuntu 16.04 using the manual method. I tried with apt-get, but that didn’t work for me.


STEP 1 (Download OpenHAB runtime):

Navigate to a folder where you can download files and use wget to fetch the latest build of OpenHAB runtime by using the following command,


The URL has to be changed as per the latest build available from,


The download may take a while, depending upon the internet speed. After the download completes unzip the downloaded zip file,
unzip __downloaded_zip_file_name -d openhab2/

If unzip is not working, it’s not installed and to install use the following command,

sudo apt-get install unzip

The unzip command will extract all the files to openhab2 folder. Now remove the downloaded zip file if you want to free up the space,

sudo rm ___downloaded_file_name


STEP 2 (Create user and First Run):

Next step is to create an user for OpenHAB and that can be done using the following command, no home folder will be created for the user and will not have login access to the server,

sudo adduser --system --no-create-home --group --disabled-login openhab

Now make openhab as the owner of openhab2 folder where the runtime files are extracted,

sudo chown -hR openhab:openhab openhab2

Now everything is down and the OpenHAB runtime can be executed. But don’t forget to change the path to the .sh file.

sudo su -s /bin/bash -c '/home/pathto/openhab2/' openhab

After issue of the above command you can access the OpenHAB instance by navigating to your_ip:8080, on your browser.


STEP 3 (Run as a Service):


Create a file openhab2.service inside /lib/systemd/system folder with the following contents,

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


Description=My OpenHAB Installation

ExecStart=/home/oksbwn/openhab2/ server
ExecStop=/bin/kill -SIGINT $MAINPID


Don’t forget to change the path to your .sh file.


After that run the following commands to run the service and will be executed automatically when the server boots up.

sudo systemctl daemon-reload
sudo systemctl enable openhab2.service

Now you can interact with the service created, using  the following commands for start, status and stop respectively,

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

Related posts

Leave a Comment