Installing Home assistant on Ubuntu server
This post is meant to explain my installation process of home assistant on ubuntu server, using kvm
You can follow the guide from
Ideally you just follow the guide here, I will add some information that was important to me
1. Network configuration
Dpending on your OS, you will have a different method of managing your networks. Some use network-manager, some NetworkManager, some systemd-networkd and so on. Either find it out by trying or read (here)[https://askubuntu.com/questions/1031439/am-i-running-networkmanager-or-networkd] to get a check which one. Depending on that, you have to configure a bridge on top of your current network interface that homeassistant can connect to. I have added a USB to ethernet adapter to my computer, that way I have two interfaces. My main interface is enp4s0
and the USB one is enx00133b9c3c5b
. You don't need that, but its nicer to have the bridge and the rest of the network separated. That way, if you mess something up, its messed up on an interface that is not needed for your main internet on the machine.
I will describe configuration of a bridge for networkd and network-manager
a. Netplan/ networkd
Ubuntu server uses netplan (systemd-networkd) as its network manager
To add a brigde, you have to first edit the permissions and then add some stuff to the following file:
sudo chmod 600 /etc/netplan/00-installer-config.yaml
After configuration, the file should have your ethernet devices at the top (for me its two, for you it can be only one) and then the bridge at the bottom
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
dhcp6: true
enx00133b9c3c5b:
dhcp4: true
dhcp6: true
bridges:
br0:
dhcp4: true
interfaces:
- enx00133b9c3c5b
macaddress: "a8:5e:45:e5:de:94"
parameters:
stp: true
netplan try
will show probable issues with the network configuration. I had tosudo apt install openvswitch-switch
as well- add a new network file
<network>
<name>bridged-network</name>
<forward mode="bridge" />
<bridge name="br0" />
</network>
b. Network-manager
I switched to Debian recently and had to do the configuration again, using network-manager. Followed the guide here.
I used brctl
to control the bridge and needed a file /etc/network/interfaces.d/br0
that I configured as followed:
## static ip config file for br0 ##
auto br0
iface br0 inet static
address 192.168.0.5
broadcast 192.168.0.255
netmask 255.255.255.0
gateway 192.168.0.1
# If the resolvconf package is installed, you should not edit
# the resolv.conf configuration file manually. Set name server here
#dns-nameservers 192.168.2.254
# If you have muliple interfaces such as eth0 and eth1
# bridge_ports eth0 eth1
bridge_ports enx00133b9c3c5b
bridge_stp on # disable Spanning Tree Protocol
bridge_waitport 0 # no delay before a port becomes available
bridge_fd 0 # no forwarding delay
After this, you have to enable forwarding of ports so have to add something to the docker configuration. You can find it in the guide I linked first in this post.
2. Start VM
I created a script that I can run, called create-haos.sh
virt-install --import --name hass \
--memory 4096 --vcpus 4 --cpu host \
--disk /path/to/haos_ova-11.2.qcow2,format=qcow2,bus=virtio \
--network bridge=br0,model=virtio \
--osinfo detect=on,require=off \
--graphics none \
--noautoconsole \
--boot uefi
Sadly I was not able to create the vm with my normal user, so I had to use sudo. Not ideal, but not too bad.
If you did everything correctly, homeassistant should turn up in your router with an IP and you should be able to connect to it