Build Redis from source

This section refers to building Redis from source. If you want to get up and running with Redis quickly without needing to build from source see the Getting started section.

Configuration files: the OS-specific sections below tell you to run ./src/redis-server redis-full.conf. redis-full.conf is the auto-generated launch config produced by make modules-update — it’s redis.conf plus the loadmodule lines and per-module settings for the bundled modules, appended after the core config. Edit Redis-core settings in redis.conf; the next make modules-update (or make sync-redis-conf) regenerates redis-full.conf. Release tarballs bake the module config directly into redis.conf during packaging, so from an extracted tarball you can also just run ./src/redis-server redis.conf. See modules/MODULES.md for the full config flow.

Build and run Redis with all data structures - Ubuntu 20.04 (Focal)

Tested with the following Docker image:

  • ubuntu:20.04
  1. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    apt-get update
    apt-get install -y sudo
    sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf gcc-10 g++-10 libtool
  2. Use GCC 10 as the default compiler

    Update the system’s default compiler to GCC 10:

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
  3. Install CMake

    Install CMake using pip3 and link it for system-wide access:

    pip3 install cmake==3.31.6
    sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
    cmake --version

    Note: CMake version 3.31.6 is the latest supported version. Newer versions cannot be used.

  4. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  6. Build Redis

    Set the necessary environment variables and compile Redis:

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  7. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - Ubuntu 22.04 (Jammy)

Tested with the following Docker image:

  • ubuntu:22.04
  1. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    apt-get update
    apt-get install -y sudo
    sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. Install CMake

    Install CMake using pip3 and link it for system-wide access:

    pip3 install cmake==3.31.6
    sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
    cmake --version

    Note: CMake version 3.31.6 is the latest supported version. Newer versions cannot be used.

  3. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  5. Build Redis

    Set the necessary environment variables and build Redis:

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  6. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - Ubuntu 24.04 (Noble)

Tested with the following Docker image:

  • ubuntu:24.04
  1. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    apt-get update
    apt-get install -y sudo
    sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  3. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  4. Build Redis

    Set the necessary environment variables and build Redis:

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  5. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - Ubuntu 26.04 (Resolute)

Tested with the following Docker image:

  • ubuntu:26.04

Note: Ubuntu 26.04 ships CMake 4.x and clang/LLVM 21 in the default repositories. The Redis modules build requires CMake ≤ 3.31.6 and explicitly passes -fuse-ld=lld, so a supported CMake must be pinned via pip3 and lld, llvm, and libcrypt-dev must be installed (the latter is needed to link the redisearch module against libcrypt).

  1. Install required dependencies

    Update your package lists and install the necessary development tools and libraries. lld and llvm are required because the modules build invokes clang with -fuse-ld=lld and uses llvm-ar; libcrypt-dev is required to link redisearch.so:

    apt-get update
    apt-get install -y sudo
    sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev libcrypt-dev make git python3 python3-pip python3-venv python3-dev unzip rsync clang lld llvm automake autoconf libtool
  2. Install CMake

    Install a supported version of CMake using pip3 (inside a virtual environment, as Ubuntu enforces PEP 668) and link it for system-wide access:

    python3 -m venv /opt/cmake-venv
    /opt/cmake-venv/bin/pip install cmake==3.31.6
    sudo ln -sf /opt/cmake-venv/bin/cmake /usr/local/bin/cmake
    cmake --version

    Note: CMake version 3.31.6 is the latest supported version. Newer versions cannot be used.

  3. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  5. Build Redis

    Set the necessary environment variables and build Redis:

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  6. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - Debian 12 (Bookworm) / 13 (Trixie)

Tested with the following Docker images:

  • debian:bookworm
  • debian:bookworm-slim
  • debian:trixie
  • debian:trixie-slim
  1. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    apt-get update
    apt-get install -y sudo
    sudo apt-get install -y --no-install-recommends ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool
  2. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  3. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  4. Build Redis

    Set the necessary environment variables and build Redis:

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  5. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - AlmaLinux 8.10 / Rocky Linux 8.10

Tested with the following Docker images:

  • almalinux:8.10
  • almalinux:8.10-minimal
  • rockylinux/rockylinux:8.10
  • rockylinux/rockylinux:8.10-minimal
  1. Prepare the system

    The steps below assume you are running as root, as in the tested container images. On AlmaLinux/Rocky 8.10-minimal, install dnf first:

    microdnf install dnf -y

    Enable the required repositories and install the base development tools:

    dnf groupinstall "Development Tools" -y
    dnf config-manager --set-enabled powertools
    dnf install -y epel-release
  2. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    dnf install -y pkg-config wget gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ git make openssl openssl-devel python3.11 python3.11-pip python3.11-devel unzip rsync clang libtool automake autoconf jq systemd-devel

    Enable the GCC toolset:

    cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh
    echo "source /etc/profile.d/gcc-toolset-13.sh" >> /etc/bashrc
  3. Install CMake

    Install CMake 3.25.1 manually:

    CMAKE_VERSION=3.25.1
    ARCH=$(uname -m)
    if [ "$ARCH" = "x86_64" ]; then
      CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-x86_64.sh
    else
      CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-aarch64.sh
    fi
    wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}
    chmod +x ${CMAKE_FILE}
    ./${CMAKE_FILE} --skip-license --prefix=/usr/local --exclude-subdir
    rm ${CMAKE_FILE}
    cmake --version
  4. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  6. Build Redis

    Enable the GCC toolset, set the necessary environment variables, and build Redis:

    source /etc/profile.d/gcc-toolset-13.sh
    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  7. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - AlmaLinux 9.7+ / Rocky Linux 9.7+

Tested with the following Docker images:

  • almalinux:9.7
  • almalinux:9.7-minimal
  • rockylinux/rockylinux:9.7
  • rockylinux/rockylinux:9.7-minimal
  1. Prepare the system

    The steps below assume you are running as root, as in the tested container images. On AlmaLinux/Rocky 9-minimal, install dnf first:

    microdnf install dnf -y

    Enable the required repositories (epel-release and CRB provide some of the -devel packages):

    dnf install -y epel-release
    dnf config-manager --set-enabled crb
  2. Install required dependencies

    Update your package lists and install the necessary development tools and libraries:

    dnf install -y pkg-config xz wget which gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ git make openssl openssl-devel python3 python3-pip python3-devel unzip rsync clang libtool automake autoconf jq systemd-devel

    Enable the GCC toolset:

    cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh
    echo "source /etc/profile.d/gcc-toolset-13.sh" >> /etc/bashrc
  3. Install CMake

    Install CMake 3.25.1 manually:

    CMAKE_VERSION=3.25.1
    ARCH=$(uname -m)
    if [ "$ARCH" = "x86_64" ]; then
      CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-x86_64.sh
    else
      CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-aarch64.sh
    fi
    wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}
    chmod +x ${CMAKE_FILE}
    ./${CMAKE_FILE} --skip-license --prefix=/usr/local --exclude-subdir
    rm ${CMAKE_FILE}
    cmake --version
  4. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  6. Build Redis

    Enable the GCC toolset, set the necessary environment variables, and build Redis:

    source /etc/profile.d/gcc-toolset-13.sh
    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    make -j "$(nproc)" all
  7. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - AlmaLinux 10.1+ / Rocky Linux 10.1+

Tested with the following Docker images:

  • almalinux:10.1
  • almalinux:10.1-minimal
  • rockylinux/rockylinux:10.1
  • rockylinux/rockylinux:10.1-minimal
  1. Prepare the system

    The steps below assume you are running as root, as in the tested container images. On AlmaLinux/Rocky 10-minimal, install dnf first:

    microdnf install dnf -y

    Enable the required repositories (epel-release and CRB provide some of the -devel packages):

    dnf install -y epel-release
    dnf config-manager --set-enabled crb
  2. Install required dependencies

    Install the necessary development tools and libraries. AlmaLinux/Rocky 10 ship GCC 14 and CMake 3.30 in the default repositories, which are supported by the Redis build, so no separate compiler/CMake toolset is required:

    dnf groupinstall "Development Tools" -y
    dnf install -y pkg-config xz wget which gcc gcc-c++ cmake git make openssl openssl-devel python3 python3-pip python3-devel unzip rsync clang lld llvm libtool automake autoconf jq systemd-devel

    On AlmaLinux/Rocky 10.1 the clang, lld, and llvm packages above are LLVM 21, which matches the LLVM version of the Rust toolchain that INSTALL_RUST_TOOLCHAIN=yes installs. RediSearch’s cross-language (C/Rust) LTO needs this match, and llvm provides the llvm-ar/llvm-ranlib archiver the LTO build uses, so no separate LLVM toolchain is required.

  3. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  4. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  5. Build Redis

    Set the necessary environment variables and build Redis. RediSearch builds with cross-language LTO (the default) because the clang/lld 21 installed in step 2 match the Rust toolchain’s LLVM. On AlmaLinux, IGNORE_MISSING_DEPS=1 bypasses the v8.7.91 dep-checker that does not yet recognize almalinux (fixed in redisearch v8.8.0; harmless on, and not required for, Rocky Linux 10):

    cd /usr/src/redis-<version>
    export BUILD_TLS=yes INSTALL_RUST_TOOLCHAIN=yes
    export IGNORE_MISSING_DEPS=1
    make modules-update
    make -j "$(nproc)" all
  6. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - Alpine 3.23+

Tested with the following Docker image:

  • alpine:3.23
  1. Install required dependencies

    apk update
    apk add --no-cache \
      build-base coreutils linux-headers bsd-compat-headers \
      openssl openssl-dev cmake bash git wget curl xz unzip tar rsync which \
      libtool automake autoconf libffi-dev libgcc ncurses-dev xsimd \
      cargo clang21 clang21-static clang21-libclang llvm21-dev lld21 \
      python3 py3-pip python3-dev

    Install the Python packages required by the RedisJSON module build:

    export PIP_BREAK_SYSTEM_PACKAGES=1
    pip install --upgrade setuptools pip
    pip install addict toml jinja2 ramp-packer
  2. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    mkdir -p /usr/src
    cd /usr/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  3. Extract the source archive

    cd /usr/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  4. Build Redis

    Set the necessary environment variables, apply the RedisJSON Rust-flags patch, and build Redis:

    cd /usr/src/redis-<version>
    
    export BUILD_TLS=yes
    export INSTALL_RUST_TOOLCHAIN=yes LTO=1
    export RUST_DYN_CRT=1
    export PATH="/usr/lib/llvm21/bin:$PATH"
    
    # Clone all bundled modules first — also satisfies the next step, which
    # needs RedisJSON's Makefile on disk before patching it.
    make modules-update
    
    # RedisJSON's bindgen must dlopen libclang.so; drop crt-static from its Rust flags.
    sed -i 's/^RUST_FLAGS=$/RUST_FLAGS += -C target-feature=-crt-static/' modules/redisjson/src/Makefile
    
    make -j "$(nproc)" all
  5. Run Redis

    cd /usr/src/redis-<version>
    ./src/redis-server redis-full.conf

Build and run Redis with all data structures - macOS 14 (Sonoma), 15 (Sequoia), 26 (Tahoe)

The following instructions apply to both Intel and Apple Silicon (ARM) Macs.

Note: Three RediSearch-specific build constraints apply on macOS and are handled in the steps below:

  • The cross-language LTO that RediSearch enables by default requires Linux; its build script aborts on macOS with Error: LTO is only supported on Linux. Step 6 sets LTO=0 to disable it.
  • RediSearch’s Rust workspace uses edition 2024 and features stabilized in Rust 1.94, so the Rust toolchain in step 3 is pinned to 1.94.0. Older Rust fails with feature edition2024 is required.
  • RediSearch’s CMake build calls libtool -static (BSD libtool syntax). Step 6’s PATH does not prepend $HOMEBREW_PREFIX/opt/libtool/libexec/gnubin, so macOS’s /usr/bin/libtool is used for that step.
  1. Install Homebrew

    If Homebrew is not already installed, follow the installation instructions on the Homebrew home page.

  2. Install required packages

    export HOMEBREW_NO_AUTO_UPDATE=1
    brew update
    brew install coreutils
    brew install make
    brew install openssl
    brew install llvm@18
    brew install cmake
    brew install gnu-sed
    brew install automake
    brew install libtool
    brew install wget
  3. Install Rust

    Rust is required to build the JSON package.

    RUST_INSTALLER=rust-1.94.0-$(if [ "$(uname -m)" = "arm64" ]; then echo "aarch64"; else echo "x86_64"; fi)-apple-darwin
    wget --quiet -O ${RUST_INSTALLER}.tar.xz https://static.rust-lang.org/dist/${RUST_INSTALLER}.tar.xz
    tar -xf ${RUST_INSTALLER}.tar.xz
    (cd ${RUST_INSTALLER} && sudo ./install.sh)
  4. Download the Redis source

    Download a specific version of the Redis source code archive from GitHub.

    Replace <version> with the Redis version, for example: 8.0.0.

    cd ~/src
    wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
  5. Extract the source archive

    Create a directory for the source code and extract the contents into it:

    cd ~/src
    tar xvf redis-<version>.tar.gz
    rm redis-<version>.tar.gz
  6. Build Redis

    cd ~/src/redis-<version>
    export HOMEBREW_PREFIX="$(brew --prefix)"
    export BUILD_TLS=yes
    export LTO=0
    PATH="$HOMEBREW_PREFIX/opt/libtool/libexec/gnubin:$HOMEBREW_PREFIX/opt/llvm@18/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
    export LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm@18/lib"
    export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/llvm@18/include"
    mkdir -p build_dir/etc
    make modules-update OS=macos
    make -j "$(nproc)" all OS=macos
    make install PREFIX=$(pwd)/build_dir OS=macos
  7. Run Redis

    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    build_dir/bin/redis-server redis-full.conf

Using the pre-built build-environment image (Docker)

The per-OS sections above build Redis natively — no Docker required. As an alternative, the repo ships docker/Dockerfile.noble (Ubuntu 24.04), a ready-made build environment that installs the base Redis build prerequisites and, for any modules already cloned into modules/<name>/src (run make modules-update first on a fresh checkout), their per-module system dependencies. You mount the repo at runtime and build inside the container:

# Native architecture only:
docker build -f docker/Dockerfile.noble -t redis-build:noble .

# Multi-arch (requires `docker buildx` configured):
docker buildx build --platform linux/amd64,linux/arm64 \
    -f docker/Dockerfile.noble -t redis-build:noble .

# Run with the working tree mounted:
docker run --rm -it -v "$PWD":/workspace -w /workspace redis-build:noble \
    bash -lc 'make && make run'

Building Redis - flags and general notes

Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures, and both 32 bit and 64-bit systems.

It may compile on Solaris derived systems (for instance SmartOS) but our support for this platform is best effort and Redis is not guaranteed to work as well as on Linux, OSX, and *BSD.

To build Redis with all the data structures (including JSON, time series, Bloom filter, cuckoo filter, count-min sketch, top-k, and t-digest) and with Redis Query Engine, make sure first that all the prerequisites are installed (see build instructions above, per operating system), then clone the bundled modules once and build:

make modules-update
make

make (same as make build / make all) always builds whatever’s cloned under modules/*/src alongside Redis core — there’s no separate flag to opt in. If nothing is cloned yet, you get a core-only build.

To build Redis with just the core data structures — even if modules are already cloned — use:

make build redis

To build with TLS support, you need OpenSSL development libraries (e.g. libssl-dev on Debian/Ubuntu) and the following flag in the make command:

make BUILD_TLS=yes

To build with systemd support, you need systemd development libraries (such as libsystemd-dev on Debian/Ubuntu or systemd-devel on CentOS), and the following flag:

make USE_SYSTEMD=yes

To append a suffix to Redis program names, add the following flag:

make PROG_SUFFIX="-alt"

You can build a 32 bit Redis binary using:

make 32bit

After building Redis, it is a good idea to test it using:

make test

If TLS is built, running the tests with TLS enabled (you will need tcl-tls installed):

./utils/gen-test-certs.sh
./runtest --tls

Fixing build problems with dependencies or cached build options

Redis has some dependencies which are included in the deps directory. make does not automatically rebuild dependencies even if something in the source code of dependencies changes.

When you update the source code with git pull or when code inside the dependencies tree is modified in any other way, make sure to use the following command in order to really clean everything and rebuild from scratch:

make distclean

This will clean: jemalloc, lua, hiredis, linenoise and other dependencies.

Also, if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, those options are cached indefinitely until you issue a make distclean command.

Fixing problems building 32 bit binaries

If after building Redis with a 32 bit target you need to rebuild it with a 64 bit target, or the other way around, you need to perform a make distclean in the root directory of the Redis distribution.

In case of build errors when trying to build a 32 bit binary of Redis, try the following steps:

  • Install the package libc6-dev-i386 (also try g++-multilib).
  • Try using the following command line instead of make 32bit: make CFLAGS="-m32 -march=native" LDFLAGS="-m32"

Allocator

Selecting a non-default memory allocator when building Redis is done by setting the MALLOC environment variable. Redis is compiled and linked against libc malloc by default, except for jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc.

To force compiling against libc malloc, use:

make MALLOC=libc

To compile against jemalloc on Mac OS X systems, use:

make MALLOC=jemalloc

Monotonic clock

By default, Redis will build using the POSIX clock_gettime function as the monotonic clock source. On most modern systems, the internal processor clock can be used to improve performance. Cautions can be found here: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/

On ARM aarch64 systems, the hardware clock is enabled by default because the ARM Generic Timer is architecturally guaranteed to be available and monotonic on all ARMv8-A processors (see the “The Generic Timer in AArch64 state” section of the Arm Architecture Reference Manual for Armv8-A).

To build with support for the processor’s internal instruction clock on other architectures, use:

make CFLAGS="-DUSE_PROCESSOR_CLOCK"

Verbose build

Redis will build with a user-friendly colorized output by default. If you want to see a more verbose output, use the following:

make V=1

Running Redis with TLS

Please consult the TLS.md file for more information on how to use Redis with TLS.

Running Redis with the Query Engine and optional proprietary Intel SVS-VAMANA optimisations

License Disclaimer If you are using Redis Open Source under AGPLv3 or SSPLv1, you cannot use it together with the Intel Optimizations (Leanvec and LVQ binaries). The reason is that the Intel SVS license is not compatible with those licenses. The Leanvec and LVQ techniques are closed source and are only available for use with Redis Open Source when distributed under the RSALv2 license. For more details, please refer to the information provided by Intel here.

By default, Redis with the Redis Query Engine supports SVS-VAMANA index with global 8-bit quantisation. To compile Redis with the Intel SVS-VAMANA optimisations, LeanVec and LVQ, use the following:

make BUILD_INTEL_SVS_OPT=yes

Alternatively, you can export the variable before running the build step for your platform:

export BUILD_INTEL_SVS_OPT=yes
make