Centos7 Redis安装教程

96 阅读1分钟

Centos7 Redis安装教程

  1. 查看是否安装wget工具,没有执行下面命令安装:

    yum install wget
    
  2. 创建application文件夹,并使用wget下载redis源码包

    cd ~
    mkdir application
    cd application
    wget http://download.redis.io/releases/redis-5.0.5.tar.gz
    

    在这里插入图片描述

  3. 解压redis源码包

    tar xf redis-5.0.5.tar.gz 
    
  4. 安装gcc

    yum install gcc
    
  5. 编译&打包

    make
    make install PREFIX=/opt/jackmouse/redis5 # 指定安装目录
    

    在这里插入图片描述

  6. 配置全局变量

    vi /etc/profile
    # 加入下面内容
    export REDIS_HOME=/opt/jackmouse/redis5
    export PATH=$PATH:$REDIS_HOME/bin
    # 刷新配置文件
    source /etc/profile
    
  7. 测试

    命令行输入redis-server,redis正常启动

    在这里插入图片描述

  8. install_server使用

    cd ~/application/redis-5.0.5/utils/
    ./install_server.sh
    
    
    Please select the redis port for this instance: [6379] #redis端口
    Selecting default: 6379
    Please select the redis config file name [/etc/redis/6379.conf]  #redis配置文件
    Selected default - /etc/redis/6379.conf
    Please select the redis log file name [/var/log/redis_6379.log] #redis日志文件
    Selected default - /var/log/redis_6379.log
    Please select the data directory for this instance [/var/lib/redis/6379] #redis数据文件
    Selected default - /var/lib/redis/6379
    Please select the redis executable path [/opt/jackmouse/redis5/bin/redis-server] #redis可执行程序的路径
    
    
  9. 查看redis运行状态

ps -fe |  grep redis