Linuxguide

Restic – Verschluessel Backups fuer Linux und macOS 2025

Open-Source Backup mit Deduplizierung und Verschluesselung

S
SeeColors IT
11. Juni 20264 Min. Lesezeit51 Aufrufe

Restic installieren

# Debian/Ubuntu
apt install restic

# Aktuellste Version direkt
curl -L https://github.com/restic/restic/releases/latest/download/restic_linux_amd64.bz2 |
    bunzip2 > /usr/local/bin/restic
chmod +x /usr/local/bin/restic

# Version pruefen
restic version

Repository initialisieren

# Lokales Repository
restic init --repo /backup/mein-server

# SFTP Repository (NAS oder Remote)
restic init --repo sftp:[email protected]:/backup/mein-server

# S3-kompatibel (MinIO, Backblaze B2, Wasabi)
export AWS_ACCESS_KEY_ID=mein-key
export AWS_SECRET_ACCESS_KEY=mein-secret
restic init --repo s3:https://s3.firma.de/backup-bucket

# Azure Blob
export AZURE_ACCOUNT_NAME=meinaccount
export AZURE_ACCOUNT_KEY=meinkey
restic init --repo azure:backup-container:/mein-server

Backup erstellen

# Passwort-Datei erstellen (sicher aufbewahren!)
echo "super-sicheres-passwort" > /root/.restic-password
chmod 600 /root/.restic-password

# Backup mit Passwort-Datei
restic backup /etc /home /var/lib/postgresql     --repo /backup/mein-server     --password-file /root/.restic-password     --verbose

# Mit Excludes
restic backup /home     --repo /backup/mein-server     --password-file /root/.restic-password     --exclude "/home/*/.cache"     --exclude "*.tmp"     --exclude "*.log"

# Snapshots anzeigen
restic snapshots     --repo /backup/mein-server     --password-file /root/.restic-password

Automatisierung mit Systemd

# /etc/systemd/system/restic-backup.service
cat << 'EOF' > /etc/systemd/system/restic-backup.service
[Unit]
Description=Restic Backup
After=network.target

[Service]
Type=oneshot
User=root
EnvironmentFile=/etc/restic/environment
ExecStart=/usr/local/bin/restic backup /etc /home /var/lib /opt/data --repo /backup/server --password-file /etc/restic/password --exclude-file /etc/restic/excludes
ExecStartPost=/usr/local/bin/restic forget --repo /backup/server --password-file /etc/restic/password --keep-daily 7 --keep-weekly 4 --keep-monthly 12
EOF

# Timer: taeglich 02:00
cat << 'EOF' > /etc/systemd/system/restic-backup.timer
[Unit]
Description=Restic Backup Timer

[Timer]
OnCalendar=02:00
Persistent=true

[Install]
WantedBy=timers.target
EOF

systemctl enable --now restic-backup.timer
systemctl list-timers restic-backup.timer

Wiederherstellung

# Spezifischen Snapshot wiederherstellen
restic restore latest     --repo /backup/mein-server     --password-file /root/.restic-password     --target /tmp/restore

# Spezifisches Verzeichnis wiederherstellen
restic restore latest     --repo /backup/mein-server     --password-file /root/.restic-password     --include /etc/nginx     --target /tmp/nginx-restore

# Repository-Integritaet pruefen
restic check     --repo /backup/mein-server     --password-file /root/.restic-password

# Deduplizierungs-Statistiken
restic stats     --repo /backup/mein-server     --password-file /root/.restic-password

FAQ

Wie gross wird ein Restic-Repository mit der Zeit?
Dank Deduplizierung waechst es nur um die wirklich geaenderten Daten. Ein 100-GB-Server mit 10% taeglicher Aenderung hat nach 30 Tagen ca. 130 GB (nicht 3 TB).

Fazit

Restic ist das beste Open-Source-Backup-Tool 2025: verschluesselt, dedupliziert, multi-backend und gut automatisierbar mit systemd.

Linux-Backup-Loesung fuer KMU in Heidelberg, Mannheim und der Rhein-Neckar-Region. Beratung anfragen.

Artikel teilen

War dieser Artikel hilfreich?

Dein Feedback hilft uns, bessere Inhalte zu erstellen.

Kommentar hinterlassen

Verwandte Artikel