6/15/2025 Aegis

How to Safely Update Your Self-Hosted n8n Instance (2025 Guide)

n8n self-hosting update docker npm automation vps

🔄 Introduction

Running n8n on your own server gives you full control — but it also means you’re in charge of updates. If you’re unsure how to safely upgrade n8n, this guide is for you.

Whether you’re using npm or Docker, we’ll walk you through a smooth update process with zero workflow loss.


📋 Prerequisites

Before updating, make sure you:

  • Have SSH access to your server
  • Know how you installed n8n (npm or Docker)
  • Backed up your workflows and data
  • Have sudo access if required

🧰 Option 1: Update n8n (npm Install)

If you installed n8n using npm globally, use this approach:

✅ Step 1: Backup

If using SQLite (default), back up your .n8n directory:

cp -r ~/.n8n ~/.n8n-backup

For Postgres setups, dump your database before upgrading.

✅ Step 2: Update via npm

sudo npm install n8n@latest -g

You can specify a version if needed:

sudo npm install n8n@1.40.0 -g

✅ Step 3: Restart n8n

If you’re using systemd:

sudo systemctl restart n8n

🐳 Option 2: Update n8n via Docker

If you’re running n8n in a Docker container, follow these steps:

✅ Step 1: Backup Your Data

Backup your .n8n volume or mapped data folder

Backup your database if using external Postgres

✅ Step 2: Pull the Latest Image

docker pull n8nio/n8n:latest

Or specify a version:

docker pull n8nio/n8n:1.40.0

✅ Step 3: Recreate the Container

Stop and remove the old container:

docker stop n8n
docker rm n8n

Start with the latest image:

docker run -d \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n:latest

⚠️ Use the same environment variables and volume mappings as your previous container.


🛡️ Best Practices for Updating

  • Always back up .n8n, your DB, and .env files
  • Check the n8n changelog before major version upgrades
  • Test updates in staging if you’re running critical workflows
  • Use version pinning (n8n@1.40.0) for stability in production

🧪 Troubleshooting Tips

  • Error after update? Run n8n doctor or journalctl -u n8n for logs
  • Check your .env config if n8n doesn’t start
  • If using Docker Compose, make sure your config is updated accordingly

🧰 Need Help Updating n8n?

I offer professional support for:

  • 🔧 Safe version upgrades
  • 💾 Full backup and rollback setup
  • ☁️ Migration between VPS and Docker
  • 🛠️ Workflow repair and environment checks

👉 Get started now — typically completed in just a few hours.