n8n is a workflow automation platform with a visual editor, hundreds of integrations, and built-in AI agent nodes. Self-hosting it on Rocky Linux 10 gives you unlimited executions, and your credentials and data stay on your own server.
This guide sets up a production-style install using Docker, PostgreSQL, and Caddy for automatic HTTPS. It also covers the problems that catch most people in the first week: webhook URLs that show the wrong address, credentials that break after a redeploy, and SELinux quietly blocking a volume mount.
Quick Outline
- Is Self-Hosted n8n Free?
- What You Need to Self-Host n8n on Rocky Linux 10
- Important n8n Environment Variables Explained
- How to Configure and Test n8n Webhooks
- How to Build a Self-Hosted AI Agent with n8n
- How to Install n8n Locally for Testing
- How to Back Up, Update, and Manage a Self-Hosted n8n Instance
- How to Troubleshoot Common n8n Deployment Errors
- Best n8n Free Alternatives
- Conclusion
- Frequently Asked Questions
Is Self-Hosted n8n Free?
The n8n Community Edition is free to self-host, with no limit on executions or workflows. You pay only for the server. It is fair code, released under the Sustainable Use License, which allows use for your own business or personal projects. It is not OSI-approved open source, so you cannot resell n8n as a hosted service.
Features such as SSO and Git based version control sit in the paid self-hosted Business plan, and managed n8n Cloud plans start at roughly 20 euros a month. Prices change, so check n8n.io before you decide. For most individuals and small teams, the free edition on a small VPS is enough.
What You Need to Self-Host n8n on Rocky Linux 10
A Rocky Linux 10 server with sudo access, a domain name pointing at it, and ports 80 and 443 reachable. For n8n that calls hosted AI models through an API, 2 vCPUs and 4 GB of RAM is a comfortable start. Running local models alongside it needs far more, which our guide on RAM and CPU for AI models explains.
Step 1: Install Docker on Rocky Linux 10
There is no installer to download. n8n ships as a Docker image, and Docker is not preinstalled on Rocky. These are the steps from our Install Docker on Rocky Linux 10 guide, including the Rocky-specific ones: installing kernel-modules-extra before Docker starts.
Docker –version sudo systemctl enable –now docker sudo usermod -aG docker $USER |
|---|

Log out and back in so the group change applies, then open the web ports:
sudo firewall-cmd –permanent –add-service=http –add-service=https sudo firewall-cmd –reload |
|---|

Step 2: Create the n8n Project and Configure Environment Variables
Now, you can create the n8n project and configure environment variables.
mkdir -p ~/n8n && cd ~/n8n { echo “POSTGRES_PASSWORD=(opensslrand-hex24)”echo”N8NENCRYPTIONKEY=(openssl rand -hex 32)” echo “N8N_HOST=n8n.example.com” echo “TZ=Asia/Karachi” } > .env chmod 600 .env |
|---|

Replace the domain and time zone with your own. Copy the encryption key somewhere safe right now. n8n uses it to encrypt every saved credential, and if it changes, your stored logins become unreadable.
Step 3: Configure n8n with Docker Compose and PostgreSQL
Create docker-compose.yml:
services: postgres: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: n8n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: n8n volumes: – pgdata:/var/lib/postgresql/data healthcheck: test: [“CMD-SHELL”, “pg_isready -U n8n -d n8n”] interval: 5s timeout: 5s retries: 12 n8n: image: docker.n8n.io/n8nio/n8n:latest restart: unless-stopped depends_on: postgres: condition: service_healthy environment: DB_TYPE: postgresdb DB_POSTGRESDB_HOST: postgres DB_POSTGRESDB_PORT: 5432 DB_POSTGRESDB_DATABASE: n8n DB_POSTGRESDB_USER: n8n DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD} N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY} N8N_HOST: N8NHOSTN8NPROTOCOL:httpsWEBHOOKURL:https://{N8N_HOST}/ N8N_PROXY_HOPS: 1 GENERIC_TIMEZONE: ${TZ} TZ: ${TZ} EXECUTIONS_DATA_PRUNE: “true” EXECUTIONS_DATA_MAX_AGE: 168 volumes: – n8n_data:/home/node/.n8n caddy: image: caddy:2 restart: unless-stopped depends_on: – n8n ports: – “80:80” – “443:443” volumes: – ./Caddyfile:/etc/caddy/Caddyfile:ro,z – caddy_data:/data – caddy_config:/config volumes: pgdata: n8n_data: caddy_data: caddy_config: |
|---|

Two details are specific to Rocky Linux. The:z on the Caddyfile mount relabels it for SELinux, and without it the container fails with a permission error even though the file looks readable. And only Caddy publishes ports. Docker-published ports can stay reachable even when firewalld never opened them, so n8n and Postgres stay on the internal network.
Create the Caddyfile with your real domain:
n8n.example.com { reverse_proxy n8n:5678 } |
|---|
Step 4: Start n8n and Enable HTTPS
Make sure the DNS A record points to your server, then start everything:
docker compose up -d |
|---|

Caddy requests a Let’s Encrypt certificate on its own. Visit https://n8n.example.com and n8n asks you to create the owner account on first load. There is no default n8n login, so choose a strong password. If you ever see a warning about a secure cookie, you are visiting over plain HTTP. Fix it by using HTTPS, not by turning the setting off. Configure SMTP through the N8N_EMAIL_MODE and N8N_SMTP_* variables if you want password reset emails to work.
Important n8n Environment Variables Explained
Variable | What it does |
|---|---|
N8N_ENCRYPTION_KEY | Encrypts stored credentials. Set it before first launch and never change it |
WEBHOOK_URL | The public base address n8n prints for webhooks |
N8N_PROXY_HOPS | Tells n8n it sits behind one reverse proxy, which fixes forwarded header errors |
DB_TYPE and DB_POSTGRESDB_* | Move from the default SQLite database to PostgreSQL |
EXECUTIONS_DATA_PRUNE and EXECUTIONS_DATA_MAX_AGE | Delete old execution logs so the database does not grow forever |
GENERIC_TIMEZONE | Time zone used by schedule triggers |
How to Configure and Test n8n Webhooks
A webhook gives a workflow a URL that other apps can call. Every webhook node shows two addresses. The test URL contains /webhook-test/ and only works while the editor is listening for a test event.
The production URL contains /webhook/ and only works once the workflow is switched on, which the toggle labels Activate or Publish depending on your version. Most “404 not registered” errors come from calling the wrong one, or from using GET on a node set to POST.
Test it from the command line:
curl -X POST https://n8n.example.com/webhook/my-path \ -H “Content-Type: application/json” -d ‘{“hello”:”world”}’ |
|---|

If the address shown in the editor includes:5678 or localhost, WEBHOOK_URL is missing or wrong. Fix it and recreate the container.
How to Build a Self-Hosted AI Agent with n8n
The AI Agent node lets a model decide which tool to call. Add it to a workflow, attach a chat model, and give it one or two tools such as an HTTP request or a database lookup. You can connect a hosted model with an API key, or point the Ollama node at a local model to self-host AI end to end.
If you want an application like ChatGPT with a chat window, n8n has a chat trigger, and our private ChatGPT-style assistant guide covers Open WebUI. The best AI application depends on the job. n8n suits automations and agents, and Open WebUI suits conversation.
For MCP, the MCP Server Trigger node exposes your workflows as tools to MCP clients, and the MCP Client Tool node lets an agent call outside MCP servers. Protect any public trigger with bearer or header authentication. Community reports show some hosted MCP clients struggle to connect to self-hosted triggers, so test with a client you control. Caddy handles the streaming connection correctly. With Nginx, you would need to disable proxy buffering.
Good first workflows include a Home Assistant automation that sends a webhook to n8n for a smart summary, or a job board monitor that messages you when a matching posting appears.
How to Install n8n Locally for Testing
To self-host n8n locally before touching a server, run one container:
docker volume create n8n_data docker run -it –rm –name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n |
|---|

Open http://localhost:5678. External services cannot reach a local machine, so for webhook testing use a tunnel and set WEBHOOK_URL to the tunnel address.

After logging in, let’s build and debug faster with the n8n assistant.

If you also manage Ubuntu servers, see our guide to install n8n on an Ubuntu 24.04 VPS, which covers alternative installation methods.
How to Back Up, Update, and Manage a Self-Hosted n8n Instance
Back up the database and export your workflows:
docker compose exec -T postgres pg_dump -U n8n n8n | gzip > n8n-db-$(date +%F).sql.gz docker compose exec n8n sh -c ‘mkdir -p /home/node/.n8n/backup && n8n export:workflow –backup –output=/home/node/.n8n/backup/’ docker compose cp n8n:/home/node/.n8n/backup ./workflows |
|---|

Commit that workflows folder to a Git repository. That gives the Community Edition version history without the paid Git feature. Credential exports stay encrypted by default. To update, pull and restart. Read the release notes before a major jump, since version 2.0 turned task runners on by default and requires external runners for Python Code nodes.
Log out and back in so the group change applies, then open the web ports:
docker compose pull && docker compose up -d |
|---|

After your first successful start, pin the image tag to the version you are running. Before removing unused Docker resources, learn how to manage Docker containers and volumes carefully to avoid deleting persistent application data.
How to Troubleshoot Common n8n Deployment Errors
Use these essential Docker commands to inspect running containers, check logs, and manage images and volumes when troubleshooting your n8n deployment
- Credentials fail after a redeploy. The encryption key changed. Restore the original in .env.
- Forwarded header validation errors in the logs. Set N8N_PROXY_HOPS=1.
- Caddy cannot get a certificate. Check that DNS has propagated and ports 80 and 443 are open at your provider.
- Permission denied on a mounted folder. Add:z for SELinux, or use named volumes as this guide does.
Best n8n Free Alternatives
If the license is a concern, Activepieces and Node-RED are open source options. Both have fewer ready-made AI and integration nodes, so compare them against your actual workflows.
Conclusion
To install and self-host n8n on Rocky Linux 10, the official and recommended method is using Docker and Docker Compose. This isolated configuration provides automatic persistence for your workflows and shields you from dependency mismatches
Self-hosting n8n on Rocky Linux 10 takes about twenty minutes. Set the encryption key first, use PostgreSQL, set WEBHOOK_URL, keep everything behind Caddy, and back up often. Do that, and you have an automation platform with no per execution fees.
Frequently Asked Questions
1. Is n8n free to self-host?
Yes. The Community Edition is free with unlimited executions. You pay for the server, and for the Business plan only if you need features such as SSO.
2. Is n8n open source?
It is source available and fair code under the Sustainable Use License, not OSI-approved open source. You can self-host it for your own use, but not resell it as a service.
3. How do I install n8n on Rocky Linux 10?
Install Docker, then run n8n with Docker Compose alongside PostgreSQL and a reverse proxy such as Caddy. Set N8N_ENCRYPTION_KEY and WEBHOOK_URL before the first start.
4. How much RAM does self-hosted n8n need?
A small instance runs on 2 GB. Use 4 GB if you run AI agents or many parallel workflows. Local AI models need much more.
5. Why does my n8n webhook show localhost or return 404?
The WEBHOOK_URL variable is missing, or you are calling the test URL instead of the production URL. Set the variable to your public HTTPS address and make sure the workflow is switched on.








Leave feedback about this