Package Memgraph
This guide will show you how to package Memgraph for one of out supportedLinux distributions. There are two main ways to package Memgraph:
- Using the
mgbuild.shscript, which builds Memgraph in a Docker container. (Recommended) - Using CPack, which builds Memgraph using CMake.
The distributions of Linux currently supported by Memgraph are and their associated OS environment variable:
- CentOS 9:
centos-9 - CentOS 10:
centos-10 - Debian 12:
debian-12 - Debian 13:
debian-13 - Fedora 42:
fedora-42 - Rocky 10:
rocky-10 - Ubuntu 22.04:
ubuntu-22.04 - Ubuntu 24.04:
ubuntu-24.04
Using the mgbuild.sh script
The mgbuild.sh script is a convenience script that builds Memgraph in a Docker container. Prior to
packaging Memgraph, you need to build it first.
Using the same export environment variables as in the
build-memgraph-from-source guide, run the
mgbuild.sh script by running the following command to build a distro-specific package:
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os "$OS" \
--arch $ARCH \
--build-type $BUILD_TYPE \
package-memgraphThen it can be copied out of the container:
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os "$OS" \
--arch $ARCH \
copy \
--package \
--dest-dir outputStop the container:
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os "$OS" \
--arch $ARCH \
stop --removeNow, the package can be found in the output directory and it can be installed using apt or
dnf, depending on the distribution. For example, for Ubuntu 24.04:
sudo apt install ./output/memgraph_<version>_<arch>.debFor Ubuntu 24.04, the package can also be used to create a Docker image. To do this, we must first build a custom OpenSSL package:
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os "$OS" \
--arch $ARCH \
build-ssl \
--version "3.5.4"The following command will then create an Ubuntu-based Docker image:
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os "$OS" \
--arch $ARCH \
--build-type $BUILD_TYPE \
package-docker \
--src-dir output \
--dest-dir docker-outputresulting in a Docker image tarball in the docker-output directory. This can then be loaded
into Docker using the docker load command.
docker load -i docker-output/memgraph-<version>-docker.tar.gzThe image can then be run using the docker run command.
docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph:<version>Using CPack
After following the build instructions using
build.sh, or
conan and cmake, one can use
CPackto build a Memgraph package for a Linux distribution.
Prior to packaging, create the output directory:
mkdir -p build/output && cd build/outputActivate the toolchain:
source /opt/toolchain-v7/activateThen run the following commands to build the package, depending upon the distibution:
- For RPM-based distributions:
cpack -G RPM --config ../CPackConfig.cmake- For DEB-based distributions:
cpack -G DEB --config ../CPackConfig.cmakeOnce built, the packages can be installed using apt or dnf.