N8N is a powerful workflow automation platform that lets you connect different applications and services without writing a line of code. Its intuitive visual interface lets you create complex workflows in just a few clicks, transforming the way you manage your daily tasks.
In this tutorial, we'll look at how to deploy N8N on a Linux KVM VPS at OuiHeberg using Docker. The Docker approach offers several major advantages over a conventional installation:
- Complete isolation : Each service runs in its own container, avoiding dependency conflicts
- Easy deployment : A single command to install everything
- Easy upgrading : Easy upgrading without the risk of damaging your system
- Portability : Deploy the same configuration on any server supporting Docker
Requirements
- A Linux KVM VPS from OuiHeberg (Ubuntu or Debian recommended)
- SSH access to your server
- Root privileges or user with sudo rights
- Basic Linux command-line skills
Step 1: Connect to the VPS via SSH
Start by connecting to your VPS using SSH:
ssh user@ip_addressofyour_vps
Replace user with your username (usually root for a newly created VPS) and ip_addressofyour_vps with the IP address supplied by OuiHeberg.
Step 2: Update the system
Before any installation, make sure your system is up to date:
apt update apt upgrade -y
This step ensures that you have the latest package versions and security patches.
Step 3: Install Docker and Docker Compose
Docker and Docker Compose are essential for our installation:
curl -sSL https://get.docker.com/ | CHANNEL=stable bash
apt install docker-compose
Check that the installation went well:
docker --version
docker-compose --version
You should see the installed versions displayed without error.
Step 4: Create the Docker configuration for N8N
We'll now create a docker-compose.yml file that will define how our N8N service should work:
Create a directory for N8N :
mkdir -p ~/n8n/data
Create docker-compose.yml :
nano ~/n8n/docker-compose.yml
Copy and paste this content into the editor:
version: '3' services: n8n: image: n8nio/n8n restart: always ports: - "5678:5678" environment: - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER=admin - N8N_BASIC_AUTH_PASSWORD=SecurePassword - NODE_ENV=production - WEBHOOK_URL=http://adresse_ip_de_votre_vps:5678 volumes: - ./data:/home/node/.n8n
This file configures:
- N8N official image
- Automatic restart in case of problem
- Port 5678 exposure
- Basic authentication to secure your instance
- Data persistence in data folder
Don't forget to customize :
- Replace admin with your desired username
- Replace SecurePassword with a strong password
- Replace address_ip_of_your_vps with the IP address of your VPS
Save the file with Ctrl+O then Enter, and exit the editor with Ctrl+X.
Step 5: Start N8N with Docker Compose
Start N8N in the background with:
cd ~/n8n docker-compose up -d
The -d option launches containers in detached mode (in the background). Docker will automatically download the N8N image and start the service according to your configuration.
Step 6: Access the N8N interface
Your N8N instance is now operational! Open your browser and go to:
http://adresse_ip_de_votre_vps:5678
You'll be greeted by the N8N login interface. Use the credentials you configured in the docker-compose.yml file.
Managing your N8N instance
Here are some useful commands for managing your N8N instance:
Consulting logs
To view logs in real time:
cd ~/n8n docker-compose logs -f
Press Ctrl+C to quit log display.
Stop N8N
cd ~/n8n docker-compose down
Start N8N
cd ~/n8n docker-compose restart
Update N8N
To update N8N to the latest version:
cd ~/n8n docker-compose pull docker-compose down docker-compose up -d
Advanced configuration (Optional)
Use with a domain name and HTTPS
For a production installation, it is strongly recommended to configure :
- A domain name pointing to your VPS
- An SSL certificate to secure connections
You can use Traefik or Nginx Proxy Manager as a reverse proxy to automatically manage SSL certificates with Let's Encrypt.
Data backup
N8N data is stored in the ~/n8n/data folder. To back up your instance, simply save this folder.
Conclusion
You now have a working N8N instance on your OuiHeberg VPS, ready to automate your daily tasks. Using Docker greatly simplifies maintenance and upgrades, allowing you to focus on creating your workflows.
N8N offers a multitude of integration possibilities with over 200 different services, generic REST APIs, and even custom scripts. Feel free to explore the official documentation to discover the full potential of this automation tool.