Skip to content

DEV: add build from source procedures #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 1, 2025
4 changes: 2 additions & 2 deletions content/operate/oss_and_stack/install/archive/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can install [Redis](https://redis.io/about/) or [Redis Stack](https://redis.

Here are the installation instructions:

* [Install Redis]({{< relref "/operate/oss_and_stack/install/install-redis" >}})
* [Install Redis Stack]({{< relref "/operate/oss_and_stack/install/install-stack" >}})
* [Install Redis]({{< relref "/operate/oss_and_stack/install/archive/install-redis" >}})
* [Install Redis Stack]({{< relref "/operate/oss_and_stack/install/archive/install-stack" >}})

While you can install Redis or Redis Stack locally, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free/?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users).
14 changes: 14 additions & 0 deletions content/operate/oss_and_stack/install/build-stack/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
categories:
- docs
- operate
- stack
- oss
description: Build and run Redis Open Source on Linux and macOS
linkTitle: Build and run Redis Open Source
stack: true
title: Build and run Redis Open Source
weight: 20
---

Build instructions are provided for the following platforms:
184 changes: 184 additions & 0 deletions content/operate/oss_and_stack/install/build-stack/almalinux-rocky-8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
categories:
- docs
- operate
- stack
- oss
linkTitle: AlmaLinux/Rocky 8.10
title: Build and run Redis Open Source on AlmaLinux/Rocky Linux 8.10
weight: 5
---

Follow the steps below to build and run Redis Open Source from its source code on a system running AlmaLinux and Rocky Linux 8.10.

{{< note >}}
Docker images used to produce these build notes:
- AlmaLinux:
- almalinux:8.10
- almalinux:8.10-minimal
- Rocky Linux:
- rockylinux/rockylinux:8.10
- rockylinux/rockylinux:8.10-minimal
{{< /note >}}

## 1. Prepare the system

{{< note >}}
For 8.10-minimal, you'll need to install `sudo` and `dnf` as follows:

```bash
microdnf install dnf sudo -y
```

For 8.10 (regular), you'll need to install `sudo` as follows:

```bash
dnf install sudo -y
```
{{< /note >}}

Clean the package metadata, enable required repositories, and install development tools:

```bash
sudo dnf clean all

# Add GoReleaser repo
sudo tee /etc/yum.repos.d/goreleaser.repo > /dev/null <<EOF
[goreleaser]
name=GoReleaser
baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0
EOF

sudo dnf update -y
sudo dnf groupinstall "Development Tools" -y
sudo dnf config-manager --set-enabled powertools
sudo dnf install -y epel-release
```

## 2. Install required packages

Install the build dependencies, Python 3.11, and supporting tools:

```bash
sudo dnf install -y --nobest --skip-broken \
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 \
curl \
libtool \
automake \
autoconf \
jq \
systemd-devel
```

Create a Python virtual environment:

```bash
python3.11 -m venv /opt/venv
```

Enable the GCC toolset:

```bash
sudo cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh
echo "source /etc/profile.d/gcc-toolset-13.sh" | sudo tee -a /etc/bashrc
```

## 3. Install CMake

Install CMake 3.25.1 manually:

```bash
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 and extract the Redis source

The Redis source code is available from the [Download](https://redis.io/downloads) page. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes git repository](https://github.com/redis/redis-hashes).

Copy the tar(1) file to `/usr/src`.

Extract the source:

```bash
cd /usr/src
tar xvf redis.tar.gz
rm redis.tar.gz
```

## 5. Build Redis

Enable the GCC toolset and build Redis with support for TLS and modules:

```bash
source /etc/profile.d/gcc-toolset-13.sh
cd /usr/src/redis

export BUILD_TLS=yes
export BUILD_WITH_MODULES=yes
export INSTALL_RUST_TOOLCHAIN=yes
export DISABLE_WERRORS=yes

make -j "$(nproc)" all
sudo make install
```

## 6. (Optional) Verify the installation

Check the installed Redis server and CLI versions:

```bash
redis-server --version
redis-cli --version
```

## 7. Start Redis

To start Redis, use the following command:

```bash
redis-server /path/to/redis.conf
```

To validate that the available modules have been installed, run the [`INFO`]{{< relref "/commands/info" >}} command and look for lines similar to the following:

```
redis-cli INFO
...
# Modules
module:name=ReJSON,ver=20803,api=1,filters=0,usedby=[search],using=[],options=[handle-io-errors]
module:name=search,ver=21005,api=1,filters=0,usedby=[],using=[ReJSON],options=[handle-io-errors]
module:name=bf,ver=20802,api=1,filters=0,usedby=[],using=[],options=[]
module:name=timeseries,ver=11202,api=1,filters=0,usedby=[],using=[],options=[handle-io-errors]
module:name=RedisCompat,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
module:name=vectorset,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
...
```
182 changes: 182 additions & 0 deletions content/operate/oss_and_stack/install/build-stack/almalinux-rocky-9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
---
categories:
- docs
- operate
- stack
- oss
linkTitle: AlmaLinux/Rocky 9.5
title: Build and run Redis Open Source on AlmaLinux/Rocky Linux 9.5
weight: 10
---

Follow the steps below to build and run Redis Open Source from its source code on a system running AlmaLinux and Rocky Linux 9.5.

{{< note >}}
Docker images used to produce these build notes:
- AlmaLinux:
- almalinux:9.5
- almalinux:9.5-minimal
- Rocky Linux:
- rockylinux/rockylinux:9.5
- rockylinux/rockylinux:9.5-minimal
{{< /note >}}

## 1. Prepare the system

{{< note >}}
For 9.5-minimal, you'll need to install `sudo` and `dnf` as follows:

```bash
microdnf install dnf sudo -y
```

For 9.5 (regular), you'll need to install `sudo` as follows:

```bash
dnf install sudo -y
```
{{< /note >}}

Enable the GoReleaser repository and install required packages:

```bash
sudo tee /etc/yum.repos.d/goreleaser.repo > /dev/null <<EOF
[goreleaser]
name=GoReleaser
baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0
EOF

sudo dnf clean all
sudo dnf makecache
sudo dnf update -y
```

## 2. Install required packages

Install build dependencies, GCC toolset, Python, and utilities:

```bash
sudo dnf install -y --nobest --skip-broken \
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 \
curl \
libtool \
automake \
autoconf \
jq \
systemd-devel
```

Create a Python virtual environment:

```bash
python3 -m venv /opt/venv
```

Enable the GCC toolset:

```bash
sudo cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh
echo "source /etc/profile.d/gcc-toolset-13.sh" | sudo tee -a /etc/bashrc
```

## 3. Install CMake

Install CMake version 3.25.1 manually:

```bash
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 and extract the Redis source

The Redis source code is available from the [Download](https://redis.io/downloads) page. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes git repository](https://github.com/redis/redis-hashes).

Copy the tar(1) file to `/usr/src`.

Extract the source:

```bash
cd /usr/src
tar xvf redis.tar.gz
rm redis.tar.gz
```

## 5. Build Redis

Enable the GCC toolset and compile Redis with TLS and module support:

```bash
source /etc/profile.d/gcc-toolset-13.sh
cd /usr/src/redis

export BUILD_TLS=yes
export BUILD_WITH_MODULES=yes
export INSTALL_RUST_TOOLCHAIN=yes
export DISABLE_WERRORS=yes

make -j "$(nproc)" all
sudo make install
```

## 6. (Optional) Verify the installation

Check that Redis was installed successfully:

```bash
redis-server --version
redis-cli --version
```

## 7. Start Redis

To start Redis, use the following command:

```bash
redis-server /path/to/redis.conf
```

To validate that the available modules have been installed, run the [`INFO`]{{< relref "/commands/info" >}} command and look for lines similar to the following:

```
redis-cli INFO
...
# Modules
module:name=ReJSON,ver=20803,api=1,filters=0,usedby=[search],using=[],options=[handle-io-errors]
module:name=search,ver=21005,api=1,filters=0,usedby=[],using=[ReJSON],options=[handle-io-errors]
module:name=bf,ver=20802,api=1,filters=0,usedby=[],using=[],options=[]
module:name=timeseries,ver=11202,api=1,filters=0,usedby=[],using=[],options=[handle-io-errors]
module:name=RedisCompat,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
module:name=vectorset,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
...
```
Loading