Skip to content

Instantly share code, notes, and snippets.

@janishar
Created June 14, 2026 04:16
Show Gist options
  • Select an option

  • Save janishar/eb7cbbcfc7aba15ac92516114ed50672 to your computer and use it in GitHub Desktop.

Select an option

Save janishar/eb7cbbcfc7aba15ac92516114ed50672 to your computer and use it in GitHub Desktop.
Linux commands for N8N setup on Raspberry PI Model 3B
# SWAP
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-swappiness.conf sudo sysctl --system
cat /proc/sys/vm/swappiness
# upgrade operating system
sudo apt update
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo reboot
# docker compose
https://docs.docker.com/compose/install/linux/
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
docker compose version
# n8n
mkdir n8n-compose
cd n8n-compose
nano .env
```
# Whether to use secure cookies (should be true if using HTTPS)
N8N_HOST=localhost
N8N_PROTOCOL=http
N8N_PORT=5678
WEBHOOK_URL=http://localhost/
# Security
N8N_PROXY_HOPS=2
N8N_TRUST_PROXY=true
N8N_SECURE_COOKIE=false
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=piuser
N8N_BASIC_AUTH_PASSWORD=123456
# Timezone
GENERIC_TIMEZONE=Asia/Kolkata
# Hardening
N8N_COOKIE_DOMAIN=localhost
N8N_PUBLIC_API_DISABLED=true
N8N_DIAGNOSTICS_ENABLED=false
N8N_VERSION_NOTIFICATIONS_ENABLED=false
N8N_TEMPLATES_ENABLED=false
EXTERNAL_FRONTEND_HOOKS_URLS=
N8N_DIAGNOSTICS_CONFIG_FRONTEND=
N8N_DIAGNOSTICS_CONFIG_BACKEND=
EXECUTIONS_DATA_SAVE_ON_SUCCESS=false
EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=168
```
mkdir local-files
nano compose.yaml
```
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
env_file:
- .env
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:
```
sudo docker compose up -d
hostname -I
sudo docker compose stop
docker compose down
docker compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment