How can I install openHAB Cloud on local Ubuntu 20.04


I could use help to install the openHAB Cloud on an Ubuntu 20.04 VM. Instead of LetsEncrypt I tried to use mkcert.

sudo hostname openhab-cloud
hostname --fqdn

At first I executed

sudo apt update && sudo apt upgrade
sudo apt install build-essential redis-server mongodb nginx python git certbot python-certbot-nginx
sudo apt-get install python-software-properties

To avoid the following error, I installed NodeJS version 12.22.1:

error: uncaughtException: Cannot find module ‘bcrypt’
Error: Cannot find module ‘bcrypt’
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/var/www/
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/var/www/
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)

So I installed NodeJS like you can see here:

sudo apt update
curl -sL | sudo -E bash -
sudo apt install nodejs

I tried to use certbot but I does not work because of DNS problems…

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for
Waiting for verification...
Challenge failed for domain
http-01 challenge for
Cleaning up challenges
Some challenges have failed.

 - The following errors were reported by the server:

   Type:   dns
   Detail: DNS problem: NXDOMAIN looking up A for

Then I tried mkcert:

sudo apt install libnss3-tools
mv mkcert-v1.1.2-linux-amd64 mkcert
chmod +x mkcert
cp mkcert /usr/local/bin/

mkcert -install
sudo mkcert '*' localhost ::1

Then the nginx configuration:

sudo rm -r rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo nano /etc/nginx/sites-available/

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    return 301 https://$server_name$request_uri;

server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    ssl on;
    ssl_certificate /root/.local/share/mkcert/rootCA.pem;
    ssl_certificate_key /root/.local/share/mkcert/rootCA-key.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ecdh_curve secp384r1;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;
    ssl_stapling on;
    ssl_stapling_verify on;
    resolver valid=300s;
    resolver_timeout 5s;

    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;

    root /var/www/;
    index index.html index.htm;
    location ~ /.well-known {
        allow all;

After that

sudo nginx -t
sudo systemctl restart nginx or sudo systemctl reload nginx

I think I should at first fix following:

curl: (6) Could not resolve host:

curl openhab-cloud
<head><title>301 Moved Permanently</title></head>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>

Then I tried to install openHAB-Cloud:

cd ~
git clone
sudo ln -s /var/www/ /home/openhabcloud/openhab-cloud
cd ~/openhab-cloud
npm install
cp config-development.json config.json

Then I changed the config.json with nano config.json

    "system": {
        "host": "",
        "port": "443",
        "protocol": "https",
        "logger" : {
            "dir": "./logs",
            "maxFiles" : "7d",
            "level" : "debug",
            "morganOption" : "dev"
      "key" : "some express key"
    "redis": {
        "host": "",
        "port": "6379"
    "mailer": {
        "host" : "somehost",
        "port": 465,
        "secureConnection": true,
        "user": "someuser",
        "password": "somepass",
        "from": "<your-mail>"
    "gcm" : {
      "jid": "",
      "password": "password"
    "apn" : {
      "team": "PB1234567",
      "keyId": "BLABLA1",
      "host": "",
      "defaultTopic": "es.spaphone.openhab",
      "signingKey": "certs/aps/AuthKey.p8"
    "ifttt" : {
      "iftttChannelKey" : "key",
      "iftttTestToken" : "token"
    "legal": {
        "terms" : "",
        "policy": ""

I removed the line with mongodb because there was nothing configured yet. Also I remove a password for redis.

Then I run sudo node app.js.


Sadly the page is empty.

However, I’m missing an explanation in this tutorial either way on how to properly set up mongodb accordingly or redis as well.

I think a little bit this could help:

(there as example the part with mongodb should be sufficiently explained.)

The bottom line, though, is that I would have to get the system to work like this first. Any functionality is still missing here. Neither by localhost I could reach it, as otherwise by URL.

On https://[my-ip] I receive:

403 Forbidden
nginx/1.18.0 (Ubuntu)

The URL http://[[my-ip] will forward to which says “Page not found”.

I think there is more than one thing misconfigured here. So besides config.json I would have to adjust the nginx configuration as well.

As far as I understand the domain does not exist yet.
I would suggest to first cretae the domain to make sure you do not have a mixture of different root causes.

1 Like

Well it`s not public but it exist. This is one reason why I can not use certbot.

Well it`s not public but it exist. This is one reason why I can not use certbot.

It doesn’t seem to exist for the system you’re running those commands on though.

curl -I openhab-cloud would at least show you where it is trying to redirect you to - where it thinks its base URL is. That might be a start

Then I tried to install openHAB:

Except the commands you pasted don’t install Openhab. Do you have that running somewhere? I’ve not used it yet, planning to do so, but am pretty certain openhab-cloud is a remote front-end / proxy service for an instance of OpenHAB, which is the actual automation platform

I still have to think about the first one. The second was simply a typo on my part. Of course I have openHAB somewhere else and wanted to install openHAB Cloud and not openHAB. I already know for what I need openHAB and for what I need openHAB Cloud, and what the difference is.