18.04.2025

How to deploy n8n on my server?

In today's fast-paced world, people are constantly bogged down by repetitive and monotonous tasks, especially those that involve copying and pasting information. In response to this issue, CRM systems have emerged as a solution to streamline business operations. While these systems are effective, they are often limited and not accessible to smaller businesses or individuals. To bridge this gap, the n8n open-source project was developed. This low-code platform enables users to automate workflows and processes without requiring extensive technical expertise.

In this guide, we'll walk through the steps of setting up your own self-hosted automation platform quickly and efficiently!

What is n8n and How to Set It Up?

n8n is a powerful automation tool that connects various applications and services through a series of nodes. Each node in the network performs specific functions, allowing for seamless communication between different external APIs. The process is initiated by a trigger event, which sets the rest of the workflow in motion.

For this installation, we’ll use Docker to deploy the n8n Community Edition. Follow the steps below to get started.

Step 1: Install Dependencies

First, ensure that Docker and Docker Compose are installed on your device. Use the following command (the exact command may vary depending on your package manager):

bash
apt install docker.io docker-compose -y

Step 2: Set Up the n8n Service

Next, create a temporary directory and set up the n8n service using a Docker Compose file. Here’s the basic configuration:

version: '3'

services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "2002:2002"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=
- N8N_BASIC_AUTH_PASSWORD=
- N8N_HOST=
- N8N_PORT=
- N8N_PROTOCOL=http
- N8N_WEBHOOK_URL=http://
- N8N_SECURE_COOKIE=false
volumes:
- n8n_data:/home/node/.n8n
networks:
- n8n_network

volumes:
n8n_data:

networks:
n8n_network:
driver: bridge

This configuration file contains environment variables that define key settings such as the authentication details and the device's IP address. You'll need to input your specific values, including the domain name and port. If you choose not to use SSL, make sure the protocol is set to http.

Step 3: Run the Docker Image

To deploy the n8n image, execute the following command:

docker-compose run -d

Once the image is loaded onto your device, you can access it via the provided URL. To complete the setup, create an account by filling out the registration form.

You'll receive an activation key via email. Enter it into the settings to complete the installation.

How to Automate Tasks with n8n

n8n is a versatile application server that automates API requests to external services. It processes incoming data, stores it in variables, and passes it to subsequent nodes for further processing.

For instance, we can integrate the Microsoft Phi-4 GPT model, which is capable of analyzing incoming data streams. The simplest workflow looks like this:

Here, a chat trigger sends a request to the GPT model, which processes the input and sends the result to an output filtering node. You can import the workflow schema by selecting the three dots on the top right and clicking "Import via File."

To connect with an API, generate an API key in the panel and copy it:

Then, open the Phi-4 node and paste the API key into the Authorization header's Value field:

You can now communicate with the model by typing into the chat interface, just like interacting with any other GPT bot. Furthermore, you can connect triggers such as Telegram bot messages or product reviews from online marketplaces. Just remember to manage the Input and Output data model properly!

In future tutorials, we’ll delve into creating more complex automation workflows by exploring additional nodes, allowing you to build personalized automation chains that suit your needs.

Frequently Asked Questions (FAQ)