1、通過(guò)wget方式直接在linux上下載Redis
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
2、解壓下載的redis-5.0.5.tar.gz 文件
tar -zxf redis-5.0.5.tar.gz
3、因?yàn)镽edis是C實(shí)現(xiàn)的,需要gcc來(lái)進(jìn)行編譯,如果系統(tǒng)未安裝gcc,在接下來(lái)進(jìn)行make操作時(shí)就會(huì)報(bào)錯(cuò),gcc依賴較多,都執(zhí)行一下,按順序執(zhí)行,以防萬(wàn)一
yum install cpp
yum install binutils
yum install glibc
yum install glibc-kernheaders
yum install glibc-common
yum install glibc-devel
yum install gcc
yum install make
4、安裝完依賴后就可以進(jìn)入redis-5.0.5文件夾中進(jìn)行編譯操作了
make

注釋:如果make報(bào)如下錯(cuò)誤,原因是jemalloc重載了Linux下的ANSI C的malloc和free函數(shù)。
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
解決辦法:make時(shí)添加參數(shù)
make MALLOC=libc
5、將redis-5.0.5文件夾遷移至/usr/local目錄下
mv? redis-5.0.5? ? /usr/local/
6、進(jìn)入src文件夾,執(zhí)行make install進(jìn)行Redis安裝
cd /usr/local/redis-5.0.5/src
make install

7、執(zhí)行src文件夾下的redis-server,可以啟動(dòng)redis服務(wù)
src/redis-server
8、執(zhí)行src文件夾下的redis-cli, 可以訪問(wèn)redis服務(wù)
src/redis-cli
redis> set foo bar
Ok
redis> get foo
"bar"
9、可以根據(jù)提示進(jìn)行測(cè)試

make test
如果報(bào)出如下錯(cuò)誤
You need tcl 8.5 or newer in order to run the Redis test
make: ***[test] Error_1
解決辦法是用yum安裝tcl8.5:
yum install tcl