How to Set Up Restic: A Step-by-Step Beginner’s Guide

How to Set Up Restic: A Step-by-Step Beginner’s Guide

Overview

Restic is a fast, efficient, and encrypted backup program that stores deduplicated backups to a variety of backends (local disk, SFTP, cloud services). This guide walks through installing Restic, initializing a repository, creating backups, restoring data, and basic maintenance.

Prerequisites

  • A machine with a supported OS (Linux, macOS, Windows)
  • Command-line access (Terminal / PowerShell)
  • A storage location for the repository (local path, SFTP server, or supported cloud backend)
  • A secure password for the repository

1. Install Restic

  • Linux (Debian/Ubuntu): download the binary or use package manager (snap/apt where available).
  • macOS: use Homebrew:
    brew install restic
  • Windows: download the restic.exe from releases and place it in PATH.

2. Initialize a repository

Choose a repository location and initialize it. Examples:

  • Local:
    restic init –repo /path/to/repo
  • SFTP:
    restic init –repo sftp://user@host:/path/to/repo
  • For cloud backends set the appropriate environment variables (e.g., AWS S3: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and RESTIC_REPOSITORY=s3:s3.amazonaws.com/bucketname) then:
    restic init

You will be prompted to create a repository password; store it safely (password manager or keyfile).

3. Back up data

Set RESTIC_REPOSITORY and RESTIC_PASSWORD (or use a password file). Basic backup command:

restic -r /path/to/repo backup /path/to/data

Examples:

  • Backup home folder:
    restic -r sftp://user@host:/backups backup /home/user

Useful flags:

  • –exclude and –exclude-file to skip files/patterns
  • –tag to label snapshots
  • –verbose for more output

4. List and inspect snapshots

  • List snapshots:
    restic -r /path/to/repo snapshots
  • Show snapshot contents:
    restic -r /path/to/repo ls 

5. Restore files

  • Restore entire snapshot to a target directory:
    restic -r /path/to/repo restore  –target /restore/path
  • Restore a single file:
    restic -r /path/to/repo restore  –include path/to/file –target /restore/path

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *