# How to install Redis on Ubuntu

Looking to speed up your applications? Redis is a powerful in-memory data store used for caching, sessions, queues, and real-time features. In this guide, we’ll install and configure Redis step by step.

***

### What Redis Is Used For

* Cache database queries (faster websites)
* Store user sessions
* Build real-time features (chat, notifications)
* Handle background jobs (queues)
* Temporary storage (carts, game states)

***

### Requirements

* Linux VPS (Ubuntu 20.04+ recommended)
* SSH access with sudo privileges
* \~10 minutes

***

### Step 1: Update Your System

```bash
sudo apt update
```

(Optional)

```bash
sudo apt upgrade -y
```

***

### Step 2: Install Redis

#### Ubuntu / Debian

```bash
sudo apt install redis-server -y
```

#### CentOS / RHEL 8+

```bash
sudo dnf install redis -y
```

#### CentOS / RHEL 7

```bash
sudo yum install epel-release -y
sudo yum install redis -y
```

***

### Step 3: Start and Enable Redis

```bash
sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis
```

***

### Step 4: Test Redis

```bash
redis-cli
ping
```

Expected output:

```
PONG
```

***

### Step 5: Secure and Configure Redis

```bash
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.backup
sudo nano /etc/redis/redis.conf
```

Recommended changes:

```
bind 127.0.0.1 ::1
requirepass YourStrongPassword123!
maxmemory 256mb
maxmemory-policy allkeys-lru
```

***

### Step 6: Restart Redis

```bash
sudo systemctl restart redis
```

***

### Done 🎉

Redis is now ready to use.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ititanhosting.ro/docs/english/vps/linux/how-to-install-redis-on-ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
