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

1 comments On Best OS for Homebridge and how to install it

  • Hi,
    I am experiencing issues running your tutorial (I also tried another one)
    while running root@DietPi:~# npm which default I am getting Unknown command: “which”
    I also tried npm install which but the issue persists. What is the purpose of this? moving npm’s default dir from ~/.npm to /usr/local/lib/node_modules/ ?
    Also: If I want a fresh start of HB and not load an old config, how do I install homebridge-ui-x?
    Thx in advance.

Leave a reply:

Your email address will not be published.

Site Footer