Installation
| Method | When to use | What you get |
|---|---|---|
| RPM package | RHEL/AlmaLinux/Rocky Linux 9 or 10 hosts | Binaries in /usr/bin, an example configuration, a systemd unit, the mygramdb service user, and its data, dump, and log directories |
| DEB package | Ubuntu 22.04 or 24.04 hosts | The same layout as the RPM |
| Docker image | Evaluation and container platforms | A linux/amd64 and linux/arm64 image that runs as a non-root user |
| Build from source | Development or a custom build | Binaries 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.
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# x86_64
sudo apt install ./mygramdb_*_amd64.deb
# ARM64
sudo apt install ./mygramdb_*_arm64.debBoth packages install:
| Path | Contents |
|---|---|
/usr/bin/mygramdb | Server binary |
/usr/bin/mygram-cli | CLI client |
/etc/mygramdb/config.yaml.example | Configuration template |
mygramdb.service | systemd unit |
/var/lib/mygramdb, /var/lib/mygramdb/dumps, /var/log/mygramdb | Data, dump, and log directories owned by the mygramdb service user |
Create and edit the service configuration before starting it:
sudo cp /etc/mygramdb/config.yaml.example /etc/mygramdb/config.yaml
sudoedit /etc/mygramdb/config.yaml
sudo systemctl enable --now mygramdbDocker
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.
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| Tag | Points to |
|---|---|
ghcr.io/libraz/mygram-db:1.14.0 | This exact release |
ghcr.io/libraz/mygram-db:1.14 | The newest 1.14.x |
ghcr.io/libraz/mygram-db:1 | The newest 1.x |
ghcr.io/libraz/mygram-db:latest | The 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:
sudo dnf install -y gcc-c++ cmake git mysql-community-devel libicu-devel zlib-devel readline-develsudo apt-get update
sudo apt-get install -y pkg-config libmysqlclient-dev libicu-dev zlib1g-dev libreadline-dev cmake g++ gitbrew install cmake [email protected] icu4c readline pkg-configOn RHEL, AlmaLinux, and Rocky Linux, mysql-community-devel comes from the MySQL 8.4 repository set up in Install a Package.
Build
git clone https://github.com/libraz/mygram-db.git
cd mygram-db
makeThe 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:
make MYBINLOG_SOURCE_DIR=/path/to/libmybinlogInstall System-wide
sudo make installThe 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
sudo useradd -r -s /bin/false mygramdbSetup Directories
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/mygramdbEdit /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
sudo cp support/systemd/mygramdb.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now mygramdbCheck Status
sudo systemctl status mygramdb
sudo journalctl -u mygramdb -fCheck the Configuration
Validate the file before starting the service:
| Command | What it checks |
|---|---|
mygramdb -c /etc/mygramdb/config.yaml -t | The configuration and the files it references, without connecting to MySQL |
mygramdb -c /etc/mygramdb/config.yaml --check-source | The 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
mygramdb --help
mygram-cli --helpWhat 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
- Configuration - Configure your instance
- Query Guide - Learn the search syntax
- Docker Deployment
- Operations Guide
- Upgrade to v1.14