Databases 9 min read

How to Install and Configure Redis on AlmaLinux (Native & Docker) – Step‑by‑Step Guide

This guide explains why Redis is used as an in‑memory cache, its relationship to traditional databases, and provides detailed native and Docker‑Compose installation steps on AlmaLinux, plus instructions for connecting and managing Redis with DataGrip.

IT Xianyu
IT Xianyu
IT Xianyu
How to Install and Configure Redis on AlmaLinux (Native & Docker) – Step‑by‑Step Guide

Why Use Redis?

Redis acts as an in‑memory cache that stores frequently accessed, rarely changed data in RAM, making reads many times faster than hitting a traditional disk‑based database such as MySQL.

Relationship to Databases

Redis complements a database by relieving pressure and improving application response speed. It typically runs between the application server and the database; the app checks Redis first, falls back to the database, and writes the result back to Redis.

Component Placement

Redis runs as an independent service (process) on an AlmaLinux server, either directly on the host or inside a Docker container.

Prerequisites

An AlmaLinux 8/9 server.

A terminal capable of SSH (Xshell, PuTTY, or console).

DataGrip for GUI interaction.

Docker and Docker‑Compose (optional but recommended).

Method 1 – Native Installation on AlmaLinux

Install Redis

sudo dnf update -y
sudo dnf install epel-release -y
sudo dnf install redis -y

Configure a password

sudo vi /etc/redis/redis.conf
# Find the line "# requirepass foobared"
# Remove the leading "#" and replace "foobared" with a strong password, e.g.
requirepass MySuperSecretPassword123!

Start and enable the service

sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis   # should show "active (running)"

Test with redis‑cli

redis-cli
127.0.0.1:6379> auth MySuperSecretPassword123!
OK
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set itxianyu "hello world"
OK
127.0.0.1:6379> get itxianyu
"hello world"

Method 2 – Docker‑Compose Deployment

Ensure Docker and Docker‑Compose are installed on the AlmaLinux host.

Create docker-compose.yml

version: '3.8'
services:
  redis:
    image: redis:7.2-alpine
    container_name: my-redis-container
    restart: always
    ports:
      - "6379:6379"
    volumes:
      - ./redis-data:/data
    command: redis-server --requirepass "MySuperSecretDockerPassword123!"

Launch the container docker compose up -d Verify the container

docker ps               # should list my-redis-container
docker logs my-redis-container

Connecting with DataGrip

Add a new Redis data source.

Host: localhost (or the server IP).

Port: 6379.

Password: the password set in redis.conf or the Docker command.

Test the connection – a “Successful” message means you are ready.

Using DataGrip

Browse keys and values in the Database pane.

Open a console to run commands such as ping, get key, keys * (use with caution in production).

Right‑click a key to create, delete, or edit values; complex structures like hashes, lists, sets, and sorted sets are displayed graphically.

Next Steps

Study Redis data structures (String, Hash, List, Set, Sorted Set) and their use cases.

Learn common commands (SET, GET, HSET, HGET, LPUSH, LRANGE, SADD, SMEMBERS, ZADD, ZRANGE, etc.).

Configure persistence (RDB snapshots vs. AOF logs).

Explore high‑availability options: replication, Sentinel, and clustering.

Integrate Redis into your application code using client libraries for Python, Java, Go, etc.

DockerCachingInstallationAlmaLinuxDataGrip
IT Xianyu
Written by

IT Xianyu

We share common IT technologies (Java, Web, SQL, etc.) and practical applications of emerging software development techniques. New articles are posted daily. Follow IT Xianyu to stay ahead in tech. The IT Xianyu series is being regularly updated.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.