Self-Host n8n in 3 Simple Steps: Your Personal Automation Server


n8n is an easy-to-use, powerful workflow automation tool that lets you connect your favorite apps and services without writing complicated code. Whether you want to automate tasks like syncing data, posting content, or triggering complex workflows, n8n puts a friendly drag-and-drop interface and a private, self-hosted server at your fingertips.
This guide will walk you through 3 simple steps to install and run n8n on your own Ubuntu machine using Docker. No deep technical skills required!
Why Self-Host n8n?
Full control & privacy: You run your own automation server.
Connect 100+ apps: Automate everything from Gmail to AI tools.
Visual workflows: Build automations easily with drag-and-drop.
Flexible & expandable: Add your own custom logic as you grow.
π 3-Step Setup to Self-Host n8n on Ubuntu
Step 1: Install Docker & Docker Compose
Open your terminal and run these commands one by one. They install Docker, the platform that runs n8n containers, and its compose tool for easy management.
sudo apt-get update
sudo apt-get install -y ca-certificates curl wget
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
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
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 2: Download n8n Configuration Files
Now, fetch the official n8n Docker setup files. These files tell Docker how to run n8n with PostgreSQL for stable data storage.
wget https://raw.githubusercontent.com/n8n-io/n8n-hosting/refs/heads/main/docker-compose/withPostgres/docker-compose.yml
wget https://raw.githubusercontent.com/n8n-io/n8n-hosting/refs/heads/main/docker-compose/withPostgres/init-data.sh
wget https://raw.githubusercontent.com/n8n-io/n8n-hosting/refs/heads/main/docker-compose/withPostgres/.env
Optional: Open the .env
file to customize your setup:
nano .env
Inside, you can set your username, password, email, and timezone. When done, save and exit.
Step 3: Start Your n8n Server
Launch n8n using Docker Compose:
docker compose up
Watch the output β if there are no errors, press Ctrl+C to stop.
Now start n8n in the background so it keeps running:
docker compose up -d
You can now open n8n by navigating to:
π Bonus: Ready-to-Use n8n Workflow Templates
Want to jump-start your automation projects? Check out this awesome curated list of community-built n8n workflow templates β from email automation and AI chatbots to social media posting and more!
π Awesome n8n Templates Repository
Explore, customize, and supercharge your productivity with pre-built workflows that you can import and tweak instantly.
Final Tips
If you get errors about missing commands like
wget
, install them withsudo apt install wget
.If port 5678 is unavailable, check your firewall or running apps.
To stop n8n anytime, run:
docker compose down
.For more detailed docs and troubleshooting: n8n Docker Docs.
Youβre now the proud owner of a self-hosted automation powerhouse. Happy automating with n8n!
Subscribe to my newsletter
Read articles from Mark P directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
