Setting Up Home Assistant on Ubuntu 26.04 Using Docker

Home Assistant is one of the most practical platforms for building a local smart home system. It can connect sensors, switches, cameras, MQTT devices, smart plugs, Zigbee devices, dashboards, and automation rules in one place.

For Ubuntu 26.04, one clean way to install it is by using Home Assistant Container with Docker Compose. This keeps the setup simple, portable, and easy to update. Home Assistant officially supports the container installation method, but note that this method does not include Home Assistant OS apps or Supervisor features. You manage the container yourself.

Screenshots

Step 1: Setting up docker container

sudo apt update
sudo apt upgrade -y

Install required packages:

sudo apt install ca-certificates curl -y

Add Docker’s official GPG key and repository:

sudo install -m 0755 -d /etc/apt/keyrings

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
-o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

Then install Docker Engine and Docker Compose plugin

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Docker’s official documentation lists Ubuntu 26.04 LTS as a supported Ubuntu release for Docker Engine, and recommends installing Docker from its official apt repository.

sudo systemctl status docker

Step 2 Create Home Assistant Folder

Create a folder to store the Home Assistant configuration:

sudo mkdir -p /opt/homeassistant/config
sudo chown -R $USER:$USER /opt/homeassistant
cd /opt/homeassistant

This folder is important because your Home Assistant settings, integrations, dashboards, and YAML files will be stored here.

Step 3. Create Docker Compose File

nano compose.yaml

Paste this configuration

services:
  homeassistant:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
    environment:
      TZ: Asia/Kuala_Lumpur

Home Assistant recommends network_mode: host for the container setup, because many smart home integrations rely on local network discovery. The official container guide also shows the /config volume, D-Bus mapping, privileged mode, and Docker Compose structure

Start Home Assistant:

docker compose up -d

Check the logs:

docker logs -f homeassistant

Then you can try and access your Home Assistant from your browser

http://YOUR_SERVER_IP:8123
http://192.168.1.50:8123

If you are running UFW firewall, allow port 8123

sudo ufw allow 8123/tcp

Additional Tips:

For an Ubuntu Docker setup, integrations that depend on USB hardware, such as Zigbee dongles, may need device mapping. For example:

devices:
  - /dev/ttyUSB0:/dev/ttyUSB0

Updating Home Assistant

You can periodically execute this to update Home Assistant docker container:

cd /opt/homeassistant
docker compose pull
docker compose down
docker compose up -d

yt-dlp – a verstatile video downloader tool

yt-dlp is a command-line tool for which allows a user to download audio/video from thousands of sites. The project is a fork of youtube-dl, which is based on the now inactive youtube-dlc.

yt-dlp can be installed using official releases or via package manager.

Unix-like operating system

curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp
chmod a+rx ~/.local/bin/yt-dlp  # Make executable

To update yt-dlp in Unix-like operating system

yt-dlp -U

Homebrew MacOS

brew install yt-dlp

Ubuntu

sudo add-apt-repository ppa:tomtomtom/yt-dlp # Add ppa repo to apt
sudo apt update # Update package list
sudo apt install yt-dlp # Install yt-dlp

Snap

sudo snap install --edge yt-dlp

Windows operating system

yt-dlp is also available for Windows operating system by using, winget:

winget install yt-dlp

Microsoft Windows binary package

The binary package for Microsoft Windows binary package can be downloaded from yt-dlp GitHub release page

Note that yt-dlp requires ffmpeg windows binaries which can be obtained from gyan.dev’s Codex FFMPEG Build

Please refer to this post for more information on the tips and tricks on using yt-dlp.

Configuration to run OJS 3 smoothly behind nginx reverse proxy

A lot of people struggling in configuring PKP Open Journal System 3 (OJS3) to run behind nginx reverse proxy as OJS3 does not support nginx natively

So most implementation would settle with Apache HTTPD server or install it behind nginx reverse proxy.

However the problem is that the OJS3 behave badly when placed behind nginx reverse proxy, especially when the reverse proxy is using HTTPS / TLS. This messed up the based URL in the OJS3, subsequently causing some resources from the website to be unavailable.

To solve this, you only need to add a single line in the Apache HTTPD site configuration file.

        SetEnvIf X-Forwarded-Proto "https" HTTPS=on

A full blown example is included via gist

Nano command for search and replace

I spend most of my time with headless Ubuntu server or Raspbian (a Debian derivatives distro for Raspberry Pi).

So naturally I use ‘nano’ to edit various configurations files and Python Scripts.

Here are several ‘nano’ shortcuts for your references

Searching

  • CTRL-W : search text string
  • ALT-W : repeat search
  • ALT-B : Backward search

Search and Replace

  • CTRL-\  search and replace

Cut, Copy and Paste

  • CTRL-K : Cut text
  • CTRL-V : Paste text
  • M-^ or ESc-^ : Copy text

Save and Exit

  • CTRL-O : Save file
  • CTRL-X : Exit nano

Indentation (useful for Python)

  • M-} :  Indent Right
  • M-{ : Indent Left (unindent)

 

That’s all which I can share for today…

 

How to Install telegram-cli in Ubuntu LTS (*.deb)

I’ve compiled an easy to install Ubuntu *.deb package for telegram-cli.

PART 1: List of telegram-cli DEB package binaries

  1. telegram-cli_1.0.6-1_amd64.deb

Install *.deb package by running this command (on Ubuntu 14.04 LTS Trusty)

sudo apt-get -y install  libjansson4
sudo dpkg -i telegram-cli_1.0.6-1_amd64.deb

Running telegram-cli is as easy as typing

telegram-cli

PART 2: Running telegram-cli

For first time login, you may need to key in the authorization code, the code will be sent to your mobile device to allow ‘telegram-cli’ to log as your username.
Once the authorization CODE has been entered, you are free to use telegram. Telegram use the concept of ‘peer’ (contact) to send messages instead of phone number. So in order to get a list of your peer, you need to run “contact_list” command.

> contact_list
John_T_Doe
Jane_doe_2
Warrick_Brown
Mark_Nelson

To send message to a peer/contact (for example to Warrick Brown), just type

> msg Warrick_Brown "wassup, dude? want to hang out today?"

To quit, you can type

> safe_quit

How to Hide OpenSSH Ubuntu version from Nmap and other scanners

In Ubuntu or Debian, a default OpenSSH server will display OpenSSH version alongside with Ubuntu/Debian distribution banner:

$ telnet repeater.my 172.16.91.20 22 
Trying 172.16.91.20...
Connected to 172.16.91.20.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

You can hide the identifying part of Ubuntu-2ubuntu2 from the server banner by editing /etc/ssh/sshd_config file, and adding “DebianBanner no” either at the end of the file, or just under “Port 22” configuration in “/etc/ssh/sshd_config

#/etc/ssh/sshd_config 
# What ports, IPs and protocols we listen for

Port 22
DebianBanner no

Save and restart OpenSSH server by typing

sudo service ssh restart

Now the response will just be:

Trying 172.16.91.20...
Connected to 172.16.91.20.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1p1

Happy trying!

Further Reading: Ubuntu Server Administrator Reference