n8n is a powerful automation tool that allows you to connect different services and create automated workflows without programming. It supports over 300 integrations and makes it easy to build scripts for data processing, sending notifications, API integrations and more.
If you want to have complete freedom in using n8n, the best choice is to self-install it on your own server. In this guide, we will detail how to install n8n on a VPS using Docker, the most convenient way to deploy n8n.
What it will take
Before starting the installation, make sure you have:
- A VPS with Linux pre-installed (e.g. Ubuntu 22.04)
- A user with
sudo
privileges - Docker and Docker Compose installed
- Minimum 1 GB of RAM (2 GB is optimal)
Installing Docker and Docker Compose
Connect to the server via SSH and run the following commands:
sudo apt update sudo apt install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-compose
Check that Docker and Docker Compose are installed:
docker --version docker-compose --version
To run Docker commands without sudo
, add yourself to the appropriate group:
sudo usermod -aG docker $USER
⚠️ You must then re-enter the SSH session or reboot for the changes to take effect.
Creating a volume and starting the n8n manually
Create a volume to store the n8n data:
docker volume create n8n_data
Starting n8n:
docker run -it --rm \ --name n8n \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n
The n8n will now be available at:
http://<Your_VPS_IP>:5678
[Optional] Connecting PostgreSQL
By default, n8n uses SQLite. However, for reliable work in production it is better to use PostgreSQL:
docker run -it --rm \ --name n8n \ -p 5678:5678 \ -e DB_TYPE=postgresdb \ -e DB_POSTGRESDB_DATABASE=db_name \ -e DB_POSTGRESDB_HOST=server_ip_or_name \ -e DB_POSTGRESDB_PORT=5432 \ -e DB_POSTGRESDB_USER=username \ -e DB_POSTGRESDB_PASSWORD=password \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n
Installation via Docker Compose (recommended)
This way is more convenient and easier to control n8n. But first, let's understand it:
Below is the text that you need to paste into the file. You need to create a text file named docker-compose.yml
and paste the suggested contents into it.
Create a file by typing in the terminal:
nano docker-compose.yml
The nano
text editor will open. Paste the following text into it:
version: '3'
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- GENERIC_TIMEZONE=Europe/Moscow
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Then press Ctrl + O
, then Enter
(to save), and Ctrl + X
(to exit).
Starting and stopping
Start n8n:
docker compose up -d
Stop:
docker compose down
Update n8n
To update n8n to the latest version:
docker compose pull docker compose down docker compose up -d
Tunnel mode (for testing)
What is tunnel mode?
This is a special mode in which the n8n temporarily publishes your local server to the Internet through a secure tunnel. This is useful if, for example, you want to test incoming Webhooks from Telegram, Stripe, or other services, but you don't have a domain and HTTPS.
Example: you create an automation that responds to an incoming message from Telegram. But Telegram can't “reach” your server if you don't have a public address. In this case, we run n8n in tunnel mode, get a temporary HTTPS address, specify it to Telegram, and everything works.
Tunnel launch:
docker run -it --rm \ --name n8n \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n \ start --tunnel
⚠️ It is not recommended to use the tunnel in production — it is only for testing and debugging.
Conclusion
Now you know how to install and run n8n on a VPS using Docker — fast, easy and convenient. You can use built-in triggers, connect APIs, Telegram, Google Sheets, Slack and more, creating powerful automations without code.
Server solution prepared for n8n
Want to get your n8n up and running without too much headache? We have everything you need!
We offer:
- Reliable VPS and dedicated servers optimized to work with n8n
- 24/7 technical support
- Transparent tariffs and flexible terms
Leave a request — and start automating your processes with n8n today!
Comments