Air-gapped

Info

Requires Redis version 7.2 or later.

Info

To install Redis in an air-gapped environment, download the required packages on a preparation machine and then transfer them to the air-gapped server. The preparation machine should have internet access and run the same operating system version as the target server.

Prerequisites

Before installing the Redis service, ensure the following requirements are met.

Requirement

Description

Operating System

Debian 12+, Ubuntu 22.04+, Rocky Linux 9+, or RHEL 9+.

Privileges

root or sudo privileges on both the preparation machine and the air-gapped server.

Hardware

2 vCPU

32 GB RAM minimum.

Disk space

At least 50 GB of available storage.

Network access

Required port is open (default port: 6379).

A minimum network bandwidth of 1 Gbps is required.

A bandwidth of 5 Gbps or higher is strongly recommended for production deployments.

Offline Package Transfer

A USB drive or other secure transfer medium is required to move the packages to the air-gapped server.

Debian, Ubuntu

Prepare packages

  1. On the preparation machine, create file prepare_redis.sh with content:

#!/usr/bin/env bash
#
# Build an offline Redis install bundle for an air-gapped Ubuntu/Debian host.
#
# Dependency resolution: apt resolves the FULL closure as if nothing were
# installed (Dir::State::status -> an empty file), so the bundle is complete
# regardless of what's on this build host - the apt equivalent of dnf's
# --alldeps. The real system is never touched (download-only + throwaway status).

set -euo pipefail

# ---- configuration ---------------------------------------------------------
# Pin the UPSTREAM Redis version (e.g. 8.6.4) - REQUIRED.
# The full apt version string - epoch, Debian revision and the codename suffix
# like "~noble1" - is detected automatically from the repo for THIS release,
# so the same script works unchanged on jammy / bookworm / etc.
  1. Run commands.

chmod +x prepare_redis.sh
./prepare_redis.sh
  1. Copy the redis-offline folder to a USB drive or secure transfer medium.

  2. Move it to the air-gapped server.

Install Redis

  1. On the target server, insert the USB drive or secure transfer medium.

  2. Copy redis-offline folder to /opt/redis-offline . E.g:

sudo cp -r redis-offline /opt/redis-offline
  1. Run the commands below.

# Verify integrity:
cd /opt/redis-offline && sha256sum -c SHA256SUMS

# Register
echo "deb [trusted=yes] file:/opt/redis-offline ./" | sudo tee /etc/apt/sources.list.d/redis-offline.list

# Update using ONLY this source
sudo apt-get -o Dir::Etc::sourcelist="sources.list.d/redis-offline.list" -o Dir::Etc::sourceparts="/dev/null" update

# Install Redis.
sudo apt-get install -y redis-server redis-tools
sudo systemctl enable --now redis-server
  1. Access Redis configuration file /etc/redis/redis.conf for editing.

  2. Comment out the bind setting and set protected-mode option to no.

...
# The following line should be commented
# bind 127.0.0.1
...
# The following line should be uncommented and set to no
protected-mode no
...
  1. Restart Redis.

sudo systemctl restart redis-server
  1. Run the command with Redis CLI.

redis-cli ping
  1. Confirm that the response returned is PONG.

PONG

Rocky, RHEL

Prepare packages

  1. On the preparation machine, create file prepare_redis.sh with content:

#!/usr/bin/env bash
#
# Build an offline Redis install bundle for an air-gapped Rocky/RHEL host.
#
# Note: `dnf download --resolve --alldeps` pulls the FULL dependency closure
# regardless of what's installed on this build host, so a clean machine is NOT
# required for completeness. The cost is a larger bundle (it grabs base libs
# too). The local-repo install step below keeps that safe: on the target you
# `dnf install <name>` and dnf installs only what's missing - it will NOT
# force-downgrade your base system.

set -euo pipefail

# ---- configuration ---------------------------------------------------------
# Pin the UPSTREAM Redis version (e.g. 8.6.4). Leave empty for the latest.
# The release tag (".el9") and arch are filled in automatically for THIS host.
REDIS_VERSION="${REDIS_VERSION:-8.6.4}"
  1. Run commands.

chmod +x prepare_redis.sh
./prepare_redis.sh
  1. Copy the redis folder to a USB drive or secure transfer medium.

  2. Move it to the air-gapped server.

Install Redis

  1. On the target server, insert the USB drive or secure transfer medium.

  2. Copy redis-offline folder to /opt/redis-offline . E.g:

sudo cp -r redis-offline /opt/redis-offline
  1. Run the commands below.

# Verify integrity
cd /opt/redis-offline && sha256sum -c SHA256SUMS

# Install from the local folder as a temporary repo
sudo dnf install -y \
--disablerepo='*' \
--repofrompath=redisoffline,/opt/redis-offline \
--setopt=redisoffline.gpgcheck=0 \
redis
  1. Access Redis configuration file /etc/redis/redis.conf for editing.

  2. Comment out the bind setting and set protected-mode option to no.

...
# The following line should be commented
# bind 127.0.0.1
...
# The following line should be uncommented and set to no
protected-mode no
...
  1. Restart Redis.

sudo systemctl restart redis
  1. Run the command with Redis CLI.

redis-cli ping
  1. Confirm that the response returned is PONG.

PONG