Automated installation script untuk deploy n8n self-hosted di Ubuntu/Debian dengan satu command.
| Fitur | Deskripsi |
|---|---|
| π Version Check | Validasi versi software yang terinstall |
| π₯οΈ OS Detection | Auto-detect Ubuntu/Debian |
| πΎ Resource Check | Cek RAM & disk sebelum install |
| π³ Docker | Install Docker Engine + Compose |
| π PostgreSQL | Database production-ready |
| π Nginx/Caddy | Pilihan reverse proxy |
| π SSL/HTTPS | Let's Encrypt otomatis |
| π‘οΈ Firewall | UFW auto-configured |
| π Auto Credentials | Generate password & encryption key |
- One-Click Install - Seluruh stack terinstall otomatis
- Production Ready - PostgreSQL, SSL, Firewall sudah dikonfigurasi
- Dual Proxy Option - Pilih Nginx (traditional) atau Caddy (modern)
- Auto SSL Renewal - Sertifikat Let's Encrypt auto-renew
- Secure by Default - Password random, encryption key, firewall enabled
- Docker-based - Easy update, backup, dan maintenance
- Colored Output - Status jelas dengan warna (hijau/kuning/merah)
- Error Handling - Validasi input dan pengecekan error
| Requirement | Minimum | Recommended |
|---|---|---|
| OS | Ubuntu 20.04 / Debian 11 | Ubuntu 24.04 / Debian 12 |
| RAM | 1 GB | 2 GB+ |
| Disk | 10 GB | 20 GB+ |
| CPU | 1 Core | 2 Cores+ |
| Domain | β Required | Pointed to server IP |
| Access | Root/Sudo | - |
# Download script
curl -O https://raw.githubusercontent.com/bangden07/n8n-Automatic-Installation-Script/refs/heads/main/install-n8n.sh
# Beri permission
chmod +x install-n8n.sh
# Jalankan
sudo ./install-n8n.sh# Dari Windows ke Server
scp install-n8n.sh user@server:/tmp/
# Di server
chmod +x /tmp/install-n8n.sh
sudo /tmp/install-n8n.shsudo ./install-n8n.shScript akan meminta:
| Input | Contoh | Keterangan |
|---|---|---|
| Domain | n8n.example.com |
Harus sudah pointing ke IP server |
admin@example.com |
Untuk sertifikat SSL | |
| Proxy | 1 atau 2 |
1=Nginx, 2=Caddy |
| Timezone | Asia/Jakarta |
Default: Asia/Jakarta |
Script akan menjalankan 10 langkah:
- System Update
- Docker Installation
- Firewall Configuration
- Reverse Proxy Installation
- SSL Certificate
- Directory Structure
- Docker Compose Configuration
- Start Containers
- Verification
- Complete!
Setelah selesai, buka browser:
https://your-domain.com
| Fungsi | Deskripsi |
|---|---|
print_banner() |
Tampilkan ASCII art banner |
check_root() |
Validasi running as root |
check_os() |
Detect Ubuntu/Debian |
check_resources() |
Cek RAM, disk, CPU |
check_existing_installations() |
Cek Docker, Nginx, Node.js |
| Fungsi | Deskripsi |
|---|---|
print_status() |
Print colored status messages |
progress_bar() |
Tampilkan progress bar visual |
check_version() |
Cek dan tampilkan versi software |
generate_password() |
Generate random password |
generate_encryption_key() |
Generate 64-char hex key |
validate_domain() |
Validasi format domain |
validate_email() |
Validasi format email |
| Fungsi | Deskripsi |
|---|---|
system_update() |
apt update && upgrade |
install_docker() |
Install Docker dari official repo |
configure_firewall() |
Setup UFW (22, 80, 443) |
install_nginx() |
Install Nginx + Certbot |
install_caddy() |
Install Caddy (auto-SSL) |
obtain_ssl_certificate() |
Request cert dari Let's Encrypt |
create_n8n_directory() |
Buat ~/n8n dan subdirectories |
create_docker_compose() |
Generate docker-compose.yml |
start_n8n() |
Pull images & start containers |
verify_installation() |
Cek semua services running |
display_summary() |
Tampilkan credentials & info |
Setelah instalasi:
~/n8n/
βββ docker-compose.yml # Docker configuration
βββ .env # Environment variables (chmod 600)
βββ credentials.txt # Saved credentials (chmod 600)
βββ data/ # n8n data directory
βββ postgres-data/ # PostgreSQL data
βββ backup/ # Backup directory
# Lihat logs
docker logs -f n8n
# Restart n8n
cd ~/n8n && docker compose restart
# Stop n8n
cd ~/n8n && docker compose down
# Start n8n
cd ~/n8n && docker compose up -d
# Update n8n
cd ~/n8n && docker compose pull && docker compose up -d
# Backup data
cp -r ~/n8n/data ~/n8n/backup/$(date +%Y%m%d)
# Lihat status container
docker compose ps- β Passwords di-generate random (24 karakter)
- β Encryption key 64-karakter hex
- β File credentials chmod 600
- β Firewall hanya buka port 22, 80, 443
- β SSL/HTTPS enforced
- β PostgreSQL tidak exposed ke public
Problem: Script berhenti setelah "Checking existing installations"
Solution: Pastikan menggunakan versi script terbaru yang sudah remove set -e
Problem: Certbot gagal mendapatkan certificate
Solution:
- Pastikan domain sudah pointing ke IP server
- Tunggu DNS propagation (bisa sampai 24 jam)
- Jalankan manual:
sudo certbot --nginx -d your-domain.com
Problem: Browser tidak bisa buka https://domain.com
Solution:
# Cek container running
docker ps
# Cek logs
docker logs n8n
# Cek nginx/caddy
systemctl status nginx
# atau
systemctl status caddyMIT License - Free to use, modify, and distribute.
Script ini dibuat berdasarkan referensi: