Installation guides

Installing Redis on RHEL

Step-by-Step Guide

  1. Update the Package Index
    Open a terminal and update the package index to ensure you have the latest information about available packages:
   sudo yum update -y
  1. Enable the EPEL Repository
    Redis is available in the EPEL (Extra Packages for Enterprise Linux) repository. Enable it using the following command:
   sudo yum install epel-release -y
  1. Install Redis
    Install Redis using the yum package manager:
   sudo yum install redis -y
  1. Start and Enable Redis
    Start the Redis service:
   sudo systemctl start redis

Enable Redis to start on boot:

   sudo systemctl enable redis
  1. Verify Redis Installation
    Check the Redis service status to ensure it is running:
   sudo systemctl status redis

If Redis is running, you should see an active (running) status.

  1. Test Redis Installation
    To test the Redis installation, use the Redis CLI to connect to the Redis server:
   redis-cli

Once connected, you can test Redis by setting and getting a key:

   SET mykey "Hello, Redis!"
   GET mykey

You should see the response “Hello, Redis!”.

  1. Secure Redis (Optional)
    For additional security, consider setting a password. Open the Redis configuration file for editing:
   sudo nano /etc/redis.conf

Uncomment the requirepass directive and set a strong password:

   requirepass your_password

Save and close the file. Restart Redis to apply the changes:

   sudo systemctl restart redis
  1. Enable Persistence (Optional)
    Redis supports two forms of persistence: RDB snapshots and AOF (Append Only File). To enable RDB snapshots, ensure the following lines are present in the Redis configuration file:
   save 900 1
   save 300 10
   save 60 10000

To enable AOF, uncomment and set the appendonly directive to yes:

   appendonly yes

Save and close the file. Restart Redis to apply the changes:

   sudo systemctl restart redis
  1. Configure Redis to Bind to Specific IP Address (Optional)
    By default, Redis listens on all available IP addresses. To restrict access, open the Redis configuration file:
   sudo nano /etc/redis.conf

Find the bind directive and set it to your server’s IP address:

   bind 127.0.0.1

Save and close the file. Restart Redis to apply the changes:

   sudo systemctl restart redis
  1. Monitor Redis
    You can monitor Redis performance and statistics using the redis-cli with the INFO command:
    bash redis-cli INFO
Other Recent Posts