How to Install n8n on a Debian 12 VPS

How to Install n8n on a Debian 12 VPS

If you want to use the n8n automation tool on a VPS, you can follow the steps in this article to install n8n on a Debian 12 VPS until you can access the tool through your browser.

Before going any further, in short, n8n is a tool that allows you to automate many systems without having to code manually, for example, pulling data from a public API and automatically adding it to a Google Spreadsheet using a schedule or trigger.

n8n Installation Requirements

In this tutorial, we will use Docker and Debian 12 for the installation, but you can certainly use other Linux distributions as well.

Besides the OS and Docker, here are other specifications you need to consider:

  • CPU: 1 vCPU
  • RAM: 1 GB (2 GB recommended for heavier workflows)
  • Storage: ±5 GB free
  • Sudo access
  • Port 5678 open and allowed in the firewall

How to Install n8n on a Debian 12 VPS

Now we will start the step-by-step process of installing n8n on a Debian 12 VPS. Make sure you can already access your VPS using SSH. If you have never tried accessing a VPS with SSH, you can follow this tutorial: How to Log In to a Linux VPS via SSH from Windows.

1. Update System

Before starting, make sure the system you are using is updated to avoid issues later on.

sudo apt update && sudo apt upgrade -y

2. Install Docker

After the system update is complete, you need to install Docker first because we will use it for the n8n installation later.

curl -fsSL https://get.docker.com | sudo sh

When finished, make sure Docker is successfully installed and running. For the easiest way, you can check the Docker version.

docker --version

3. Install Docker Compose

Usually, by default, Debian automatically installs the Docker Compose plugin when you install Docker, but you can verify it first.

docker compose version

If Docker Compose is not yet present, you can install it first.

sudo apt install docker-compose-plugin -y

4. Create n8n Folder and Docker Compose

You can create an n8n folder. The folder name does not have to be the same, but keep in mind to use this folder for the n8n installation later.

mkdir ~/n8n-wpgan && cd ~/n8n-wpgan

After being inside the n8n folder you created, now you need to create the docker compose file inside that folder.

nano docker-compose.yml

Enter the following lines into docker-compose.yml, then save by pressing CTRL + X > Y > Enter when in the nano editor

services:  n8n:    image: n8nio/n8n:latest    container_name: n8n-wpgan    ports:      - "5678:5678"    environment:      - TZ=Asia/Jakarta      - N8N_HOST=0.0.0.0      - N8N_PORT=5678      - N8N_PROTOCOL=http      - N8N_SECURE_COOKIE=false      - N8N_BASIC_AUTH_ACTIVE=true      - N8N_BASIC_AUTH_USER=admin      - N8N_BASIC_AUTH_PASSWORD=passwordkuhehe    volumes:      - ./n8n_data:/home/node/.n8n    restart: unless-stopped

Make sure to change admin and my-password in the N8N_BASIC_AUTH section before you run n8n.

5. Run n8n

If everything is ready and correct, you can immediately run n8n by executing the docker compose file you created.

docker compose up -dchown -R 1000:1000 n8n_datachmod -R 755 n8n_data

Also, make sure to check the container after running docker compose.

docker ps

6. Set Up n8n in Browser

Now you can access n8n in your browser by accessing http://IP-SERVER:5678/setup, for example, if your server IP is 192.168.8.8, then you can access http://192.168.8.8:5678/setup and start setting up the owner account to be used for logging in later.

After successfully setting up the owner account, you will be directed straight to the n8n dashboard and can start creating your first workflow!

Cara Install n8n di Debian 12 VPS - 6-2

For data backup, you can save all data in the folder where you saved docker_compose.yml previously. For example, in this article docker_compose.yml is in the folder ~/n8n-wpgan, so the data is saved in ~/n8n-wpgan/n8n_data.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...