# Claude Code — Installation & Verteilung

## Uebersicht

Claude Code ist auf allen 5 mTLS-Cluster-Servern als root installiert. Nur root-Zugang, keine anderen User. Konfiguration (`.claude/`) wird automatisch via lsyncd von .2 an .3-.6 synchronisiert.

Siehe auch: [CLUSTER.md](CLUSTER.md) fuer die gesamte Cluster-Architektur und Zugangsinfos.

## Installation

| Server | VLAN | Version | Installiert |
|--------|------|---------|-------------|
| Cert-Server-1-NBG | 10.0.0.2 | 2.1.110 | Referenz-Server |
| Cert-Server-0-NBG | 10.0.0.3 | 2.1.110 | 2026-04-16 |
| Cert-Server-0-FSN | 10.0.0.4 | 2.1.110 | 2026-04-16 |
| Cert-Server-1-FSN | 10.0.0.5 | 2.1.110 | 2026-04-16 |
| Cert-Server-HEL | 10.0.0.6 | 2.1.110 | 2026-04-16 |

## Pfade

| Pfad | Inhalt |
|------|--------|
| `/root/.local/bin/claude` | Symlink auf aktive Version |
| `/root/.local/share/claude/versions/` | Binary-Versionen |
| `/root/.claude/` | Config, Memory, Commands, Projects |
| `/root/.claude/commands/` | Custom Slash-Commands (z.B. `/do-everything`) |
| `/root/.claude/projects/-srv/memory/` | Persistente Memory-Dateien |

## lsyncd-Synchronisation

lsyncd auf .2 synct `/root/.claude/` automatisch (delay=1s) an .3-.6:

```
Gesynct:     commands/, projects/, memory/, settings
Ausgeschlossen: .credentials.json, statsig/, activity.log
```

**WICHTIG:** `/root/.claude/downloads/` wird ebenfalls gesynct und interferiert mit dem Installer (Checksum-Fehler). Bei Updates: lsyncd vorher stoppen oder `downloads/` als Exclude ergaenzen.

## Neuen Server installieren

```bash
# 1. lsyncd auf .2 stoppen (verhindert Checksum-Interferenz)
ssh root@10.0.0.2 "systemctl stop lsyncd"

# 2. Claude Code installieren
curl -fsSL https://claude.ai/install.sh | bash

# 3. PATH permanent setzen
grep -q '/.local/bin' ~/.bashrc || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

# 4. lsyncd auf .2 wieder starten
ssh root@10.0.0.2 "systemctl start lsyncd"

# 5. Verifizieren
claude --version
```

## Update auf allen Servern

```bash
# Von .2 aus:
systemctl stop lsyncd
for ip in 10.0.0.2 10.0.0.3 10.0.0.4 10.0.0.5 10.0.0.6; do
  echo "=== $ip ==="
  if [ "$ip" = "10.0.0.2" ]; then
    curl -fsSL https://claude.ai/install.sh | bash
  else
    ssh root@$ip 'rm -rf /root/.claude/downloads && curl -fsSL https://claude.ai/install.sh -o /tmp/claude-install.sh && bash /tmp/claude-install.sh'
  fi
done
systemctl start lsyncd
```

## Bekannte Probleme

- **lsyncd + Installer-Konflikt:** lsyncd synct `/root/.claude/downloads/` und zerstoert Checksum-Verifikation. Fix: lsyncd vor Install stoppen.
- **PATH nicht gesetzt:** Nach frischer Installation zeigt `claude: command not found`. Fix: `export PATH="$HOME/.local/bin:$PATH"` in `.bashrc`.
- **Nur root:** Bewusst so — kein `/usr/local/bin` Symlink, keine Multi-User-Installation.
