
How to Install n8n on Rocky Linux 10: A Step-by-Step Guide
Workflow automation is a game-changer for businesses and developers, and n8n stands out as a powerful, open-source, and self-hostable tool. By hosting n8n yourself, you gain complete control over your data, workflows, and operational costs. Rocky Linux 10, with its enterprise-grade stability and security, provides the perfect foundation for a reliable n8n instance.
This guide will walk you through the entire process of installing and securing n8n on a fresh Rocky Linux 10 server using Docker, the officially recommended method.
Prerequisites
Before we begin, ensure you have the following:
- A server running a clean installation of Rocky Linux 10.
- Root or sudo access to the server.
- A domain name pointed to your server’s IP address (highly recommended for a secure, production-ready setup).
Step 1: Install Docker and Docker Compose
Running n8n in a Docker container is the most efficient and maintainable approach. It isolates the application and its dependencies, simplifying installation and future updates.
First, update your system’s package repository to ensure you have the latest versions.
sudo dnf update -y
Next, we’ll add the official Docker repository to our system. This ensures we install a legitimate and up-to-date version of Docker Engine.
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Now, install Docker Engine, the command-line interface (CLI), and other necessary components.
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
Once the installation is complete, start and enable the Docker service. This ensures Docker will automatically run whenever the server reboots.
sudo systemctl start docker
sudo systemctl enable docker
You can verify that Docker is running correctly with the following command:
sudo systemctl status docker
Step 2: Prepare the n8n Environment
It’s best practice to keep your application files organized. Let’s create a dedicated directory for our n8n configuration.
mkdir ~/n8n
cd ~/n8n
Inside this directory, we need to download the docker-compose.yml
file. This file contains the instructions for Docker on how to set up and run the n8n container. We can use curl
to download it directly.
curl -L https://raw.githubusercontent.com/n8n-io/n8n/master/docker/compose/docker-compose.yml -o docker-compose.yml
Step 3: Configure and Launch n8n
Before launching the container, you may want to make a few important configuration changes. Open the docker-compose.yml
file with a text editor like nano
.
nano docker-compose.yml
A crucial setting to adjust is the timezone. By default, the container uses UTC. To set it to your local timezone, add the GENERIC_TIMEZONE
environment variable. For example, to set the timezone to New York:
services:
n8n:
# ... other settings
environment:
- GENERIC_TIMEZONE=America/New_York
# ... other settings
After saving your changes (Ctrl+X, then Y, then Enter in nano), you are ready to launch n8n. Run the following command from within your ~/n8n
directory:
sudo docker compose up -d
The -d
flag runs the container in “detached mode,” meaning it will continue to run in the background. Docker will now download the n8n image and start the container.
You can check if the container is running with sudo docker ps
. To access your new n8n instance, open a web browser and navigate to http://your-server-ip:5678
. You should be greeted by the n8n setup screen.
Step 4: Secure Your n8n Instance with a Reverse Proxy (Recommended)
Accessing n8n via an IP address and port number is fine for testing, but for production use, you must secure it with an SSL certificate (HTTPS). The best way to do this is by using a reverse proxy like Nginx.
First, install Nginx.
sudo dnf install nginx -y
Next, create a new Nginx configuration file for your n8n domain.
sudo nano /etc/nginx/conf.d/n8n.conf
Paste the following configuration into the file, replacing n8n.yourdomain.com
with your actual domain name.
server {
listen 80;
listen [::]:80;
server_name n8n.yourdomain.com;
location / {
proxy_pass http://localhost:5678;
proxy_set_header Connection '';
proxy_http_version 1.1;
proxy_set_header Host $host;
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 Upgrade $http_upgrade;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
Save and close the file. Now, use Certbot to automatically obtain a free SSL certificate from Let’s Encrypt and configure Nginx for HTTPS.
sudo dnf install certbot python3-certbot-nginx -y
sudo certbot --nginx -d n8n.yourdomain.com
Follow the on-screen prompts. Certbot will handle the entire process for you.
Finally, adjust the firewall on Rocky Linux to allow web traffic.
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
You can now securely access your n8n instance by navigating to https://n8n.yourdomain.com
.
Managing Your n8n Installation
Here are a few essential commands for managing your n8n Docker container:
- To stop n8n:
sudo docker compose down
- To restart n8n:
sudo docker compose up -d
- To update n8n to the latest version:
sudo docker compose pull && sudo docker compose up -d
By following these steps, you have successfully deployed a secure, robust, and self-hosted n8n automation platform on Rocky Linux 10, giving you a powerful tool to streamline your digital workflows.
Source: https://centlinux.com/install-n8n-on-rocky-linux-10/