Initial: Add all homelab manifests
This commit is contained in:
143
docs/01-kvm-libvirt.md
Normal file
143
docs/01-kvm-libvirt.md
Normal file
@@ -0,0 +1,143 @@
|
||||
# 01 — KVM & libvirt Installation
|
||||
|
||||
**Datum:** 2026-03-16
|
||||
**Host:** rnk-cp01
|
||||
**OS:** Ubuntu 24.04.4 LTS (Noble Numbat)
|
||||
|
||||
---
|
||||
|
||||
## Übersicht
|
||||
|
||||
Installation und Konfiguration von KVM (Kernel-based Virtual Machine) als Hypervisor sowie libvirt als Management-Layer für VMs im Homelab.
|
||||
|
||||
---
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
### Hardware-Virtualisierung prüfen
|
||||
|
||||
```bash
|
||||
kvm-ok
|
||||
```
|
||||
|
||||
Erwartete Ausgabe:
|
||||
```
|
||||
INFO: /dev/kvm exists
|
||||
KVM acceleration can be used
|
||||
```
|
||||
|
||||
Falls `kvm-ok` nicht verfügbar ist, zuerst `cpu-checker` installieren:
|
||||
```bash
|
||||
sudo apt-get install -y cpu-checker
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
### Pakete installieren
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y \
|
||||
qemu-kvm \
|
||||
libvirt-daemon-system \
|
||||
libvirt-clients \
|
||||
bridge-utils \
|
||||
virtinst \
|
||||
virt-manager \
|
||||
cpu-checker
|
||||
```
|
||||
|
||||
| Paket | Beschreibung |
|
||||
|--------------------------|-----------------------------------------------|
|
||||
| `qemu-kvm` | QEMU mit KVM-Unterstützung (Hypervisor) |
|
||||
| `libvirt-daemon-system` | libvirt Daemon + systemd-Integration |
|
||||
| `libvirt-clients` | CLI-Tools (`virsh`) |
|
||||
| `bridge-utils` | Netzwerk-Bridging für VMs |
|
||||
| `virtinst` | `virt-install` zum Erstellen von VMs |
|
||||
| `virt-manager` | Grafische VM-Verwaltung |
|
||||
| `cpu-checker` | `kvm-ok` Tool |
|
||||
|
||||
---
|
||||
|
||||
## Konfiguration
|
||||
|
||||
### Benutzer zu Gruppen hinzufügen
|
||||
|
||||
```bash
|
||||
sudo usermod -aG libvirt mtkadmin
|
||||
sudo usermod -aG kvm mtkadmin
|
||||
```
|
||||
|
||||
Danach ab- und wieder anmelden oder:
|
||||
```bash
|
||||
newgrp libvirt
|
||||
```
|
||||
|
||||
Gruppen prüfen:
|
||||
```bash
|
||||
groups mtkadmin
|
||||
# mtkadmin : mtkadmin adm cdrom sudo dip plugdev kvm lxd libvirt
|
||||
```
|
||||
|
||||
### sudo ohne Passwort (für nicht-interaktive Prozesse)
|
||||
|
||||
```bash
|
||||
echo "mtkadmin ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/mtkadmin-nopasswd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Dienst starten
|
||||
|
||||
```bash
|
||||
sudo systemctl enable --now libvirtd
|
||||
sudo systemctl status libvirtd
|
||||
```
|
||||
|
||||
Der Dienst startet automatisch beim Booten (`enabled`).
|
||||
|
||||
---
|
||||
|
||||
## Versionen (Stand Installation)
|
||||
|
||||
| Komponente | Version |
|
||||
|------------|---------|
|
||||
| libvirt | 10.0.0 |
|
||||
| QEMU | 8.2.2 |
|
||||
| API | QEMU 10.0.0 |
|
||||
|
||||
---
|
||||
|
||||
## Verifikation
|
||||
|
||||
```bash
|
||||
# KVM verfügbar?
|
||||
kvm-ok
|
||||
|
||||
# libvirtd läuft?
|
||||
sudo systemctl status libvirtd
|
||||
|
||||
# virsh funktioniert?
|
||||
virsh version
|
||||
|
||||
# Standard-Netzwerk vorhanden?
|
||||
virsh net-list --all
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Standardnetzwerk (virbr0)
|
||||
|
||||
libvirt legt automatisch ein NAT-Netzwerk an:
|
||||
|
||||
- **Name:** default
|
||||
- **Bridge:** virbr0
|
||||
- **Subnetz:** 192.168.122.0/24
|
||||
- **DHCP:** aktiviert (via dnsmasq)
|
||||
|
||||
Netzwerk aktivieren (falls nicht aktiv):
|
||||
```bash
|
||||
sudo virsh net-start default
|
||||
sudo virsh net-autostart default
|
||||
```
|
||||
Reference in New Issue
Block a user