redis简单安装

Installation

Download, extract and compile Redis with:redis

$ wget http://download.redis.io/releases/redis-5.0.4.tar.gz
$ tar xzf redis-5.0.4.tar.gz
$ cd redis-5.0.4
$ make

The binaries that are now compiled are available in the src directory. Run Redis with:ide

$ src/redis-server

You can interact with Redis using the built-in client:函数

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

编辑redis.conf测试

注释掉这句,支持远程访问
#bind 127.0.0.1
将如下这句修改yes修改成no,去掉密码限制
protected-mode no

 

 

安装过程可能出现的问题:网站

  1. CentOS5.7默认没有安装gcc,这会致使咱们没法make成功。使用yum安装:
    yum -y install gcc
  2. make时报以下错误:
    zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
    zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
    make[1]: *** [adlist.o] Error 1
    make[1]: Leaving directory `/data0/src/redis-2.6.2/src'
    make: *** [all] Error 2

    缘由是jemalloc重载了Linux下的ANSI C的malloc和free函数。解决办法:make时添加参数。ui

    make MALLOC=libc
  3. make以后,会出现一句提示
    Hint: To run 'make test' is a good idea ;)

    可是不测试,一般是能够使用的。若咱们运行make test ,会有以下提示idea

    [devnote@devnote src]$ make test
    You need tcl 8.5 or newer in order to run the Redis test
    make: ***[test] Error_1

    解决办法是用yum安装tcl8.5(或去tcl的官方网站http://www.tcl.tk/下载8.5版本,并参考官网介绍进行安装)spa

    yum install tcl
相关文章
相关标签/搜索