259 lines
5.8 KiB
Markdown
259 lines
5.8 KiB
Markdown
# AuthorBuddy – Installation auf Ubuntu VPS
|
||
|
||
## Voraussetzungen
|
||
|
||
- Ubuntu 22.04 oder 24.04 LTS
|
||
- Root-Zugriff oder `sudo`
|
||
- Mindestens 8 GB RAM, 4 Kerne (empfohlen für lokale LLMs)
|
||
- ca. 15 GB freier Speicher für Ollama + Modelle
|
||
|
||
---
|
||
|
||
## 1. System aktualisieren & Abhängigkeiten
|
||
|
||
```bash
|
||
sudo apt update && sudo apt upgrade -y
|
||
sudo apt install -y curl git ufw
|
||
```
|
||
|
||
## 2. .NET 10 SDK / Runtime installieren
|
||
|
||
```bash
|
||
# Microsoft-Paketquelle registrieren
|
||
sudo apt install -y wget
|
||
wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh
|
||
chmod +x /tmp/dotnet-install.sh
|
||
|
||
# .NET 10 SDK (zum Build)
|
||
sudo /tmp/dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet
|
||
|
||
# Symlink für globale Nutzung
|
||
sudo ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet
|
||
|
||
# Prüfen
|
||
dotnet --version
|
||
# => 10.0.xxx
|
||
```
|
||
|
||
> Falls nur Runtime benötigt wird: `--channel 10.0 --runtime aspnetcore`
|
||
|
||
## 3. Ollama installieren
|
||
|
||
```bash
|
||
curl -fsSL https://ollama.com/install.sh | sh
|
||
|
||
# Dienst starten
|
||
sudo systemctl enable ollama
|
||
sudo systemctl start ollama
|
||
|
||
# Prüfen
|
||
ollama --version
|
||
|
||
# Port prüfen (default 11434)
|
||
ss -tlnp | grep 11434
|
||
```
|
||
|
||
### Modelle pullen
|
||
|
||
Für den Betrieb werden mindestens 2 Modelle empfohlen:
|
||
|
||
```bash
|
||
# Standard-Modell für Lektorat, Assistent, Stilanalyse
|
||
ollama pull llama3.2:3b
|
||
|
||
# Modell für Rechtschreibprüfung (kleiner, schneller)
|
||
ollama pull llama3.2:1b
|
||
```
|
||
|
||
Größere Modelle (7B–13B) liefern bessere Texte. Beispiele:
|
||
|
||
```bash
|
||
ollama pull llama3.1:8b
|
||
ollama pull dolphin-mistral:7b
|
||
```
|
||
|
||
**Übersicht Speicherverbrauch:**
|
||
| Modell | RAM/VRAM |
|
||
|--------|----------|
|
||
| llama3.2:1b | ~1 GB |
|
||
| llama3.2:3b | ~2,5 GB |
|
||
| llama3.1:8b | ~5,5 GB |
|
||
| dolphin-mistral:7b | ~5 GB |
|
||
|
||
---
|
||
|
||
## 4. App bauen & deployen
|
||
|
||
```bash
|
||
# Quellcode auf den Server kopieren (z.B. via SCP oder Git)
|
||
git clone https://github.com/dein-repo/AuthorBuddy.Web /opt/AuthorBuddy.Web
|
||
# ODER: scp -r . ubuntu@deine-vps:/opt/AuthorBuddy.Web
|
||
|
||
cd /opt/AuthorBuddy.Web
|
||
|
||
# Restore & Build (Release)
|
||
dotnet restore
|
||
dotnet publish -c Release -o /opt/AuthorBuddy.Web/publish
|
||
|
||
# Daten-Verzeichnis für Projekte anlegen
|
||
mkdir -p /home/ubuntu/Documents/AuthorBuddy
|
||
```
|
||
|
||
### Datenbankpfad prüfen
|
||
|
||
LiteDB erzeugt die Datenbank `author_brain.db` standardmäßig im `bin/`-Verzeichnis.
|
||
Besser: Ein festes Verzeichnis setzen → Umgebungsvariable oder Code-Anpassung in `Program.cs`:
|
||
|
||
```csharp
|
||
// Program.cs (optional – falls gewünscht)
|
||
var dbDir = "/opt/AuthorBuddy.Web/data";
|
||
Directory.CreateDirectory(dbDir);
|
||
var dbPath = Path.Combine(dbDir, "author_brain.db");
|
||
```
|
||
|
||
---
|
||
|
||
## 5. Systemd-Service einrichten
|
||
|
||
```bash
|
||
sudo nano /etc/systemd/system/authorbuddy.service
|
||
```
|
||
|
||
```ini
|
||
[Unit]
|
||
Description=AuthorBuddy Web
|
||
After=network.target ollama.service
|
||
|
||
[Service]
|
||
WorkingDirectory=/opt/AuthorBuddy.Web/publish
|
||
ExecStart=/usr/share/dotnet/dotnet /opt/AuthorBuddy.Web/publish/AuthorBuddy.Web.dll
|
||
Restart=always
|
||
RestartSec=10
|
||
KillSignal=SIGINT
|
||
SyslogIdentifier=authorbuddy
|
||
User=ubuntu
|
||
Environment=ASPNETCORE_URLS=http://localhost:5000
|
||
Environment=ASPNETCORE_ENVIRONMENT=Production
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
```
|
||
|
||
```bash
|
||
sudo systemctl daemon-reload
|
||
sudo systemctl enable authorbuddy
|
||
sudo systemctl start authorbuddy
|
||
|
||
# Status prüfen
|
||
sudo systemctl status authorbuddy
|
||
|
||
# Logs live
|
||
sudo journalctl -u authorbuddy -f
|
||
```
|
||
|
||
---
|
||
|
||
## 6. Reverse Proxy mit Nginx
|
||
|
||
```bash
|
||
sudo apt install -y nginx
|
||
```
|
||
|
||
`/etc/nginx/sites-available/authorbuddy`:
|
||
|
||
```nginx
|
||
server {
|
||
listen 80;
|
||
server_name deine-domain.de;
|
||
|
||
# (Optional: später mit Certbot auf HTTPS upgraden)
|
||
# return 301 https://$host$request_uri;
|
||
|
||
location / {
|
||
proxy_pass http://localhost:5000;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
||
# Blazor Server benötigt lange Timeouts für Streaming
|
||
proxy_read_timeout 86400s;
|
||
proxy_send_timeout 86400s;
|
||
}
|
||
}
|
||
```
|
||
|
||
```bash
|
||
sudo ln -s /etc/nginx/sites-available/authorbuddy /etc/nginx/sites-enabled/
|
||
sudo nginx -t
|
||
sudo systemctl reload nginx
|
||
```
|
||
|
||
### HTTPS (Let's Encrypt)
|
||
|
||
```bash
|
||
sudo apt install -y certbot python3-certbot-nginx
|
||
sudo certbot --nginx -d deine-domain.de
|
||
```
|
||
|
||
---
|
||
|
||
## 7. Firewall
|
||
|
||
```bash
|
||
sudo ufw allow OpenSSH
|
||
sudo ufw allow 'Nginx Full'
|
||
sudo ufw enable
|
||
```
|
||
|
||
---
|
||
|
||
## 8. Einrichtung in der App
|
||
|
||
Nach dem ersten Start:
|
||
|
||
1. **Im Browser öffnen:** `http://deine-domain.de`
|
||
2. **Ersten Benutzer registrieren** (wird automatisch Admin)
|
||
3. **Settings → Ollama Server:** `http://localhost:11434`
|
||
4. **Test** – Verbindung prüfen
|
||
5. **Modelle zuweisen:**
|
||
- RAG-Modell: `llama3.2:3b` (oder größer)
|
||
- Stil-Modell: `llama3.2:3b`
|
||
- Rechtschreib-Modell: `llama3.2:1b` (klein = schnell)
|
||
6. **Prompts prüfen** – Standard-Prompts sind vorbelegt
|
||
|
||
---
|
||
|
||
## 9. Nützliche Befehle
|
||
|
||
| Aktion | Befehl |
|
||
|--------|--------|
|
||
| App neustarten | `sudo systemctl restart authorbuddy` |
|
||
| Logs ansehen | `sudo journalctl -u authorbuddy -f` |
|
||
| Ollama neustarten | `sudo systemctl restart ollama` |
|
||
| Verfügbare Modelle | `ollama list` |
|
||
| Modell laufend testen | `ollama run llama3.2:3b` |
|
||
| App stoppen | `sudo systemctl stop authorbuddy` |
|
||
|
||
---
|
||
|
||
## 10. Backup
|
||
|
||
```bash
|
||
# Datenbank + Projekte sichern
|
||
sudo tar czf /root/backup-authorbuddy-$(date +%Y%m%d).tar.gz \
|
||
/opt/AuthorBuddy.Web/data \
|
||
/home/ubuntu/Documents/AuthorBuddy
|
||
```
|
||
|
||
---
|
||
|
||
## Fehlerbehebung
|
||
|
||
- **502 Bad Gateway** → App-Logs prüfen: `journalctl -u authorbuddy -f`
|
||
- **Ollama nicht erreichbar** → `curl http://localhost:11434` testen
|
||
- **Port bereits belegt** → `ASPNETCORE_URLS` in der Service-Datei ändern
|
||
- **Blazor SignalR disconnect** → `proxy_read_timeout` in Nginx erhöhen (86400s)
|