The Everywhere Cloud

Deploy an instance.
Accelerate your application.

Running Home Assistant on Linux Servers

Home Assistant is an open-source home automation system powered by Python, primarily intended to run on single-board computers like the Raspberry Pi. The following procedure shows how to run Home Assistant Core on common Debian-based Linux servers, in either physical or virtual machines.



1.1. Update the package list and upgrade the existing packages.

user@host: $ sudo apt-get update && sudo apt-get dist-upgrade -y

1.2. Install Python and required packages.

user@host: $ sudo apt-get install python3 python3-dev python3-venv libffi-dev libssl-dev autoconf

1.3. Create a system account (-r) with a dedicated home directory (-m).

user@host: $ sudo useradd -r -m homeassistant

1.3.1. If groups for hardware input/output are present, append the system account. Else, skip this step for now.

user@host: $ sudo usermod -a -G dialout,gpio,i2c homeassistant

1.4. Ensure that only the system account and members of its group can access the dedicated home directory.

user@host: $ sudo chmod 770 /home/homeassistant

1.5. Create an installation directory for Home Assistant Core.

user@host: $ sudo mkdir /srv/homeassistant

1.6. Change owner of the installation directory to the system account.

user@host: $ sudo chown homeassistant:homeassistant /srv/homeassistant


2.1. Log in as the system account (-u), with $HOME "bin" included in $PATH (-i).

user@host: $ sudo -i -u homeassistant

2.2. Create a virtual environment for Home Assistant Core.

user@host: $ python3 -m venv /srv/homeassistant

2.3. Make the "activate" command executable by the system account.

user@host: $ chmod 700 /srv/homeassistant/bin/activate

2.4. Activate the virtual environment.

user@host: $ /srv/homeassistant/bin/activate

2.5. Install the "wheel" Python package.

user@host: $ /srv/homeassistant/bin/pip3 install wheel

2.6. Install Home Assistant Core.

user@host: $ /srv/homeassistant/bin/pip3 install homeassistant

2.7. Run the Home Assistant server. It may take around twenty (20) minutes to initially configure itself. Many required libraries and dependencies will be downloaded and installed on its first run.

user@host: $ /srv/homeassistant/bin/hass

2.8. Access the Home Assistant server through a web browser.


3.1. Log in as the system account (-u), with $HOME "bin" included in $PATH (-i).

user@host: $ sudo -i -u homeassistant

3.2. Follow the Linux crontab steps on this blog post but replace the @reboot line with the following.

@reboot /srv/homeassistant/bin/hass > /dev/null 2>&1 &


For security purposes, HTTPS can be enabled in Home Assistant to encrypt data transfers.



1. Home Assistant. Raspberry Pi. Install Home Assistant Core.



Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers