Skip to content

Installation ​

MethodWhen to useWhat you get
RPM packageRHEL/AlmaLinux/Rocky Linux 9 or 10 hostsBinaries in /usr/bin, an example configuration, a systemd unit, the mygramdb service user, and its data, dump, and log directories
DEB packageUbuntu 22.04 or 24.04 hostsThe same layout as the RPM
Docker imageEvaluation and container platformsA linux/amd64 and linux/arm64 image that runs as a non-root user
Build from sourceDevelopment or a custom buildBinaries under /usr/local by default; you create the service user, directories, and unit yourself

Install a Package ​

Download the package for your distribution and architecture from GitHub Releases: x86_64 or aarch64 RPMs for RHEL, AlmaLinux, and Rocky Linux 9/10, and amd64 or arm64 DEBs built for Ubuntu 22.04 (Jammy) or 24.04 (Noble).

The RPM needs the MySQL 8.4 client libraries (libmysqlclient.so.24). Install them from the MySQL repository, then install MygramDB with dnf, which resolves dependencies. rpm -i does not.

bash
sudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el$(rpm -E %rhel)-1.noarch.rpm
sudo dnf module disable -y mysql

# EL9 (RHEL/AlmaLinux/Rocky Linux 9) on x86_64
sudo dnf install -y ./mygramdb-*.el9.x86_64.rpm

# EL10 on aarch64
sudo dnf install -y ./mygramdb-*.el10.aarch64.rpm
bash
# x86_64
sudo apt install ./mygramdb_*_amd64.deb

# ARM64
sudo apt install ./mygramdb_*_arm64.deb

Both packages install:

PathContents
/usr/bin/mygramdbServer binary
/usr/bin/mygram-cliCLI client
/etc/mygramdb/config.yaml.exampleConfiguration template
mygramdb.servicesystemd unit
/var/lib/mygramdb, /var/lib/mygramdb/dumps, /var/log/mygramdbData, dump, and log directories owned by the mygramdb service user

Create and edit the service configuration before starting it:

bash
sudo cp /etc/mygramdb/config.yaml.example /etc/mygramdb/config.yaml
sudoedit /etc/mygramdb/config.yaml
sudo systemctl enable --now mygramdb

Docker ​

Prepare a config file before starting

For production use under Docker, mount a config file that contains the MySQL connection, replication settings, target tables, network.allow_cidrs, and api.admin_token.

The mounted config must set api.tcp.bind: 0.0.0.0 and, when HTTP is enabled, api.http.bind: 0.0.0.0 so the published ports can reach the container. Keep the loopback host mappings below and a restrictive CIDR allowlist. The allowlist must include 127.0.0.1/32 (and ::1/128 when localhost resolves over IPv6), because the image health check probes localhost from inside the container and the allowlist applies to health endpoints. Expose the service through a reverse proxy only after setting an admin token.

Starting the image does not load your existing data. Run SYNC <table> for that, or set replication.auto_initial_snapshot: true. A healthy container does not mean data is loaded; see Docker Deployment.

bash
docker pull ghcr.io/libraz/mygram-db:1.14.0

docker run -d \
  -p 127.0.0.1:11016:11016 \
  -p 127.0.0.1:8080:8080 \
  -v /path/to/config.yaml:/etc/mygramdb/config.yaml:ro \
  ghcr.io/libraz/mygram-db:1.14.0
TagPoints to
ghcr.io/libraz/mygram-db:1.14.0This exact release
ghcr.io/libraz/mygram-db:1.14The newest 1.14.x
ghcr.io/libraz/mygram-db:1The newest 1.x
ghcr.io/libraz/mygram-db:latestThe newest release

The image supports both linux/amd64 and linux/arm64, is based on Ubuntu 26.04, and runs as the mygramdb user (UID 1000).

Build from Source ​

Prerequisites ​

The build requires CMake 3.18 or later. Install the compiler and libraries for your platform:

bash
sudo dnf install -y gcc-c++ cmake git mysql-community-devel libicu-devel zlib-devel readline-devel
bash
sudo apt-get update
sudo apt-get install -y pkg-config libmysqlclient-dev libicu-dev zlib1g-dev libreadline-dev cmake g++ git
bash
brew install cmake [email protected] icu4c readline pkg-config

On RHEL, AlmaLinux, and Rocky Linux, mysql-community-devel comes from the MySQL 8.4 repository set up in Install a Package.

Build ​

bash
git clone https://github.com/libraz/mygram-db.git
cd mygram-db
make

The build fetches its pinned dependencies, including the binlog decoder libmybinlog, from GitHub. For an offline build, point MYBINLOG_SOURCE_DIR at a local libmybinlog checkout:

bash
make MYBINLOG_SOURCE_DIR=/path/to/libmybinlog

Install System-wide ​

bash
sudo make install

The prefix defaults to /usr/local; override it with make PREFIX=/opt/mygramdb install. The unit in support/systemd/mygramdb.service hard-codes /usr/local/bin/mygramdb, so edit ExecStart when you change the prefix.

Running as a Service ​

These steps apply to source builds; the packages already include the service user, directories, and unit.

Create User ​

bash
sudo useradd -r -s /bin/false mygramdb

Setup Directories ​

bash
sudo mkdir -p /etc/mygramdb /var/lib/mygramdb/dumps
sudo mkdir -p /var/log/mygramdb
sudo install -m 0640 -o root -g mygramdb examples/config.yaml /etc/mygramdb/config.yaml
sudo chown -R mygramdb:mygramdb /var/lib/mygramdb /var/log/mygramdb

Edit /etc/mygramdb/config.yaml with the source connection, searchable tables, and network allowlist before starting the service. The systemd unit writes logs to the journal by default; /var/log/mygramdb is available if logging.file is configured.

Install systemd Service ​

bash
sudo cp support/systemd/mygramdb.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now mygramdb

Check Status ​

bash
sudo systemctl status mygramdb
sudo journalctl -u mygramdb -f

Check the Configuration ​

Validate the file before starting the service:

CommandWhat it checks
mygramdb -c /etc/mygramdb/config.yaml -tThe configuration and the files it references, without connecting to MySQL
mygramdb -c /etc/mygramdb/config.yaml --check-sourceThe same, then connects once and runs the startup source and table checks

The binary exits with status 78 for configuration and source-requirement errors and 1 for other failures; see Command-Line Options. The units shipped in the packages and in support/systemd set RestartPreventExitStatus=78 so a configuration error stops the service instead of restarting it every 5 seconds. A hand-written unit that uses Restart=on-failure should add that line.

Verify Installation ​

bash
mygramdb --help
mygram-cli --help

What is still needed after installing

Installing the package or pulling the image does not load any searchable data. Configure the MySQL source requirements, the target tables, and the allowed network range, then run SYNC <table> once to build the index from existing rows, and wait for mygram-cli --wait-ready INFO before querying. See MySQL Replication for source settings and Getting Started for the full first-run path.

Security Note ​

DANGER

MygramDB refuses to run as root for security. Always run it as a dedicated non-privileged user.

Next Steps ​