How to Install and Configure n8n for Workflow Automation (2025 Guide)
Installing and configuring n8n is the essential next step after learning what this automation tool can do. Whether you’re a beginner exploring workflow automation or a developer looking to self-host powerful automations, n8n provides everything you need to connect apps, APIs, and tasks without writing complex code. In this guide, we’ll show you how to install and configure n8n locally — step by step.
1. What is n8n and Why Use It in 2025
n8n (short for “nodemation”) is an open-source automation platform that lets you connect tools like Gmail, Notion, Telegram, Google Sheets, and hundreds more using visual workflows. It’s similar to Zapier or Make (Integromat) but with one major advantage — you can host it yourself and have full control.
- Free and open-source: No limits on how many workflows you create.
- Self-hosted or cloud: Run it locally, on your own server, or use n8n Cloud.
- Visual editor: Build automations with a drag-and-drop interface.
- Integrations: Works with 300+ apps and supports custom API connections.
2. How to Install n8n Locally (Step-by-Step)
You can install n8n on Windows, macOS, or Linux. There are three main installation methods: using npm (Node.js), using Docker, or using n8n Cloud. We’ll start with the local setup via npm.
Method 1: Install n8n with npm (Node.js)
- First, make sure you have Node.js and npm installed.
- Open your terminal or command prompt.
- Run the following command to install n8n globally:
npm install n8n -g
Once installed, start n8n by running:
n8n start
After a few seconds, open your browser and visit:
http://localhost:5678
Congratulations! You’re now running n8n locally and ready to create your first workflow.
Method 2: Install n8n with Docker
If you prefer containerized environments, Docker is the most stable and scalable option.
- Install Docker Desktop.
- Create a new folder for your n8n setup, e.g.,
n8n-docker. - Inside that folder, create a
docker-compose.ymlfile with this content:
version: "3"
services:
n8n:
image: n8nio/n8n
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=yourpassword
volumes:
- ./n8n_data:/home/node/.n8n
Then start the container with:
docker compose up -d
Now go to http://localhost:5678 and log in using the credentials you defined. You’re all set!
3. How to Configure n8n for the First Time
When you first open the n8n dashboard, you’ll see an empty canvas. Before building workflows, it’s important to set up a few options:
- Basic Authentication: Always protect your local n8n instance with a username and password (via environment variables).
- Database: For production setups, configure
PostgreSQLinstead of SQLite to handle larger workflows. - Environment Variables: Store API keys safely in the
.envfile instead of hardcoding them in nodes.
# Example .env file
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=mysecurepass
DB_TYPE=postgresdb
4. Running n8n in the Background
If you want n8n to run continuously (even after closing your terminal), you can use PM2 — a process manager for Node.js.
npm install pm2 -g
pm2 start n8n --name n8n
To check its status:
pm2 list
Or stop it anytime:
pm2 stop n8n
5. Troubleshooting Common Installation Issues
- Port already in use: Change n8n’s default port by adding
--port 5679when starting the app. - Permission errors: Run the install command with admin rights or check folder permissions.
- Docker volume issues: Delete and recreate the
n8n_datafolder if it doesn’t persist workflows.
6. Final Thoughts
Installing n8n locally is the first big step toward mastering automation in 2025. Whether you’re testing workflows for personal use or building scalable automation solutions for clients, n8n gives you complete flexibility and control.