如何安装 n8n
- User
如何安装 n8n
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
如何安装 n8n
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
n8n 支持多种安装方式,以下是三种常用方法(推荐 Docker 方式):
适合所有主流操作系统
安装 Docker:
sudo apt update && sudo apt install docker.io docker-compose创建 docker-compose.yml 文件:
version: '3'
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true # 启用基础认证(可选)
- N8N_BASIC_AUTH_USER=<用户名> # 替换为你的用户名
- N8N_BASIC_AUTH_PASSWORD=<密码> # 替换为你的密码
volumes:
- ./.n8n:/home/node/.n8n # 持久化数据
启动服务:
docker-compose up -d
访问 Web 界面:
http://localhost:5678
需先安装 Node.js
安装 Node.js(需 v16+):
# Ubuntu/Debian
sudo apt update && sudo apt install nodejs npm
全局安装 n8n:
sudo npm install n8n -g
启动服务:
n8n
访问 Web 界面:
http://localhost:5678
适合本地开发测试
下载安装包:
安装并运行:
.exe 文件Applications 文件夹设置认证(增强安全性):
# Linux/macOS
export N8N_BASIC_AUTH_USER=<用户名>
export N8N_BASIC_AUTH_PASSWORD=<密码>
n8n
修改端口:
n8n --port=8080 # npm 方式
# 或 Docker 中修改 ports: "8080:5678"
持久化数据:
volumes 挂载目录~/.n8n 目录端口冲突:
5678 端口,或使用 --port 指定新端口Docker 权限问题:
sudo usermod -aG docker $USER # 将用户加入 docker 组
newgrp docker # 刷新组权限
更新 n8n:
docker-compose pull && docker-compose up -dsudo npm update n8n -g提示:生产环境建议使用 Docker + HTTPS 反向代理(如 Nginx)并启用认证!