📜  redis ubuntu install - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:04:52.132000             🧑  作者: Mango

Redis Ubuntu Install

Redis is an open source in-memory data store that is often used as a database, cache or message broker. It is fast, efficient, and easy to use.

This guide will walk you through the installation of Redis on Ubuntu.

Prerequisites

Before we begin, you will need:

  • A server running Ubuntu 18.04 or later
  • Access to a terminal window (or SSH client) as a user with sudo privileges
Step 1 – Update Ubuntu

Before we install Redis, we need to make sure our Ubuntu server's package lists are up to date.

To do this, open up a terminal window and run:

sudo apt-get update
Step 2 – Install Redis

Now we can install Redis using the Ubuntu package manager:

sudo apt-get install redis-server

This will download and install Redis, along with any necessary dependencies.

Once the installation is complete, you can check that Redis is running using:

sudo systemctl status redis-server

If Redis is running, you should see output that looks like this:

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-03-28 15:06:45 UTC; 2min 24s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 1124 (redis-server)
    Tasks: 4 (limit: 1151)
   CGroup: /system.slice/redis-server.service
           └─1124 /usr/bin/redis-server 127.0.0.1:6379
Step 3 – Configure Redis

Redis comes with some default configuration settings, but you may need to make some changes to suit your needs.

The main configuration file for Redis is located at /etc/redis/redis.conf. You can open this file in your favorite text editor to modify it.

Here are some common configuration changes you might make:

  • Change the Redis port (default is 6379)
  • Add a password to authenticate connections
  • Change the maximum memory limit

After you make changes to the configuration file, you will need to reload Redis for the changes to take effect:

sudo systemctl restart redis-server
Conclusion

In this guide, we installed Redis on Ubuntu and configured it to suit our needs. Redis is a powerful tool that can be used for a variety of tasks, including caching, database storage, and message queuing. With Redis installed, you can start building powerful and scalable applications.