Links on the site may earn us an affiliate commission. Learn more.

I’m going to show you step by step how you can set up an Ubuntu server, install Docker, set up Home Assistant Supervised, and last, but not least, we’re going to set up Portainer. So you can manage all the containers installed.

Create an Ubuntu server bootable drive

To set up an Ubuntu server on a computer, go to the Ubuntu website and download the Ubuntu server image. Then, create a bootable drive using Etcher, which makes it super simple to flash the image to a USB stick.

When you open Etcher, click on Select image and select the Ubuntu ISO file that was downloaded. If you only have one USB drive connected to the computer, Etcher automatically selects that drive. Lastly, click on Flash and give it a couple of minutes.

Install Ubuntu server

Once the bootable drive is created, connect it to the computer where you want to install the Ubuntu server. When you turn on your computer, it should automatically boot from the USB stick. However, if it doesn’t, you would need to access the Boot Menu to select the drive that you want to boot from. As soon as you boot the computer, on the first screen that you get, you should be able to see the key that you need to press to access the Boot menu.

In the Ubuntu installation, select the language, the Keyboard layout, then select Install Ubuntu. On the Network connections, Leave it as DHCP. So the router can assign the configuration automatically. However, on your router, you want to make sure that you set up a static IP address for your server. So like that the server always gets the same IP address. That’s something that I won’t be covering here because all routers are different. You would need to check with your router’s manufacturer to learn how to do it.

The Proxy configuration leave empty, and for the Ubuntu Archives mirror, leave it as default. For the Filesystem Setup, select Use an entire disk. If you have more than one drive installed, select the drive that you want to perform the installation. Then, click on Done and Continue.

Next, set up a profile so enter your Name, the Server name, a Username, and a Password. Because the server is going to be a headless machine, meaning that no monitor would be connected to it. You want to make sure that you select, Install OpenSSH server. So you can remotely connect from another computer. Lastly, Under Featured Server Snaps leave it as it is and just click on Done to complete the installation. When the installation finishes, click on Reboot now and remove the bootable USB drive.

Remotely connect to the server using SSH

All right, so the Ubuntu server is now up and running, and you can access it via SSH from another computer. So let’s go ahead and do that and continue the installation remotely.

On your computer open the terminal and type, ssh, the username, then @ and the IP address for your server.

ssh username@192.168.XX.XX

Then, press Enter and type, yes to continue with the connection. Now, before doing the rest of the installation, update the packages on the Linux server with:

sudo apt update

Then upgrade the packages with:

sudo apt upgrade

Install Docker

To set up Docker, you need to install some additional packages. However, first, you want to get Root access so type the command: sudo -i. Then enter the following command to install the packages:

apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg-agent \
  software-properties-common

NOTE

The Backslash " \ " is there to ONLY split the command into multiple lines.

Then, add the Docker’s official GPG key with the command:

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

After that, you need to verify that you have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. So search for the last 8 characters of the fingerprint with the following:

apt-key fingerprint 0EBFCD88

Next, you need to add the repository where you are going to get Docker from. There are 3 different channels, StableNightly, and test. You definitely want to get the stable version so enter the command:

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

All right, everything is ready, so you can now install Docker with:

apt-get install docker-ce docker-ce-cli containerd.io

Then, to verify that Docker was installed correctly, you can run the command:

docker run hello-world

The last thing that you want to do before installing Hass.io is to make sure that Docker starts when the server boots. So enter the following:

systemctl enable docker

Install Home Assistant Supervised

Docker is now up and running, and if for some reason the server is rebooted, Docker is going to start automatically. To install Home Assistant Supervised, you’ll need to first install a few more required packages so on the terminal enter the following:

apt-get install \
  apparmor-utils \
  avahi-daemon \
  dbus \
  jq \
  network-manager \
  socat

After that is done, you can install Hass.io with the command:

curl -sL "https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh" | bash -s

And that’s it. Give it like a minute or two and Home Assistant would be ready to go and you can access the frontend using the server’s IP address with the port 8123 at the end.

192.168.XX.XX:8123

Restore Home Assistant from Backup file

So Home Assistant is all set, and you can start configuring it as you usually would. You can also restore the configuration from a backup. So if you had Home Assistant already installed on another device, you could create a backup there and save it to your computer. Then, on this new installation, you can set up the Samba add-on, and transfer the backup file to the Backup folder. Then, when you go to the Supervisor tab and then Snapshots, the backup file would be available there for you to restore from.

Home Assistant can also be updated normally via the Supervisor tab. You don’t need to remove the container and redownload the Supervised version to get the latest version of Home Assistant.

Install Portainer

There are 2 ways that you can manage your Docker containers. You can do it via the terminal or use Portainer which provides a nice user interface making it simple to manage all the containers installed.

On the terminal, enter the following to create a new Docker volume for Portainer:

docker volume create portainer_data

If you’re not logged in as root, you would need to put sudo at the beginning.

Then, enter this command to run Portainer:

docker run -d -p 9000:9000 \
--name portainer \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer

And that’s about it. You can now access Portainer with the server’s IP and the port 9000 at the end.

192.168.XX.XX:9000

When you access Portainer for the first time, it would ask you to create a new username and password. Then, after you log in, select Local and then click on Connect.

Now you can see all the containers that are installed, and you can either Start, Stop, or Remove containers without having to use the terminal. There are a lot more things that you can do with Portainer. However, to not make this tutorial long, I just wanted to cover the setup process. I want to cover more about Docker and Portainer on future articles and videos, so if you have any suggestions, you can let me know via Twitter or leave a comment on the above video.

Want to support my work?