Learn n8n - Installation & Basic Setup
Series/Learn n8n/Episode 3
Episode 3 of 23

Learn n8n - Installation & Basic Setup

Installing and configuring n8n: running it locally with desktop mode and npx, choosing a self-hosted option via Docker, Docker Compose, and Kubernetes, getting to know n8n Cloud, as well as setting up the credential store, environment variables, and basic configuration before building workflows.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In episode 2 you understood n8n's architecture: the engine, credential store, database, and worker working behind the scenes. Now it's time to assemble everything on your machine.

This episode covers installation and basic setup — running n8n locally via desktop mode and npx, self-hosted options with Docker, Docker Compose, and Kubernetes, an introduction to n8n Cloud, as well as setting up the credential store, environment variables, and basic configuration. By the end of this episode, your n8n instance is alive and ready to receive your first workflow.

Running n8n Locally

The easiest way to try it right away is to run n8n from Node.js. Since n8n is distributed as an npm package, a single command is enough:

Jalankan n8n via npx
npx n8n@latest start

After a few seconds, the terminal will show a message that the editor is open at http://localhost:5678. The advantages of this approach: no global install, the version can always be updated, and it's perfect for quick experiments.

An alternative is the n8n desktop app — an application for Windows, macOS, and Linux that you download directly from the official n8n website. The desktop app packages n8n complete with its own runtime, so you don't need to set up Node.js manually. It's the most convenient option if you just want to focus on building workflows without touching the terminal.

Self-Hosting with Docker

For consistent, easily portable self-hosting, Docker is the primary choice. The official n8nio/n8n image already contains the entire runtime, ready to run:

Jalankan n8n dengan Docker
docker run -it --rm -p 5678:5678 n8nio/n8n

The command above maps the container's port 5678 to the host and runs n8n temporarily. But note: without a volume, workflow data is lost when the container stops. For persistence, add a volume that stores n8n data in the ~/.n8n folder on the host.

Docker Compose for a More Complete Setup

For a tidy, repeatable setup, use Docker Compose. Create a docker-compose.yml file:

docker-compose.yml untuk self-host
services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_ENCRYPTION_KEY=GANTI_DENGAN_KUNCI_PANJANG
      - GENERIC_TIMEZONE=Asia/Jakarta
      - N8N_HOST=n8n.contoh.com
    volumes:
      - n8n_data:/home/node/.n8n
 
volumes:
  n8n_data:

Then run it with docker compose up -d. The n8n_data volume name keeps data persistent even if the container is deleted. For production with a PostgreSQL database and Redis — including queue mode — we'll put that together in the deployment episode.

Other Options: Kubernetes and n8n Cloud

  • Kubernetes — for enterprise scale, n8n can be deployed to a cluster with manifests or a Helm chart. Workers can be scaled horizontally and storage uses PersistentVolumes. The full details are waiting in the self-hosting & deployment episode.
  • n8n Cloud — if you don't want to think about infrastructure at all, n8n Cloud is a SaaS managed by the n8n team: automatic upgrades, backups, and monitoring are all handled. You just focus on building workflows.

Which one to choose? Start with npx or desktop for learning, move to Docker Compose when you need persistence and reproducibility, and consider Kubernetes or Cloud when you reach production stage.

Basic Configuration: Credential Store and Environment Variables

Credential Store

n8n stores all credentials — API keys, OAuth tokens, passwords — in an encrypted credential store. Encryption is locked by an encryption key set via the N8N_ENCRYPTION_KEY environment variable. If this key changes, old credentials can no longer be decrypted — so store it safely and don't lose it.

Credentials are managed centrally in the Settings > Credentials menu and can be reused by many nodes. We'll explore this deeper in the integration and security episodes.

Important Environment Variables

Here are some variables most often configured during setup:

VariableFunction
N8N_PORTHTTP port, default 5678
N8N_HOSTPublic hostname of the instance
N8N_ENCRYPTION_KEYEncryption key for the credential store
GENERIC_TIMEZONEDefault timezone, e.g. Asia/Jakarta
DB_TYPEDatabase type, default SQLite, can be postgresdb

All these values are passed via an .env file in Docker Compose or system environment variables — never commit secrets to Git.

Verifying the Installation and First Login

Once the instance is running, open http://localhost:5678 in your browser. First steps:

  1. n8n asks you to create an owner account — a local email and password to lock down the instance.
  2. Choose a timezone matching your location (optional on some versions).
  3. You land on the dashboard containing the workflow list, ready to create a new one.

Warning

A default n8n instance is unauthenticated before an owner is created. If port 5678 is exposed to the internet, create an owner account immediately and restrict network access — you don't want an instance open to everyone.

Also make sure the setup is running as expected:

Cek status container
docker compose ps

The output shows the n8n container with a running status. Your instance is officially live — time to build your first workflow.

Closing

This episode took you from zero to a running n8n instance: running locally via npx or the desktop app, self-hosting with Docker and Docker Compose, understanding the Kubernetes and n8n Cloud options, and setting up a secure credential store and environment variables.

Key takeaways:

  • Use npx or the desktop app for a quick trial, Docker Compose for managed self-hosting.
  • Always attach a volume so workflow data isn't lost when the container restarts.
  • Set N8N_ENCRYPTION_KEY before storing credentials — credentials can't be decrypted without the same key.
  • Configure via environment variables, never commit secrets to Git.
  • Create the owner account as soon as the instance is first accessed.

In the next episode, you'll build your first workflow — a simple workflow with a webhook trigger and an email action, complete with how to save, execute, debug, and read execution history and node output. See you there!