Home Assistant has dropped native support for ubuntu.
So it is not possible to have supervised Home Assistant on ubuntu other then virtual machine.
There are plenty of guides for Home Assistant installation using virtualbox GUI, but it is not helpful for ubuntu-server headless computers. So we try to connect to our server via ssh and do all the work using command line only.
1. Install VirtualBox
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install virtualbox
We need to add our user
to vboxusers
group
$ sudo usermod -aG vboxusers user
As this instruction says, we need to do the following:
For VirtualBox create a new virtual machine, select “Other Linux (64Bit), assign it at least 2 GB of memory and “Use an existing virtual hard disk file”, select the VDI file from above, afterwards edit the “Settings” of the VM and go “System” then Motherboard and Enable EFI, then “Network” “Adapter 1” Bridged and your adapter.
2. Create virtual machine
Let’s create VM with name hass
:
$ VBoxManage createvm --name hass --ostype Linux_64 --register
Set it’s bios to efi:
$ VBoxManage modifyvm hass --firmware efi
Set cpu number and memory:
$ VBoxManage modifyvm hass --cpus 2 --memory 2048
We need to bridge our virtual machine to existing network adapter.
Type ifconfig
to know its name.
For me it is enp3s0
.
So let’s connect VM’s virtual network card nic1
to real network card enp3s0
:
$ VBoxManage modifyvm hass --nic1 bridged --bridgeadapter1 enp3s0
3. Download and connect Home Assistant image to our virtual machine
Virtualbox creates a folder in user home directory to store VM files.
/home/user/VirtualBox VMs
and there is a folder with our new created VM:
/home/user/VirtualBox VMs/hass/
We need to download a virtual VDI image from here, unpack and place it in VM’s folder
/home/user/VirtualBox VMs/hass/
Let’s create a sata controller
$ VBoxManage storagectl hass --name "SATA Controller" --add sata --bootable on
And connect our downloaded Home Assistant image to it:
$ VBoxManage storageattach hass --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium /home/user/VirtualBox VMs/hass/hassos_ova-4.12.vdi
4. Run
Now we can run our Home Assistant virtual machine:
$ VBoxManage startvm hass --type headless
If you need to stop it use:
$ VBoxManage controlvm hass poweroff
As we used bridged network, our VM is going to have it’s own IP address. So the easiest way to know it, is to look in your router interface. It would be better to fix its IP by static DHCP in the router.
When VM is running, we can connect to it via browser:
http://your_vm_ip:8123