---
title: Backup SQLite databases with litestream
url: https://calvin.my/posts/backup-sqlite-databases-with-litestream
published: 2024-12-08
updated: 2026-09-17
category: Operations
tags:
- sqlite
- Database
- litestream
summary: The article explains how to back up SQLite databases with Litestream. It covers installing the version appropriate for the host architecture, enabling the service, and editing its configuration to replicate a database locally or to Amazon S3. Users set replica details, synchronization frequency, and retention period, then restart Litestream. Backup operation can be verified through service journal messages and by confirming that backup files appear in the configured S3 bucket.
---

# Backup SQLite databases with litestream

This article shows the steps to back up SQLite databases using Litestream.

* * *

## Install Litestream

1. Check the latest release on&nbsp;[GitHub](https://github.com/benbjohnson/litestream/releases).

2. Pick and install the one that matches your machine architecture.

   ```bash
   $ wget https://github.com/benbjohnson/litestream/releases/download/v0.3.13/litestream-v0.3.13-linux-arm64.deb
   $ sudo dpkg -i litestream-v0.3.13-linux-arm64.deb
   ```

3. Enable and start the service.

   ```bash
   $ sudo systemctl enable litestream
   $ sudo systemctl start litestream
   ```

* * *

## Configure Litestream

1. Locate the configuration file

   ```bash
   $ sudo pico /etc/litestream.yml
   ```

2. Configure local or S3 replicas based on your needs. Refer [here](https://litestream.io/reference/config/).

   ```yaml
   access-key-id: AKxxx
   secret-access-key: xxxxxx
   region: xxxxxx

   dbs:
     - path: path/to/your.sqlite3
       replicas:
         - url:  s3://bucket-name
           sync-interval: 30s
           retention: 24h
   ```

3. Save and restart service.

   ```bash
   $ sudo systemctl restart litestream
   ```

* * *

## Check Backups

1. Check the journal to see if the backup process is started.

   ```bash
   $ sudo systemctl restart litestream

   time=2024-12-08T11:55:50.759+08:00 level=INFO msg="write snapshot" db=
   time=2024-12-08T11:55:50.872+08:00 level=INFO msg="snapshot written" db=  elapsed=xxxms sz=xxxx
   time=2024-12-08T11:55:50.890+08:00 level=INFO msg="write wal segment" db=
   time=2024-12-08T11:55:50.908+08:00 level=INFO msg="wal segment written" db= elapsed=xxxms sz=xxxx
   ```

2. Check your S3 bucket to see if the backup directory is established.

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/354fdcce-e7e5-4723-b6ba-b6a946ebb49c.png)
