Installing HASS.io in docker on Ubuntu 18

Little did I know that when I tried this the first time on Ubuntu I would be taking the easy way...having since tried it on a few more distributions and Operating systems it has been less trivial. That being said, one has to use at least 3 different instructions in order to get it done so I am going to try to get it all in one place.  Most of this should work for any debian based distribution that uses systemctl. For example these instructions do not work on a mac that uses launchctl or Alpine Linux that uses OpenRC.

First Get docker-ce

Full instructions for setting up docker-ce are here: https://docs.docker.com/install/linux/docker-ce/ubuntu/ but hopefully These will be sufficient for you like they were for me.

Get rid of any current docker installation:
$ sudo apt-get remove docker docker-engine docker.io
Set up the docker repository:
Make sure apt is up to date
$ sudo apt-get update
Make sure apt works over SSL
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
Add the docker Key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Make sure it is there by checking for the end of the fingerprint (8 chars)
$ sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22
Now that we have the key, add the repository
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
update again to get the new repo up to date
$ sudo apt-get update
Install docker-ce (comunity edition)
$ sudo apt-get install docker-ce
add your user to the docker group
$ sudo usermod -ag docker <yourUser>
now log out and back in so that the groups change takes effect.
Test docker
$ docker run hello-world
Troubleshoot any errors

Installing the other requirements:

Full instructions for installing homeAssistant and the relevant requirements can be found here: https://www.home-assistant.io/docs/installation/virtualenv/ but we only need the first part
$ sudo apt-get install python3-pip python3-venv build-essential libssl-dev libffi-dev python-dev
You probably have most or all of these already unless you installed a minimal server environment like I did.
The rest of the requirements and steps come from github https://github.com/home-assistant/hassio-build/tree/master/install#install-hassio
$ sudo apt-get install bash jq curl avahi-daemon dbus
Optionally install the following
$ sudo apt-get install apparmor-utils network-manager

Now the fun part:

$ sudo su -
Yes you really need to be the root user to do this, you can't just sudo curl ... just trust me.
$ curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s

Watch it do some stuff and hopefully end with:
[Info] Run Hass.io
and no errors.
Most of the errors I ran into on ubuntu were related to rights, because

  1. I was trying to sudo curl ... or 
  2. I had not added my user to the docker group (which doesn't impact this step but surely does later).

open your browser to http://<UbuntuServer>:8123 and enjoy the glory!!!!


At some point I will also detail how I use docker-compose to bring up and down the Homeassistant docker instance while still letting it be managed by hassio-supervisor

I'm hoping to do a video of this soon so check back for updates
As always leave me a comment if you have troubles and I will try to find an answer.

I hope you HASS some fun with this!

Comments

Tim Naylor said…
If you try to do this on Disco Dingo, the docker install may not work. As of right now there is no docker-CE release for Ubuntu 19 however the current test branch works great.

To use that: after completing the prerequisites run
curl -fsSL get.docker.com | CHANNEL=test sh

and docker will install,
Then continue with the group assignment and everything else is correct.
I also updated the URI for the HASS.io install script as it has changed.

Popular posts from this blog

HomeAssistant via docker on a Mac

Flashing my tuya switches with tasmota

How I put Tasmota on my NodeMCU board and why I love them so much.