Centos8中安装Redis

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

centos8 安装redis

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

  1. docker run -it centos:centos8 bash

  1. centos8中安装编译器

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

    https://redis.io/download

拷贝图中的连接地址

image-20211215214214205

  1. 下载Redis

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

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

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

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

    1. [root@a3052a608abe bin]# redis-cli -h 127.0.0.1 -p 6379
    2. 127.0.0.1:6379> set name marion
    3. OK
    4. 127.0.0.1:6379> get name
    5. "marion"
    6. 127.0.0.1:6379>