Build from source

How to build rqlite from source

rqlite can be compiled for a wide variety of operating systems and platforms.

Release process

A rqlite release is generated automatically using GitHub Actions anytime a new GitHub release is created and tagged.

Building rqlite

Building rqlite requires Go 1.22 or later. gvm is a great tool for installing and managing your versions of Go. You must also have a C compiler installed.

One goal of rqlite is to keep the build process as simple as possible, to aid development and debugging. Download, build, and run rqlite like so (tested on 64-bit Ubuntu 20.04, macOS, and Windows):

mkdir rqlite # Or any directory of your choice.
cd rqlite/
export GOPATH=$PWD
mkdir -p src/
cd src/
git clone
cd rqlite
go install ./...
$GOPATH/bin/rqlited ~/node.1

This starts a rqlite server listening on localhost, port 4001. This single node automatically becomes the Leader.

To rebuild and run, perhaps after making some changes to the source, do something like the following:

cd $GOPATH/src/
go install ./...
$GOPATH/bin/rqlited ~/node.1

Compilation errors locating SQLite functions

If, during compilation, you experience errors about undefined SQLite functions, your C compilation step is probably not configured correctly. Check that you have a C compiler installed and that the environment variable CGO_ENABLED must be set to 1. You can explicitly set the C compiler using the CC environment variable.

Raspberry Pi

The process outlined above will work for Linux, OSX, and Windows. For Raspberry Pi, check out this GitHub issue.

Protobuf code generation

This step is not necessary unless you are making changes to protobuf definitions.

Ensure you have the required tools installed, and that GOPATH is set.

go install
export GOBIN=$GOPATH/bin
go generate ./...

Speeding up the build process

It can be rather slow to rebuild rqlite, due to the repeated compilation of the SQLite source code. You can compile and install the SQLite libary once, so subsequent builds are much faster. To do so, execute the following commands:

cd $GOPATH/src/
go install

Cloning a fork

If you wish to work with fork of rqlite, your own fork for example, you must still follow the directory structure above. But instead of cloning the main repo, instead clone your fork. You must fork the project if you want to contribute upstream.

Follow the steps below to work with a fork:

export GOPATH=$HOME/rqlite
mkdir -p $GOPATH/src/
cd $GOPATH/src/
git clone<your Github username>/rqlite

Retaining the directory structure $GOPATH/src/ is necessary so that Go imports work correctly.


Be sure to run the unit test suite before opening a pull request. An example test run is shown below.

$ cd $GOPATH/src/
$ go test ./...
?       [no test files]
ok  0.001s
?    [no test files]
?   [no test files]
ok    0.769s
ok  0.006s
ok 6.117s
ok   7.853s

Development philosophy

Clean commit histories

If you open a pull request, please ensure the commit history is clean. Squash the commits into logical blocks, perhaps a single commit if that makes sense. What you want to avoid is commits such as “WIP” and “fix test” in the history. This is so we keep history on master clean and straightforward.

Third-party libraries

Please avoid using libaries other than those available in the standard library, unless necessary. This requirement is relaxed somewhat for software other than rqlite node software itself. To understand why this approach is taken, check out this post.

Last modified May 10, 2024: Update (a64f643)