redis安装
版本选择
我们选择最新的5.0.3
安装步骤
下载
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
解压
tar -zxvf redis-5.0.3.tar.gz
mv redis-5.0.3 /usr/local
构建
make
tips:
1、如果出现下面的错误,则需要安装gcc,yum install gcc
cd src && make all
make[1]: Entering directory /usr/local/redis-5.0.3/src' CC Makefile.dep make[1]: Leaving directory
/usr/local/redis-5.0.3/src’
make[1]: Entering directory /usr/local/redis-5.0.3/src' rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark (cd ../deps && make distclean) make[2]: Entering directory
/usr/local/redis-5.0.3/deps’
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-)
make[2]: Leaving directory /usr/local/redis-5.0.3/deps' (rm -f .make-*) echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings echo OPT=-O2 >> .make-settings echo MALLOC=jemalloc >> .make-settings echo CFLAGS= >> .make-settings echo LDFLAGS= >> .make-settings echo REDIS_CFLAGS= >> .make-settings echo REDIS_LDFLAGS= >> .make-settings echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings (cd ../deps && make hiredis linenoise lua jemalloc) make[2]: Entering directory
/usr/local/redis-5.0.3/deps’
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-)
(echo “” > .make-cflags)
(echo “” > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory /usr/local/redis-5.0.3/deps/hiredis' gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c make[3]: gcc: Command not found make[3]: *** [net.o] Error 127 make[3]: Leaving directory
/usr/local/redis-5.0.3/deps/hiredis’
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory /usr/local/redis-5.0.3/deps' make[1]: [persist-settings] Error 2 (ignored) CC adlist.o /bin/sh: cc: command not found make[1]: *** [adlist.o] Error 127 make[1]: Leaving directory
/usr/local/redis-5.0.3/src’
make: *** [all] Error 2
2、如果出现下面的错误,则将make改为make MALLOC=libc。
cd src && make all
make[1]: Entering directory /usr/local/redis-5.0.3/src' CC Makefile.dep make[1]: Leaving directory
/usr/local/redis-5.0.3/src’
make[1]: Entering directory /usr/local/redis-5.0.3/src' CC adlist.o In file included from adlist.c:34:0: zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory #include <jemalloc/jemalloc.h> ^ compilation terminated. make[1]: *** [adlist.o] Error 1 make[1]: Leaving directory
/usr/local/redis-5.0.3/src’
make: *** [all] Error 2
在/usr/local/bin 目录下找到 redis-server
redis-server
启动成功!
开机启动配置
参照大神博客 https://www.cnblogs.com/renzhicai/p/7773080.html