Today, we're going to migrate Hass.io from a Raspberry Pi and install it on Docker containers
in a Linux machine.
I'm going to show you step by step how you can set up an Ubuntu server, set up Docker,
install Hass.io on Docker containers, and last but not least we're going to set up Portainer
so you can manage all the containers installed.
All right so to set up an Ubuntu server in a computer, we’ll need to download the server
image from the Ubuntu website and create a bootable drive.
You can find the links for everything that we are going to be using in the description
below.
For those of you that already know how to set up an Ubuntu server or already have one
set up, you can skip these steps by jumping to this part of the video.
OK so let’s go to the Ubuntu website and download the server image.
Then, to create a bootable drive, we are going to use 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.
OK, the bootable drive is ready to go, Now, let's connect it to the computer where we
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.
All right, once you are 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, we're are going to be using the whole drive so 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 Password.
Because the server is going to be a headless machine.
Meaning that no monitor would be connected to it, we want to make sure that we select
Install OpenSSH server so we can remotely connect from another computer.
Lastly, Under Featured Server Snaps leave it as it is and click on done to complete
the installation.
When the installation finishes, click on Reboot now and remove the bootable USB drive.
All right, so the Ubuntu server is now up and running, and we 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.
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-get update.
Then upgrade the packages using, sudo apt-get upgrade.
Before installing Docker, we need to set up some additional packages.
But first, we want to get Root access so type the command sudo -i.
Then enter the following command to install the packages.
Then, add the Docker's official GPG key with the following.
After that, we need to verify that we have the key with this fingerprint.
So search for the last 8 characters of the fingerprint with this command.
Now, we need to add the repository where we are going to get Docker from.
There are 3 different channels, Stable, Nightly, and test.
We definitely want to get the stable version so enter this command:
All right, everything is ready, so we can now install Docker with the following.
Then, to verify that Docker was installed correctly, we can run the Hello-World image.
The last thing that we want to do before installing Hass.io is to make sure that docker starts
when the server boots.
So type systemctl enable docker.
All right, so Docker is up and running, and if for some reason the server is rebooted,
Docker is going to restart automatically.
Now, to install Hass.io, we'll need to first install a few more required packages so on
the terminal enter the following:
After that is done, we can install Hass.io with this command.
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.
OK so we have Home Assistant all set, and we can start configuring it as we usually
would.
We can also restore the configuration from a backup.
So if you had Hass.io 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 Hass.io tab and then Snapshots, the backup file would be available
there for you to restore it.
The other thing that I wanted to mention is about updating Home Assistant.
You can update it like you normally would via Hass.io.
Just press the update button, and it would update to the latest version.
You don't need to remove the container and then redownload Hass.io to get the newest
version of Home Assistant.
Last but not least.
I want to show you how to manage your Docker containers.
There are 2 ways that you can do it.
You can use the terminal or by using 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 Docker volume for Portainer.
Then, enter this command to run Portainer.
And that's about it.
You can now access Portainer with the server's IP and the port 9000 at the end.
When you access Portainer for the first time, it will ask you to create a username and password.
Then, after you log in, select Local and then click on Connect.
Now we can see all the containers that are installed, and we 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 video long, I just wanted to cover the setup process.
I would like to cover more about Docker and Portainer on future videos so if you have
any suggestions, let me know in the comments below.
All right, guys.
That's all I have for you today.
If you have any questions, let me know if the comments.
You can also follow me on twitter and stay in touch.
If you like this video and found it useful, give it a thumbs up.
Don't forget to subscribe if you haven't done so already, and I will see you in the next
video.