Install N8N di VM Ubuntu 22.04
Loncat ke navigasi
Loncat ke pencarian
Langkah 1: Persiapan VM di Proxmox
Pastikan VM kamu sudah:
- Berjalan dengan OS Ubuntu 22.04
- Memiliki koneksi internet
- Akses SSH (direkomendasikan)
- Minimal 2 GB RAM (4 GB lebih baik untuk n8n)
- Minimal 20 GB storage
Asumsi:
- IP VM:
192.178.0.12(ganti sesuai IP kamu) - Hostname:
n8n-server - User:
ubuntuatauroot
Langkah 2: Update & Upgrade Sistem
Login ke VM via SSH, lalu jalankan:
sudo apt update && sudo apt upgrade -y
Langkah 3: Install Docker & Docker Compose
n8n paling mudah dijalankan dengan Docker.
1. Install Docker
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io
2. Tambahkan user ke grup docker
Ganti ubuntu dengan user kamu:
sudo usermod -aG docker robie
Log out dan log in kembali agar grup diterapkan.
3. Install Docker Compose (versi plugin)
sudo apt install -y docker-compose-plugin docker compose version
Langkah 4: Buat Direktori untuk n8n
mkdir -p ~/n8n && cd ~/n8n
Langkah 5: Buat docker-compose.yml
nano docker-compose.yml
Tempel konfigurasi berikut:
services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=192.168.0.12 # Ganti dengan IP VM
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_BASE_URL=http://192.168.0.12:5678 # Ganti dengan IP VM
- N8N_SECURE_COOKIE=false
- NODE_ENV=production
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=rahasia123 # Ganti dengan password kuat!
- N8N_ENCRYPTION_KEY=mysecretenckey # Ganti dengan kunci acak panjang!
volumes:
- ./data:/home/node/.n8n
networks:
- n8n-network
networks:
n8n-network:
driver: bridge
Catatan Keamanan:
- Ganti
N8N_BASIC_AUTH_PASSWORDdengan password kuat. - Ganti
N8N_ENCRYPTION_KEYdengan string acak panjang. N8N_HOSTbisa diubah ke domain jika pakai reverse proxy.
Langkah 6: Jalankan n8n dengan Docker Compose
docker compose up -d Jika berhasil akan muncul tampilan seperti berikut [+] Running 14/14 ✔ n8n Pulled 44.1s ✔ fe07684b16b8 Pull complete 1.5s ✔ 49b72e7e39fe Pull complete 6.4s ✔ c1ab3b052759 Pull complete 6.5s ✔ 845179b1d451 Pull complete 6.5s ✔ ad03744990d9 Pull complete 7.4s ✔ 4f4fb700ef54 Pull complete 7.5s ✔ 82fe61b89c46 Pull complete 35.5s ✔ 8bbefc0a3d20 Pull complete 35.7s ✔ 61fa1f23038c Pull complete 35.8s ✔ e0b8394f15f7 Pull complete 35.9s ✔ 43ef2e487a4a Pull complete 36.0s ✔ 6e7f4382f6c9 Pull complete 36.7s ✔ 554527a3fe56 Pull complete 37.4s [+] Running 2/2 ✔ Network n8n_n8n-network Created 0.0s ✔ Container n8n-n8n-1 Started 0.2s
Langkah 7: Cek Status
docker compose ps Menghasilkan tampilan seperti berikut: NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS n8n-n8n-1 n8nio/n8n "tini -- /docker-ent…" n8n 13 seconds ago Up 12 seconds 0.0.0.0:5678->5678/tcp, [::]:5678->5678/tcp docker compose ps Menghasilkan tampilan seperti berikut: total 484 drwxrwxr-x 6 robie robie 4096 Aug 12 15:03 . drwxrwxr-x 3 robie robie 4096 Aug 12 15:03 .. drwxr-xr-x 2 robie robie 4096 Aug 12 15:03 binaryData -rw-r--r-- 1 robie robie 38 Aug 12 15:03 config -rw-r--r-- 1 robie robie 0 Aug 12 15:03 crash.journal -rw-r--r-- 1 robie robie 462848 Aug 12 15:03 database.sqlite drwxr-xr-x 2 robie robie 4096 Aug 12 15:03 git -rw-r--r-- 1 robie robie 0 Aug 12 15:03 n8nEventLog.log drwxr-xr-x 2 robie robie 4096 Aug 12 15:03 nodes drwxr-xr-x 2 robie robie 4096 Aug 12 15:03 ssh
Tekan Ctrl+C untuk berhenti dari log.
Langkah 8: Akses n8n dari Browser
Buka:
http://<IP_VM>:5678
Contoh:
http://192.168.1.100:5678
Login:
- User:
admin - Password:
rahasia123
Solusi Error HTTPS
1. Edit docker-compose.yml:
nano ~/n8n/docker-compose.yml Ubah Bagian berikut environment: - N8N_HOST=192.168.0.12 - N8N_PORT=5678 - N8N_PROTOCOL=http - N8N_BASE_URL=http://192.168.0.12:5678 - N8N_SECURE_COOKIE=false # <-- TAMBAHKAN BARIS INI - NODE_ENV=production - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER=admin - N8N_BASIC_AUTH_PASSWORD=rahasia123 - N8N_ENCRYPTION_KEY=mysecretenckey
2. Restart Container
cd ~/n8n docker compose down docker compose up -d