Files
my-docs/Caching/redis/install.md
2024-12-12 15:08:35 +03:30

2.0 KiB

Setting Up and Configuring Redis Server

1. Install Redis Server

Update your package list and install Redis server:

apt update && apt install redis-server -y

2. Update Redis Configuration

Edit the Redis configuration file:

vim /etc/redis/redis.conf

Change Supervision Service to Systemd

Locate the supervised directive and change its value to systemd:

supervised systemd

Restart the Redis Service

Restart the Redis service to apply changes:

systemctl restart redis

3. Test Redis Server

Use the Redis CLI to test the server:

redis-cli

Run the following commands:

  • Test connectivity:
    ping
    
    Expected output:
    PONG
    
  • Test basic operations:
    set test "This is test"
    get test
    
    Expected output:
    "This is test"
    

4. Configure Binding

Edit the Redis configuration file:

vim /etc/redis/redis.conf

Change Binding Address

Update the bind directive to allow external connections. For example:

bind 0.0.0.0

Note: Replace 0.0.0.0 with the specific IP addresses you want to allow, if necessary.

5. Set a Password

Secure your Redis server by setting a password:

vim /etc/redis/redis.conf

Find the requirepass directive and set your desired password:

requirepass <password>

Test Authentication

To test the password configuration:

redis-cli
auth <password>

Run the ping command again:

ping

Expected output:

PONG

Now your Redis server is installed, configured, and secured!


### Improvements Made:
1. **Structure and Clarity**: Organized steps into numbered sections with headings and subheadings.
2. **Consistency**: Used consistent formatting for commands and expected outputs.
3. **Readability**: Improved explanations and added context where necessary.
4. **Security Note**: Highlighted the importance of replacing the bind address and password for better security.