Skip to Content
Installation

Install n8n

Automate what is otherwise done by hand every week: a flow is drawn in the browser and runs on a schedule.

Last reviewed:

What you get out of this

Every business has a few tasks that keep coming back. Someone has to move orders from the form to the spreadsheet. Someone has to send the confirmation email. Someone has to post the week's numbers in the company chat. It takes five minutes each time and nobody remembers to do it.

n8n is the tool that does it for you. You draw a flow on a canvas in the browser: this is where it starts, this is where the information goes, this is what happens next. The flow runs when you tell it to, on a schedule, or when something happens. You do not write any code, but you think like a programmer, and that is really the part you take with you.

What you need before you start

  • Docker installed on Windows or Linux Mint. The guide Install Docker covers that, and this guide continues from there.
  • 2 GB of free memory. n8n is gentler on the computer than most systems in this section.
  • An account with the services you want to connect, for example Google, Discord or your email account. n8n accesses them on your behalf, so you need to be able to log in yourself.
  • A place for passwords and keys. You will create an encryption key and it must not be lost. Install Vaultwarden solves that if you do not already have a solution.
  • A concrete task that annoys you. Never start by installing n8n and then look for something to automate. That ends up as a workflow nobody uses.

Time and difficulty

The installation is the easiest in this entire series: one command, ten minutes. Still, count on an hour before your first flow does anything for real, and an afternoon before you have built something you trust. The difficulty is not in the installation but in working out what the flow should do when something goes wrong.

The license: read this before you build a business idea

n8n is not open source in the usual sense. The program is covered by something called the Sustainable Use License, and it says roughly this: you may use n8n as much as you like internally in your business, and you may modify it, but you may not sell n8n onward as a service to others.

For a company that automates its own routines, this is no problem. If the business idea is instead to sell automations as a service to other companies, you should read the license carefully first, and show it to a lawyer if you are unsure. That detail is expensive to miss.

The files you paste in

Create a folder called n8n where you usually save files, and a text file in it called compose.yaml:

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - GENERIC_TIMEZONE=Europe/Stockholm
      - TZ=Europe/Stockholm
      - N8N_ENCRYPTION_KEY=BYT_UT_MIG
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Replace BYT_UT_MIG with a long random string, at least twenty-four characters. On Mint you get one with openssl rand -base64 32, on Windows the password generator in your password manager works just as well.

That key is more important than it looks. n8n encrypts all saved logins with it, meaning tokens for Google, Discord and everything else you connect. If you lose the key, n8n cannot read its own data, and you have to connect every service again from scratch. If you do not set a key at all, n8n creates one itself and puts it in the volume, which works until the volume disappears. Enter your own and save it where the company saves passwords.

The time zone is the second line that matters. Without GENERIC_TIMEZONE, n8n falls back on America/New_York, not UTC, and the difference from Swedish time is six hours: what should be sent at eight o'clock goes at fourteen instead.

Windows: start n8n

Check that Docker Desktop is running. Open PowerShell and run:

cd $HOME\Documents\n8n
docker compose up -d

Use docker compose ps to check that the service shows as running, then open http://localhost:5678. The first time, you need to create an owner account with an email address and password. Use the company's shared email address, not someone's private one, otherwise the account depends on a single person who might leave.

If you would rather avoid Docker, n8n can run directly with Node.js, but only within the range n8n supports (currently about 20.19 to 24.x, check the current range in the project's package.json if the npx command complains): npx n8n starts it on the same port. That is convenient for a quick test and worse in the long run, because then the data sits in the home directory on that particular computer and never moves with you.

Linux Mint: start n8n

Open Terminal and run:

cd ~/n8n
docker compose up -d
docker compose logs -f

The last command shows the log while n8n starts. When it says the editor is available, press Ctrl and C to get back to the prompt, without shutting anything down. Open http://localhost:5678 and create the owner account.

If someone else in the company needs to reach n8n from their computer on the same network, find the address with hostname -I and go to http://ADRESSEN:5678. Then an annoying error appears: by default n8n requires a secure connection for its login cookie, and over plain http to an IP address it refuses. Add the line - N8N_SECURE_COOKIE=false under environment and run docker compose up -d again.

Use that setting on the company's own network and nowhere else. If n8n needs to be reached from outside, it should happen over HTTPS with a real domain name, and then it belongs on a server and not on a computer at the office.

Your first workflow

Build something small where you see the result right away. A good first workflow: every Monday morning, a summary of the week's orders is sent to the company chat.

  1. Click Create Workflow at the top right.
  2. Add a node, that is, a step, by clicking the plus sign. Choose Schedule Trigger and set it to Monday at 08:00. The trigger is what starts the workflow.
  3. Add the next node and choose the source where the orders are, for example Google Sheets. n8n asks for login and opens Google's own login window. Approve, and the details are saved encrypted with the key you set earlier.
  4. Add a Code node or an Edit Fields node that picks out what you want to include: number of rows, total, maybe the three most recent customers.
  5. Add the last node, for example Discord, Gmail or Telegram, and write the message.
  6. Click Execute workflow and check that it does what you intended. Then click Publish at the top right (previously called the Active toggle). A workflow that has not been published never runs on the schedule, and that is the most common mistake in n8n.

Under the Executions tab you see every run, what came in and what went out. If something went wrong, it says so there, and you can run the same data again once you have fixed the error.

Webhooks, and why they do not work from home

The second type of trigger is called Webhook. It gives you an address that another service calls when something happens, for example when the contact form on the website receives a reply.

The problem is that the address points to localhost, meaning your own computer, and nothing from the outside reaches it. n8n used to have a built-in tunnel for testing this, but it was removed in n8n 2.x for security reasons. If you need to test webhooks against an external service today, use a standalone tunnel such as Cloudflare Tunnel or ngrok instead.

For webhooks to work for real, n8n needs to run on a server with its own domain name. It is the same kind of server as in Install Odoo, and one single server is enough for both.

Back up

Everything n8n owns is in the volume: the workflows, the logins and the history. Export the workflows to files regularly, because a file can be read and put back even if the volume is gone:

docker compose exec n8n n8n export:workflow --all --output=/home/node/.n8n/workflows.json
docker compose cp n8n:/home/node/.n8n/workflows.json ./workflows.json

Save the file together with the encryption key, but not in the same document. The workflows without the key can be read and rebuilt. The key without the workflows is worthless to an outsider. Both in the same file is exactly what you want to avoid.

How to know it worked

  • docker compose ps shows n8n as running.
  • You log in at http://localhost:5678 with the owner account.
  • A workflow can be run manually and gives the right result.
  • The workflow is active and has a row under Executions after the next scheduled run.
  • The workflows are exported as a file outside the computer.
  • The encryption key is saved where the company stores passwords.

If something goes wrong

The workflow never runs once the schedule has passed. The workflow is not published, or the computer was turned off at that time. n8n does not fetch missed runs again.

The time is wrong. Check GENERIC_TIMEZONE in the compose file. An error of six hours means the line is missing and that n8n runs on its own default value America/New_York instead of Europe/Stockholm.

Login to a service stops working. Tokens expire. Open Credentials, reconnect that service and run the workflow again.

You cannot get in after changing computer or volume. The encryption key does not match the one the data was saved with. If you still have the key, add it to the compose file. If you do not have it, delete the logins and reconnect the services.

The login page loads but does not accept the password over the network. It is the cookie setting. See the section on Linux Mint above.

What you do next

Build one more flow, but only one. Two flows that work are better than seven half-finished ones, and in six months someone else should be able to understand what they do. Write a line in the description field on each flow about what it does and why.

If the orders live in a business system instead of in a spreadsheet, the flows immediately get sharper. Install Odoo shows how to set it up, and Install Nextcloud gives the flows a file surface to put the reports on.

Cart

Loading