Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Tutorial for installing Redis on Linux

Shulou Source: shulou.com Published: 2022-06-02 09:44:05 10月02日 Update

This article mainly explains "the tutorial of installing Redis on Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the tutorial of installing Redis on Linux.

Sudo is a privilege management mechanism. Administrators can authorize some ordinary users to perform some operations performed by root without knowing the password of root.

First, install Redis

It is generally recommended to use source code for installation. The whole installation can be completed in the following six steps. Take version 3.0.7 as an example.

1. Download the specified version of the source code package of Redis to the current directory

$wget http://download.redis.io/releases/redis-3.0.7.tar.gz

two。 Decompress the Redis source code compression package

$tar xzf redis-3.0.7.tar.gz

3. Establish a soft link to the redis directory to point to redis-3.0.7 (a soft link to the redis directory is established in order not to fix the redis directory on the specified version, which is conducive to future Redis version upgrades)

$ln-s redis-3.0.7 redis

4. Enter the redis directory

$cd redis

5. Compile (make sure the operating system has gcc installed before compilation)

If the gcc command cannot be found when compiling, you can install the gcc command with the following command, where gcc is the compile command for c

$yum install gcc-c++

$make

6. Installation

After the default make, if we start the redis service, we have to go to the installation directory every time, which is very tedious, so we can make and then execute make install, and the generated binaries will be placed in the / usr/local/bin directory, so we can execute Redis commands in any directory.

Note: if an ordinary user needs root permission to execute make install, use sudo make install

$sudo make install

2. Start Redis

We need to set up background startup (foreground startup, need to restart a client to log in, which is very inconvenient)

In the configuration file of redis.conf, make the following changes:

Daemonize no

Modified to:

Daemonize yes

$redis-server redis.conf

3. Close Redis

$redis-cli shutdown

Uninstall Redis

Uninstalling redis is very simple, with only three simple steps

1. Stop the redis server

/ / check whether the redis service is running through the following command

$ps aux | grep redis

/ / stop the redis server with the following command

$redis-cli shutdown

2. Several redisXXX files (/ usr/local/bin/) generated when make is deleted

$rm-rf / usr/local/bin/redis*

3. Delete the extracted file directory and all files

$rm-rf redis

At this point, I believe you have a deeper understanding of the "tutorial on installing Redis on Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Directories commands files versions services compilers tutorials source code faceted normal content time server permissions users learning generation management practical deeper Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Linux Shulou Tech Info Huawei vpn