In today’s time, Automation is no longer a luxury; it’s a necessity!
If you are looking for a powerful yet flexible automation tool, n8n (pronounced n-eight-n) is one of the best open-source solutions out there. It helps you connect different apps, automate repetitive tasks, and streamline workflows without requiring extensive code.
In this guide, we will walk you through the step-by-step process of manually installing n8n on Ubuntu. Whether you are a beginner or an experienced sysadmin, this tutorial is designed to be clear, simple, and practical.
By the end of this tutorial, you will have a fully functional n8n instance running on your Ubuntu server, accessible from anywhere, at any time.
Prerequisites
Before diving into the installation, make sure you have:
- An Ubuntu 20.04/22.04/24.04 server (VPS or dedicated server).
- A non-root user with sudo privileges.
- Basic Linux command-line knowledge.

Try our ready-to-go n8n self-hosting and start automating in minutes!
Steps to Manually Install n8n on Ubuntu
➔ Step 1: Update Your Ubuntu Server
It’s always a good idea to start by updating your system packages.
You have to run:
sudo apt update && sudo apt upgrade -y | Copied!
Before we start installing, let’s add some essential dependencies that help Ubuntu handle HTTPS repositories and software installations smoothly:
➔ Step 2: Install Required Dependencies
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common | Copied!
★ apt-transport-https → It enables package downloads over HTTPS.
★ ca-certificates → It ensures SSL certificates are trusted.
★ curl → It allows for fetching external scripts (like Node.js setup).
★ software-properties-common → It makes it easier to manage repositories.
➢ Option A – Containerized Installation Using Docker
If you are planning to use n8n for production workflows or want a setup that is stable, portable, and easy to manage, the containerized installation using Docker is the recommended method.
Here’s how you can set it up:
➔ First, we need Docker installed on your Ubuntu server:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo “deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker –version | Copied!
This installs the Docker engine, the CLI tools, and the container runtime, and ensures Docker is ready to run containers.
➔ To make sure your n8n workflows and data are saved even if the container is stopped or removed, create a dedicated folder for persistent storage:
sudo mkdir -p /root/n8n_data sudo chown -R 1000:1000 /root/n8n_data | Copied!
Here, we assign ownership to the user ID 1000, which corresponds to the default user inside the n8n container.
➔ Now, you have to run n8n inside a Docker container with all necessary environment variables for basic authentication:
docker run -d –name n8n \ -p 5678:5678 \ -v /root/n8n_data:/home/node/.n8n \ -e N8N_BASIC_AUTH_ACTIVE=true \ -e N8N_BASIC_AUTH_USER=admin \ -e N8N_BASIC_AUTH_PASSWORD=strongpassword \ -e N8N_SECURE_COOKIE=false \ –restart always \ n8nio/n8n:latest | Copied!
★ -d → runs the container in detached mode (in the background).
★ –name n8n → names the container “n8n”.
★ -p 5678:5678 → exposes port 5678 on your server so you can access the n8n interface.
★ -v /root/n8n_data:/home/node/.n8n → maps your host storage to the container for persistent data.
★ -e N8N_BASIC_AUTH_* → enables basic authentication for security.
★ –restart always → ensures the container restarts automatically on server reboot.
➔ Now, you have to check that your n8n container is running properly by using:
docker ps | Copied!
You should see your n8n container listed with the status Up. Now open your browser and go to:
http://<server-ip>:5678 | Copied!
You have to replace <server-ip> with your actual server IP address. Log in using the credentials you provided in the environment variables.
This method is highly recommended for production usage because it keeps your n8n instance isolated, persistent, and easy to manage. Updating or migrating your automation workflows becomes much simpler, and you don’t need to worry about breaking other software on your server.
➢ Option B – Direct Installation Using Node.js
This option is best if you want to quickly get n8n up and running without extra configuration.
Steps for Direct Installation:
➔ Install Node.js version 18 (LTS), which is the recommended version for n8n.
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash – sudo apt install -y nodejs node -v npm -v | Copied!
➔ Once Node.js is installed, install n8n globally with npm:
sudo npm install -g n8n | Copied!
➔ Start n8n manually by running:
n8n | Copied!
This will start the n8n service in your terminal session.
➔ Open your browser and enter:
http://<server-ip>:5678 | Copied!
You have to replace <server-ip> with your actual server IP address. You should now see the n8n editor interface, where you can begin building workflows.
With this, you have successfully installed and launched n8n using the quickest method. It’s a great way to get familiar with the tool and start experimenting right away.
Conclusion
Manually installing n8n on Ubuntu provides the flexibility to choose a setup that suits your needs, whether it’s for quick testing or a full production environment.
If you are just getting started or want to explore n8n’s powerful workflow automation capabilities, the direct Node.js installation allows you to launch n8n quickly and begin experimenting within minutes.
On the other hand, if you’re building workflows that need to run reliably for your business, the containerized Docker installation provides a stable, portable, and secure environment with persistent data storage and automatic restarts.
By following this guide, you now have a clear understanding of both installation methods, the prerequisites, and the steps required to get n8n up and running on your Ubuntu server. You can now confidently start building, automating, and scaling your workflows.