Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing and Configuring Redis 7 on Linux

Tech Jun 29 2

Prerequisites: GCC Compiler Setup

Understanding GCC

GCC (GNU Compiler Collection) is the standard compiler suitee for Linux systems, supporting multiple programming languages including C, C++, Fortran, Java, and Ada. It can target various architectures such as x86, x86-64, PowerPC, SPARC, and ARM.

Before installing Redis, you need the C++ development environment:

yum -y install gcc-c++

Verify the installation:

gcc -v

Selecting a Redis Version

Check your current Redis version:

redis-server -v

Note: Due to security vulnerabilities in older versions, ensure you use version 6.0.8 or higher. This guide uses Redis 7.0.

Installation Steps for Redis 7

Step 1: Download the Package

Place the downloaded archive in the /opt directory:

wget https://download.redis.io/releases/redis-7.0.0.tar.gz

Step 2: Extract the Archive

tar -zxvf redis-7.0.0.tar.gz

Step 3: Build and Install

Navigate to the extracted directory and compile:

cd redis-7.0.0
make && make install

Step 4: Locate Installation Directory

The default binaries are installed in /usr/local/bin. Key executables include:

  • redis-server - Server startup command
  • redis-cli - Command-line client interface
  • redis-benchmark - Performance testing utility
  • redis-check-aof - AOF file repair tool
  • redis-check-dump - RDB file repair tool

Copy the default configuration to a custom location:

mkdir -p /myredis
cp /opt/redis-7.0.0/redis.conf /myredis/

Step 5: Configure Redis

Edit the configuration file in /myredis/redis.conf with these essential changes:

  • Change daemonize no to daemonize yes to run as a background service
  • Change protected-mode yes to protected-mode no for external connections
  • Comment out or modify bind 127.0.0.1 to allow remote access
  • Set a password with requirepass your_secure_password

Restart the service after making changes.

Step 6: Start the Server

redis-server /myredis/redis.conf

Step 7: Connect to Redis

Without password authentication:

redis-cli

With password:

redis-cli -a your_password -p 6379

To suppress security warnings:

redis-cli -a your_password 2>/dev/null

Step 8: Stop the Service

For single instance:

redis-cli -a your_password shutdown

For multiple instances (specify port):

redis-cli -p 6379 shutdown

Step 9: Uninstall Redis

First, stop the running service:

redis-cli -a your_password shutdown

Remove installed binaries:

ls -l /usr/local/bin/redis-*
rm -rf /usr/local/bin/redis-*

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.