What N8n is and where to install it
N8n is a workflow automation tool that lets you connect different apps and services without writing code. Instead of manually moving data between tools — copying information from a form into a spreadsheet, or sending Slack messages when something happens in your project management software — N8n does it for you.
You can run N8n in three ways: on your own computer for testing, on a server you control, or through N8n's hosted cloud version. This guide covers the first two, which give you full control over your workflows and data. The installation method depends on what you already have installed and how much technical setup you want to handle.
Key Takeaways
- N8n requires Node.js version 18 or higher to run on your computer or server.
- The fastest way to test N8n locally is using Docker, which packages everything you need in one container.
- If you do not have Docker, you can install N8n directly using npm, which is Node.js's package manager.
- After installation, N8n runs on localhost:5678 in your browser, where you build and manage workflows.
- Self-hosted installations on a server require a database like PostgreSQL and a reverse proxy like Nginx to handle traffic securely.
Installing N8n locally with Docker
Docker is the simplest path if you have it installed. Docker packages N8n and all its dependencies into a container, so you do not have to install anything else. Open your terminal or command prompt and run this command:
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n
This command downloads the N8n image, starts a container, and maps port 5678 on your computer to the container's port 5678. When you see a message saying N8n is ready, open your browser and go to http://localhost:5678. You will see a setup screen where you create your first user account. Docker stores your workflows in a temporary location by default, so if you stop the container, your work disappears — for persistent storage, add a volume flag to the command.
If you want your workflows to survive container restarts, use this longer command instead:
docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n n8nio/n8n
The -v n8n_data:/home/node/.n8n part creates a named volume that persists your data even after you stop and restart the container.
Installing N8n with npm if you do not have Docker
If Docker is not installed or you prefer not to use it, you can install N8n directly on your computer using npm. First, check that you have Node.js version 18 or higher by opening your terminal and typing node --version. If you do not have Node.js, download it from nodejs.org and install it — npm comes bundled with Node.js.
Once Node.js is installed, run this command in your terminal:
npm install -g n8n
The -g flag installs N8n globally, so you can start it from any folder. After installation finishes, start N8n by typing:
n8n start
N8n will display a message with the URL where it is running, usually http://localhost:5678. Open that URL in your browser and create your user account. This method stores your workflows in a folder called .n8n in your user's home directory, so they persist between sessions.
Setting up N8n on a server for production use
Running N8n on a server you control is more involved than local installation, but gives you a permanent, always-on automation platform. You will need a server with Linux (Ubuntu 20.04 or later is common), Node.js 18 or higher, and a database like PostgreSQL to store your workflows and execution history.
Start by connecting to your server via SSH, then install Node.js and PostgreSQL if they are not already present. Create a new system user for N8n to run under, then install N8n globally using npm as described above. Before starting N8n, set environment variables to point it to your PostgreSQL database. Create a file called .env in your N8n directory with these lines:
DB_TYPE=postgresdb DB_POSTGRESDB_HOST=localhost DB_POSTGRESDB_PORT=5432 DB_POSTGRESDB_DATABASE=n8n DB_POSTGRESDB_USER=n8n DB_POSTGRESDB_PASSWORD=your_secure_password
Replace your_secure_password with a strong password. Then start N8n with n8n start. It will create the database tables automatically on first run.
For security, do not expose N8n directly to the internet. Instead, use a reverse proxy like Nginx to sit in front of it, handle HTTPS encryption, and route traffic to N8n running on localhost:5678. Configure Nginx to forward requests to N8n and set up an SSL certificate using Let's Encrypt. This keeps your workflows encrypted in transit and protects your automation from unauthorized access.
Connecting your first apps and testing the installation
After N8n starts and you create your account, you are in the main editor. Click the plus icon to create a new workflow. The left sidebar shows available nodes — these are the individual apps and actions N8n can connect to. Search for an app you use, like Slack or Google Sheets, and click it to add it to your workflow.
Each node needs credentials to connect to the real app. When you add a node, N8n prompts you to authenticate — you will sign into that app or paste an API key. After you authenticate once, N8n stores the credentials and reuses them for future nodes using the same app.
Build a simple test workflow: add a trigger (something that starts the workflow, like a schedule or a webhook), add an action node (like sending a message), and click the play button to test it. If it works, you have confirmed that N8n is installed correctly and can communicate with external services.
Troubleshooting common installation problems
If N8n does not start, check that Node.js is installed and the correct version by running node --version again. If you see a port error saying port 5678 is already in use, either stop the other process using that port or start N8n on a different port with n8n start --port 3000.
If you installed with npm and workflows are not saving, check that the .n8n folder in your home directory exists and is writable. On Linux or Mac, run ls -la ~/ | grep n8n to see if the folder is there. If you installed with Docker and your data disappeared after a restart, you did not use the volume flag — recreate the container with the -v option shown above.
For server installations, if N8n starts but you cannot reach it from your browser, check that your firewall allows traffic on port 5678 (or whatever port you chose) and that Nginx is configured correctly. Test locally first by running curl http://localhost:5678 on the server itself to confirm N8n is responding.
Frequently Asked Questions
Do I need Docker to install N8n?
No. Docker makes installation simpler and more consistent, but you can install N8n directly using npm if you have Node.js 18 or higher. Both methods work equally well for testing and development.
Can I use N8n without a database?
Yes, for local testing. N8n uses SQLite by default, which stores data in a single file. For production servers, PostgreSQL or MySQL is recommended because they handle larger volumes of workflow executions and multiple users more reliably.
What is the difference between localhost:5678 and a server installation?
Localhost runs only on your computer and stops when you close it. A server installation runs continuously on a machine you control or rent, so your workflows run on a schedule even when your personal computer is off. Server installations also let multiple people access the same N8n instance.
How do I update N8n after installation?
If you installed with npm, run npm install -g n8n@latest to update to the newest version. If you use Docker, pull the latest image with docker pull n8nio/n8n and restart your container. Always back up your database before updating.
Is N8n free to use?
Yes. N8n is open source and free to install and run on your own computer or server. N8n also offers a cloud-hosted version with a free tier and paid plans if you prefer not to manage your own installation.