How to know Redis is installed or not in WSL

How to Check if Redis is Installed on WSL (and How to Fix It)

If you're developing on Windows, using Redis inside Windows Subsystem for Linux (WSL) is the gold standard for performance. But sometimes, it’s hard to tell if you already have it set up or if the service is just sleeping.

Here is a quick guide to verifying your Redis installation and getting it running in seconds.


Phase 1: The "Quick Check"

Before digging into system logs, try these two commands to see if Redis is already in your path.

1. Check the Version

redis-server --version
  • Success: You’ll see Redis server v=7.x.x.

  • Failure: You’ll see command not found.

2. Locate the Binary

which redis-server

This tells you exactly where the executable lives (usually /usr/bin/redis-server). If it returns nothing, Redis likely isn't installed.


Phase 2: Verifying via Package Manager

If the commands above failed, it’s possible the package is there but not in your environment path. Check the dpkg database:

dpkg -l | grep redis

Look for the ii prefix, which indicates the package is "Installed/Installed."


Phase 3: Is the Service Actually Running?

Just because it's installed doesn't mean it's "alive." Use the Redis CLI to send a "heartbeat" to the server.

redis-cli ping
  • Expected Response: PONG

  • Error Response: Could not connect to Redis at 127.0.0.1:6379: Connection refused

If you get an error, check the service status:


sudo service redis-server status
# OR (if using systemd)
sudo systemctl status redis-server

Phase 4: How to Install (If you're starting fresh)

If you realized you don't have it yet, don't sweat it. Run these commands in your WSL terminal:

  1. Update your packages:


    sudo apt update
    
  2. Install the server:


    sudo apt install redis-server
    
  3. Start the service:


    sudo service redis-server start
    

Pro Tip: To make sure Redis starts every time you boot up your WSL instance, run: sudo systemctl enable redis-server


Final Verification

Run redis-cli ping one last time. If you see that glorious PONG, you’re ready to start caching!

Comments

Popular posts from this blog

How to enable Google Sheet in Google Cloud project

Finding Your Redis Credentials: Host, Port, and Password

Ways to install your own extension