本文是Linux系統(tǒng)下的安裝姻僧,如果需要在windows下使用副瀑,請前往https://github.com/MicrosoftArchive/redis/tags下載windows版本,注意目前win的最高版本只有3.2版本妆档。
前往redis官網下載自己需要的版本:https://redis.io/download
下載完成后按照其教程進行解壓編譯:
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
如果你不是mac系統(tǒng)痹愚,此時可能出現下面的問題:
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: 沒有那個文件或目錄
#include <jemalloc/jemalloc.h>
^
compilation terminated.
Makefile:248: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory '/usr/local/redis-5.0.5/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2
此時附加一個參數即可:
make MALLOC=libc
此時即可成功編譯:
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory '/usr/local/redis-5.0.5/src'
接下來啟動服務器即可使用:
src/redis-server
然后使用內置的redis-cli:
src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"