It is very easy to install Home Assistant on a Linux distribution (Ubuntu, Debian, CentOS …) on a virtual machine running on a NAS with snapd. Snaps are packages of desktop, cloud, and IoT apps that are easy to install, secure, cross-platform, and dependency-free. Only one command line is needed to install an application which considerably reduces the difficulties when starting with Linux.
Hassio, the packaged version of Home Assistant integrating the supervisor is very easy to install with Docker. However, when the version of Docker installed on the NAS is too old or the update is late, it is no longer possible to update Hassio (Home Assistant). If your NAS has enough power (at least 8GB of RAM) and supports virtualization (usually NAS equipped with Intel processor), installing Hassio on a Virtual Machine (VM) is a sustainable alternative.
Which NAS to choose to run a VM
Several consumer models may be suitable for running a Linux virtual machine (Debian, Ubuntu …).
Preferably choose a dual bay model to create a RAID 1 or Btrfs volume (more modern) to secure your data.
Best choice | |||
---|---|---|---|
2021 models | DS220+ | DS720 + | DS920 + |
Older generations | DS218 + | DS718 + | DS918 + |
Average price of bare NAS ** | ~ 340€ | ~ 455€ | ~ 550€ |
Processor | Intel Celeron J3355
Dual Core@2.0 GHz |
Intel Celeron J3455
Quad Core@2.3 GHz |
Intel Celeron J3455
Quad Core@2.3 GHz |
Score CPU Benchmark | 1193 | 2126 | 2126 |
RAM | 2 GB DDR3L | 2 GB DDR3L | 4 GB DDR3L |
Max RAM | 6 GB (2 GB + 4 GB)
possible 8GB |
6 GB (2 GB + 4 GB)
possible 8GB |
8 GB (2 x 4 GB ) |
VM name max. * | 2 | 2 | 4 |
Max storage | 28 TO
2 x 14 TO |
28 TO
2 x 14 TO |
56 TO
4 x 14 TO |
Transcoding *** | H.264 (AVC), H.265 (HEVC), MPEG-2 and VC-1; maximum resolution: 4K (4096 x 2160) @ 30fps | H.264 (AVC), H.265 (HEVC), MPEG-2 and VC-1; maximum resolution: 4K (4096 x 2160) @ 30fps | H.264 (AVC), H.265 (HEVC), MPEG-2 and VC-1; maximum resolution: 4K (4096 x 2160) @ 30fps |
USB 2.0 | x2 | ||
USB 3.0 | x1 | x3 | x2 |
1GbE Ethernet | x1 | x2 | x2 |
eSATA | x1 | x1 | x1 |
Noise | 19.3 dB(A) | 18.4 dB(A) | 19.8 dB(A) |
Conso. normal | 17,23W | 20.1 watts | 28.8 watts |
Conso. Standby | 5.4 watts | 9.1 watts | 12.6 watts |
Technical sheet | Read | Read | Read |
(*) requires at least 4GB of RAM.
(**) The NAS is delivered without hard drive and memory expansion.
(***) Makes it possible to greatly reduce the storage space (and therefore the overall cost of the NAS) for video surveillance
Which version of Linux to choose to install Hassio (Home Assistant)?
All versions of Linux will be able to run Home Assistant. If you are just starting out, your best bet is to stick with a distro with a very large community and regular, stable updates.
Ubuntu is a great choice, but it’s really a matter of taste. If the virtual machine is dedicated to Home Assistant, there is no need to bother with the graphical desktop (Desktop version), the Lite / Server version will do the trick … provided you are not afraid of the Terminal, of course. Don’t worry, everything is explained in the tutorial!
Create Ubuntu 20.04 LTS Virtual Machine on Synology NAS
Go to the official Ubuntu site to grab the ISO image of the distribution of your choice. Preferably choose an LTS (Long Time Service) version which will receive security updates for 10 years.
Then create a virtual machine on the Synology NAS as you are used to. Remember to deselect the ISO file from the Ubuntu distribution at the end of the installation.
Enable SSH port
By default, Ubuntu does not have an SSH server. Whatever version is installed (Desktop or server), it is much more convenient and faster to install SSH. Start by switching to administrator mode, this will prevent you from having to precede each command with a sudo.
sudo -i
Then we update the system and we install the openssh server
apt update
apt install openssh-server
Now, we check that the ssh service is started by running the systemctl status ssh command
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-12-14 13:13:35 CET; 4min 17s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 2961 (sshd)
Tasks: 1 (limit: 2318)
Memory: 3.3M
CGroup: /system.slice/ssh.service
└─2961 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
déc. 14 13:13:35 vm-ubuntu20 systemd[1]: Starting OpenBSD Secure Shell server...
déc. 14 13:13:35 vm-ubuntu20 sshd[2961]: Server listening on 0.0.0.0 port 22.
déc. 14 13:13:35 vm-ubuntu20 sshd[2961]: Server listening on :: port 22.
déc. 14 13:13:35 vm-ubuntu20 systemd[1]: Started OpenBSD Secure Shell server.
All that remains is to change the firewall settings by allowing SSH
ufw allow ssh
You can now connect SSH to Ubuntu from Terminal on macOS or Linux or using Putty with Windows.
Enable snapd on your linux distribution
Snapd is the background service that automatically manages and maintains your snaps. The (snap) package is independent * of the Linux distribution and the platform (ARM, Intel …), that’s what is great about snap. It even works on the Raspberry Pi!
If you are using Ubuntu 16.04 LTS (Xenial Xerus) or later, including Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 20.04 LTS (Focal Fossa), you don’t need to do anything. Snap is already installed and ready to go.
For Ubuntu versions between 14.04 LTS (Trusty Tahr) and 15.10 (Wily Werewolf) , as well as Ubuntu versions that do not include snap by default, snap can be installed from the Ubuntu Software Center by searching for snapd .
You can also install snapd from Terminal by running the following two commands
At the end of the installation, log out and log back in or restart your system to ensure that the snap paths are properly updated.
sudo apt update
sudo apt install snapd
More information here
On Debian 9 (Stretch) and Debian 10 (Buster), snap can be installed directly from the command line:
sudo apt update
sudo apt install snapd
If the sudo command is not installed (usually because a root password was provided during installation), you can install snap by switching to the root account first:
su root
apt update
apt install snapd
Log out and log back in, or restart your system to make sure the snap paths are properly updated. After that, install the snapd corecomponent in order to get the latest snapd version.
sudo snap install core
core 16-2.45.2 from Canonical✓ installed
More information here
sudo apt update
sudo apt install snapd
You will also need to restart the Raspberry Pi by executing the command (be careful to save your documents before executing the command
sudo reboot
After that, install the snapd corecomponent in order to get the latest snapd version.
sudo snap install core
core 16-2.45.2 from Canonical✓ installed
Note. Some snaps require new snapd features and will show an error like snap “lxd” assumes unsupported features “during install. You can resolve this problem by ensuring that the main snap-in is installed (snap install core) and that ‘this is the latest version (snap refresh core).
To test your system, install the hello-world snap and make sure it is working properly
snap install hello-world
hello-world 6.3 from Canonical✓ installed
hello-world
More information here
In case of installation problem on your Linux distribution, go to this page of the snapcraft documentation.
Install Hassio, Home Assistant, Configurator, HACS snaps
There are (currently) two Home Assistant snaps. You have to install the snaps developed by Joachim Marthinsen Giæver.
I advise you to install the 3 snaps to have a Top configuration.
I suggest that you install the 3 snaps from the Terminal on command line because you will need to enter some parameters during the installation anyway. Note, however, that the 3 Joachim snaps can also be installed from
Click on the magnifying glass and type Home Assistant in the search field to find them.
1 home-assistant-snap the Core of the home assistant home automation server
snap install home-assistant-snap
Upon completion of the installation, Home Assistant starts up as a service. Access to the HTML interface is accessible from a browser at the address IP_UBUNTU: 8123
Once you have created your user account, go to Configuration -> Info to retrieve the path to the Home Assistant configuration.yaml file .
Usually, Home Assistant configuration files and scripts are stored in the /var/snap/home-assistant-snap/101/ folder.
The configurator (former File Editor) allows you to modify all configuration files and scripts without leaving the Home Assistant interface
snap install home-assistant-configurator
The two snaps are automatically connected to each other. To check it, run
snap connections
If all went well you should find the following line in the list
content[configurations] home-assistant-configurator:configurations home-assistant-snap:configurations
If this is not the case, we manually connect the snaps by executing the command
snap connect home-assistant-configurator:configurations home-assistant-snap:configurations
Open the configuration.yaml file
nano /var/snap/home-assistant-snap/101/configuration.yaml
and add the following lines by changing IP_HASSIO to the IP address of your Ubuntu virtual machine on the Synology NAS. Notes:
- Enter the domain name or IP address only. localhost does not work because Home Assistant integrates the HTML page of the configurator as an iframe.
- If you have enabled HTTPS support on Home Assistant, you can enter https in the url, otherwise the configurator page will not be accessible
panel_iframe:
configurator:
title: Configurator
icon: mdi:wrench
url: http://IP_HASSIO:3218
Save the modification with Ctrl + X (then Y) then restart Home Assistant
sudo snap restart home-assistant-snap
You now have access to all HomeAssistant scripts and YAML files
3 HACS allows you to install many additional themes and plugins directly from the Home Assistant interface.
The installation of HACS is super simplified using the Joachim snap.
Run this command to install the HACS snap
sudo snap install home-assistant-hacs
At the end of the installation, restart the server
sudo snap restart home-assistant-snap
Wait for Home Assistant to restart then go to Configuration -> Integration -> + Add integration .
Find HACS in the search field and click on the line
Check to accept all terms of use
You will need a GitHub account (free) to access HACS repositories.
Finish by clicking on submit . If everything is correct, you should get a success message. You can associate HACS with a part but it is not mandatory. Finally click on Finish
You can now add new plugins and themes.
Read this article to learn more about HACS
Update Home Assistant
For the moment, there is no snap allowing to add the Supervisor which would allow updating Home Assistant from the HTML interface.
The only thing you can do is install the candidate version like this.
Stop the service
sudo snap stop home-assistant-snap
Refresh (update) by adding the –candidate option
sudo snap refresh home-assistant-snap --candidate
Then we restart the server
sudo snap start home-assistant-snap
Some useful commands to manage your snaps
Here are some useful commands
List installed snaps
Stop a snap
sudo snap stop snap_name
All other orders
- Basic functions: find, info, install, remove, list
- Advanced: refresh, revert, switch, disable, enable, create-cohort
- History: changes, tasks, abort, watch
- Services : services, start, stop, restart, logs
- Permissions : connections, interface, connect, disconnect
- Configuration: get, set, unset, wait
- Aliases : alias, aliases, unalias, prefer
- User account: login, logout, whoami
- Snapshots : saved, save, check-snapshot, restore, forget
- Device : model, reboot, recovery
- Other: warnings, okay, known, ack, version
- Development: download, pack, run, try
Updates
2021/01/19 Publication of the tutorial
Thanks for reading
- Get Started with HC-SR04, measure distance by ultrasound. Arduino code example
- ESP32, GPIO pins and associated functions. I/O, PWM, RTC, I2C, SPI, ADC, DAC
- ESP32-CAM pinout and equipments. ESP-EYE, AI Thinker, TTGO T-Camera, M5Stack Timer Camera …
- ESP32-CAM. Which model to choose? ESP-EYE, AI Thinker, TTGO T-Camera, M5Stack Timer Camera …
- M5Stack Atomic GPS. ESP32 TinyGPS++ tracker, GPX export on SD card, visualization on Google Maps or VSCode