Best OS for Homebridge and how to install it

So the best OS for Homebridge from my point of view is DietPi (even de VMware version). It’s very light and fast for homebridge.

How to install Homebridge on DietPI?

First of all, using dietpi-software (command in terminal) you have to install using search software bellow applications:

  • build-essentials
  • avahi-daemon
  • node.js
  • python

And then using apt-get install bellow:

# apt-get install -y libavahi-compat-libdnssd-dev 
# npm install -g --unsafe-perm homebridge hap-nodejs node-gyp
# npm which default # cd /usr/local/lib/node_modules/
# npm install --unsafe-perm bignum

How to configure Homebridge to start automatically on boot?

Here are the steps adapted to DietPi based on this tutorial.

  • # nano /etc/default/homebridge and paste bellow code:
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/homebridge -I
# If you uncomment the following line, homebridge will log more
# You can display this via systemd’s journalctl: journalctl -f -u homebridge
# DEBUG=*
  • # nano /etc/systemd/system/homebridge.service and paste bellow code:
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
  • Create user where to run the service:
# useradd --system homebridge
  • Create homebridge folder:
# mkdir /var/homebridge
  • Copy the current config. Assume that you already have a working config.
# cp ~/.homebridge/config.json /var/homebridge/
# cp -r ~/.homebridge/persist /var/homebridge
  • Change homebridge folder permission and services:
# chmod -R 0777 /var/homebridge
# systemctl daemon-reload
# systemctl enable homebridge
# systemctl start homebridge
  • To check the status of the service and view logs:
# systemctl status homebridge
# journalctl -f -u homebridge

Leave a reply:

Your email address will not be published.

Site Footer