openHABianPi Initial Setup

Tags: #<Tag:0x00007f616d67abd0> #<Tag:0x00007f616d67aa40> #<Tag:0x00007f616d67a950>

After having fucked up my openHAB installation I had to set up my openHABianPi from scratch and took the opportunity to write down the necessary steps. Mainly for myself, so that next time I wouldn’t have to search for all the different tutorials, always hoping not to forget any of the options I deem necessary…
And perhaps some of you can use this guide in a similar situation - or just as inspiration which options might be useful.


  • Installation
  • Configuration
  • SSD / Grafana / InfluxDB
  • Amanda-Backup
  • git
  • Decluttering the Log



  • connect to your openHABianPi
    • connect via ssh: ssh openhabian@openhab
    • Password: openhabian
  • open openHABian Configuration Tool: sudo openhabian-config
    • Check for updates - run the following options
      • 01 | Update
      • 02 | Upgrade System
      • 10 | Apply Improvements
        • 11 | Packages
        • 12 | Bash&Vim Settings
        • 13 | System Tweaks
        • 14 | Fix Permissions
        • 15 | FireMotD
      • 30 | System Settings
        • 34 | Change Passwords
          • all: you should not use any of the default passwords - do not skip this step because you think you will take care of that one later…
          • test if the password change did work - somehow the Config Tool doesn’t work for me in regard to password changes. If you have the same trouble the following comands should do the trick for you:
            • Linux system: passwd
            • openHAB Console: sudo passwd openhab
            • Samba: sudo smbpasswd openhabian
            • Amanda backup: sudo passwd backup
        • 31 | Change Hostname - choose an individual hostname
          • remember to use the new hostname when you reconnect via ssh
        • 32 | Set System Locale
          • set if you want to change the system language, for example to display weekdays on your sitemaps in your local language
      • 40 | openHAB related
        • 42 Remote Console
          • enter the password for ‘openHAB Console’ you selected during the step ‘Change Passwords’
          • test from a different computer ( stands for the hostname selected in step ‘Change Hostname’): ssh -p 8101 openhab@<hostname>
  • Close openHAB config with ‘ESC’
  • reboot: sudo reboot

SSD / Grafana / InfluxDB

Disclaimer: I’m not using Grafane & InfluxDB anymore since they seem to overwork my Raspi 3B setup (RAM use always at more than 90%, reliability of rule execution way lower than what I’m used to). Might use these tools again in the future if I switch to a more powerfull server :thinking:

If you wish to use Grafana & InfluxDB to persist and display stuff, you might also wish to switch your openHAB system to an external USB drive both both to protect your SD card from wear by to many write cycles and a growing database…
Since USB sticks have the same limitations as SD cards you should choose an USB HDD or SSD. If you consider buying a new HDD / SSD for that purpose I recommend to research a bit in regard to how much power the Raspy can deliver vs what your device needs, if your Raspy is able to boot from USB, if the Raspy is able to boot from your specific HDD / SSD, …
In my case the Raspy is not able to boot from my SSD, so I boot from SD card and have everything else on my SSD.

  • Move root to an SSD
    • connect USB drive to your openHABianPi
    • open openHABian Configuration Tool: sudo openhabian-config
    • 30 | System Settings - 37 | Move root to USB
    • reboot
  • Install Grafana & InfluxDB
    • open openHABian Configuration Tool: sudo openhabian-config
    • 20 | Additional Components - 24 | InfluxDB+Grafana
    • reboot
    • Test Installation by visiting http://<hostname>:3000 and signing in with admin and your adminpwd
    • look into the log to to see if you get InfluxDB related error messages - if yes execute the following commands:
      • sudo chown -hR openhab:openhab /etc/openhab2
      • sudo chown openhab:openhabian /etc/openhab2/services/influxdb.cfg
      • influx -port 8086 -username admin -password myinfluxdbadminpwd -host localhost
      • CREATE DATABASE openhab_db
      • CREATE USER admin WITH PASSWORD 'myinfluxdbadminpwd' WITH ALL PRIVILEGES
      • CREATE USER openhab WITH PASSWORD 'myopenhabpassword'
      • CREATE USER grafana WITH PASSWORD 'mygrafanapassword'
      • GRANT ALL ON openhab_db TO openhab
      • GRANT READ ON openhab_db TO grafana
      • (Found at InfluxDB+Grafana persistence and graphing)
    • Guide for starting with InfluxDB, Grafana & openHAB:


Yes, you want an automated backup!

  • mount a backup drive
    • follow this guide:
    • example:
      • connect to your NAS via SSH (DSM):
      • sudo vim /etc/exports
      • mkdir /volume1/Backup/openHAB
      • append: /volume1/Backup/openHAB <hostname>(rw,async,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,anonuid=1024,anongid=100)
        • the values for anonuid and anongid can be found under /etc/passwd for the System default user (admin:x:1024:100)
      • sudo exportfs -ra
    • do the following steps on your openHABianPi
      • sudo mkdir /mnt/backup
      • sudo vim /etc/fstab
        • press ‘i’ to insert text
        • Append the following line: <DNS name NAS>://volume1/Backup/openHAB /mnt/backup nfs nouser,atime,auto,rw,dev,exec,suid 0 0
        • press ‘ESC’
        • type ‘:wq’ and press ‘Enter’
      • sudo mount -a
      • sudo chmod 777 /mnt/backup
      • test the mounted folder by creating a file on your Pi and checking the file on your NAS. Than delete the file on your NAS and check on your Pi
  • set up amanda
    • follow this guide:
      • sudo openhabian-config
        • 50 | Backup/Restore
        • 51 | Amanda Backup
          • backup location: /mnt/backup
          • Storage: 1024
    • configure additional folders to be backed up
      • switch to user backup: sudo su - backup
      • vim /etc/amanda/openhab-dir/disklist
      • add: <hostname> /etc/amanda/openhab-dir user-tar
    • test backup
      • currently no backup: amreport openhab-dir
      • run backup: amdump openhab-dir
      • backup report: amreport openhab-dir


My git setup is not traditional, but you should be able to tweak it for your purpose without to much trouble.

Decluttering the log

log4j2.appender.event.filter.ItemStateChangedEvent.type = RegexFilter
log4j2.appender.event.filter.ItemStateChangedEvent.regex = .* changed .*
log4j2.appender.event.filter.ItemStateChangedEvent.onMatch = DENY
log4j2.appender.event.filter.ItemStateChangedEvent.onMisMatch = ACCEPT

Feel free to add the steps for options you deem necessary or let me know about improvements for my post :slight_smile:


One thing missing, though.
Add in a UPS and a driver to properly shutdown the Pi, to reduce the chances of SD card corruption.

1 Like

Add use of ZRAM (install option 38) to mitigate SD card corruption.

1 Like

nice job! Should be updated in the official wiki.

Anyone is free to edit it. :wink:

In the current form it’s more of a work log, I think for the wiki it would need a little bit more polish :thinking:
On the other hand I would appreciate it if someone would take this post as groundwork for a wiki entry :grinning:

I’ve installed OH in this way and it worked great but yesterday my SSD drive broke down :frowning: .

Now I trying to restore backup using amanda but I have no idea how to do it. (I’ve read tutorial but I completly don’t understand it :frowning: )
Could you write how you restore backup?

Hi @Dom_KS,

Thx for your trust - but I have never actually used Amanda to restore after a crash, so I can’t really help you with that.
A quick search in this forum for „Amanda restore“ points you to some posts that might be helpful, for example this one

Then read it again. Twice if needed. Don’t hurry but take your time to understand what’s written.
Yes OH and Amanda expect users to invest a fair minimum of their own time and thinking.
You are welcome to get back here with concrete questions, but not with an overall ‘lazy’ one like this.
And please follow the rules in here:
How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

1 Like