How to install & configure Redis 6 on OpenSUSE Leap 15.3

Pinterest LinkedIn Tumblr

Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.

In this tutorial we are going to learn how to install Redis 6 on OpenSUSE Leap 15.3.

Related Content


To follow along, ensure that you have:

  • An updated OpenSUSE Leap server
  • Access to the Internet
  • Root access to the server or user with sudo access

Table of Content

  1. Update the OpenSUSE Leap server
  2. Installing Redis
  3. Configuring Redis
  4. Connecting and performing basic operations in Redis
  5. Performing Redis Benchmark

1. Update the OpenSUSE Leap Server

Before proceeding, ensure that the server is updated. We will refresh the repositories then update using this commands:

sudo zypper ref
sudo zypper up -y

Let us also ensure vim is installed using this command since we will use it later:

sudo zypper in -y vim

2. Installing redis

Redis 6 is available in the default OpenSUSE Leap Servers. But it is not the latest version. To get the latest version, add the Databases repo using this command:

sudo curl -L -o /etc/zypp/repos.d/server-database.repo

Confirm the content of the repo using the cat command:

~> cat /etc/zypp/repos.d/server-database.repo
name=Databases (openSUSE_Leap_15.3)

Then refresh the repos using this commannd:

sudo zypper ref

Now install redis:

~> sudo zypper in redis
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:

1 new package to install.
Overall download size: 1.1 MiB. Already cached: 0 B. After the operation, additional 4.3 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package redis-6.2.6-lp153.178.3.x86_64                                                                     (1/1),   1.1 MiB (  4.3 MiB unpacked)
Retrieving: redis-6.2.6-lp153.178.3.x86_64.rpm ......................................................................................................[done]

Checking for file conflicts: ........................................................................................................................[done]
(1/1) Installing: redis-6.2.6-lp153.178.3.x86_64 ....................................................................................................[done]
Additional rpm output:
useradd -r -s /sbin/nologin -c "User for redis key-value store" -g redis -d /var/lib/redis redis
See /usr/share/doc/packages/redis/README.SUSE to continue

Use this command to confirm the redis package installed:

~> zypper info redis
Loading repository data...
Reading installed packages...

Information for package redis:
Repository     : Databases (openSUSE_Leap_15.3)
Name           : redis
Version        : 6.2.6-lp153.178.3
Arch           : x86_64
Vendor         : obs://
Installed Size : 4.3 MiB
Installed      : Yes
Status         : up-to-date
Source package : redis-6.2.6-lp153.178.3.src
Summary        : Persistent key-value database
Description    :
    redis is an advanced key-value store. It is similar to memcached but the dataset
    is not volatile, and values can be strings, exactly like in memcached,
    but also lists, sets, and ordered sets. All this data types can be manipulated
    with atomic operations to push/pop elements, add/remove elements, perform server
    side union, intersection, difference between sets, and so forth. Redis supports
    different kind of sorting abilities.

Upon installation, I noticed that no systemd service was not added for managing the redis. Let us create a systemd file in this path /etc/systemd/system/redis.service using this command:

sudo vim /etc/systemd/system/redis.service

The add this content to the file:

Description=Redis In-Memory Data Store

ExecStart=/usr/sbin/redis-server /etc/redis/redis.conf
ExecStop=/usr/bin/redis-cli shutdown


Create the specified config file /etc/redis/redis.conf by copying the sample file:

sudo cp /etc/redis/default.conf.example /etc/redis/redis.conf

Finally, update the file permission:

sudo chown redis.redis /etc/redis/redis.conf

Now that the service file has been created, let’s start it with this command:

sudo systemctl start redis

Enable the service so it starts on boot:

$ sudo systemctl enable redis
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/redis.service.

After the service starts, use this command to check the status of the service:

~> sudo systemctl status redis
● redis.service - Redis In-Memory Data Store
     Loaded: loaded (/etc/systemd/system/redis.service; disabled; vendor preset: disabled)
     Active: active (running) since Mon 2021-11-01 07:28:53 UTC; 2min 21s ago
   Main PID: 4377 (redis-server)
      Tasks: 5 (limit: 4587)
     CGroup: /system.slice/redis.service
             └─4377 /usr/sbin/redis-server

Nov 01 07:28:53 ip-10-2-40-60 systemd[1]: Started Redis In-Memory Data Store.

The Active: active (running) means that the service has been started successfully.

3. Configuring Redis

The redis configuration file is located in this path /etc/redis/redis.conf. In this section, we are going to update the redis configuration file to allow remote access, to set an authentication password, to add a pid file and to Set Persistent Store for Recovery.

Edit redis config file using this:

sudo vim /etc/redis/redis.conf

To allow remote access to the redis instance, bind redis to using this line:

bind * -::*

To set password in redis, use this:

requirepass j2GfJuLFR8

To add a pid file to redis:

pidfile /var/run/redis/

Set Persistent Store for Recovery by changing the appendonlyvalue to yes

appendonly yes
appendfilename "appendonly.aof"

Restart redis service to apply changes:

sudo systemctl restart redis

4. Connecting and performing basic operations in Redis

If you have an active firewalld service, allow port 6379

sudo firewall-cmd --add-port=6379/tcp --permanent
sudo firewall-cmd --reload

Connecting to redis locally:

$ redis-cli

To authenticate:> auth j2GfJuLFR8

You should receive OK in the output. If you input a wrong password, Authentication should fail.

Check redis information.> INFO

This will output a long list of data. You can limit the output by passing Section as an argument. E.g.> INFO Server
# Server
os:Linux 5.3.18-59.27-default x86_64

5. Performing Redis Benchmarking

Run the benchmark with 15 parallel connections, for a total of 10k requests, against local redis to test its performance.

~> redis-benchmark -h -p 6379 -n 10000 -c 15 -a j2GfJuLFR8
====== PING_INLINE ======
  10000 requests completed in 0.18 seconds
  15 parallel clients
  3 bytes payload
  keep alive: 1
  host configuration "save": 3600 1 300 100 60 10000
  host configuration "appendonly": no
  multi-thread: no

Latency by percentile distribution:
0.000% <= 0.039 milliseconds (cumulative count 1)
50.000% <= 0.111 milliseconds (cumulative count 6640)
75.000% <= 0.119 milliseconds (cumulative count 7573)
87.500% <= 0.183 milliseconds (cumulative count 8767)
93.750% <= 0.255 milliseconds (cumulative count 9439)
96.875% <= 0.383 milliseconds (cumulative count 9705)
98.438% <= 0.607 milliseconds (cumulative count 9847)
99.219% <= 0.887 milliseconds (cumulative count 9923)
99.609% <= 1.047 milliseconds (cumulative count 9963)
99.805% <= 1.231 milliseconds (cumulative count 9981)
99.902% <= 1.991 milliseconds (cumulative count 9991)
99.951% <= 3.095 milliseconds (cumulative count 9999)
99.994% <= 3.103 milliseconds (cumulative count 10000)
100.000% <= 3.103 milliseconds (cumulative count 10000)

Cumulative distribution of latencies:
40.480% <= 0.103 milliseconds (cumulative count 4048)
91.360% <= 0.207 milliseconds (cumulative count 9136)
95.620% <= 0.303 milliseconds (cumulative count 9562)
97.280% <= 0.407 milliseconds (cumulative count 9728)


99.970% <= 0.503 milliseconds (cumulative count 9997)
100.000% <= 0.607 milliseconds (cumulative count 10000)

  throughput summary: 75187.97 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
        0.173     0.064     0.167     0.239     0.295     0.583

For more options and examples, use:

$ redis-benchmark --help


We have managed to install and configure Redis 6 in OpenSUSE Leap.

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment