Search
Write a publication
Pull to refresh

n8n Local Install Tutorial (CLI + Docker)

Level of difficultyEasy
Reading time3 min
Views611

n8n is a powerful, extendable workflow automation tool that allows you to connect different applications and services. Running it on your local machine gives you complete control over your data and workflows, which can be done on Windows, Mac, or Linux systems. This tutorial covers the two primary methods for local installation: using Docker and using Node.js (npm). If you are interested, then read this article until the end. :)

n8n Local Install Tutorial (CLI + Docker)
n8n Local Install Tutorial (CLI + Docker)

How to Set Up n8n Locally

There are two main ways to install and run n8n locally: using Docker or using Node.js with npm.

Method 1: Installing n8n with Docker

This method utilizes Docker to run n8n in an isolated environment known as a container. It is often the recommended approach, as it bundles all dependencies together.

First, visit https://www.docker.com/products/docker-desktop/, download Docker Desktop for Mac, Windows, or Linux, and install it on your computer.

Docker Website
Docker Website

Then open Docker Desktop or your terminal window and create a dedicated volume for n8n. This ensures that your workflow data is saved persistently, even if you stop or remove the n8n container. Open your terminal (or Command Prompt/PowerShell on Windows) and run the following command:

docker volume create n8n_data 

Note for Linux Users: If you receive a "permission denied" error, you may need to run the command with administrator privileges by adding sudo at the beginning: sudo docker volume create n8n_data.

Next, run the command that will download the official n8n image and start the container. This command maps your local port 5678 to the container's port and links the volume you just created.

docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

Note for Linux Users: As before, if you encounter a permission error, prepend the command with sudo.

Once the command finishes, the terminal will indicate that the n8n is now accessible. You can open your web browser and navigate to: http://localhost:5678

The first time you access this URL, youwill see a “Set up owner account” screen. Fill in your details to create your main administrator account. Once completed, you will be taken to the n8n dashboard, ready to build your first workflow.

Method 2: Installing n8n with Node.js (npm)

This method uses the Node Package Manager (npm), which comes with Node.js. It's a straightforward alternative if you prefer not to use Docker.

You must have Node.js and npm installed. It is essential to use a version of Node.js that is supported by n8n. The tool currently supports Node.js versions 18.x, 20.x, and 22.x. You can download Node.js from the official website, which is available for Mac, Windows, and Linux users.

Installing Node.js (npm)
Installing Node.js (npm)

Then, open your terminal (or Command Prompt/PowerShell on Windows) and run the following command to install n8n.

npm install n8n -g

The -g flag ensures it's installed globally, making the n8n command accessible from anywhere in your terminal.

Note for Linux/Mac Users: For global installations, you may need to use sudo: sudo npm install n8n -g.

After the installation is complete, you can start the n8n application with a simple command:

n8n start

The terminal will show that the process has been initialized and is running on port 5678. You can now open your web browser and go to the following address:http://localhost:5678

Just like with the Docker method, you will be prompted to create an owner account. After setting it up, you can begin creating and managing your workflows locally.

Video Tutorial: How to Install n8n on Your Computer

If you prefer a video tutorial, please watch my step-by-step video:

Watch on YouTube: n8n locally

Conclusion

Both methods result in the same result: n8n running on your local machine. You can pick the one that best fits your experience and system preferences. Give it a shot and share with me your comments below!

Cheers! ;)

Tags:
Hubs:
+2
Comments0

Articles