Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pages/advanced-algorithms/install-mage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sudo apt-get update && sudo apt-get install -y \
git \
pkg-config \
uuid-dev \
libxmlsec1-dev xmlsec1 \
xmlsec1 \
--no-install-recommends
```

Expand All @@ -106,7 +106,7 @@ git clone --recurse-submodules https://github.com/memgraph/mage.git && cd mage

Download and install the [Memgraph Toolchain](https://memgraph.com/docs/getting-started/build-memgraph-from-source#toolchain-installation-procedure):
```bash
curl -L https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-amd64.tar.gz -o toolchain.tar.gz
curl -L https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-amd64.tar.gz -o toolchain.tar.gz
sudo tar xzvfm toolchain.tar.gz -C /opt
```

Expand All @@ -125,16 +125,16 @@ curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
python3 -m pip install -r python/requirements.txt
python3 -m pip install -r cpp/memgraph/src/auth/reference_modules/requirements.txt
python3 -m pip install torch-sparse torch-cluster torch-spline-conv torch-geometric torch-scatter -f https://data.pyg.org/whl/torch-2.3.0+cpu.html
python3 -m pip install dgl -f https://data.dgl.ai/wheels/torch-2.3/repo.html
python3 -m pip install torch-sparse torch-cluster torch-spline-conv torch-geometric torch-scatter -f https://data.pyg.org/whl/torch-2.6.0+cpu.html
python3 -m pip install dgl -f https://data.dgl.ai/wheels/torch-2.6/repo.html
```

{<h3 className="custom-header">Run the `setup` script</h3>}

Run the following command:

```shell
source /opt/toolchain-v6/activate
source /opt/toolchain-v7/activate
python3 setup build
sudo cp -r dist/* /usr/lib/memgraph/query_modules
```
Expand Down
220 changes: 144 additions & 76 deletions pages/getting-started/build-memgraph-from-source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ If you are using Mac M1 or above, please check our [MacOS Lima Compilation
Guide](https://www.notion.so/MacOS-Lima-Compilation-Guide-eae1e9dcef5740579c5a41075b8f499b?pvs=21)
first.

ARM build instructions are located at [Building Memgraph for ARM64
CPU](https://www.notion.so/Building-Memgraph-for-ARM64-CPU-a73d243c3c7c4daa94cb574ca8ff9516?pvs=21)
document.

</Callout>

## Obtaining the Source Code
Expand All @@ -44,16 +40,22 @@ git clone git@github.com:memgraph/memgraph.git

The above will create a `memgraph` directory and put all source code there.

## Downloading the dependencies

Before you can compile Memgraph, you first need to download its dependencies

In your terminal, position yourself in the obtained memgraph directory.

```bash
cd memgraph
```

There are three different methods for building Memgraph:

1. Using the `build.sh` script (Recommended)
2. Manually with `conan` and `cmake` (Advanced)
3. Docker (ideal for building on unsupported systems)

## Downloading the dependencies (required by methods 1 and 2)

Before you can compile Memgraph, you first need to download its dependencies.

Building Memgraph depends on some system-wide packages. The installation scripts
can be found under `environment/os/`. The directory contains a dependencies
management script for each supported operating system.
Expand All @@ -69,11 +71,11 @@ not necessary for the toolchain but are required by Memgraph.

<Callout>

Based on your OS, version and architecture, execute appropriate scripts (e.g., on **Debian 11**, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph/tree/master/environment/os):
Based on your OS, version and architecture, execute appropriate scripts (e.g., on **Debian 12**, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph/tree/master/environment/os):

```bash
sudo ./environment/os/debian-11.sh install TOOLCHAIN_RUN_DEPS
sudo ./environment/os/debian-11.sh install MEMGRAPH_BUILD_DEPS
sudo ./environment/os/debian-12.sh install TOOLCHAIN_RUN_DEPS
sudo ./environment/os/debian-12.sh install MEMGRAPH_BUILD_DEPS
```

For ARM look for `-arm` in the script name (e.g., on Ubuntu 24.04 with Apple M processor):
Expand All @@ -86,7 +88,7 @@ not necessary for the toolchain but are required by Memgraph.

Once everything is installed, you can proceed to the compilation.

## Compiling
## Toolchain installation procedure (required by methods 1 and 2)

Memgraph is compiled using our own custom toolchain that can be obtained from
the toolchain repository. All our tools used in the development of Memgraph are
Expand All @@ -106,20 +108,20 @@ You should read the
[Toolchain](https://www.notion.so/Toolchain-37c37c84382149a58d09b2ccfcb410d7?pvs=21)
to install the appropriate toolchain for your distribution.

### Toolchain installation procedure

Download the toolchain for your operating system from one of the following links:

- [CentOS 9](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-centos-9-x86_64.tar.gz)
- [CentOS 10](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-centos-10-x86_64.tar.gz)
- [Debian 11 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-11-amd64.tar.gz)
- [Debian 11 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-11-arm64.tar.gz)
- [Debian 12 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-12-amd64.tar.gz)
- [Debian 12 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-12-arm64.tar.gz)
- [Fedora 41 (x86_64)](https://s3.eu-west-1.amazonaws.com/download.memgraph.com/memgraph/v3.1.1/fedora-41/memgraph-3.1.1_1-1.x86_64.rpm)
- [Ubuntu 22.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-22.04-amd64.tar.gz)
- [Ubuntu 24.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-amd64.tar.gz)
- [Ubuntu 24.04 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-arm64.tar.gz)
- [CentOS 9](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-centos-9-x86_64.tar.gz)
- [CentOS 10](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-centos-10-x86_64.tar.gz)
- [Debian 11 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-12-amd64.tar.gz)
- [Debian 11 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-12-arm64.tar.gz)
- [Debian 12 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-13-amd64.tar.gz)
- [Debian 12 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-13-arm64.tar.gz)
- [Fedora 41 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-fedora-42-x86_64.tar.gz)
- [Fedora 41 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-fedora-42-aarch64.tar.gz)
- [Rocky Linux 10 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-rocky-10-x86_64.tar.gz)
- [Ubuntu 22.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-22.04-amd64.tar.gz)
- [Ubuntu 24.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-amd64.tar.gz)
- [Ubuntu 24.04 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-arm64.tar.gz)

Extract the toolchain with the following command:

Expand All @@ -130,98 +132,152 @@ sudo tar xzvfm {{toolchain-archive}}.tar.gz -C /opt
<Callout>

After you have installed the toolchain, you should read the instructions for the
toolchain in the toolchain install directory (`/opt/toolchain-v6/README.md`)
toolchain in the toolchain install directory (`/opt/toolchain-v7/README.md`)
and install dependencies that are necessary to run the toolchain.

</Callout>

If you have not already installed toolchain dependencies, please check and
install required toolchain runtime dependencies by executing

```bash
sudo ./environment/os/install_deps.sh check TOOLCHAIN_RUN_DEPS
sudo ./environment/os/install_deps.sh install TOOLCHAIN_RUN_DEPS
```
install required toolchain runtime dependencies as in the section above.

<Callout>

Based on your OS, version and architecture, execute appropriate scripts (e.g., on Debian 11, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph)):
If you put the toolchain on some other path, it’s possible to say to the `cmake`
the root is there, that is done by [setting `MG_TOOLCHAIN_ROOT` environment
variable](https://www.notion.so/If-you-put-toolchain-on-some-other-path-it-s-possible-to-say-to-the-cmake-there-the-root-is-that-s-e45311092e9a454eb73c720bf9ef04c1?pvs=21).

```bash
sudo ./environment/os/debian-11.sh check TOOLCHAIN_RUN_DEPS
sudo ./environment/os/debian-11.sh install TOOLCHAIN_RUN_DEPS
```

For ARM look for `-arm` in script name (e.g. on Ubuntu 24.04 with Apple M processor):

```bash
sudo ./environment/os/ubuntu-24.04-arm.sh check TOOLCHAIN_RUN_DEPS
sudo ./environment/os/ubuntu-24.04-arm.sh install TOOLCHAIN_RUN_DEPS
```
</Callout>
That’s also useful where you have different versions of libraries under system
compare to what the Memgraph build process needs.

</Callout>

## Using the `build.sh` script

When you want to compile Memgraph, you should activate the toolchain using the
prepared toolchain activation script that is also described in the toolchain
`README`.
This method should be the easiest way to build Memgraph directly on a compatible host system.

You must activate the toolchain every time you want to compile Memgraph:
Calling the script with no arguments will build everything, including tests, for the `Release` build type:

```bash
source /opt/toolchain-v6/activate
./build.sh
```

In case you need to deactivate the toolchain, you can run:
Optionally you can specify target and build types, e.g.

```bash
deactivate
./build.sh --target memgraph --build-type Debug
```

<Callout>
where the build type can be `Release` (default), `Debug` or `RelWithDebInfo`.

If you put the toolchain on some other path, it’s possible to say to the `cmake`
the root is there, that is done by [setting `MG_TOOLCHAIN_ROOT` environment
variable](https://www.notion.so/If-you-put-toolchain-on-some-other-path-it-s-possible-to-say-to-the-cmake-there-the-root-is-that-s-e45311092e9a454eb73c720bf9ef04c1?pvs=21).

That’s also useful where you have different versions of libraries under system
compare to what the Memgraph build process needs.
Other cmake options can be passed as well, e.g. to disable testing:

</Callout>
```bash
./build.sh --target memgraph --build-type Release -DMG_ENABLE_TESTING=OFF
```

The resulting binary will be in the `build/` directory.

## Using `conan` and `cmake`

## Installing Memgraph dependencies
This approach offers greater flexibility and granular control over the build process.
While it performs the same operations as the `build.sh` script, it gives you direct access
to configure individual build parameters and dependencies.

In addition to the system-wide dependencies, Memgraph requires certain libraries
to be built locally. The proper setup of these libraries should be checked by
running the `init` script:
To build Memgraph using this method, follow these steps:

1. Create a Python virtual environment and install `conan`:
```bash
python3 -m venv env
source env/bin/activate
pip install conan
conan profile detect
```

2. Run the init script to fetch other libs required for the build:
```bash
./init
```

<Callout>
3. Install conan dependencies:
```bash
export MG_TOOLCHAIN_ROOT=/opt/toolchain-v7
conan install . --build=missing -pr ./memgraph_template_profile -s build_type=Release
source build/generators/conanbuild.sh
```

Make sure to activate the toolchain before the `./init` command.
4. Configure the project with cmake - note that the name of the preset depends on the build type set in the previous step:
```bash
cmake --preset conan-release
```

5. Build the project (this will build everything, including tests):
```bash
cmake --build --preset conan-release -j$(nproc)
```

6. Or for a specific target (e.g. Memgraph binary):
```bash
cmake --build --preset conan-release --target memgraph -j$(nproc)
```

</Callout>

With all of the dependencies installed and the build environment set-up, you
need to configure the build system. To do that, execute the following:
## Using Docker

Start by setting the environment variables for the desired OS, architecture, and build type:

```bash
mkdir -p build
cd build
cmake ..
export OS="ubuntu-24.04"
export ARCH="amd" # or arm
export BUILD_TYPE="Release"
export TOOLCHAIN="v7"
```

If only Memgraph binary is required you can run build using:
Next, pull the appropriate Docker image for the build, e.g.:

```jsx
make -j$(nproc) memgraph
```bash
docker pull memgraph/mgbuild:v7_ubuntu-24.04
```

If you need to compile the whole project (e.g., unit tests) run:
Available image tags can be found [here](https://hub.docker.com/r/memgraph/mgbuild/tags).

Then spin up the container:

```bash
make -j$(nproc)
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os $OS \
--arch $ARCH \
--build-type $BUILD_TYPE \
run
```

Then build Memgraph:
```bash
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os $OS \
--arch $ARCH \
--build-type $BUILD_TYPE \
build-memgraph
```

Run Memgraph inside the container (the name of the container will look something like `mgbuild_v7_ubuntu-24.04`):
```bash
# find the name of the container
docker ps

# run Memgraph
docker exec -i mgbuild_v7_ubuntu-24.04 bash -c "cd /home/mg/memgraph && ./build/memgraph"
```

Stop the container:
```bash
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os $OS \
--arch $ARCH \
stop --remove
```

## Running Memgraph
Expand All @@ -232,8 +288,20 @@ After the compilation, verify that Memgraph works:
./memgraph --version
```

The unit tests can be run using
The unit tests can be run using:

```bash
ctest -R unit -j$(nproc)
```

Or in Docker:

```bash
./release/package/mgbuild.sh \
--toolchain $TOOLCHAIN \
--os $OS \
--arch $ARCH \
--enterprise-license $MEMGRAPH_ENTERPRISE_LICENSE \
--organization-name $MEMGRAPH_ORGANIZATION_NAME \
test-memgraph unit
```
2 changes: 1 addition & 1 deletion pages/getting-started/install-memgraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ installation options and pick the preferred one.
href="/getting-started/install-memgraph/wsl"
/>
<Cards.Card
title="[Discontinued] Rocky"
title="Rocky"
href="/getting-started/install-memgraph/rocky"

/>
Expand Down
2 changes: 1 addition & 1 deletion pages/getting-started/install-memgraph/debian.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CodeSnippet from '/components/code-snippet/CodeSnippet'

# Install Memgraph on Debian

Install and run Memgraph on Debian 11 or Debian 12.
Install and run Memgraph on Debian 12 or Debian 13.

<Callout type="warning">
Newer versions of Memgraph might not be backward
Expand Down
Loading