Installing n8n
What this article covers
- How to install n8n with Docker or Docker Compose.
- How to configure the basics.
- How to create your first workflow.
- Which environment variables matter.
- Troubleshooting common issues.
Introduction: installing n8n explained
n8n is a workflow automation tool that connects processes visually. You install it on your server, open it in a browser, and build workflows with drag-and-drop. n8n is open source, self-hosted, and includes over 400 integrations.
This article is for users who want to install n8n. You should have basic Docker knowledge. See Docker Basics for fundamentals.
Why do you need n8n?
Imagine automating recurring tasks: processing emails, syncing databases, generating reports. Instead of writing scripts, you build workflows visually. n8n makes automation accessible without needing to code.
n8n installation in brief
n8n is a self-hosted workflow tool. You install it with Docker, open it in a browser, and create workflows with drag-and-drop. For AI workflows, connect n8n to Ollama.
The core idea is simple: visual workflows instead of scripts.
Who is this article for?
- Self-hosters who want to install n8n.
- Automation builders who want to create workflows.
- Developers implementing automation.
- Teams automating repetitive tasks.
Basic Docker knowledge is helpful.
Key terms
- n8n - Workflow automation. Useful for: the tool itself.
- Docker - Container platform. Useful for: installation.
- Docker Compose - Multi-container tool. Useful for: complex setups.
- Workflow - Sequence of steps. Useful for: what n8n automates.
- Node - Building block in a workflow. Useful for: individual steps.
- Ollama - Local model server. Useful for: AI workflows.
Prerequisites
- Docker installed. See Docker Basics.
- Docker Compose installed.
- At least 1GB RAM, 1 CPU core.
- Port 5678 available (default).
Installation with Docker Compose
1. Create docker-compose.yml
version: "3.8"
services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=0.0.0.0
- N8N_PORT=5678
- N8N_PROTOCOL=http
- WEBHOOK_URL=http://localhost:5678/
- GENERIC_TIMEZONE=Europe/Berlin
- TZ=Europe/Berlin
volumes:
- n8n_data:/home/node/.n8n
networks:
- n8n-network
volumes:
n8n_data:
networks:
n8n-network:
driver: bridge
2. Start the container
docker compose up -d
3. Open n8n
Open your browser: http://localhost:5678
Installation with Docker (without Compose)
docker run -d \
--name n8n \
-p 5678:5678 \
-e N8N_HOST=0.0.0.0 \
-e N8N_PORT=5678 \
-e WEBHOOK_URL=http://localhost:5678/ \
-e GENERIC_TIMEZONE=Europe/Berlin \
-e TZ=Europe/Berlin \
-v n8n_data:/home/node/.n8n \
--restart unless-stopped \
n8nio/n8n:latest
Getting started
1. Create an admin account
On first startup, you’ll be prompted to create an admin account.
2. Create your first workflow
- Click “New Workflow”.
- Drag a “Manual Trigger” node into the workflow.
- Add a “Set” node next to it.
- Connect both nodes.
- Click “Execute Workflow”.
3. Save the workflow
Click “Save” and give your workflow a name.
Important environment variables
| Variable | Description | Example |
|---|---|---|
| N8N_HOST | Host for n8n | 0.0.0.0 |
| N8N_PORT | Port for n8n | 5678 |
| N8N_PROTOCOL | http or https | http |
| WEBHOOK_URL | URL for webhooks | http://localhost:5678/ |
| GENERIC_TIMEZONE | Timezone | Europe/Berlin |
| TZ | Timezone | Europe/Berlin |
| N8N_ENCRYPTION_KEY | Encryption key | random string |
| DB_TYPE | Database type | sqlite (default) |
| EXECUTIONS_DATA_PRUNE | Delete old executions | true |
| EXECUTIONS_DATA_MAX_AGE | Max age in days | 30 |
Connecting to Ollama
To connect n8n with Ollama, both containers need to be on the same network:
version: "3.8"
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
networks:
- n8n-network
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=0.0.0.0
- WEBHOOK_URL=http://localhost:5678/
volumes:
- n8n_data:/home/node/.n8n
networks:
- n8n-network
volumes:
ollama_data:
n8n_data:
networks:
n8n-network:
driver: bridge
In n8n, use http://ollama:11434 as your Ollama URL.
See n8n-Ollama Integration for details.
Security notes
- Set a strong password: Create a strong admin password.
- Use HTTPS in production: Enable HTTPS for production deployments. See TLS Certificates.
- Don’t expose to the internet: Never expose n8n to the internet without authentication.
- Enable encryption: Set N8N_ENCRYPTION_KEY for sensitive data.
- Backup regularly: Back up your n8n data often. See Backup.
Troubleshooting
n8n won’t start
# Check logs
docker logs n8n
# Common causes:
# - Port 5678 is in use
# - Insufficient memory
# - Database corruption
Port already in use
# Use a different port
docker run -d -p 5679:5678 n8nio/n8n:latest
Database error
# Reset the database
docker exec -it n8n n8n db:reset
Ollama not reachable
# Check if Ollama is running
docker ps | grep ollama
# Check network
docker network inspect n8n-network
Practical example: your first workflow
// Workflow: Create a log entry every hour
// 1. Schedule Trigger: Every hour
// 2. Function Node:
return {
timestamp: new Date().toISOString(),
message: "Hourly check"
};
// 3. HTTP Request: Send to Ollama (optional)
Further reading
- n8n Guide - n8n in detail.
- n8n-Ollama Integration - Ollama in n8n.
- Docker Basics - Understanding Docker.
- Docker Compose - Understanding Compose.
- Workflow Automation Basics - Fundamentals.
- Installing Ollama - Install Ollama.
Key takeaways:
- n8n is a self-hosted workflow tool.
- Install with Docker or Docker Compose.
- Runs on port 5678, create an admin account at startup.
- Connect to Ollama for AI workflows.
- Security: strong password, HTTPS, don’t expose publicly.
FAQ
What is n8n?
How do I install n8n?
What port does n8n run on?
Should I use Docker or Docker Compose?
Where is data stored?
How do I connect n8n to Ollama?
How do I enable HTTPS?
Is n8n secure?
How do I back up n8n?
n8n won’t start. What do I do?
Sources and further reading
- n8n Documentation - Official docs.
- n8n Docker - Docker installation.
- Docker Compose - Compose documentation.


