Then run these commands to be sure the system is up to date.
sudo apt-get update
sudo apt-get upgrade
Install Python 3 dependencies
Install the required Python 3 dependencies with these commands.
sudo apt-get install python3 python3-dev
sudo apt-get install python3-venv python3-pipCopy
You can check the installed version ofPython 3 with this command.
Install Cryptography dependencies
Install the libffi package required by the cryptography package during the Home Assistant installation.
sudo apt-get install libffi-devCopy
Directory for Home Assistant
If you didn’t create a user account for Home Assistant when installing Armbian we will now do it with the command useradd.
sudo useradd -rm hass -G dialoutCopy
Since this account is only for running Home Assistant the extra arguments of -rm is added to create a system account and create a home directory. The argument -G dialout adds the user to the dialout group. This group is required for using Z-Wave and Zigbee controllers.
Create now a group for Home Assistant.
sudo addgroup homeassistantCopy
Then we create a directory for the installation of Home Assistant and change the owner to the hass account.
sudo mkdir /srv/homeassistant
sudo chown hass:homeassistant /srv/homeassistantCopy
Virtual environment for Home Assistant
Next we create a python virtual environment for Home Assistant with the hass account.
sudo -u hass -H -sCopy
python3 -m venv /srv/homeassistantCopy
Now we activate the virtual environment.
Notice how the prompt changes once you have activated the virtual environment.
Run the following command to install the required wheel python package.
python3 -m pip install wheel
Successfully installed wheel-0.31.1Copy
Install Home Assistant
Finally, the time to install Home Assistant has come!
python3 -m pip install homeassistant
Successfully installed MarkupSafe-1.0 PyJWT-1.6.4 aiohttp-3.4.0 asn1crypto-0.24.0 astral-1.6.1 async-timeout-3.0.0 attrs-18.1.0 bcrypt-3.1.4 certifi-2018.8.24 cffi-1.11.5 chardet-3.0.4 cryptography-2.3.1 homeassistant-0.77.0 idna-2.7 idna-ssl-1.1.0 jinja2-2.10 multidict-4.3.1 pycparser-2.18 pytz-2018.5 pyyaml-3.13 requests-2.19.1 six-1.11.0 urllib3-1.23 voluptuous-0.11.5 yarl-1.2.6Copy
Start Home Assistant
Now that we have successfully installed Home Assistant it is time to run the hass command to start Home Assistant for the first time.
This will complete the installation, create the .homeassistant configuration directory in the /home/homeassistant directory and install any basic dependencies.