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
相關文章
相關標籤/搜索