How to Install rqlite on Ubuntu 24.04 and Use SQLite over HTTP

This guide installs rqlite 10.6 on an Ubuntu 24.04 server from the .deb package on GitHub Releases, then creates a table…

Ubuntu 24.04rqlite 10.6x86_64About 13 min

Verified guide

This guide was verified by creating a cloud server and running every command in it, from start to finish, exactly as written.

OS
Ubuntu 24.04.5 LTS · x86_64
Installed version
rqlite 10.6.5 (rqlite_10.6.5_amd64.deb, SQLite 3.53.4)
Test server
DigitalOcean · 1 vCPU / 1 GB RAM / 25 GB SSD (s-1vcpu-1gb, sgp1)
Last checked
2026-10-28

This guide contains affiliate links. If you sign up through them, Codesand may earn a commission. This doesn't affect the content or our assessments.

This guide installs rqlite 10.6 on an Ubuntu 24.04 server from the .deb package on GitHub Releases, then creates a table, inserts data, and runs queries with the rqlite CLI and curl. It also covers where the data is stored, backups, password authentication, a firewall (ufw) setting that allows only your PC to reach the HTTP API, troubleshooting, and how to uninstall.

1. What is rqlite

rqlite is a distributed database that uses SQLite as its storage engine. When you run it on several nodes (servers), it uses the Raft consensus protocol to replicate the same data to every node. The program runs as a single executable (rqlited) with no other dependencies, and you send SQL to it through an HTTP API. It is open source under the MIT license. This guide uses version 10.6.5.

The biggest difference from plain SQLite is how you connect. With SQLite, your program opens the database file directly and reads and writes it. With rqlite, you connect over the network (HTTP) to a running rqlite server and send SQL to it. Every change must also go through the HTTP API, and other programs must not write directly to the SQLite file that rqlite manages. If you join several nodes into a cluster, you can keep using the database even when one node stops, as long as a majority of the nodes are running. This guide covers installing rqlite on a single server. Building a cluster is explained in the next guide.

The official documentation describes its use cases and limits as follows.

  • The purpose of replicating to multiple nodes is fault tolerance and availability, not performance. It suits services that must keep their data available even when one server stops.
  • Only one node, the leader, can change data. Adding nodes does not increase write throughput.
  • Each write adds communication between nodes and a Raft log entry, so writes are slower than with standalone SQLite.

2. Requirements

  • One Ubuntu 24.04 LTS server (x86_64)
  • SSH access with an account that has sudo privileges
  • The public IP address of the PC you will connect from (example: 203.0.113.10)
  • curl on the PC, used to test access

If you don't have a server, try creating a DigitalOcean Droplet (1 vCPU, 1 GB). This Droplet is enough to run rqlite. Every step in this guide was verified on a Droplet (1 vCPU, 1 GB memory, 25 GB SSD, Ubuntu 24.04, Singapore). External access was tested from a PC (example IP 203.0.113.10) to the server (example IP 203.0.113.20).

3. Download the rqlite package

rqlite is not in the default Ubuntu repository. Download the .deb package for Ubuntu from the GitHub Releases page (github.com/rqlite/rqlite/releases). This guide uses 10.6.5, the latest version at the time of testing. To install another version, change the two version numbers in the URL. -fsSLO downloads without a progress display, reports errors, follows redirects, and saves the file under its original name.

curl -fsSLO https://github.com/rqlite/rqlite/releases/download/v10.6.5/rqlite_10.6.5_amd64.deb
ls -lh rqlite_10.6.5_amd64.deb
-rw-r--r-- 1 root root 13M Oct 28 09:54 rqlite_10.6.5_amd64.deb

Check that the downloaded file is the same as the one on the release page. If the output below matches the sha256 value shown next to the file name on the release page, the file is correct.

sha256sum rqlite_10.6.5_amd64.deb
e4d7a8a20791019a64f7db03afb7a85fb64ef44c71ba559e88a377d160840dd5  rqlite_10.6.5_amd64.deb

4. Install rqlite

Install the downloaded file with apt. The ./ before the file name means it installs the file in the current folder, not a package from a repository.

sudo apt install -y ./rqlite_10.6.5_amd64.deb
The following NEW packages will be installed:
  rqlite
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Preparing to unpack /root/rqlite_10.6.5_amd64.deb ...
Unpacking rqlite (10.6.5) ...
Setting up rqlite (10.6.5) ...

The package contains the server program rqlited, the client tool rqlite, the benchmark tool rqbench, and a systemd service file. The installation also creates the rqlite system user and the data folder /var/lib/rqlite. Check the installed version.

rqlited -version
rqlited v10.6.5 linux amd64 go1.27.3 sqlite3.53.4 (commit efd3e6e1d58ba948016bd8487838b65dffe1671a, compiler gc)
rqlite -v
Version v10.6.5, commit efd3e6e1d58ba948016bd8487838b65dffe1671a, built on 2026-10-24T13:06:48+0000

5. Start the service and check its status

After the installation, the service is not started, and it is not registered to start automatically when the server reboots (disabled).

sudo systemctl status rqlited --no-pager
○ rqlited.service - rqlite - lightweight, distributed relational database
     Loaded: loaded (/usr/lib/systemd/system/rqlited.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: https://rqlite.io

Start the service and register it to start automatically when the server reboots. --now starts the service at the same time as registering it.

sudo systemctl enable --now rqlited
Created symlink /etc/systemd/system/multi-user.target.wants/rqlited.service → /usr/lib/systemd/system/rqlited.service.

If active (running) is shown, it is running normally.

sudo systemctl status rqlited --no-pager
● rqlited.service - rqlite - lightweight, distributed relational database
     Loaded: loaded (/usr/lib/systemd/system/rqlited.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-10-28 09:55:14 UTC; 4s ago

rqlite uses two ports. 4001 is the HTTP API port that receives SQL, and 4002 is the Raft port that cluster servers use to exchange data. Right now both are open only on 127.0.0.1, so you can connect only from inside the server.

sudo ss -tlnp | grep rqlited
LISTEN 0      4096       127.0.0.1:4001      0.0.0.0:*    users:(("rqlited",pid=3170,fd=6))
LISTEN 0      4096       127.0.0.1:4002      0.0.0.0:*    users:(("rqlited",pid=3170,fd=3))

6. Create a table and query it with the rqlite CLI

Running rqlite opens a prompt where you can enter SQL one line at a time. Without any options, it connects to 127.0.0.1:4001. Create a table, insert data, query it, and then check the table list with .tables. Enter .exit to quit.

rqlite
Welcome to the rqlite CLI.
Enter ".help" for usage hints.
Connected to http://127.0.0.1:4001 running version v10.6.5
127.0.0.1:4001> CREATE TABLE notes (id INTEGER PRIMARY KEY, body TEXT)
0 row affected
127.0.0.1:4001> INSERT INTO notes(body) VALUES('hello rqlite')
1 row affected
127.0.0.1:4001> SELECT * FROM notes
+----+--------------+
| id | body         |
+----+--------------+
| 1  | hello rqlite |
+----+--------------+
127.0.0.1:4001> .tables
+-------+
| name  |
+-------+
| notes |
+-------+
127.0.0.1:4001> .exit
bye~

7. Use the HTTP API with curl

Programs use rqlite through the HTTP API. SQL that changes data (CREATE, INSERT, UPDATE, DELETE) is sent to /db/execute with POST. The body is a JSON array that holds the SQL and the values for the ? placeholders together. Because the values are not added to the SQL string directly, values that contain quotes are stored as they are. ?pretty at the end of the URL formats the result JSON across multiple lines so it is easier to read.

curl -s -XPOST 'localhost:4001/db/execute?pretty' -H 'Content-Type: application/json' -d '[["INSERT INTO notes(body) VALUES(?)", "from curl"]]'
{
    "results": [
        {
            "last_insert_id": 2,
            "rows_affected": 1
        }
    ]
}

SQL that reads data (SELECT) is sent to /db/query with GET. Using -G together with --data-urlencode converts the spaces and symbols in the SQL into a form that can go in a URL and appends it after q=. Both the row inserted with the CLI in step 6 and the row just inserted with curl are shown.

curl -s -G 'localhost:4001/db/query?pretty' --data-urlencode 'q=SELECT * FROM notes'
{
    "results": [
        {
            "columns": [
                "id",
                "body"
            ],
            "types": [
                "integer",
                "text"
            ],
            "values": [
                [
                    1,
                    "hello rqlite"
                ],
                [
                    2,
                    "from curl"
                ]
            ]
        }
    ]
}

Use /readyz to check whether the server is ready to accept requests. If all four lines are ok, it is working normally. You can use this address in scripts that check server status or as a load balancer health check.

curl -s localhost:4001/readyz
[+]node ok
[+]leader ok
[+]store ok
[+]db ok

8. Data location and backups

Data is stored in /var/lib/rqlite/data. db.sqlite is the SQLite database file, and raft.db stores the history of changes made so far (the Raft log). rqlite manages these files, so do not edit them directly. Change data only through the CLI or the HTTP API.

sudo ls -l /var/lib/rqlite/data
total 72
-rw-r--r-- 1 rqlite rqlite  4096 Oct 28 09:55 db.sqlite
-rw-r--r-- 1 rqlite rqlite 32768 Oct 28 09:55 db.sqlite-shm
-rw-r--r-- 1 rqlite rqlite     0 Oct 28 09:55 db.sqlite-wal
drwxr-xr-x 2 rqlite rqlite  4096 Oct 28 09:55 extensions
drwxr-xr-x 2 rqlite rqlite  4096 Oct 28 09:55 raft
-rw------- 1 rqlite rqlite 32768 Oct 28 09:55 raft.db
drwxr-xr-x 2 rqlite rqlite  4096 Oct 28 09:55 wsnapshots

Take backups with /db/backup. You can download the database as a single SQLite file without stopping the server. Use the file command to check that the downloaded file is a SQLite database.

curl -s localhost:4001/db/backup -o backup.sqlite
file backup.sqlite
backup.sqlite: SQLite 3.x database, last written using SQLite version 3053004, writer version 2, read version 2, file counter 2, database pages 2, cookie 0x1, schema 4, UTF-8, version-valid-for 2

9. Configure the firewall (ufw)

Before allowing external access, set the firewall so that only your PC's IP can connect to port 4001. Always allow SSH before you turn on the firewall. If you turn on the firewall without allowing SSH, your connection to the server is dropped. When you use a single server, you do not need to open port 4002.

sudo ufw allow OpenSSH
sudo ufw allow from 203.0.113.10 to any port 4001 proto tcp
sudo ufw --force enable
sudo ufw status
Rules updated
Rules updated (v6)
Rules updated
Firewall is active and enabled on system startup
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
4001/tcp                   ALLOW       203.0.113.10
OpenSSH (v6)               ALLOW       Anywhere (v6)

10. Password authentication and external access

Right after installation, rqlite accepts all requests without authentication. Before opening external access, create an authentication file with a user and password. Replace change-this-password with the password you will actually use. all in perms allows every kind of request, including queries, changes, and backups.

sudo mkdir -p /etc/rqlite
sudo tee /etc/rqlite/auth.json > /dev/null <<'EOF'
[
  {
    "username": "admin",
    "password": "change-this-password",
    "perms": ["all"]
  }
]
EOF

The authentication file contains the password in plain text, so change its permissions so that only root and the rqlite service can read it.

sudo chown root:rqlite /etc/rqlite/auth.json
sudo chmod 640 /etc/rqlite/auth.json
ls -l /etc/rqlite/auth.json
-rw-r----- 1 root rqlite 102 Oct 28 09:57 /etc/rqlite/auth.json

Instead of editing the file installed by the package (/usr/lib/systemd/system/rqlited.service), change the service options with a separate override file (override.conf). The override file stays in place when the package is upgraded. The first ExecStart= line clears the original command, and the second line is the new command.

  • -http-addr 0.0.0.0:4001: Accepts HTTP API connections on all IPv4 addresses of the server.
  • -http-adv-addr 203.0.113.20:4001: The address of this server that is advertised to clients. Replace it with the server's public IP. This option is required when you listen on 0.0.0.0 (see step 12, Troubleshooting).
  • -auth /etc/rqlite/auth.json: Uses the authentication file created above.
sudo mkdir -p /etc/systemd/system/rqlited.service.d
sudo tee /etc/systemd/system/rqlited.service.d/override.conf > /dev/null <<'EOF'
[Service]
ExecStart=
ExecStart=/usr/bin/rqlited -http-addr 0.0.0.0:4001 -http-adv-addr 203.0.113.20:4001 -auth /etc/rqlite/auth.json /var/lib/rqlite/data
EOF
sudo systemctl daemon-reload
sudo systemctl restart rqlited

If override.conf is shown under Drop-In and the status is active (running), it is working normally.

sudo systemctl status rqlited --no-pager | head -6
● rqlited.service - rqlite - lightweight, distributed relational database
     Loaded: loaded (/usr/lib/systemd/system/rqlited.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/rqlited.service.d
             └─override.conf
     Active: active (running) since Wed 2026-10-28 09:58:39 UTC; 38s ago
       Docs: https://rqlite.io

If port 4001 has changed to *:4001, it now accepts connections from outside. Port 4002 is still open only on 127.0.0.1.

sudo ss -tlnp | grep rqlited
LISTEN 0      4096       127.0.0.1:4002      0.0.0.0:*    users:(("rqlited",pid=4633,fd=3))
LISTEN 0      4096               *:4001            *:*    users:(("rqlited",pid=4633,fd=6))

Requests without a user are now rejected. -i shows the response headers as well.

curl -si -G localhost:4001/db/query --data-urlencode 'q=SELECT * FROM notes' | head -1
HTTP/1.1 401 Unauthorized

The CLI also needs -u user:password to run SQL.

rqlite -u admin:change-this-password
Welcome to the rqlite CLI.
Enter ".help" for usage hints.
Connected to http://127.0.0.1:4001 running version v10.6.5
127.0.0.1:4001> SELECT COUNT(*) FROM notes
+----------+
| COUNT(*) |
+----------+
| 2        |
+----------+
127.0.0.1:4001> .exit
bye~

11. Test access from your PC

Send a query to the server from a terminal on your PC. Replace 203.0.113.20 with your server's IP. If the data inserted up to step 7 is shown, external access is working.

curl -s -u admin:change-this-password -G 'http://203.0.113.20:4001/db/query?pretty' --data-urlencode 'q=SELECT * FROM notes'
{
    "results": [
        {
            "columns": [
                "id",
                "body"
            ],
            "types": [
                "integer",
                "text"
            ],
            "values": [
                [
                    1,
                    "hello rqlite"
                ],
                [
                    2,
                    "from curl"
                ]
            ]
        }
    ]
}

Also check that you can insert data from the PC.

curl -s -u admin:change-this-password -XPOST 'http://203.0.113.20:4001/db/execute?pretty' -H 'Content-Type: application/json' -d '[["INSERT INTO notes(body) VALUES(?)", "from my pc"]]'
{
    "results": [
        {
            "last_insert_id": 3,
            "rows_affected": 1
        }
    ]
}

If the password is wrong, the request is rejected with 401 Unauthorized.

curl -si -u admin:wrong-password -G 'http://203.0.113.20:4001/db/query' --data-urlencode 'q=SELECT 1' | head -1
HTTP/1.1 401 Unauthorized

12. Troubleshooting

fatal: advertised HTTP address is not routable (0.0.0.0), specify it via -http-addr or -http-adv-addr

If you set only -http-addr 0.0.0.0:4001 and leave out -http-adv-addr, rqlited exits with this error right after it starts. In this case, systemctl is-active rqlited run right after systemctl restart may still show active, so check that sudo ss -tlnp | grep rqlited shows nothing and look at the log from sudo journalctl -u rqlited --no-pager -n 20. Add -http-adv-addr server-IP:4001 to override.conf, then run sudo systemctl daemon-reload and sudo systemctl restart rqlited to fix it.

HTTP/1.1 401 Unauthorized

This means you sent a request without a user after turning on authentication, or the password is wrong. Connect with -u admin:password in curl, or rqlite -u admin:password in the CLI. If you connect to the CLI without a user, ERR! server responded with 401 Unauthorized: is shown when you enter SQL.

curl: (28) Failed to connect to 203.0.113.20 port 4001 after 10003 ms: Timeout was reached

This means you connected from the PC but the server did not respond at all. This error occurs when the firewall blocks port 4001 (it is the result of waiting only 10 seconds with --connect-timeout 10). Check that sudo ufw status has the rule 4001/tcp ALLOW 203.0.113.10 and that the IP matches your PC's current public IP. Also check your cloud provider's network firewall.

curl: (7) Failed to connect to localhost port 4001 after 0 ms: Couldn't connect to server

This means rqlited is not running. Check the status with sudo systemctl status rqlited --no-pager and start it with sudo systemctl start rqlited. If the same error appears after starting it, look for lines that start with fatal in sudo journalctl -u rqlited --no-pager -n 20.

"error": "no such table: note"

This means the table in your SQL does not exist. rqlite returns SQL errors in the error field of the JSON. In your program, always check whether results in the response contains error. You can check table names with .tables in the CLI.

13. Uninstall

First, delete the port 4001 rule you added to the firewall.

sudo ufw delete allow from 203.0.113.10 to any port 4001 proto tcp
Rule deleted

Stop the service and remove it from automatic startup.

sudo systemctl disable --now rqlited
Removed "/etc/systemd/system/multi-user.target.wants/rqlited.service".

Remove the package. DEBIAN_FRONTEND=noninteractive prevents confirmation prompts during removal. A warning is shown that the data folder was left in place because it is not empty.

sudo DEBIAN_FRONTEND=noninteractive apt purge -y rqlite
The following packages will be REMOVED:
  rqlite*
Removing rqlite (10.6.5) ...
dpkg: warning: while removing rqlite, directory '/var/lib/rqlite' not empty so not removed

Delete the data folder, the authentication file, and the override file, and also delete the rqlite user created during installation. This also deletes the data stored in /var/lib/rqlite, so back up any data you need first. Running userdel also deletes the group with the same name.

sudo rm -rf /var/lib/rqlite /etc/rqlite /etc/systemd/system/rqlited.service.d
sudo systemctl daemon-reload
sudo userdel rqlite

Delete the downloaded package file and the backup file as well.

rm rqlite_10.6.5_amd64.deb backup.sqlite

Check that no rqlite package remains. If 0 is shown, everything has been removed.

dpkg -l | grep -c rqlite
0
id rqlite
id: ‘rqlite’: no such user

Try it yourself

No server yet? You can spin up an Ubuntu server in a few minutes with one of these providers. We verified this guide on DigitalOcean.