This is for a fresh install of Homebridge with auto-start on reboot or error.
If you are trying to convert an existing install, this step-by-step will not work for you, and you’ll need to modify it to suit your needs.
- Create the Default Settings file:
sudo nano /etc/default/homebridge
…and paste this into it. - Create the executable service:
sudo nano /etc/systemd/system/homebridge.service
…and paste this into it. - Create a user to run the service:
sudo useradd --system homebridge
- Create the directory for Homebridge to live in:
sudo mkdir /var/homebridge
- Open up the directory permissions:
sudo chmod -R 0777 /var/homebridge
- Reload all of the daemons
sudo systemctl daemon-reload
- Enable the Homebridge service to start:
sudo systemctl enable homebridge
- Start Homebridge yourself:
sudo systemctl start homebridge
Troubleshooting:
journalctl -f -u homebridge
to view the logssystemctl status homebridge
to check the service status.
Contents of /etc/defaults/homebridge
:
# 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
# If you uncomment the following line, homebridge will log more
# You can display this via systemd’s journalctl: journalctl -f -u homebridge
# DEBUG=*
Contents of /etc/systemd/system/homebridge.service
:
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target