Install Redis on Linux, Windows, Mac, or Docker
Install Redis with the right steps for APT, other Linux distros, or Docker, then verify the service and lock down your server before connecting apps.

tl;dr the short answer
Redis is an in-memory data store that keeps frequently used information in RAM for fast reads and writes, often serving as a cache, session store, or message broker. Install it with your operating system’s package manager or run it in Docker, then verify the service and live version; keep access limited to trusted networks, configure memory and persistence for your needs, and make backups. A successful install is only the start: safe access and sensible upkeep make Redis dependable.
Think of a sticky note on your monitor: you glance at it all day, so it’s the first thing you reach for. Redis plays that role for your apps.
It’s an in-memory data store, which means it keeps data in RAM (your computer’s fast short-term memory) for near-instant reads and writes.
Installing it is usually a single package command, but the steps around it are where things go sideways.
We’ll cover APT (Advanced Package Tool, the package manager on Debian and Ubuntu), other distros, and Docker, then verify, harden, and tackle the Fedora, Arch, and systemd quirks that generic guides skip.
What to Know Before You Install Redis
Before you install, we’ll cover what Redis is for, what you need, and where its license stands.
What Redis does and where it helps
Redis is an in-memory data store, so it keeps data in RAM (your working memory) for fast reads and writes. It’s built for speed over capacity, since RAM is quick but holds far less than a disk. That’s the trade-off.
Common roles include:
- A cache for slow-to-recompute results
- A database for data your app reads constantly
- A message broker for passing data between apps
- Real-time analytics and sessions
Think of a self-hoster with a web app on a spare mini computer. Redis keeps each login in memory, so pages stay snappy.
Admin access and what your system needs
Installing Redis changes system files, so check these first:
- Sudo rights. Sudo runs commands with admin rights, and without it the install fails.
- Basic command-line comfort. You’ll paste commands into a terminal.
- A supported operating system or version. Distros may ship older Redis builds.
- An internet connection. Packages come from online repositories.
License changes and whether self-hosting is free
Redis has used the Server Side Public License (SSPL) and the Redis Source Available License (RSAL). Redis’s own announcement says it decided in March 2024 to move Redis to SSPL.
With Redis 8, Redis added AGPLv3, the GNU Affero General Public License version 3, as an additional licensing option.
For your own projects and home servers, self-hosting Redis 8 under AGPLv3 is free. Offering it as a hosted service is another matter, so read the license text.
If the changes make you uneasy, look at Valkey, a fork (a copy of the code developed separately). Check its own docs first.
How Redis Stores Data and Common Patterns
Before we get to config, here’s what Redis holds and how it fits with your database.
The kinds of data Redis can hold
Redis stores typed values, so match the shape to how you’ll read the data:
- Strings hold a single value, like a cached HTML fragment.
- Hashes group field-value pairs under one key, like a user profile.
- Lists keep items in order, like a simple job queue.
- Sets hold unique, unordered members for fast membership checks.
- Sorted sets order members by a score, perfect for leaderboards.
- Bitmaps pack yes/no flags into bits, cheap for many IDs.
- HyperLogLog estimates unique counts with very little memory.
Pick the type for how you’ll read the data, not just what it is. Shape matters.
Using Redis alongside your main database
Picture a self-hoster whose blog front page runs a slow query on every visit. Caching that result means most visitors skip the database.
Redis suits caching (keeping copies of slow results) and sessions (remembering logins between page loads).
Keep your relational database (the tables-and-rows store behind most apps) as the source of truth. Copies in Redis are disposable, since the database can rebuild them.
The cache-aside pattern has your app do the copying:
- Check Redis for the value.
- On a hit, return it.
- On a miss, query the database, store the result, and return it.
Redis keeps data in memory, so durability is a dial you tune. Saving to disk more often costs speed, but saving less risks losing recent writes in a crash. Decide how much you can afford to lose.

Install Redis on Linux with APT
If you’re on Debian or Ubuntu, the cleanest route is Redis’s own repository, installed through APT (Advanced Package Tool, the package manager those distros use). You’ll get updates through the same tool you already use for everything else.
Get the tools and signing key ready
First, install the helpers:
- lsb-release reports your distro codename
- curl downloads the signing key
- gpg (GNU Privacy Guard, a signing tool) prepares it for APT
sudo apt-get install -y lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
The --dearmor flag converts the key from text into the binary keyring format APT reads. The chmod 644 makes sure APT can read the file itself.
Point APT at the official Redis repo
Next, tell APT where to look. The source entry points at packages.redis.io, and signed-by limits trust to packages signed with that keyring. The $(lsb_release -cs) piece swaps in your codename (like jammy or noble) so the line matches your release.
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
Writing to sources.list.d keeps Redis in its own file instead of your main sources list, so it’s easy to remove later.
Refresh package lists and install Redis
Update first so APT learns about the new repo, then install:
sudo apt-get update
sudo apt-get install redis
That pulls in redis-server, the server itself, and redis-tools, which includes redis-cli for talking to it by hand. You should land on an 8.x release, so confirm with redis-server --version.
Think of a homelab tinkerer who needs Redis for a self-hosted app before dinner. A quick redis-cli ping that answers PONG tells them the server is alive, and the evening’s project is back on track.
Changed your mind? Run sudo apt-get purge redis-server redis-tools, then delete /etc/apt/sources.list.d/redis.list and the keyring file. Purging also clears config files, so back up anything you want to keep first.
Other ways to install on Linux
Not every system runs APT, and each of these is a short setup:
- Red Hat and Rocky:
sudo yum install redis - Ubuntu with Snap: Snap packages are an option, but they carry a boot-start caveat, so confirm the server starts on its own after a reboot.
- Arch:
sudo pacman -S redis, orsudo pacman -S valkeyif you’d rather use Valkey, a community fork of Redis. - Fedora:
sudo dnf install redis
Your distro’s packaged copy can run behind the official release, which is why the Redis repo is worth the extra setup. Pick one path and stick with it.
Starting, Stopping, and Keeping Redis Running
Once Redis is installed, systemd (the service manager on most modern Linux distros) handles starting and stopping it. Here’s how we put it to work.
Control the service with systemctl
Redis runs as a background service, and systemctl controls it. These are the commands you’ll use most:
sudo systemctl enable redis-servermakes Redis start at every boot, so it comes up on its own.sudo systemctl start redis-serverandsudo systemctl stop redis-serveract right now.systemctl status redis-servershould showactive (running)in its output.
start only helps right now. enable is what keeps Redis running after a reboot. For example, a student running a ten-year-old ThinkPad as a dev box enables Redis once and never has to think about it again.
If Redis crashes, systemd can restart it automatically. Run sudo systemctl edit redis-server, add Restart=on-failure under [Service], save, then run sudo systemctl restart redis-server.
The service name depends on your distro: Debian and Ubuntu use redis-server, while Fedora and Arch use redis. If you get a ‘not found’ error, try the other one.

Where to find and edit the config
Redis reads its settings from redis.conf. On Debian and Ubuntu it lives at /etc/redis/redis.conf, though other distros may put it elsewhere.
Open it with sudo nano /etc/redis/redis.conf or your editor of choice. Say a self-hoster wants their homelab app on another machine to reach Redis. They change the bind line so it listens beyond localhost, then save. Only widen it if you need to. If nano feels clumsy, our Vscode install guide is the next stop toward a better editor.
Config changes don’t apply until Redis restarts, so run sudo systemctl restart redis-server after every save. That’s the whole loop: save, restart, check.
Checking That Redis Installed Correctly
Before you build anything on Redis, confirm the server is up and find out which version you’re actually running. Wondering whether there’s a GUI for Redis? You don’t need one, since every check here runs in a terminal.
A graphical client for browsing keys is an optional add-on you can explore later.
Test the server with a redis-cli ping
Picture a Fedora user who installed Redis for a side project and wants proof it works before wiring it into their app. The quickest test uses redis-cli, the command-line client that comes with Redis:
- Launch
redis-cliin a terminal. - Type
pingand press Enter. - Expect a
PONGresponse.
By default, redis-cli talks to port 6379, so a PONG means the server is listening there. That’s the difference between Redis being running and Redis merely being installed. If you get an error instead, the server isn’t listening yet.
Start it first, and save the reinstall for later.
Find out which Redis version you have
Consider an Arch user who just upgraded and wants to know whether the new version is actually serving requests. Three checks answer that, and each one reports something different:
redis-server --versionshows the server binary on disk.redis-cli --versionshows the client tool.INFO server, run inside redis-cli, shows the live version: the version of the server that’s actually running.
The first two report what’s installed. The third reports what’s running, and the two can differ after an upgrade if the running server was never restarted. When they don’t match, restart Redis and check again. Trust the live version.
Keep Your Redis Server Locked Down
Your Redis server should answer only the people and programs you trust, so lock the network first, then the logins.
Stop outside access to your Redis port
It’s less about whether Redis runs and more about where it can be reached. Bind it to localhost or a private IP with the bind setting in redis.conf:
bind 127.0.0.1 -::1
Keep protected mode on, too. It refuses outside connections when no password or bind address is set.
Don’t expose port 6379 to the public internet. According to an Imperva spokesperson, most Redis servers left open without authentication are likely hosting malware.
Picture a Linux user who spins up Redis on a cheap cloud VM and skips the bind line. A quick check with ss, the socket statistics tool, takes seconds:
sudo ss -tlnp | grep 6379
A 0.0.0.0:6379 or [::]:6379 line means every interface is listening. You want only localhost or your private address.
Require passwords and restrict risky commands
- requirepass: Set it in redis.conf to a long, unique password. Clients must send it before Redis runs their commands.
- Named users: For multiple users, ACLs (access control lists) give each account its own password and command limits.
ACL SETUSER reader on >a-long-password ~* +@readcreates a read-only user. - Risky commands: Rename them to an empty string to disable them.
rename-command FLUSHALL ""makes FLUSHALL unusable.
If requirepass lives in redis.conf, anyone who can read that file can read the password.
Lock it with sudo chown redis:redis /etc/redis/redis.conf and sudo chmod 640 /etc/redis/redis.conf (your path may differ) so other users can’t read it. Then check your work.
Set up Redis After It Is Installed
Installing Redis only starts the server. Once it’s running, we’ll tune what survives a restart, what gets dropped under memory pressure, and what happens when a server dies.
Saving data so it survives restarts
Redis holds data in memory by default, so a restart wipes it unless it writes to disk. The default is RDB snapshots, periodic dumps saved to dump.rdb. For less loss, enable AOF (append-only file) with appendonly yes, then choose an appendfsync mode:
always: safest, but slowest.everysec: the default, risking about a second of writes.no: fastest, but leaves flushing to the operating system.
Current releases default to a hybrid RDB preamble, so AOF files start with a snapshot and reload quickly.

Capping memory and choosing what to drop
maxmemory is unlimited by default, so Redis grows until the machine runs out of RAM. Cap it, like maxmemory 512mb, and pick an eviction policy for when it fills:
noeviction(the default): new writes fail with an error, but reads still work.allkeys-lru: evicts the least recently used key from everything stored.
For a cache, you want Redis to forget cold keys, so allkeys-lru is the usual pick. For sessions or job queues, keep noeviction. Picture a homelabber whose dashboard keeps logins in Redis.
A full server should throw an error they can fix, not quietly log everyone out. A loud error is fixable. A silent eviction isn’t.
Watching performance and making backups
redis-cli --stat shows live keys, memory, and clients, and redis-cli --latency measures response time. Run both under load, since an idle server looks fine.
BGSAVE writes a snapshot in the background without pausing the server. Copy dump.rdb offsite, to another machine or a storage bucket, because a backup on the same disk dies with the disk.
Keeping replica copies for failover
One Redis node is a single point of failure. A replica copies the primary’s data once you point it there with replicaof <primary-ip> 6379 in redis.conf (older guides say slaveof).
Manual failover means running REPLICAOF NO ONE on the replica when the primary dies, then pointing your apps at it. That’s fine if you’re around to pull the trigger.
Redis Sentinel handles automatic failover, but the complexity is real: it needs a quorum of Sentinel processes (usually three) and Sentinel-aware clients, and writes not yet copied to the replica can be lost during a switch.
A replica is a live copy, not a backup.
Managed hosting compared with running it yourself
Self-hosting looks cheap until you add up the server, patching, monitoring, and the 3am restore.
A KanyaRakshak paper on a real-time personal safety system describes its stack as using managed Upstash Redis, so you hand the upkeep to someone else.
Pricing is tiered, so compare the tier you’d need against a server and your own time. Check whether failover is included in that tier rather than assuming it’s there.
Redis on Windows, Mac, and Docker
Not on Linux? You’ve got three routes, and each one has its own quirks. Here’s how we’ll handle them.
Running Redis on Windows with WSL2
Redis isn’t officially supported natively on Windows, so you’ll run it inside the Windows Subsystem for Linux (WSL2), which gives you a real Linux environment on your PC. You’ll need WSL2 enabled with an Ubuntu distro installed.
Then follow the Ubuntu steps in this guide and start the server with service redis-server start.
Think of a tmux tinkerer with a Windows work laptop and a home Linux box. WSL2 lets them reuse the same Ubuntu commands, so the laptop matches the setup they already know.
Installing on a Mac with Homebrew
Homebrew is a package manager for macOS, so start there. Then work through these steps:
- Install Homebrew first, if it isn’t already on your Mac.
- Run
brew install redis. - Run
brew services start redisto keep Redis running in the background. - Or skip the service and start it by hand with
redis-server.
Pick the service if you want Redis running in the background, or start it by hand if you only need it for one session.
Running Redis in Docker and Compose
Whether you start the container directly or from a Compose file, these settings matter:
- Official image: use
redis:8, the official Redis 8 image. - Data volume: mount one at
/dataso your data outlives the container. - Custom config: mount your own
redis.confto set your options. - Localhost-only ports: publish to
127.0.0.1so only your machine can reach it. - Restart policy: set one so the container comes back up on its own.
Set it once. Then forget it.
Installing Redis is the easy part, and you now have a clean path on Linux whether you use APT, another distro’s package manager, or Docker. Verifying the install and hardening the server are what keep it dependable day to day.
Keep the Fedora, Arch, and systemd notes handy, since those are where a fresh install most often trips people up. Fast data only helps when it’s safe, so give the lockdown steps the time they deserve.
References
Questions
What is a Redis server for?
Redis is an in-memory data store that apps use for fast reads and writes. Common uses include caching, storing frequently accessed data, managing sessions, passing messages between services, and real-time analytics.
How do I install Redis on my Mac?
Install Homebrew if needed, then open Terminal and run `brew install redis`. To run Redis in the background, use `brew services start redis`; to start it only for the current session, run `redis-server`.
Is Redis faster than RAM?
No. Redis stores data in RAM, which is much faster to access than disk storage, but Redis itself cannot be faster than the RAM it uses. Its speed comes from keeping data in memory rather than fetching it from disk.
Is there a GUI for Redis?
Yes. Redis has graphical clients that let you browse and manage keys, but a GUI is optional. You can also check and interact with Redis from the terminal using `redis-cli`.


