How to Manually Install n8n on Ubuntu?
In today’s digital environment, automation helps businesses reduce repetitive work and improve productivity. If you are searching for a flexible workflow automation platform, n8n is an excellent open-source solution. It allows you to connect different applications, automate routine tasks, and manage workflows without requiring advanced coding knowledge.
In this guide, we will explain how to manually install n8n on Ubuntu using two methods: Docker and Node.js. The steps are simple and suitable for beginners as well as experienced system administrators. By the end of this tutorial, you will have n8n installed and accessible through your Ubuntu server.
Prerequisites
Before starting the installation, make sure you have:
- An Ubuntu 20.04, 22.04, or 24.04 server
- A VPS or dedicated server
- A non-root user with sudo privileges
- Basic knowledge of Linux commands
- SSH access to your Ubuntu server
Steps to Manually Install n8n on Ubuntu
Step 1: Update Your Ubuntu Server
Before installing any software, update your Ubuntu system packages.
Run the following command:
sudo apt update && sudo apt upgrade -y
This command updates the package list and installs the available system updates.
Step 2: Install Required Dependencies
Next, install the essential packages required for software installation and secure repository access:
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
These packages perform the following functions:
- apt-transport-https: Enables package downloads over HTTPS.
- ca-certificates: Helps verify trusted SSL certificates.
- curl: Downloads external files and installation scripts.
- software-properties-common: Helps manage software repositories.
Option A: Containerized Installation Using Docker
If you plan to use n8n for business automation or production workflows, Docker is a convenient option. It keeps n8n isolated, simplifies management, and allows your data to remain persistent when configured correctly.
Step 3: Install Docker
First, add the Docker GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Add the Docker repository:
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
Update the package list:
sudo apt update
Install Docker:
sudo apt install -y docker-ce docker-ce-cli containerd.io
Verify the installation:
docker --version
This installs Docker Engine, Docker command-line tools, and the container runtime required to run n8n.
Step 4: Create Persistent Storage for n8n
To ensure your workflows and n8n data are retained even if the container is stopped or removed, create a dedicated storage directory:
sudo mkdir -p /root/n8n_data
Set the required ownership:
sudo chown -R 1000:1000 /root/n8n_data
The user ID 1000 generally corresponds to the default user inside the n8n container.
Step 5: Run n8n in a Docker Container
Run the following command to start n8n:
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
Replace strongpassword with a strong and unique password.
Here is what the main options mean:
-d→ Runs the container in the background.--name n8n→ Assigns the namen8nto the container.-p 5678:5678→ Makes n8n available through port 5678.-v→ Mounts server storage for persistent n8n data.N8N_BASIC_AUTH_*→ Configures basic authentication for the referenced setup.--restart always→ Automatically restarts the container after a server reboot.
For production use, configure n8n with HTTPS, secure authentication, and appropriate access restrictions.
Step 6: Check the n8n Container
Confirm that the n8n container is running:
docker ps
You should see the n8n container listed with a status similar to Up.
Now open your browser and enter:
http://<server-ip>:5678
Replace <server-ip> with your actual Ubuntu server IP address.
Log in using the credentials configured in the Docker command.
The Docker method is suitable for users who want a portable and manageable n8n installation with persistent storage and automatic restarts.
Option B: Direct Installation Using Node.js
The direct Node.js installation method is useful if you want to install n8n quickly without configuring Docker.
This option is suitable for testing, learning, and experimenting with n8n workflows.
Step 3: Install Node.js
Install Node.js 18 LTS using the NodeSource setup script:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Then install Node.js:
sudo apt install -y nodejs
Verify the installed versions:
node -v
npm -v
Make sure the installed Node.js version is compatible with the n8n version you plan to use.
Step 4: Install n8n Using npm
Once Node.js is installed, install n8n globally with npm:
sudo npm install -g n8n
The -g option installs n8n globally so that you can run it directly from the terminal.
Step 5: Start n8n
Start n8n manually by running:
n8n
This starts n8n in your current terminal session.
Step 6: Access the n8n Dashboard
Open your browser and enter:
http://<server-ip>:5678
Replace <server-ip> with your actual server IP address.
You should now see the n8n editor interface, where you can create workflows and connect different applications.
Note: When n8n is started directly from the terminal, it may stop when the terminal session ends. For continuous production usage, configure a suitable service manager or use Docker with a restart policy.
Conclusion
Manually installing n8n on Ubuntu allows you to automate repetitive tasks and connect different applications through customizable workflows. You can choose the direct Node.js installation for testing or Docker for a more organized and reliable setup.
For businesses and developers who need a dedicated environment for workflow automation, n8n VPS Hosting provides the flexibility, control, and server resources required to run n8n efficiently. With proper security, regular backups, and continuous monitoring, you can use n8n to manage automation workflows smoothly on your own VPS.
Read more knowledge base How to Enable Root Login via SSH in Ubuntu