How to Install n8n on AlmaLinux 9

Estimated reading: 3 minutes 1241 views

Introduction

n8n is a powerful workflow automation tool that allows you to connect apps, services, and databases to automate repetitive tasks. This guide will show you how to install and run n8n on a CentOS or AlmaLinux server using Docker and Docker Compose, and set up Nginx as a reverse proxy for IP-based access.

By the end of this guide, you’ll have a fully functional n8n instance accessible via your server’s IP address.

Step 1: Connect to Your Server

Use SSH to connect as the root user:

ssh root@YOUR_SERVER_IP

Replace YOUR_SERVER_IP with your server’s IP address.


Step 2: Update the System

Update all system packages:

dnf update -y

Step 3: Install Docker and Dependencies

Install required packages:

dnf install curl ca-certificates gnupg2 yum-utils -y

Add the Docker repository:

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install Docker and Docker Compose plugin:

dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

Enable and start Docker:

systemctl enable --now docker

Verify installation:

docker --version
docker compose version


Step 4: Set Up the n8n Directory

Create a directory for n8n:

mkdir -p /opt/n8n
cd /opt/n8n

Create folders for persistent storage:

mkdir n8n-data local-files

Set ownership so Docker can write:

chown -R 1000:1000 n8n-data local-files


Step 5: Create the Docker Compose File

Open a new  docker-compose.yml :

nano docker-compose.yml

Paste the following:

services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=YOUR_SERVER_IP
- N8N_PORT=5678
- N8N_PROTOCOL=http
- WEBHOOK_URL=http://YOUR_SERVER_IP:5678
- N8N_EDITOR_BASE_URL=http://YOUR_SERVER_IP:5678
- GENERIC_TIMEZONE=UTC
- N8N_USER_FOLDER=/home/node/.n8n
volumes:
- ./n8n-data:/home/node/.n8n
- ./local-files:/files
networks:
- n8n-network
networks:
n8n-network:
driver: bridge

Replace YOUR_SERVER_IP with your server’s IP address.

Save and exit (CTRL + O, ENTER, CTRL + X).


Step 6: Start n8n with Docker Compose

Start n8n in detached mode:

docker compose up -d

Check running containers:

docker compose ps

Monitor logs:

docker logs -f n8n

n8n is now running on port 5678.


Step 7: Install and Configure Nginx

Install Nginx:

dnf install nginx -y

Enable and start Nginx:

systemctl enable --now nginx

Create a reverse proxy configuration:

nano /etc/nginx/conf.d/n8n.conf

Paste this:

server {
listen 80;
server_name _;

location / {
proxy_pass http://localhost:5678;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;

proxy_buffering off;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
}

Test and reload Nginx:

nginx -t
systemctl reload nginx

Step 8: Restart n8n

Restart the container to apply any changes:

docker compose restart

Step 9: Access n8n

Open your web browser and navigate to:

http://YOUR_SERVER_IP:5678

You should now see the n8n dashboard and be able to start creating workflows.


Conclusion

You have successfully installed and configured n8n on a CentOS/AlmaLinux server using Docker and Docker Compose, with Nginx as a reverse proxy for IP-based access.

Your n8n instance is now ready for workflow automation without requiring a domain or SSL. You can start building automations, connecting apps, and managing data directly through the dashboard.

Share this Doc

How to Install n8n on AlmaLinux 9

Or copy link

CONTENTS