Ubuntu 24.04 LTS - clean install -> n8n running local, cheat sheet

So I had a mare of a time getting this thing up and running on Linux.
Pretty sure my kids have learnt at least 3 new swear words.

I am NOT by any measure a ‘linux’ expert.
but below is a ‘cheat sheet’ that will install all dependencies and linux nonsense

(assumes Nvidia GPU & intel/AMD chip)

Hope it help, and good luck

(n8n isn’t done trolling me yet, max 5 links per post - so will split into this and a reply) edit (I also can’t post the git clone url either)

This doc will (hopefully) provide all the commands - in order, to get Ubuntu 24.04 LTS ready for N8N ai. ctrl+alt+T - to open terminal then run:

sudo apt update && sudo apt upgrade -y

sudo apt install -y curl wget unzip git vim build-essential

sudo apt install -y python3 python3-pip python3-dev

(confirm install with:)

python3 --version

pip3 --version

***3.5

curl -fsSL https://ollama.com/install.sh | sh

Install Docker dependencies

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

Add Docker’s official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up the stable Docker repository

echo “deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] Index of linux/ubuntu/ $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine and Docker Compose

sudo apt update

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

sudo curl -L

sudo curl -L “https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose

Then:

sudo chmod +x /usr/local/bin/docker-compose

sudo chmod +x /home/bread/Downloads/docker-compose-darwin-x86_64

Then:

docker-compose --version

Nvidia container toolkit install (use: Nvidia-smi to check GPU - should have CUDA 12.xx)

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \

&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \

sed ‘s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g’ | \

sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update

sudo apt-get install -y nvidia-container-toolkit

BACK TO LINUX STUFF - (More Nvidia to come)

Install Node.js (LTS version)

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

sudo apt install -y nodejs

(verify)

node --version

BACK to NVIDIA

sudo nvidia-ctk runtime configure --runtime=docker

(correct output=)

INFO[0000] Config file does not exist; using empty config

INFO[0000] Wrote updated config to /etc/docker/daemon.json

INFO[0000] It is recommended that docker daemon be restarted.

sudo systemctl restart docker

REBOOT ( sudo reboot)

THEN

Sudo docker run hello-world

(if it gives permission error do:)

THEN

sudo docker run hello-world

12

sudo apt-get update

sudo apt-get install -y nvidia-docker2

git clone GitHub - n8n-io/self-hosted-ai-starter-kit: The Self-hosted AI Starter Kit is an open-source template that quickly sets up a local AI environment. Curated by n8n, it provides essential tools for creating secure, self-hosted AI workflows.

cd self-hosted-ai-starter-kit

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \

| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg

curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \

| sed ‘s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g’ \

| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update

(just in case)

sudo apt-get install -y nvidia-container-toolkit

sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker

sudo systemctl restart docker

17

Cloning the Repository N8N

git clone (I don’t think I can post the link - so get the github adress for the ai self hosted starter kit)

cd self-hosted-ai-starter-kit

Running n8n using Docker Compose

For Nvidia GPU users

cd self-hosted-ai-starter-kit

*** OPEN Docker-compose - change the first X-ollama port to 11345 to prevent conflict (its first ports in doc) should be:

ports:

  • 11435:11434

NOW YOU ARE READY TO RUN IT!!

sudo docker compose --profile gpu-nvidia up

Open browser and goto: (I can’t post this link i think, but its your local host and then) 5678

To shut the thing down use

Sudo docker compose down -v

You can add more Ollama models by editing the Ollama pull commands in docker compose - add a semicolon for each model

E.g. “sleep 3, ollama pull llama3.2; ollama pull mistral; ollama pull model-name”

You will also need to assign a port address for postgres

Should look something like this:

services:

postgres:

image: postgres:16-alpine

hostname: postgres

networks: [‘demo’]

restart: unless-stopped

ports:

  • 6451:6451

environment:

  • POSTGRES_USER

  • POSTGRES_PASSWORD

Then:

sudo systemctl restart docker (just for good measure)

Run docker compose again - and it should load the new models.