redis的安装


下载redis

解压redis进入解压后的目录

  • 安装依赖

    yum install -y gcc 
    yum install jemalloc-devel -y
    yum install bzip2
    
    cd deps
    make lua hiredis linenoise
    
    cd ..
    make MALLOC=libc
    make install
    
    
  • 修改配置文件

    vim /etc/redis.conf
    logfile "/var/log/redis/redis.log" # 日志文件
    
    # protected-mode yes # 关闭保护模式,如果需要其他主机可以访问
    
    daemonize yes # 进程后台运行
    
    # bind 127.0.0.1 -::1 # 取消绑定本机,允许其他主机访问
    
    requirepass "" #设置密码
    
  • 启动redis服务

    redis-server /etc/redis.conf