Whether you want to automate repetitive tasks, build AI-powered workflows, or connect apps without writing a single line of code, n8n has quietly become one of the most practical tools available for workflow automation. It is open source, flexible, and powerful enough to handle everything from simple two-step automations to complex multi-service pipelines that run continuously in the background.
But before you can build anything useful with an n8n installation, you need to set it up. And how you set it up matters more than most beginners realise.
Running the n8n setup locally on your laptop is fine for testing and learning. But if you want workflows that trigger automatically, run around the clock, and handle webhooks from external services reliably, you need a proper deployment that stays online even when your computer is switched off.
This n8n guide covers every method available, from the quickest possible start to a production-ready deployment that scales with your needs. Whether you are completely new to n8n or looking to move from a local experiment to something more serious, this tutorial has you covered.
Before jumping into any n8n installation method, a few things are worth having in place depending on which setup you choose.
A basic internet connection is obviously required for downloading n8n and accessing the interface.
Check whether Docker is installed on your machine. Because it is the most recommended way to run n8n and handles dependencies in a contained environment and works the same way on different operating systems like Mac, Windows, and Linux.
If you choose the npm installation way for n8n setup, then you will only need Node.js 18 or higher versions. You can use the ‘node -v’ command in your terminal to check your existing Node.js version.
A VPS or cloud server is what you need for a 24/7 self-hosted n8n hosting setup. The server with a minimum 2GB RAM on a Ubuntu 22.04 server works just fine to get started.
A domain name and SSL certificate are optional for local setups but important for production deployments where you want a clean URL and secure HTTPS connection rather than accessing n8n through a raw IP address.
Before diving into each method, here is a quick overview of your options so you can jump straight to what suits your situation.
|
n8n Setup Type |
Difficulty | Best For |
|
n8n Cloud |
Easy | People who just want to start quickly without worrying about setup |
|
Docker (Local) |
Easy |
Trying things out on your own system |
|
npm / Node.js |
Medium |
Developers who prefer manual control |
|
VPS Self-Hosted |
Medium-Advanced |
Running workflows 24/7 in a production setup |
| Docker Compose + PostgreSQL |
Advanced |
More serious, production-grade deployments |
If you want to try n8n without installing anything, the cloud option is the fastest path to a working instance.
What it is: n8n Cloud is the hosted version managed entirely by the n8n team. You get a running instance without touching a server.
Steps to get started:
Go to n8n.io and click Start for free. Create an account, and your n8n instance will be ready within minutes. After the n8n setup, a dedicated dashboard URL will be given to you, using which you can start building your workflows immediately.
When this makes sense: You want to learn n8n without thinking about servers at all. You are evaluating whether n8n actually solves your problem before investing time in a self-hosted n8n setup.
Where it falls short: It costs money on an ongoing basis; your data lives on n8n’s servers rather than yours; and you have less control over the environment. Fine for learning, less ideal as a long-term production solution if you have the technical appetite for self-hosting.
If you want an n8n setup running quickly on your machine, Docker is normally the most simple way to install n8n on your machine. Docker handles everything cleanly so you do not end up in dependency-conflict hell trying to get the right versions of things installed.
Make sure Docker Desktop is running, then open your terminal and run this:
bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Once it starts up, open your browser and go to http://localhost:5678. You will see the n8n setup screen, where you create your owner account.
General Issues:
If port 5678 is already being used by something else on your machine, just change the first port number in the command to something like 5679 and open http://localhost:5679 instead.
If the container stops immediately, check that Docker Desktop has enough memory allocated. n8n is comfortable with 1GB, but more is better if you are running other containers simultaneously.
This setup is great for learning and building workflows, but remember that it stops when you close the terminal or restart your computer. That is fine for testing but not for anything you want running continuously.
If you are a developer who prefers to work directly with Node.js and think that Docker adds additional cost for your workflow, npm installation is a simple and easy alternative.
Check your Node.js version first:
bash
node -v
You need version 18 or higher. If you are behind, update Node.js before continuing.
Install n8n globally:
bash
npm install n8n -g
Then start it:
bash
n8n start
Open http://localhost:5678 in your browser, and you are in.
When this makes sense: You are a developer already working in a Node.js environment and want to integrate n8n without adding Docker to the mix or like to install n8n directly without containerisation. For production deployments using npm, pair it with PM2 to keep n8n running after you close the terminal:
bash
npm install pm2 -g
pm2 start n8n
pm2 save
This is where things get genuinely useful. A VPS deployment means your workflows run around the clock, webhooks from external services can reach n8n reliably, and nothing breaks because your laptop has gone to sleep.
The same approach works on a dedicated server too if your workflows are resource-heavy or you need more hardware control. The setup process is identical; you just have more resources available.
Before you begin the self-hosted n8n installation, you will need to make sure that you have a Ubuntu 22.04 VPS with Docker installed (at least 2GB RAM) and a domain name pointing to your server’s IP.
First, connect to your VPS using SSH. Once you’re in, install Docker using this official script:
bash
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
And that’s it! Docker will be installed on your VPS server.
In this n8n installation method, it is beneficial to use Docker Compose files instead of running long Docker commands. It helps to keep your configuration in a readable file you can easily edit or version control.
Create a directory for your n8n setup:
bash
mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml
Now paste your configuration file inside:
yaml
version: '3.8'
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://yourdomain.com/
- GENERIC_TIMEZONE=Asia/Kolkata
volumes:
- ~/.n8n:/home/node/.n8n
Just replace yourdomain.com with your actual domain name.
Let’s start the n8n setup with:
bash
docker compose up -d
After executing this command, n8n will be active in the background and ready to use.
A reverse proxy sits in front of n8n and handles incoming web traffic, routing it to your n8n instance. SSL encryption protects the connection through HTTPS so data between your browser and n8n stays secure.
Nginx is the most commonly used reverse proxy for this setup. Install it with:
bash
sudo apt install nginx -y
Then install Certbot for free SSL certificates from Let’s Encrypt:
bash
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com
Certbot handles the SSL configuration automatically and sets up automatic certificate renewal. Once complete, your n8n instance is accessible at https://yourdomain.com.
By default n8n uses SQLite to store its data. SQLite is perfectly fine when you are just getting started or running low-volume automations. Where it starts showing limitations is when you have multiple workflows running simultaneously, a team using the same instance, or execution history growing into thousands of records.
PostgreSQL handles concurrent database operations much more gracefully and is the right choice for anything you are running seriously.
Here is a Docker Compose file that adds PostgreSQL to your setup:
yaml
version: '3.8'
services:
postgres:
image: postgres:15
restart: always
environment:
POSTGRES_USER: n8n
POSTGRES_PASSWORD: your_secure_password
POSTGRES_DB: n8n
volumes:
- postgres_data:/var/lib/postgresql/data
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=yourdomain.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://yourdomain.com/
- GENERIC_TIMEZONE=Asia/Kolkata
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=your_secure_password
volumes:
- ~/.n8n:/home/node/.n8n
depends_on:
- postgres
volumes:
postgres_data:
Replace your_secure_password with something strong. Start everything with docker compose up -d and n8n connects to PostgreSQL automatically on first launch. No additional configuration needed beyond what is in the file.
Open your browser and go to http://localhost:5678 for local setups or https://yourdomain.com for your hosted deployment.
First-time setup: You will be asked to create an owner account. This email and password become your primary login, so use something you will remember.
Creating your first workflow: Click the plus button on the main screen to open a new workflow. The canvas starts empty. Add a Manual Trigger node to get started and then add an action node like HTTP Request or Send Email to see how the connection works. Running it manually the first few times is the fastest way to understand how n8n thinks.
Credentials: Most integrations need API keys, tokens, or login details. Go to Settings, then Credentials, to add these once and reuse them across any workflow. Storing them centrally rather than in individual workflows makes things much easier to manage as you add more automation.
Execution history: The Executions section in the left sidebar shows every time a workflow ran, what data went through it, and any errors that happened. This is your first stop when something is not working as expected.
Run ‘lsof -i :5678’ on Mac or Linux to see what is already using that port. You can either stop running the process or switch to a different port such as 5679 in your Docker setup and access n8n from there.
When the Docker container keeps stopping unexpectedly, check the logs to see what is going wrong using the following command:
bash
docker logs n8n
The most common culprits are not enough memory allocated to Docker, a typo in an environment variable, or a permissions issue with the data directory. For the permissions issue, run:
bash
sudo chown -R 1000:1000 ~/.n8n
External services sending webhooks need to reach your n8n instance over the public internet. If you are running locally, that is not possible without a tool like ngrok to expose your local port temporarily. For reliable webhook handling long-term, a VPS deployment is the right solution.
Run sudo certbot renew to refresh any expired certificates. If you are seeing errors immediately after setup, verify that your domain DNS is pointing correctly to your server’s IP address before running Certbot.
If n8n fails to start with errors about not being able to write to the data directory, fix the ownership:
bash
sudo chown -R 1000:1000 ~/.n8n
|
Use Case |
Recommended Setup |
|
Learning n8n for the first time |
Local Docker |
|
Small personal automations |
n8n Cloud |
|
24/7 workflows and webhooks |
VPS with Docker |
|
Business-critical automations |
Docker with PostgreSQL |
|
Large-scale enterprise deployments |
Kubernetes |
Manual executions, on the other hand, take place when you click the ‘Execute Workflow’ option at the time of the development process. Another difference between the two of them is that active executions run automatically in the background, while manual executions are mostly used when you want to test or debug something.
There is no single n8n setup that fits every situation, and that is actually a good thing. The flexibility to start simple and scale later means you are not locked into a decision that is difficult to reverse.
If you are just getting started, the local Docker setup gets you running in under five minutes with nothing to configure beyond installing Docker itself. Once you are comfortable with how n8n works and want your workflows running reliably around the clock, a VPS deployment with Docker Compose is the natural next step. Adding PostgreSQL on top of that is what makes the setup genuinely production-ready for business-critical automations.
The important thing is to start somewhere and build from there rather than getting stuck trying to architect the perfect n8n setup before building a single workflow. Most n8n users start locally, move to a VPS when they need reliability, and add PostgreSQL when their workflow volume justifies it. That progression works well for a reason.
For the VPS deployment specifically, host.co.in’s n8n hosting gives you the clean Ubuntu environment, full root access, NVMe SSD storage, and support for unlimited workflows, scalable architecture and more that a self-hosted n8n instance needs to run reliably around the clock.
Explore host.co.in’s VPS hosting plans and get your n8n instance running on infrastructure that stays up when your workflows need it most.