How to Install n8n on a VPS, Step by Step (2026)
Quick answer: With a ready-made template it takes under half an hour: get a 4 GB VPS, point a subdomain at its IP, deploy the n8n template and set up the certificate. What really matters isn’t the install — it’s the three steps almost every guide skips: switching to PostgreSQL instead of the default database, closing the firewall, and setting up backups before you put anything serious on it.
Installing n8n is easy. Having it installed in a way that won’t ruin your week six months from now is less so. This guide covers both, and flags the points where most tutorials leave you with a server that works but is either exposed or has no backups.
Before starting, an honest check: if you’re not clear on why you’d self-host rather than use a cloud tool, read is it worth it for a small business first. For a lot of people it isn’t, and it’s better to find that out before building the server than after.
🔎 This article contains affiliate links. If you sign up through them we earn a commission at no extra cost to you. Read our affiliate policy.
What you need before starting
- A VPS with at least 4 GB of RAM. If you’ll run a language model on the same machine, 8 GB. The reasoning is in which VPS you need for n8n.
- A domain or subdomain you can point at the server. n8n technically starts without one, but you’ll work unencrypted and several integrations that call back into your server will fail.
- Half an hour, and some comfort with a command line. You don’t need to be a sysadmin, but a terminal shouldn’t scare you.
Step 1: get the server
Any VPS running Ubuntu works. We use Hostinger because it ships a template with n8n and Docker preconfigured, which is exactly where most people give up: pick that image when creating the server and you skip installing Docker, writing the compose file and fighting with permissions.
While creating it you’ll be asked for a root password or an SSH key. Choose the SSH key if offered: it’s more convenient and it eliminates brute-force attacks against the password, which start within minutes of the server going online.
👉 See VPS plans with an n8n template
Step 2: point the domain
In your domain’s DNS panel, create an A record pointing the subdomain you’ll use (say flows.yourdomain.com) at the server’s IP. Propagation usually takes anywhere from a few minutes to a couple of hours.
Do this before configuring the certificate. It’s the most common ordering mistake: try to issue the certificate before the domain resolves to the right IP and validation fails, leaving you with a working server and no encryption.
Step 3: deploy n8n
With the template, the control panel handles it. Doing it manually, the standard deployment is Docker Compose: one file describing the n8n container, the database container and the proxy that manages the certificate.
The variables you absolutely must set:
- The public URL (
WEBHOOK_URLand the host). Leave it out and n8n generates webhook addresses pointing atlocalhost, so no external integration can reach you. This is the number-one failure in home-made installs. - The timezone. It defaults to UTC, so a workflow scheduled for “09:00” will run at 11:00 local time in a summer CEST timezone.
- A username and password. n8n started without authentication is an open panel on the internet from which code can be executed. This isn’t theoretical: it’s actively scanned for.
Step 4: switch the database to PostgreSQL
Here’s the advice people thank us for six months later. By default n8n stores everything in a SQLite file. It works, and it’s fine for testing. But with several executions at once, SQLite locks the file and you start seeing intermittent errors that are miserable to diagnose.
If this is going to hold up part of your business, set up PostgreSQL from the start. Migrating later is possible but awkward, and you always end up doing it on the worst possible day.
Step 5: lock the server down
A freshly created VPS has every port open and a public IP. The minimum:
- Firewall: leave only 80, 443 and your SSH port open. Nothing else.
- Don’t expose n8n’s port directly (5678). It belongs behind the proxy serving HTTPS, not reachable from outside.
- Don’t expose PostgreSQL’s port. The database only needs to talk to n8n, inside the server itself.
- Automatic security updates for the operating system, enabled.
Step 6: backups, before you use it for real
The server is yours, so the backups are too. And a backup that’s never been restored isn’t a backup, it’s an intention.
The reasonable minimum: a daily database dump stored off the server itself — if the disk corrupts, a backup living on it goes with everything else — plus one restore test in the first month. If your provider offers automatic VPS snapshots, turn those on as well: they’re different from the database dump and the two complement each other.
The mistakes that cost most
- Leaving it without authentication “just for a moment” while testing. That moment is enough.
- Not setting the public URL, then discovering no webhooks arrive.
- Staying on SQLite and hitting strange errors as you grow.
- Skipping backups until important workflows are already built.
- Forgetting the timezone, so everything scheduled runs hours off.
FAQ
Can I install n8n on shared hosting? No. It needs a permanently running process and access to Docker or Node.js, and shared hosting provides neither.
How long does it really take? With a template, twenty to forty minutes including DNS propagation. By hand with no prior Docker experience, budget an afternoon.
Do I need to know how to program? To install it, no: you need to copy commands and understand what each one does. To use n8n afterwards, also no, though knowing some JavaScript opens quite a few doors.
How do I update n8n? With Docker, pull the new image and recreate the container. Back up the database before every update: it’s quick and one day it’ll save you.
What if I outgrow the server? Most providers let you upgrade the plan without reinstalling. Even so, starting at 4 GB is more comfortable than migrating in a hurry.
🔎 This article contains affiliate links to Hostinger. Read our affiliate policy.
