What is Redis, Why Do You Need It, and How to Install It on Ubuntu Server?

Giteqa

Greetings, friends!

Data access speed plays a pivotal role in the high performance of modern web applications. Under heavy workloads, traditional relational databases (PostgreSQL, MySQL) often encounter disk input/output (I/O) bottlenecks.

To solve this challenge, engineers rely on Redis (Remote Dictionary Server)—an ultra-fast, high-performance NoSQL in-memory data store. In this article, we will examine how Redis works, explore its primary use cases, and walk step-by-step through installing the service on a Linux VPS.

Key Takeaways: Core Conclusions

  • Sub-millisecond Speed: Storing data directly in system RAM delivers sub-millisecond (< 1 ms) response times and the ability to process hundreds of thousands of operations per second.

  • Rich Data Structures: Unlike basic key-value engines such as Memcached, Redis supports complex data structures: strings, lists, sets, sorted sets, hashes, geospatial indexes, and streams.

  • Disk Persistence: Despite operating in memory, Redis supports asynchronous persistence to disk (RDB snapshots and AOF logs) to protect against data loss during server reboots.

How to Install Redis on an Ubuntu Server

We have recorded a step-by-step video guide demonstrating how to install Redis on your Ubuntu server, covering Ubuntu 24.04 and Ubuntu 26.04:

Commands for Installing Redis on Ubuntu:

Bash
sudo apt install -y docker.io docker-compose-v2
sudo systemctl enable --now docker
docker pull redis:latest
mkdir -p /var/lib/redis_data
docker run -d \
  --name redis-server \
  --restart always \
  -p 6379:6379 \
  -v /var/lib/redis_data:/data \
  redis:latest redis-server --requirepass "YourStrongPasswordHere" --protected-mode no
sudo ufw allow 6379/tcp
sudo ufw reload
sudo apt install redis-tools -y

redis-cli -h YOUR_SERVER_IP -p 6379 -a "YourStrongPasswordHere" ping

docker rm -f redis-server
mkdir redis-stack && cd redis-stack
nano docker-compose.yml

docker-compose.yml Configuration:

YAML
version: '3.8'

services:
  redis:
    image: redis:latest
    container_name: redis-server
    restart: always
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    command: redis-server --requirepass "YourStrongPasswordHere" --protected-mode no

  redisinsight:
    image: redis/redisinsight:latest
    container_name: redis-insight
    restart: always
    ports:
      - "5540:5540"
    volumes:
      - redisinsight_data:/data

volumes:
  redis_data:
  redisinsight_data:
Bash
docker compose up -d

Access the web interface at: http://SERVER_IP:5540

These commands provide everything required to complete the installation.

Working purely in the CLI can be inconvenient for some developers; therefore, Redis Insight offers a browser-based GUI to inspect and manage your key-value store directly. Our video walks through this process in detail.

What Makes Redis a Fundamental Development Tool?

Redis handles a broad array of backend engineering tasks thanks to its versatile architecture:

  1. Caching: Caches complex SQL queries, HTML fragments, and API objects to offload pressure from your primary database.

  2. Session Storage: Serves as a centralized, fast session store for user sessions across distributed web application clusters.

  3. Message Broker & Queues (Pub/Sub & Queues): Implements Publish/Subscribe patterns and message lists for background job processing (Celery, BullMQ, Laravel Queues).

  4. Counters & Rate Limiting: Manages view counters, likes, or rate limits for API endpoints based on client IP addresses using key Time-To-Live (TTL) mechanisms.

FAQ: Frequently Asked Questions

  • How does Redis differ from Memcached? Memcached is a simple distributed key-string memory cache that operates purely in RAM without native disk persistence. Redis supports rich data structures, replication, disk snapshots, transactions, and Lua scripting.

  • What happens to data in Redis when the server reboots? If persistence is enabled (RDB snapshots or AOF logs, which are enabled by default in most distributions), Redis automatically restores its state from disk into RAM upon startup.

  • How much RAM is required to run Redis? Memory consumption depends on your dataset size. For handling web sessions and basic page caching, 256–512 MB of RAM is often sufficient. For high-throughput systems storing millions of keys, memory requirements should be sized according to object dimensions.

Conclusion

Redis is an indispensable component of the modern backend stack, capable of accelerating web applications, shielding relational databases, and orchestrating rapid message passing.

Because Redis holds active datasets in RAM while routinely persisting dumps to storage, consistent CPU clock speeds, fast system RAM, and low disk I/O latency are critical server requirements.

If you are looking for a high-performance hosting platform to deploy Redis, microservices, or databases, explore NVMe Cloud VPS options from MivoCloud. Our infrastructure—built on pure KVM virtualization, guaranteed CPU/RAM allocations, and ultra-fast Enterprise NVMe storage—delivers minimal latency and 24/7 service responsiveness.


Article Author: Anatolie Cohaniuc