Centos8中安装Redis

分类:软件编程
阅读:1590
作者:majingjing
发布:2021-12-15 21:59

centos8 安装redis

[TOC]

我没有虚拟机,此处使用docker安装centos8镜像,进行模拟

docker run -it centos:centos8 bash

  1. centos8中安装编译器

    yum install wget
    
    # 安装编译器
    yum install gcc-c++
    
    yum -y install gcc automake autoconf libtool make
    
  2. 进入Redis官网

https://redis.io/download

拷贝图中的连接地址

image-20211215214214205

  1. 下载Redis

    cd /
    mkdir /opt/
    cd /opt
    wget https://download.redis.io/releases/redis-6.2.6.tar.gz
    
  2. 解压,安装

    # 解压
    tar -xzvf redis-6.2.6.tar.gz
    
    # 编译
    cd /opt/redis-6.2.6
    
    make
    
    # 安装
    make install
    
  3. 拷贝配置文件

    # redis 默认安装路径 /usr/local/bin
    
    mkdir /usr/local/bin/marionconfig
    
    cp redis.conf /usr/local/bin/marionconfig/
    
  4. 启动Redis服务

    [root@a3052a608abe bin]# redis-server marionconfig/redis.conf
    
    
  5. 验证

    [root@a3052a608abe bin]# redis-cli -h 127.0.0.1 -p 6379
    127.0.0.1:6379> set name marion
    OK
    127.0.0.1:6379> get name
    "marion"
    127.0.0.1:6379>