Linux下安裝Redis

首先去官網下載redis安裝包:下載redisredis

準備安裝

運行命令:

tar zxvf redis-3.0.4.tar.gz

進入解壓後的文件夾:

cd redis-3.0.4

編譯源碼:

make

出錯

若是出現下面錯誤:

[root@localhost redis-3.0.4]# make
cd src && make all
make[1]: Entering directory `/root/redis-3.0.4/src‘
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127make[1]: Leaving directory `/root/redis-3.0.4/src‘
make: *** [all] Error 2

則須要安裝gcc服務器

若是出現下面錯誤:

[root@localhost redis-3.0.4]# make
cd src&& make all
make[1]: Entering directory `/root/redis-3.0.4/src‘
    CC adlist.o
In file included from adlist.c:34:
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 1make[1]: Leaving directory `/root/redis-3.0.4/src‘
make: *** [all] Error 2

則更改make命令,爲 make MALLOC=libcui

安裝

安裝完成後,執行make install,執行文件被複制到了/usr/local/bin中,
須要手動複製配置文件'code

cp redis.conf /usr/local/bin

啓動服務器:

./redis-server redis.conf

啓動客戶端:

./redis-cli

相關文章
相關標籤/搜索