Learn how to install n8n on Rocky Linux 10 step by step—secure, fast, and production-ready. Unlock the power of automation today before your competitors do. Don’t miss out on boosting efficiency with this complete guide! #centlinux #linux #n8n
Table of Contents
Introduction
When it comes to workflow automation, n8n has become one of the most powerful open-source tools available today. Think of it as an open-source alternative to Zapier, but with far greater flexibility. It allows you to connect APIs, databases, and services in a seamless way, automating repetitive tasks and giving you back valuable time.
Now, you might be wondering: Why would I install n8n on Rocky Linux 10? Well, Rocky Linux 10 is quickly gaining popularity as a rock-solid, enterprise-ready alternative to CentOS. With its long-term support and stability, it makes for a perfect operating system to host critical applications like n8n.
Self-hosting n8n on Rocky Linux doesn’t just give you control over your data; it also ensures you’re not locked into SaaS restrictions or pricing. Plus, with the flexibility to scale and integrate with tools like PostgreSQL, Docker, and Nginx, you get a professional-grade automation engine running on your own infrastructure.
In this guide, we’ll go step by step through the process of installing and configuring n8n on Rocky Linux 10. By the end, you’ll have a fully functioning n8n instance that’s secured, optimized, and ready for production use.

Prerequisites for Installing n8n
Before diving into the installation process, let’s make sure your system is prepared. The last thing you want is to get halfway through only to realize your server doesn’t meet the requirements.
1. Hardware Requirements
At minimum, you’ll need:
- 1 vCPU (2 or more recommended for production)
- 2 GB RAM (4 GB or more is better)
- 10 GB Disk Space (depending on workflows and database usage)
If you plan to scale up workflows or integrate with databases, allocate additional CPU and memory.
2. Software Requirements
You’ll need the following installed or available for installation:
- Rocky Linux 10 (freshly installed or updated)
- Node.js (v18 LTS or later)
- npm (comes bundled with Node.js)
- Nginx (for reverse proxy setup)
- PostgreSQL (optional but recommended for database)
- Docker & Docker Compose (optional method)
3. User Permissions
You should have:
- A non-root user with sudo privileges
- Ability to open firewall ports (default n8n uses 5678)
- Access to DNS/domain configuration if using a custom domain
Making sure you’ve got these prerequisites handled will save you hours of frustration later.
Recommended Training: DevOps Beginners to Advanced with Projects
Begin Your DevOps Career As a Newbie | AWS, Linux, Scripting, Jenkins, Ansible, GitOps, Docker, Kubernetes, & Terraform.

Step 1 – Updating and Preparing Rocky Linux 10
The first thing we always do on a fresh Rocky Linux installation is update the system. Security and stability come first, and you don’t want to run into issues with outdated packages.
Run the following commands:
sudo dnf update -y
sudo dnf upgrade -y
Next, install essential packages you’ll need:
sudo dnf install -y curl wget nano git unzip tar
These tools will help us download, edit, and manage configurations.
Firewall and SELinux Setup
Rocky Linux comes with firewalld and SELinux enabled by default. To allow n8n traffic, open port 5678:
sudo firewall-cmd --add-port=5678/tcp --permanent
sudo firewall-cmd --reload
If you plan to use Nginx as a reverse proxy with HTTPS, also allow ports 80 and 443:
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
Regarding SELinux, you can leave it enabled for security, but in case you run into permission issues later with services like Nginx or Docker, you may need to adjust policies. For testing, you can temporarily set it to permissive mode:
sudo setenforce 0
But remember, disabling SELinux permanently isn’t recommended for production. Instead, configure policies properly.
HP 14 Laptop, Intel Celeron N4020, 4 GB RAM, 64 GB Storage, 14-inch Micro-edge HD Display, Windows 11 Home, Thin & Portable, 4K Graphics, One Year of Microsoft 365 (14-dq0040nr, Snowflake White)
34% OffStep 2 – Installing Node.js and npm
Since n8n is built with Node.js, we need to install it before proceeding. Rocky Linux doesn’t always ship with the latest version of Node.js, so we’ll use the NodeSource repository.
Run:
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo dnf install -y nodejs
Verify installation:
node -v
npm -v
You should see Node.js v18.x or later and npm installed successfully.
At this point, we’ve set up the foundation. With Node.js ready, we’re now prepared to install n8n itself.
Step 3 – Installing n8n
Now comes the fun part: installing n8n. Since we’ll be running it system-wide, we’ll install it globally using npm.
sudo npm install -g n8n
Depending on your Linux server specs, this may take a few minutes.
Once done, verify installation:
n8n --version
If it returns a version number, congratulations—you’ve successfully installed n8n!
Creating a Dedicated System User
It’s always best practice not to run applications as root. Let’s create a new user:
sudo adduser --system --group --home /var/lib/n8n n8n
sudo chown -R n8n:n8n /var/lib/n8n
Switch to this user whenever running n8n manually:
sudo -u n8n n8n
By default, n8n will start on port 5678. Open your browser and visit:
http://your_server_ip:5678
At this point, you should see the n8n welcome screen.
Step 4 – Running n8n as a Service
Running n8n manually is fine for testing, but in production, we want it to run automatically on boot and restart if it crashes. That’s where systemd comes in.
Creating a Systemd Service File
We’ll set up a dedicated systemd unit for n8n:
sudo nano /etc/systemd/system/n8n.service
Paste the following configuration:
[Unit]
Description=n8n workflow automation tool
After=network.target
[Service]
Type=simple
User=n8n
ExecStart=/usr/bin/n8n
Restart=on-failure
Environment=PATH=/usr/bin:/usr/local/bin
WorkingDirectory=/var/lib/n8n
[Install]
WantedBy=multi-user.target
Save and exit (CTRL+O
, CTRL+X
).
Enable and Start n8n Service
Reload systemd to recognize the new service:
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
Enable and start the n8n service:
sudo systemctl enable n8n
sudo systemctl start n8n
Check the status to confirm it’s running:
sudo systemctl status n8n
If everything is configured properly, you should see n8n active and running in the background.
Viewing Logs
To troubleshoot or monitor activity, view logs:
journalctl -u n8n -f
Now, every time your Rocky Linux server reboots, n8n will start automatically.
Step 5 – Configuring Reverse Proxy with Nginx
While n8n is accessible on port 5678, in a production setup, it’s better to run it behind a reverse proxy like Nginx. This allows you to use a domain name, enable SSL, and handle traffic securely.
Install Nginx
On Rocky Linux 10, install Nginx using:
sudo dnf install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
Verify it’s running:
systemctl status nginx
Open your browser and visit your server IP—you should see the Nginx default page.

Configure Reverse Proxy
Create a new Nginx configuration file for n8n:
sudo nano /etc/nginx/conf.d/n8n.conf
Paste the following config (replace yourdomain.com
with your real domain):
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1: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;
}
}
Save and exit. Test the configuration:
sudo nginx -t
Reload Nginx:
sudo systemctl reload nginx
Now, visiting http://yourdomain.com
should take you directly to your n8n instance.
Enable SSL with Let’s Encrypt
For production, SSL is mandatory. Install Certbot:
sudo dnf install -y certbot python3-certbot-nginx
Obtain and apply a free SSL certificate:
sudo certbot --nginx -d yourdomain.com
Certbot will automatically configure Nginx with SSL. Test it by visiting:
https://yourdomain.com
Congratulations—you now have a secure, domain-accessible n8n setup.
Levi’s Men’s 527 Slim Bootcut Jeans
$45.64 (as of August 17, 2025 00:00 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Step 6 – Securing n8n with Environment Variables
By default, n8n has no authentication, which is risky for production. Fortunately, it supports environment variables that add security layers.
Setting Environment Variables
We’ll store these variables in a file inside n8n’s home directory.
sudo nano /var/lib/n8n/.n8n_env
Add the following:
# Security
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=strongpassword
# Webhook URL
N8N_HOST=yourdomain.com
N8N_PORT=5678
N8N_PROTOCOL=https
Save and exit.
Update Systemd Service to Use Env File
Edit the n8n service file:
sudo nano /etc/systemd/system/n8n.service
Update [Service]
to include:
EnvironmentFile=/var/lib/n8n/.n8n_env
Reload systemd and restart n8n:
sudo systemctl daemon-reload
sudo systemctl restart n8n
Now, when you visit your domain, you’ll be prompted for a username and password before accessing n8n.

Extra Security Options
- Restrict IP Access: Configure Nginx to only allow specific IPs.
- Use Fail2ban: Protect against brute-force attacks.
- Enable HTTPS-only: Redirect all HTTP traffic to HTTPS.
This ensures your n8n instance is locked down and production-ready.
Step 7 – Using PostgreSQL with n8n
By default, n8n stores its data in SQLite, which works fine for small setups. However, for scalability and reliability, PostgreSQL is the recommended database.
Install PostgreSQL
On Rocky Linux 10, run:
sudo dnf install -y postgresql-server postgresql-contrib
sudo postgresql-setup --initdb
sudo systemctl enable postgresql
sudo systemctl start postgresql
Create n8n Database and User
Log in as the postgres user:
sudo -i -u postgres
psql
Run these commands inside PostgreSQL:
CREATE DATABASE n8n;
CREATE USER n8nuser WITH ENCRYPTED PASSWORD 'securepassword';
GRANT ALL PRIVILEGES ON DATABASE n8n TO n8nuser;
\q
exit
Configure n8n to Use PostgreSQL
Edit your .n8n_env
file:
sudo nano /var/lib/n8n/.n8n_env
Add the following:
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=localhost
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8nuser
DB_POSTGRESDB_PASSWORD=securepassword
Restart n8n:
sudo systemctl restart n8n
Now, n8n will use PostgreSQL as its database backend—much more robust and reliable than SQLite for production environments.
Step 8 – Setting Up n8n with Docker (Alternative Method)
If you prefer containerization, Docker is an excellent way to deploy n8n. It isolates dependencies and makes upgrades easier.
Install Docker & Docker Compose
Run:
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable docker
sudo systemctl start docker
Verify installation:
docker --version
docker compose version
Run n8n in Docker
Create a directory for n8n:
mkdir ~/n8n-docker && cd ~/n8n-docker
Create a docker-compose.yml
file:
version: "3.3"
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=strongpassword
volumes:
- ./n8n_data:/home/node/.n8n
Start n8n:
docker compose up -d
Now, n8n is running inside Docker, with persistent data storage in ./n8n_data
.
This method is clean, portable, and easy to update—perfect if you’re managing multiple servers.
Step 9 – Automating n8n with PM2 (Optional Method)
While systemd is the standard way to manage services on Rocky Linux, some developers prefer PM2, a Node.js process manager that makes it easy to run, monitor, and restart applications. PM2 is especially useful if you’re running multiple Node.js apps or want an additional layer of control.
Installing PM2
First, install PM2 globally using npm:
sudo npm install -g pm2
Verify installation:
pm2 --version
You should see the PM2 version displayed.
Running n8n with PM2
Switch to the n8n
user:
sudo -u n8n -s
Start n8n with PM2:
pm2 start n8n --name n8n
Check the status:
pm2 status
You’ll see n8n running under PM2 management.
Enable PM2 Startup Script
To ensure n8n restarts on boot, run:
pm2 startup systemd
Follow the on-screen instructions to enable auto-start. Then save the process list:
pm2 save
Now, n8n will restart automatically even if the server reboots.
Benefits of Using PM2
- Easy process monitoring with
pm2 logs
- Auto-restart on crash
- Built-in load balancing support
- Easy scaling with
pm2 scale
If you prefer simplicity, stick to systemd. But if you want advanced Node.js process management, PM2 is a great option.
New Balance Kids’ 680 V6 Hook and Loop Running Shoe
23% OffStep 10 – Testing n8n Installation
Now that n8n is running as a service (or via PM2/Docker), it’s time to test if everything works properly.
Accessing n8n in Browser
Open your browser and visit:
https://yourdomain.com
(or http://your_server_ip:5678
if you didn’t set up a domain). You should be prompted for the username and password you configured earlier.
After logging in, you’ll see the n8n dashboard.
Running a Sample Workflow
Let’s test automation by creating a simple workflow:
- Click “New Workflow”.
- Add a Cron node that triggers every minute.
- Add a Set node that outputs a custom message like
"Hello from n8n on Rocky Linux 10!"
. - Execute the workflow and check the results.
If the workflow runs successfully, your n8n installation is working perfectly.
Troubleshooting Common Issues
- Port already in use → Make sure nothing else is running on port 5678.
- Nginx 502 Bad Gateway → Check logs with
journalctl -u n8n -f
. - SSL issues → Ensure DNS points to your server and renew certs with
certbot renew
. - Database connection errors → Double-check PostgreSQL credentials in
.n8n_env
.
Testing workflows is the best way to confirm everything is set up correctly.
Step 11 – Optimizing n8n Performance
If you plan to use n8n in production with multiple workflows, you’ll want to optimize performance.
1. Allocate More Resources
- Increase CPU and RAM if workflows are resource-heavy.
- Consider upgrading to a dedicated VPS for stability.
2. Use PostgreSQL Instead of SQLite
As mentioned earlier, PostgreSQL offers better performance and data integrity compared to SQLite.
3. Enable Caching
If workflows query APIs often, use Redis or caching mechanisms to reduce repeated requests.
4. Limit Concurrent Executions
By default, n8n executes workflows simultaneously. You can set concurrency limits in your .n8n_env
file:
EXECUTIONS_PROCESS=main
EXECUTIONS_TIMEOUT=3600
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
5. Monitor n8n
Use tools like:
- htop → Monitor system usage.
- pm2 monit → Monitor Node.js processes.
- Grafana + Prometheus → Full monitoring stack for advanced setups.
Optimizing performance ensures that n8n runs smoothly even as your automation needs grow.
Step 12 – Backup and Restore Strategies
Automation workflows are valuable, and losing them would be a nightmare. That’s why setting up backup and restore procedures is critical.
Backing Up n8n Data
If you’re using SQLite:
- Backup the
~/.n8n
directory (or/var/lib/n8n
).
If you’re using PostgreSQL:
- Use
pg_dump
to back up the database:
pg_dump -U n8nuser -d n8n > n8n_backup.sql
For Docker users, simply back up the n8n_data
volume.
Automating Backups
Set up a cron job to back up daily:
crontab -e
Add:
0 2 * * * pg_dump -U n8nuser -d n8n > /backups/n8n_$(date +\%F).sql
This creates daily backups at 2 AM.
Restoring from Backup
For PostgreSQL:
psql -U n8nuser -d n8n < n8n_backup.sql
For SQLite:
- Stop n8n.
- Restore the
.sqlite
file. - Restart n8n.
With backups automated, you’ll never have to worry about losing workflows or critical data.
Step 13 – Updating n8n on Rocky Linux 10
n8n is actively developed, and updates often bring new features, nodes, and security patches.
Updating n8n (npm method)
Run:
sudo npm install -g n8n@latest
Restart the service:
sudo systemctl restart n8n
Updating n8n (Docker method)
If you’re using Docker, simply pull the latest image:
docker compose pull
docker compose up -d
Handling Compatibility Issues
- Always back up before upgrading.
- Check the n8n changelog for breaking changes.
- Test in a staging environment if workflows are mission-critical.
Keeping n8n updated ensures you benefit from the latest security improvements and automation features.
Conclusion
You’ve successfully learned how to install, configure, and secure n8n on Rocky Linux 10. From preparing your system, installing Node.js, running n8n as a service, setting up Nginx with SSL, configuring PostgreSQL, and even exploring Docker and PM2—your automation platform is now production-ready.
With n8n, you gain full control over your automation workflows without being tied to SaaS restrictions. Rocky Linux 10 provides the perfect stable foundation, ensuring reliability and performance for your self-hosted n8n instance.
Now it’s time to explore the world of workflow automation—connect APIs, automate emails, sync databases, and much more. The possibilities are endless with n8n.
Need expert AWS and Linux system administration? From cloud architecture to server optimization, I provide reliable and efficient solutions tailored to your needs. Hire me on Fiverr today!
FAQs
1. Can I run n8n on Rocky Linux without Docker?
Yes, n8n can be installed natively using Node.js and npm. Docker is optional but simplifies deployment.
2. How do I enable HTTPS for n8n?
Use Nginx as a reverse proxy and install an SSL certificate with Certbot to enable secure HTTPS access.
3. What ports does n8n use?
By default, n8n listens on port 5678, but you can change this via environment variables or reverse proxy configuration.
4. Is PostgreSQL better than SQLite for n8n?
Yes, PostgreSQL is more reliable and scalable for production. SQLite works for small setups but is not ideal for large workflows.
5. How do I reset the n8n admin credentials?
Edit the .n8n_env
file and update N8N_BASIC_AUTH_USER
and N8N_BASIC_AUTH_PASSWORD
. Restart n8n to apply changes.
Leave a Reply
Please log in to post a comment.