Install n8n locally on Centos,Almalinux Docker

This article provides step-by-step instructions to install Docker and deploy the n8n workflow automation tool using containers on RHEL-based distributions. The setup ensures data persistence and proper timezone configuration.

Prerequisites

A system running CentOS 8, AlmaLinux 8/9, or RHEL 8/9
Root or sudo privileges
Internet connectivity for downloading packages and Docker images

Step 1: Install yum-utils.

The yum-utils package provides useful utilities such as yum-config-manager, which allows managing repositories.

dnf install yum-utils -y

Step 2: Add Docker Repository.

Add the official Docker repository to your system for access to the latest stable Docker packages.

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

Step 3: Install Docker Engine.

Install Docker Engine, the Docker CLI, and supporting components including containerd.io and the Docker Compose plugin.

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

Verify Docker installation:

docker --version

Enable and start the Docker service:

systemctl enable docker
systemctl start docker
systemctl status docker

Step 4: Create a Persistent Volume for n8n.

Create a Docker volume to store n8n configuration and data persistently. This ensures your workflows and settings remain intact even after container recreation.

docker volume create n8n_data

Step 5: Run n8n Container.

Run the n8n container using the official image with timezone settings and persistent data storage.

docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -e GENERIC_TIMEZONE="Asia/Calcutta" \
  -e TZ="Asia/Calcutta" \
  -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
  -e N8N_RUNNERS_ENABLED=true \
  -e N8N_SECURE_COOKIE=false \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

Once started, access n8n in your browser at: http://[Your IP]:5678

Best Practices

  • For easier management and scalability, use a docker-compose.yml file to define environment variables, ports, and volumes.
  • Enable auto-start for containers.
  • Secure your n8n instance
-e N8N_BASIC_AUTH_ACTIVE=true
-e N8N_BASIC_AUTH_USER=admin
-e N8N_BASIC_AUTH_PASSWORD=StrongPassword
  • Backup regularly since data is stored in the Docker volume (n8n_data), schedule regular volume backups.
  • Keep Docker updated.

Conclusion

You have deployed n8n on CentOS, AlmaLinux, or other RHEL-based distributions using Docker containers, achieving isolation, ease of management, and portability. The aforementioned best practices will help you maintain a secure, reliable, and production-ready n8n installation.

Leave a Comment