---
name: proxmox-setup
description: Instalacao completa de Proxmox VE 8.x em Hetzner -- installimage, ZFS RAID-1, NAT networking single-IP e vSwitch com optimizacoes.
---

# Proxmox Setup

Instalacao completa e configuracao de Proxmox VE 8.x em servidor dedicado Hetzner com ZFS RAID-1, networking NAT single-IP e optimizacoes.

## Quando Usar

- Instalar novo node Proxmox em servidor Hetzner
- Setup inicial com ZFS mirror NVMe
- Configurar networking NAT para single-IP
- Preparar node para clustering futuro

## Sintaxe

```bash
/proxmox-setup <server-ip> <hostname> [--zfs-pool rpool] [--arc-max 16G] [--vswitch]
```

## Knowledge Sources (Consultar SEMPRE)

### NotebookLM Proxmox Research
```bash
mcp__notebooklm__notebook_query \
  notebook_id:"276ccdde-6b95-42a3-ad96-4e64d64c8d52" \
  query:"proxmox installation hetzner zfs networking"
```

### Hub Docs
- `Hub/05-Projectos/Cluster Descomplicar/Research/Proxmox-VE/Guia-Definitivo-Proxmox-Hetzner.md`

---

## Workflow Completo

### Fase 1: Pre-Installation Checks

```bash
# Via SSH MCP - verificar Rescue Mode
mcp__ssh-unified__ssh_execute \
  server:"hetzner-rescue" \
  command:"uname -a && df -h"
```

Consultar NotebookLM para hardware specs e template correcto.

### Fase 2: installimage com ZFS RAID-1

Detalhes completos do template installimage e configuracao ZFS em: `references/installimage-zfs.md`

Resumo do workflow:
1. Instalar Debian 12 com LVM via installimage
2. Boot em Debian
3. Instalar ZFS + Proxmox
4. Criar ZFS pool para VMs (Opcao A recomendada: LVM root, ZFS para VMs)

### Fase 3: Proxmox VE 8.x Installation

```bash
# Adicionar repo Proxmox
echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list

# Adicionar key
wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

# Update e instalar
apt update && apt full-upgrade
apt install proxmox-ve postfix open-iscsi chrony

# Remover kernel Debian (apos boot em PVE kernel)
apt remove linux-image-amd64 'linux-image-6.1*'
update-grub
reboot
```

### Fase 4: ZFS Tuning

Detalhes em: `references/installimage-zfs.md` (seccao ZFS Tuning)

### Fase 5: Networking NAT (Single-IP Hetzner)

Configuracao completa de NAT, port forwarding e vSwitch em: `references/networking-nat.md`

### Fase 6: Proxmox Web UI + Storage

```
https://SERVER_IP:8006
User: root
Password: (root password do servidor)
```

```bash
# Comentar enterprise repo
sed -i 's/^deb/#deb/' /etc/apt/sources.list.d/pve-enterprise.list
apt update
```

Storage no Web UI: Datacenter -> Storage -> Add (Directory, ZFS, PBS).

### Fase 7: Validation Checklist

```bash
pveversion -v          # PVE version
zpool status           # ZFS status
zpool list && zfs list
ping -c 3 8.8.8.8     # Networking
curl -k https://localhost:8006  # Web UI
arc_summary | grep "ARC size"   # ARC stats
```

**Security Hardening:**
```bash
sed -i 's/#PermitRootLogin yes/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
systemctl restart sshd
```

---

## Troubleshooting

| Problema | Comando diagnostico |
|----------|-------------------|
| Web UI nao acessivel | `systemctl status pveproxy` + `journalctl -u pveproxy -f` |
| VMs sem internet (NAT) | `cat /proc/sys/net/ipv4/ip_forward` + `iptables -t nat -L -n -v` |
| ZFS ARC nao limita | `cat /sys/module/zfs/parameters/zfs_arc_max` |
| vSwitch MTU issues | `ping -M do -s 1372 10.0.0.2` |

---

## Quando NAO Usar

- Para servidores non-Hetzner (diferentes gotchas de networking)
- Para Proxmox ja instalado (usar outras skills de config)
- Para troubleshooting (criar skill especifica)

---

## References

- `references/installimage-zfs.md` - Template installimage, conversao ZFS, tuning ARC
- `references/networking-nat.md` - NAT single-IP, port forwarding, vSwitch, gotchas Hetzner
- **NotebookLM:** 276ccdde-6b95-42a3-ad96-4e64d64c8d52 (150+ fontes)
- **Proxmox Docs:** https://pve.proxmox.com/pve-docs/pve-admin-guide.html
- **Hetzner Docs:** https://docs.hetzner.com/robot/dedicated-server/

---

Projecto: Cluster Proxmox Descomplicar (#65) | Tarefa: #1712

---

## Healing Log

Registo de erros conhecidos e como evitá-los. Lido automaticamente antes de executar.

```jsonl
{"date":"","issue":"","fix":"","source":"user|auto"}
```

*Adicionar nova linha após cada erro corrigido.*
