linux安装redis

一、redis介绍

详见:http://www.runoob.com/redis/redis-install.html

二、redis安装
  1. 下载安装包:wget http://download.redis.io/releases/redis-3.2.11.tar.gz
  2. 解压:tar xzvf redis-3.2.11.tar.gz
  3. 安装
    • cd redis-3.2.11
    • make
    • cd src
    • make install PREFIX=/usr/local/redis

    • 如上图执行make install PREFIX=/usr/local/redis失败,则先执行yum install gcc进行gcc服务安装,然后再执行make install PREFIX=/usr/local/redis

  • 如上图执行make install PREFIX=/usr/local/redis失败,则先设置make MALLOC=libc,,然后再执行make install PREFIX=/usr/local/redis
  • 三、配置

    1、移动配置文件到安装目录
    先切换到上级目录cd..
    mkdir /usr/local/redis/etc
    mv redis.conf /usr/local/redis/etc


    2、配置设置后台启动
    vi /usr/local/redis/etc/redis.conf
    daemonize no 修改为daemonize yes

    3、配置开机启动

vi /etc/rc.local
添加 /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

四、启动

/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf