Self-hosting n8n on my "Home Server"
#ai#linux#automation#n8n

Self-hosting n8n on my "Home Server"

Author
Kurt Chan
Coffee Driven Developer
October 17, 2025

3 mins read


Since AI automation is the trend these days, I started exploring different tools — but wow, most of them are pretty expensive! Some even have trial periods, but those short trials weren’t enough to satisfy my curiosity about AI automation.

Then I stumbled upon this guy named Jan Oberhauser, who built n8n — and it’s free, plus you can self-host it!

What is n8n?

n8n is a workflow automation tool — its name actually stands for "n-eight-n," short for "nodemation" (node-based automation). Basically, it combines the idea of visual “nodes” (like a flowchart) with “automation,” all powered by Node.js.

You can use it to automate just about anything — from IT helpdesk and ticketing systems to monitoring, alerts, or even AI agents that handle your day-to-day tasks. You can even connect it to your smart home setup if you want. The possibilities are endless; it’s really up to your imagination.

How to get started?

n8n offers a 14-day free trial on their cloud hosting (no credit card needed), but if you want something long-term, it’s best to host it yourself.

I had an old Acer Laptop lying around — like, really old — 10 years old(?), running on an Intel Pentium N3710 / 1.6 GHz, 2GB RAM, 500GB HDD, and a dead battery (it shuts down the moment you unplug it).

So I turned it into my “home server.” I installed Ubuntu Server 24.04 LTS on it and started setting up n8n.

Installation

There are several ways to self-host n8n, but personally, I prefer using Docker because it’s easy to maintain and redeploy.

bash
# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl 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 # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update

Then I installed Docker with this command:

bash
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

To test if Docker is working properly:

bash
sudo docker run hello-world

When I saw “Hello World from Docker”, that’s when I knew it was working perfectly. Now for the fun part — setting up n8n.

Setting up n8n in Docker

Technically, you can start n8n by running this command:

bash
docker volume create n8n_data docker run -it --rm \ --name n8n \ -p 5678:5678 \ -e GENERIC_TIMEZONE="<YOUR_TIMEZONE>" \ -e TZ="<YOUR_TIMEZONE>" \ -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \ -e N8N_RUNNERS_ENABLED=true \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n

But I wanted to make it more permanent and easier to manage, so I used a docker-compose.yml file. I also planned to use Cloudflare Tunnel to expose my home server securely.

bash
version: "3.8" services: n8n: image: docker.n8n.io/n8nio/n8n container_name: n8n restart: unless-stopped ports: - "5678:5678" environment: GENERIC_TIMEZONE: "<YOUR_TIMEZONE>" TZ: "<YOUR_TIMEZONE>" N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true" N8N_RUNNERS_ENABLED: "true" # you need to set this to false if you are not running on https N8N_SECURE_COOKIE: "false" WEBHOOK_URL: "<YOUR_DOMAIN>" volumes: - n8n_data:/home/node/.n8n volumes: n8n_data:

Since I already own a domain (kurtchan.com). I want to expose my server and connect it to the internet. Oh! you can buy your domain in Hostinger for free!


The plan is to create a subdomain and use it as the Webhook URL of my n8n.

Setting up Cloudflare Tunnel

Now let’s connect it to the internet using Cloudflare Tunnel (no need to open ports manually or expose your IP).

First, install cloudflared and run:

bash
# Add cloudflare gpg key sudo mkdir -p --mode=0755 /usr/share/keyrings curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null # Add this repo to your apt repositories echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared noble main' | sudo tee /etc/apt/sources.list.d/cloudflared.list # install cloudflared sudo apt-get update && sudo apt-get install cloudflared

Create your tunnel:

bash
cloudflared tunnel create <YOUR_TUNNEL_NAME>

You’ll get a Tunnel ID — keep that handy because you’ll need it next.

Then, inside your root folder (/.cloudflared/config.yml), create a config.yml file with the following content:

bash
tunnel: <Tunnel-ID> credentials-file: /root/.cloudflared/<TUNNEL_ID>.json ingress: - hostname: <YOUR_DOMAIN> service: http://localhost:5678 - service: http_status:404

Next, route your DNS:

bash
cloudflared tunnel route dns <YOUR_TUNNEL_NAME> <YOUR_DOMAIN>

And finally, start everything up!

bash
docker compose up -d --build cloudflared tunnel run <YOUR_TUNNEL_NAME>

That’s it! You’ve got n8n running on your own home server, accessible securely through your custom domain. 🎉


Written by

Author
Kurt Chan
Coffee Driven Developer
October 17, 2025