Installing LeonsDB
LeonsDB is one program, the server, plus a plugin for each Minecraft server. This guide takes you from nothing to a network saving its players in LeonsDB: on Ubuntu, on Windows, or with Docker. Then connect your Minecraft servers.
The downloads are at https://leonsdb.com/download/, one folder per
version. In the commands below, replace 0.1.0 with the newest version.
Ubuntu (and other Linux)
Ubuntu 22.04 or later, Debian 12 or later, or any 64-bit Linux with
systemd. Run these on the machine that will hold the data, as a user that
can use sudo.
1. Download and unpack LeonsDB
cd /tmp
wget https://leonsdb.com/download/0.1.0/leonsdb-0.1.0-linux-amd64.tar.gz
tar xzf leonsdb-0.1.0-linux-amd64.tar.gz
cd leonsdb-0.1.0-linux-amd64
On an ARM server (for example Oracle’s or Hetzner’s Ampere machines) take
linux-arm64 instead of linux-amd64.
2. Get a certificate (skip this if your Minecraft servers run on this same machine)
Minecraft servers on other machines connect over TLS, so LeonsDB needs a
certificate for the name they use, for example db.example.com. Point that
name at this machine in your DNS, then:
sudo apt install -y certbot
sudo certbot certonly --standalone -d db.example.com
(Port 80 must be free for a moment. If a web server already uses it, run
certbot through it instead, for example --nginx.)
3. Install it as a service
sudo ./deploy/install.sh --domain db.example.com
Without step 2, leave out --domain ...: LeonsDB then listens on this
machine only. The installer creates a leonsdb user, writes
/etc/leonsdb/leonsdb.yml, starts LeonsDB, starts it again at every boot,
and opens ports 7420 and 7422 in the firewall (ufw). When the certificate is
renewed, LeonsDB picks up the new one by itself.
4. Keep the admin token
sudo cat /var/lib/leonsdb/initial-admin-token
Copy it to a password manager, then delete the file:
sudo rm /var/lib/leonsdb/initial-admin-token
5. Check that it runs
systemctl status leonsdb
leonsdb version
Its log: journalctl -u leonsdb -f. Its settings: /etc/leonsdb/leonsdb.yml
(every setting is explained in Running the server;
sudo systemctl restart leonsdb after a change).
Now connect your Minecraft servers and schedule backups.
Windows
Windows 10, Windows 11 or Windows Server 2019 or later, 64-bit.
1. Download and unpack LeonsDB
Download leonsdb-0.1.0-windows-amd64.zip from
https://leonsdb.com/download/0.1.0/ and unpack it into C:\LeonsDB, so that
C:\LeonsDB\leonsdb.exe exists.
2. Write its configuration
Create C:\LeonsDB\leonsdb.yml with Notepad. If your Minecraft servers run
on this same machine:
listen: 127.0.0.1:7420
data_dir: C:\LeonsDB\data
backups:
dir: C:\LeonsDB\backups
If they run on other machines, LeonsDB needs TLS: get a certificate for the name they connect to (for example with win-acme, saved as PEM files), and use:
listen: 0.0.0.0:7420
data_dir: C:\LeonsDB\data
tls:
cert_file: C:\LeonsDB\tls\fullchain.pem
key_file: C:\LeonsDB\tls\privkey.pem
backups:
dir: D:\LeonsDB-backups
(Backups are safer on another disk than the data.)
3. Install it as a service
Open a Command Prompt as administrator (Start, type cmd, right-click,
Run as administrator):
cd C:\LeonsDB
leonsdb.exe service install -config C:\LeonsDB\leonsdb.yml
LeonsDB starts now, again at every boot and after a crash, and logs to
C:\LeonsDB\leonsdb.log. It shows in Services as LeonsDB.
4. Open the firewall (only for Minecraft servers on other machines)
netsh advfirewall firewall add rule name=LeonsDB dir=in action=allow protocol=TCP localport=7420,7422
5. Keep the admin token
Open C:\LeonsDB\data\initial-admin-token in Notepad, copy the token to a
password manager, then delete the file.
To remove LeonsDB later: leonsdb.exe service uninstall in an administrator
prompt. Your data, configuration and backups stay.
Docker
wget https://leonsdb.com/download/0.1.0/leonsdb-0.1.0-docker-amd64.tar.gz https://leonsdb.com/download/0.1.0/docker-compose.yml
docker load -i leonsdb-0.1.0-docker-amd64.tar.gz
mkdir tls # put fullchain.pem and privkey.pem here, then: sudo chown 65532 tls/*.pem
LEONSDB_VERSION=0.1.0 docker compose up -d
docker compose cp leonsdb:/data/initial-admin-token .
See With Docker.
Connect your Minecraft servers
1. Make a token for each server, on the LeonsDB machine (Ubuntu shown;
on Windows, set LEONSDB_TOKEN=<the admin token> and leonsdb.exe):
export LEONSDB_TOKEN=<the admin token>
leonsdb token create -name lobby-1 -role server
leonsdb token create -name survival -role server
leonsdb token create -name proxy -role proxy # only with a Velocity proxy
With TLS add -tls -addr db.example.com:7420. Each token is shown once.
2. Install the plugin on each Paper or Folia server: put
LeonsDB-Paper-0.1.0.jar (from the same download folder) in its plugins/
folder, start the server once, stop it, and set in
plugins/LeonsDB/config.yml:
server:
host: db.example.com # 127.0.0.1 on the same machine
port: 7420
tls: true # false on the same machine
token: "<this server's token>"
server-name: lobby-1 # the name the proxy uses for it in velocity.toml
3. With a Velocity proxy, put LeonsDB-Velocity-0.1.0.jar in the
proxy’s plugins/ folder and set the same server: section with the proxy
token. See Networks with a Velocity proxy.
Start the servers: their log says when the plugin is connected. Plugins
that store data in LeonsDB are written against its API; see
For plugin developers. To move existing data in
from MySQL, MongoDB, SQLite, H2 or YAML, run
java -jar leonsdb-import-0.1.0.jar for its options.
Schedule backups
LeonsDB makes a backup when asked, like mysqldump, so schedule one. On
Ubuntu, give backups a token of their own and add a cron job:
sudo LEONSDB_TOKEN=<the admin token> leonsdb token create -name backups -role admin -secret-file /etc/leonsdb/backup-token
sudo crontab -e
and add the line (with TLS, add -tls -addr db.example.com:7420):
0 */6 * * * LEONSDB_TOKEN_FILE=/etc/leonsdb/backup-token /usr/local/bin/leonsdb backup now >> /var/log/leonsdb-backup.log 2>&1
On Windows, in an administrator prompt (with the token made the same way,
into C:\LeonsDB\backup-token):
schtasks /create /tn "LeonsDB backup" /sc hourly /mo 6 /ru SYSTEM /tr "cmd /c set LEONSDB_TOKEN_FILE=C:\LeonsDB\backup-token&& C:\LeonsDB\leonsdb.exe backup now >> C:\LeonsDB\backup.log 2>&1"
Check now and then that a backup restores: leonsdb backup verify. See
Backups.
Check your download
Each version folder has SHA256SUMS, the checksum of every file. In the
folder with what you downloaded:
sha256sum -c --ignore-missing SHA256SUMS
On Windows: certutil -hashfile leonsdb-0.1.0-windows-amd64.zip SHA256, and
compare with the line in SHA256SUMS.
New versions: see Upgrading.