This is how i installed hass.io on ubuntu with docker / portainer via ssh

Install ubuntu desktop, choose minimal version with LVM.

Open the terminal and type the following commands

First we need sudo / root access, type the following into terminal.

sudo -s

now enter your password

Now we have root (sudo) access to do the following

This will upgrade and update everything

apt-get upgrade

apt-get update

This will install the pre-requisites, most of these will already be installed

apt-get install -y bash jq curl avahi-daemon dbus network-manager apparmor-utils

apt-get install -y apt-transport-https ca-certificates curl software-properties-common

This next bit is to download the docker repository and finger print check

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Now install docker-ce by copy + paste this whole box of 4 lines of text and press enter

add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Now we can install docker-ce

apt-get update

apt-get install docker-ce

Now we can finally install hass.io

curl -sL https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install | bash -s

(or) if we use an Intel NUC

curl -sL https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install | bash -s -- -m intel-nuc

Now we can install portainer to manage docker containers from web interface

docker pull portainer/portainer

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Now we check portainer is running

docker ps

We should see output in the terminal that lists all 3x containers
(portainer / homeassistant / hass-io-supervisor)

If we need to check what our IP address of the server is we can type

ifconfig

Now we can access the hass.io and portainer web-gui

Hass io - http://xxx.xxx.xxx.xxx:8123
Portainer - http://xxx.xxx.xxx.xxx:9000

Note:

  1. If we want to install the SSH addon for hass.io and we also want to use SSH with ubuntu, then we need to change the default ssh port for ubuntu from 22 to 2222. The ports will be [ hass.io ssh addon = 22 / ubuntu desktop = 2222 / hass.io-supervisor = 22222 ].

  2. If any of the pre-requisites wont install you can try the following:
    add-apt-repository universe
    apt-get update

13 Likes

Great write up! Do you have instructions on changing the SSH port?

It’s easier to just change the ssh add on port and leave the host port alone. Not sure why you need supervisor or port 22222.

I’ve read that the hass.io SSH server add-on had a fixed SSH port, and there are no instructions on how to change the port.

The recommendation I believe is to use the community addon where you can change the port. When I read the instructions pretty sure it even said you can’t use the normal addon.

I could not find an option to change the SSH add-on port.

Ahh I see you are referencing this:

check out this it has a way to enter root ssh

Blockquote > Gaining true root access to HassOS

HassOS based Hass.io

Use a USB drive formatted with FAT, ext4, or NTFS and name it CONFIG (case sensitive). Create an authorized_keys file containing your public key, and place it in the root of the USB drive. From the UI, navigate to the hass.io system page and choose “Import from USB”. You can now access your device as root over SSH on port 22222. Alternatively, the file will be imported from the USB when the hass.io device is rebooted.

From <https://developers.home-assistant.io/docs/en/hassio_debugging.html#hassos-based-hassio&gt;

danrspencer provides more detail here 73 on the SSH process to create credentials between the Pi and the PS4

SSH into the true root of your Pi running HASS.IO :

Use the SSH home-assistant guide 61 to get to the true root of your Pi from Windows.

To do this, you’ll need to

  • Create a public/private RSA key pair, (use PuTTygen.exe to create a new public and private key)
  • Copy public key text generated by puttygen.exe
  • 2 ways to add the public key to hassos

Use the feature >hassio >system >import from usb. See

Put the public key text onto the root of the boot partition named authorized_keys ( save with no file extention) of your HASS.IO Pi’s SD card

  • Install the private key into your SSH software on your Windows machine.
  • Put the SD card back into the Pi,
  • Boot up,
  • SSH into your Pi’s root (ssh [email protected] -p 22222).
  • Type the passphrase you used when creating the private key with puttygen.exe earlier

used in this post

Awesome! Thanks so much for this. Exactly what i was wanting to setup. Worked perfectly

1 Like

Good day,
Could anyone assist me please.
Everything goes smoothly until i need to install hass.io.
It gives me the following error:
"bash: line 97: /etc/hassio.json: Permission denied.

With thanks

Did you switch to root?

Linux noob here so my apologies. I added “sudo” before the command and it gave me that error. But the installation started when i first did “sudo -s”
Thank you @silvrr

If your a Linux noob I would recommend these instructions.

While you are waiting on the install, research what each command does.

1 Like

Everytime I run this line I get “mkdir: cannot create directory ‘/usr/share/hassio’: Permission denied”.

Some questions I have:

  • Is that install file specifying the path for it to be installed to?
  • Why am I being denied permission even after adding sudo?
  • Do I need to specify a folder I have permission to and if so how do I do this?
  • I installed docker-ce and portainer and they are running fine. Where in these commands is it specifying for it to be installed in a docker container?

Thank you!

did you use sudo -s to get root / admin mode

My apologies. I see where you addressed this with other users above. That did get me further along. It looks like it installed everything a started running Hass.io. However, in Portainer I only see 2 containers: Portainer and hassio_supervisor. When running docker ps, I only see Portainer.

Does it simply take time for Hass.io to install and show up properly?

not sure i proably don’t know much more than you do, but there should be 2 containers running, hass.io supervisor and home assistant. Maybe hass.io supervisor is still isntalling…

It didn’t work. The supervisor says it was created in portainer but I cannot start it. Portainer says that it doesn’t exist. I setup the portainer as local. Is that correct?

hi, i’ve installed hassio on ubuntu 18.04 (and on docker) and i want to get persistent my usb, i try to connect [email protected] -p 22222 but give me connection refused, can you help a newbie? :slight_smile:
When i go hassio/system i can’t view import from usb…

you’ll need to find a guide on how to setup ssh in ubuntu and assign a port that is not 22. you need to login physically to the computer to do this.

this worked for me, thank you for the clear instructions