n8n Installation: Step-by-Step Guide on Ubuntu with Docker Compose
💡 What Will You Learn in This Guide?
You will learn how to install the n8n open source workflow automation tool on your own Ubuntu server using Docker Compose.
Data privacy, PostgreSQL database, Nginx security, and Let's Encrypt SSL configuration are covered throughout the guide.
In the last step, you will create and test your first automation flow.
🧠 Technical Summary
Main Technical Topic: Installation of n8n workflow automation platform on its own server (Self-Hosted).
Problem Solved: Ensuring data privacy and scalability without being dependent on SaaS solutions such as Zapier.
Steps Followed:
- Install prerequisites
- Create the Docker Compose file
- Start services
- Enable HTTPS security
- Configure web interface
- Create the first automation
🛠️ Prerequisites
Meet the following system requirements before starting installation:
- A Virtual Server (Instance/Droplet) on Ubuntu 22.04 or above
- Your domain name (example:
otomasyon.ornek.com) - Root or sudo privileged user
- Docker and Docker Compose must be installed
sudo apt update
sudo apt install docker.io docker-compose -y
💡 This command installs Docker components and updates the system.
⚙️ Step 1: Creating the Docker Compose Configuration
Open a new directory to run n8n and PostgreSQL containers together:
mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml
Add the following configuration (change your domain and passwords):
version: '3.7'
services:
db:
image: postgres:14
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=benzersizsifre123
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
restart: always
n8n:
image: n8nio/n8n
ports:
- "5678:5678"
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=db
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=benzersizsifre123
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=cokguclusifre456
- N8N_HOST=otomasyon.ornek.com
- WEBHOOK_TUNNEL_URL=https://otomasyon.ornek.com
depends_on:
- db
volumes:
- n8n_data:/home/node/.n8n
restart: always
volumes:
postgres_data:
n8n_data:
📦 This structure runs the PostgreSQL database and n8n application via Docker in a production-ready manner.
⚡ Step 2: Launching and Verifying n8n
Start services:
docker-compose up -d
Check the status:
docker-compose ps
🚀 Make sure both containers are in the “Up” position.
Access: 👉 http://server\_ip\_adresi:5678 (If you get HTTPS warning, we will solve it in the next step.)
🔒 Step 3: HTTPS Security with Nginx and Let's Encrypt
sudo apt install nginx certbot python3-certbot-nginx -y
Create the Nginx configuration:
sudo nano /etc/nginx/sites-available/n8n
Paste the following content:
server {
listen 80;
server_name otomasyon.ornek.com;
location /.well-known/acme-challenge/ {
root /var/www/html;
}
location / {
return 301 https://$host$request_uri;
}
}
Activate and get certified:
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d otomasyon.ornek.com
👤 Step 4: n8n Web Interface Initial Setup
Create your administrator account.
Activate the free community license with your email address.
Enter the activation key sent to your e-mail from the following menu: Settings → Usage and Plan → Activation Key
✅ This process unlocks premium features for free.
🧩 Step 5: Create Your First Workflow
Create new Workflow
Add webhook node
Method: POST
Path: test-webhook
Add set node
Name: message, Value: "Hello from GenixNode!"
Activate the flow
Test from terminal:
curl -X POST https://otomasyon.ornek.com/webhook/test-webhook
🎉 Reply “Hello from GenixNode!” If it returns everything is working correctly!
🧠 Sample Scenario: Server Crash Notification
Uptime tracking with UptimeRobot
Restarting Nginx on error detection
Update SSL/DNS settings with Cloudflare API
Send Slack/WhatsApp notifications
Getting approval via Discord
This structure allows you to automatically resolve system crashes.
🧐 Frequently Asked Questions (FAQ)
1. Why should PostgreSQL be preferred?
Recommended for data security, persistence and scalability. SQLite is for testing environment only.
2. How to update?
docker-compose pull && docker-compose up -d
3. How do I back up my data?
Copy n8n_data and postgres_data volumes regularly.
4. What should I do if the webhook is not working?
Verify your DNS settings and WEBHOOK_TUNNEL_URL.
5. Is n8n scalable?
Yes, it can expand horizontally using Queue Mode (Redis).
🧩 Troubleshooting
| Error | Why | Solution |
|---|---|---|
| 401 Unauthorized | Incorrect credentials | Check variables N8N_BASIC_AUTH_* |
| SSL failed | DNS redirect missing | Renew certificate, check DNS |
| Webhook not triggering | Wrong URL | WEBHOOK_TUNNEL_URL must be correct |
🎯 Result
n8n is a powerful automation tool that offers developers data privacy, freedom and complete control. You have set up your own self-hosted n8n platform with Docker Compose and made it ready for the production environment.
💬 Create a virtual server on the GenixNode Platform right now and implement your own automation system!

