一、前言
本章通过redis-4.0.2.tar.gz在Centos的linux操作系统上进行安装(redis的详细介绍操作配置命令&window版本参见其他文章),下方在SSH命令终端进行详细安装步骤。
二、安装步骤
1. 在线下载redis(如网络问题请离线本站redis-4.0.2.tar.gz包)[root@centos6 soft]# wget http://download.redis.io/releases/redis-4.0.2.tar.gz@b@--2018-09-17 17:27:55-- http://download.redis.io/releases/redis-4.0.2.tar.gz@b@正在解析主机 download.redis.io... 109.74.203.151@b@正在连接 download.redis.io|109.74.203.151|:80... 已连接。@b@已发出 HTTP 请求,正在等待回应... 200 OK@b@长度:1713990 (1.6M) [application/x-gzip]@b@正在保存至: “redis-4.0.2.tar.gz”@b@@b@ 5% [====> @b@ ... @b@ 100%[==========================================================================================================>] 1,713,990 11.9K/s in 1m 45s @b@2018-09-17 17:29:41 (16.0 KB/s) - 已保存 “redis-4.0.2.tar.gz” [1713990/1713990])
2. 解压redis-4.0.2.tar.gz包[root@centos6 soft]# tar -zxvf redis-4.0.2.tar.gz @b@@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/mutex.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/pages.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/private_namespace.sh@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/private_symbols.txt@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/private_unnamespace.sh@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/prng.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/prof.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/public_namespace.sh@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/public_unnamespace.sh@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/ql.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/qr.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/quarantine.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/rb.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/rtree.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/size_classes.sh@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/stats.h@b@redis-4.0.2/deps/jemalloc/include/jemalloc/internal/tcache.h@b@...@b@redis-4.0.2/utils/releasetools/@b@redis-4.0.2/utils/releasetools/01_create_tarball.sh@b@redis-4.0.2/utils/releasetools/02_upload_tarball.sh@b@redis-4.0.2/utils/releasetools/03_test_release.sh@b@redis-4.0.2/utils/releasetools/04_release_hash.sh@b@redis-4.0.2/utils/releasetools/changelog.tcl@b@redis-4.0.2/utils/speed-regression.tcl@b@redis-4.0.2/utils/whatisdoing.sh
3. make编译[root@centos6 soft]# chmod -R 755 redis-4.0.2@b@[root@centos6 soft]# cd redis-4.0.2@b@[root@centos6 redis-4.0.2]# ls -l@b@总用量 280@b@-rwxr-xr-x. 1 root root 131381 9月 21 2017 00-RELEASENOTES@b@-rwxr-xr-x. 1 root root 53 9月 21 2017 BUGS@b@-rwxr-xr-x. 1 root root 1815 9月 21 2017 CONTRIBUTING@b@-rwxr-xr-x. 1 root root 1487 9月 21 2017 COPYING@b@drwxr-xr-x. 6 root root 4096 9月 21 2017 deps@b@-rwxr-xr-x. 1 root root 11 9月 21 2017 INSTALL@b@-rwxr-xr-x. 1 root root 151 9月 21 2017 Makefile@b@-rwxr-xr-x. 1 root root 4223 9月 21 2017 MANIFESTO@b@-rwxr-xr-x. 1 root root 20530 9月 21 2017 README.md@b@-rwxr-xr-x. 1 root root 57764 9月 21 2017 redis.conf@b@-rwxr-xr-x. 1 root root 271 9月 21 2017 runtest@b@-rwxr-xr-x. 1 root root 280 9月 21 2017 runtest-cluster@b@-rwxr-xr-x. 1 root root 281 9月 21 2017 runtest-sentinel@b@-rwxr-xr-x. 1 root root 7606 9月 21 2017 sentinel.conf@b@drwxr-xr-x. 3 root root 4096 9月 21 2017 src@b@drwxr-xr-x. 10 root root 4096 9月 21 2017 tests@b@drwxr-xr-x. 8 root root 4096 9月 21 2017 utils @b@[root@centos6 redis-4.0.2]# make@b@cd src && make all@b@make[1]: Entering directory '/home/soft/redis-4.0.2/src'@b@ CC Makefile.dep@b@make[1]: Leaving directory '/home/soft/redis-4.0.2/src'@b@make[1]: Entering directory '/home/soft/redis-4.0.2/src'@b@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@b@(cd ../deps && make distclean)@b@make[2]: Entering directory '/home/soft/redis-4.0.2/deps'@b@(cd hiredis && make clean) > /dev/null || true@b@(cd linenoise && make clean) > /dev/null || true@b@(cd lua && make clean) > /dev/null || true@b@(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true@b@(rm -f .make-*)@b@make[2]: Leaving directory '/home/soft/redis-4.0.2/deps'@b@(rm -f .make-*)@b@echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings@b@echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings@b@echo OPT=-O2 >> .make-settings@b@echo MALLOC=jemalloc >> .make-settings@b@echo CFLAGS= >> .make-settings@b@echo LDFLAGS= >> .make-settings@b@echo REDIS_CFLAGS= >> .make-settings@b@echo REDIS_LDFLAGS= >> .make-settings@b@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@b@echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings@b@(cd ../deps && make hiredis linenoise lua jemalloc)@b@make[2]: Entering directory '/home/soft/redis-4.0.2/deps'@b@(cd hiredis && make clean) > /dev/null || true@b@(cd linenoise && make clean) > /dev/null || true@b@(cd lua && make clean) > /dev/null || true@b@(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true@b@(rm -f .make-*)@b@(echo "" > .make-ldflags)@b@(echo "" > .make-cflags)@b@MAKE hiredis@b@cd hiredis && make static@b@make[3]: Entering directory '/home/soft/redis-4.0.2/deps/hiredis'@b@cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c@b@cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c@b@cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c@b@cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c@b@cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb read.c@b@ar rcs libhiredis.a net.o hiredis.o sds.o async.o read.o@b@make[3]: Leaving directory '/home/soft/redis-4.0.2/deps/hiredis'@b@MAKE linenoise@b@cd linenoise && make@b@make[3]: Entering directory '/home/soft/redis-4.0.2/deps/linenoise'@b@cc -Wall -Os -g -c linenoise.c@b@make[3]: Leaving directory '/home/soft/redis-4.0.2/deps/linenoise'@b@MAKE lua@b@cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' " MYLDFLAGS="" AR="ar rcu"@b@make[3]: Entering directory '/home/soft/redis-4.0.2/deps/lua/src'@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lapi.o lapi.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lcode.o lcode.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldebug.o ldebug.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldo.o ldo.c@b@ldo.c: 在函数‘f_parser’中:@b@ldo.c:496: 警告:未使用的变量‘c’@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldump.o ldump.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lfunc.o lfunc.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lgc.o lgc.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o llex.o llex.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lmem.o lmem.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lobject.o lobject.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lopcodes.o lopcodes.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lparser.o lparser.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstate.o lstate.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstring.o lstring.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltable.o ltable.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltm.o ltm.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lundump.o lundump.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lvm.o lvm.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lzio.o lzio.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o strbuf.o strbuf.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o fpconv.o fpconv.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lauxlib.o lauxlib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lbaselib.o lbaselib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldblib.o ldblib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o liolib.o liolib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lmathlib.o lmathlib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o loslib.o loslib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ltablib.o ltablib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lstrlib.o lstrlib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o loadlib.o loadlib.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o linit.o linit.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_cjson.o lua_cjson.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_struct.o lua_struct.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_cmsgpack.o lua_cmsgpack.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua_bit.o lua_bit.c@b@ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o fpconv.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o lua_bit.o # DLL needs all object files@b@ranlib liblua.a@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lua.o lua.c@b@cc -o lua lua.o liblua.a -lm @b@liblua.a(loslib.o): In function 'os_tmpname':@b@loslib.c:(.text+0x35): warning: the use of 'tmpnam' is dangerous, better use 'mkstemp'@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o luac.o luac.c@b@cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o print.o print.c@b@cc -o luac luac.o print.o liblua.a -lm @b@make[3]: Leaving directory '/home/soft/redis-4.0.2/deps/lua/src'@b@MAKE jemalloc@b@cd jemalloc && ./configure --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""@b@checking for xsltproc... /usr/bin/xsltproc@b@checking for gcc... gcc@b@checking whether the C compiler works... yes@b@checking for C compiler default output file name... a.out@b@checking for suffix of executables... @b@checking whether we are cross compiling... no@b@checking for suffix of object files... o@b@checking whether we are using the GNU C compiler... yes@b@checking whether gcc accepts -g... yes@b@checking for gcc option to accept ISO C89... none needed@b@checking how to run the C preprocessor... gcc -E@b@checking for grep that handles long lines and -e... /bin/grep@b@checking for egrep... /bin/grep -E@b@checking for ANSI C header files... yes@b@checking for sys/types.h... yes@b@checking for sys/stat.h... yes@b@checking for stdlib.h... yes@b@checking for string.h... yes@b@checking for memory.h... yes@b@checking for strings.h... yes@b@checking for inttypes.h... yes@b@checking for stdint.h... yes@b@checking for unistd.h... yes@b@checking whether byte ordering is bigendian... no@b@checking size of void *... 8@b@checking size of int... 4@b@checking size of long... 8@b@^Achecking size of intmax_t... 8@b@checking build system type... x86_64-unknown-linux-gnu@b@checking host system type... x86_64-unknown-linux-gnu@b@checking whether pause instruction is compilable... yes@b@checking for ar... ar@b@checking malloc.h usability... yes@b@checking malloc.h presence... yes@b@checking for malloc.h... yes@b@checking whether malloc_usable_size definition can use const argument... no@b@checking whether __attribute__ syntax is compilable... yes@b@checking whether compiler supports -fvisibility=hidden... yes@b@checking whether compiler supports -Werror... yes@b@checking whether tls_model attribute is compilable... yes@b@checking whether compiler supports -Werror... yes@b@checking whether alloc_size attribute is compilable... yes@b@checking whether compiler supports -Werror... yes@b@checking whether format(gnu_printf, ...) attribute is compilable... yes@b@checking whether compiler supports -Werror... yes@b@checking whether format(printf, ...) attribute is compilable... yes@b@checking for a BSD-compatible install... /usr/bin/install -c@b@checking for ranlib... ranlib@b@checking for ld... /usr/bin/ld@b@checking for autoconf... false@b@checking for memalign... yes@b@checking for valloc... yes@b@checking configured backtracing method... N/A@b@checking for sbrk... yes@b@checking whether utrace(2) is compilable... no@b@checking whether valgrind is compilable... no@b@checking whether a program using __builtin_ffsl is compilable... yes@b@checking LG_PAGE... 12@b@checking pthread.h usability... yes@b@checking pthread.h presence... yes@b@checking for pthread.h... yes@b@checking for pthread_create in -lpthread... yes@b@checking for library containing clock_gettime... -lrt@b@checking for secure_getenv... no@b@checking for issetugid... no@b@checking for _malloc_thread_cleanup... no@b@checking for _pthread_mutex_init_calloc_cb... no@b@checking for TLS... yes@b@checking whether C11 atomics is compilable... no@b@checking whether atomic(9) is compilable... no@b@checking whether Darwin OSAtomic*() is compilable... no@b@checking whether madvise(2) is compilable... yes@b@checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no@b@checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no@b@checking for __builtin_clz... yes@b@checking whether Darwin OSSpin*() is compilable... no@b@checking whether glibc malloc hook is compilable... yes@b@checking whether glibc memalign hook is compilable... yes@b@checking whether pthreads adaptive mutexes is compilable... yes@b@checking for stdbool.h that conforms to C99... yes@b@checking for _Bool... yes@b@configure: creating ./config.status@b@config.status: creating Makefile@b@config.status: creating jemalloc.pc@b@config.status: creating doc/html.xsl@b@config.status: creating doc/manpages.xsl@b@config.status: creating doc/jemalloc.xml@b@config.status: creating include/jemalloc/jemalloc_macros.h@b@config.status: creating include/jemalloc/jemalloc_protos.h@b@config.status: creating include/jemalloc/jemalloc_typedefs.h@b@config.status: creating include/jemalloc/internal/jemalloc_internal.h@b@config.status: creating test/test.sh@b@config.status: creating test/include/test/jemalloc_test.h@b@config.status: creating config.stamp@b@config.status: creating bin/jemalloc-config@b@config.status: creating bin/jemalloc.sh@b@config.status: creating bin/jeprof@b@config.status: creating include/jemalloc/jemalloc_defs.h@b@config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h@b@config.status: creating test/include/test/jemalloc_test_defs.h@b@config.status: executing include/jemalloc/internal/private_namespace.h commands@b@config.status: executing include/jemalloc/internal/private_unnamespace.h commands@b@config.status: executing include/jemalloc/internal/public_symbols.txt commands@b@config.status: executing include/jemalloc/internal/public_namespace.h commands@b@config.status: executing include/jemalloc/internal/public_unnamespace.h commands@b@config.status: executing include/jemalloc/internal/size_classes.h commands@b@config.status: executing include/jemalloc/jemalloc_protos_jet.h commands@b@config.status: executing include/jemalloc/jemalloc_rename.h commands@b@config.status: executing include/jemalloc/jemalloc_mangle.h commands@b@config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands@b@config.status: executing include/jemalloc/jemalloc.h commands@b@===============================================================================@b@jemalloc version : 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c@b@library revision : 2@b@@b@CONFIG : --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence 'CFLAGS=-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops ' LDFLAGS=@b@CC : gcc@b@CFLAGS : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -fvisibility=hidden@b@CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT@b@LDFLAGS : @b@EXTRA_LDFLAGS : @b@LIBS : -lpthread@b@TESTLIBS : -lrt @b@RPATH_EXTRA : @b@@b@XSLTPROC : /usr/bin/xsltproc@b@XSLROOT : @b@@b@PREFIX : /usr/local@b@BINDIR : /usr/local/bin@b@DATADIR : /usr/local/share@b@INCLUDEDIR : /usr/local/include@b@LIBDIR : /usr/local/lib@b@MANDIR : /usr/local/share/man@b@@b@srcroot : @b@abs_srcroot : /home/soft/redis-4.0.2/deps/jemalloc/@b@objroot : @b@abs_objroot : /home/soft/redis-4.0.2/deps/jemalloc/@b@@b@JEMALLOC_PREFIX : je_@b@JEMALLOC_PRIVATE_NAMESPACE@b@ : je_@b@install_suffix : @b@autogen : 0@b@cc-silence : 1@b@debug : 0@b@code-coverage : 0@b@stats : 1@b@prof : 0@b@prof-libunwind : 0@b@prof-libgcc : 0@b@prof-gcc : 0@b@tcache : 1@b@fill : 1@b@utrace : 0@b@valgrind : 0@b@xmalloc : 0@b@munmap : 0@b@lazy_lock : 0@b@tls : 1@b@cache-oblivious : 1@b@===============================================================================@b@cd jemalloc && make CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS="" lib/libjemalloc.a@b@make[3]: Entering directory '/home/soft/redis-4.0.2/deps/jemalloc'@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/arena.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/atomic.o src/atomic.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/base.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/bitmap.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk.o src/chunk.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_dss.o src/chunk_dss.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_mmap.o src/chunk_mmap.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/ckh.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/ctl.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/extent.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/hash.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/huge.o src/huge.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mb.o src/mb.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/mutex.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/pages.o src/pages.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/prof.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/quarantine.o src/quarantine.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/rtree.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/stats.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/tcache.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/util.o src/util.c@b@gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c@b@ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/atomic.o src/base.o src/bitmap.o src/chunk.o src/chunk_dss.o src/chunk_mmap.o src/ckh.o src/ctl.o src/extent.o src/hash.o src/huge.o src/mb.o src/mutex.o src/pages.o src/prof.o src/quarantine.o src/rtree.o src/stats.o src/tcache.o src/util.o src/tsd.o@b@make[3]: Leaving directory '/home/soft/redis-4.0.2/deps/jemalloc'@b@make[2]: Leaving directory '/home/soft/redis-4.0.2/deps'@b@ CC adlist.o@b@ CC quicklist.o@b@ CC ae.o@b@ CC anet.o@b@anet.c: 在函数‘anetSockName’中:@b@anet.c:643: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:641: 附注:initialized from here@b@anet.c:647: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:645: 附注:initialized from here@b@anet.c: 在函数‘anetPeerToString’中:@b@anet.c:587: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:585: 附注:initialized from here@b@anet.c:591: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:589: 附注:initialized from here@b@anet.c: 在函数‘anetTcpAccept’中:@b@anet.c:558: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:556: 附注:initialized from here@b@anet.c:562: 警告:dereferencing pointer ‘s’ does break strict-aliasing rules@b@anet.c:560: 附注:initialized from here@b@ CC dict.o@b@ CC server.o@b@ CC sds.o@b@ CC zmalloc.o@b@ CC lzf_c.o@b@ CC lzf_d.o@b@ CC pqsort.o@b@ CC zipmap.o@b@ CC sha1.o@b@ CC ziplist.o@b@ CC release.o@b@ CC networking.o@b@ CC util.o@b@ CC object.o@b@ CC db.o@b@ CC replication.o@b@ CC rdb.o@b@ CC t_string.o@b@ CC t_list.o@b@ CC t_set.o@b@ CC t_zset.o@b@ CC t_hash.o@b@ CC config.o@b@ CC aof.o@b@ CC pubsub.o@b@ CC multi.o@b@ CC debug.o@b@ CC sort.o@b@ CC intset.o@b@ CC syncio.o@b@ CC cluster.o@b@ CC crc16.o@b@ CC endianconv.o@b@ CC slowlog.o@b@ CC scripting.o@b@ CC bio.o@b@ CC rio.o@b@ CC rand.o@b@ CC memtest.o@b@ CC crc64.o@b@ CC bitops.o@b@ CC sentinel.o@b@ CC notify.o@b@ CC setproctitle.o@b@ CC blocked.o@b@ CC hyperloglog.o@b@ CC latency.o@b@ CC sparkline.o@b@ CC redis-check-rdb.o@b@ CC redis-check-aof.o@b@ CC geo.o@b@ CC lazyfree.o@b@ CC module.o@b@^A CC evict.o@b@ CC expire.o@b@ CC geohash.o@b@ CC geohash_helper.o@b@ CC childinfo.o@b@ CC defrag.o@b@ CC siphash.o@b@ CC rax.o@b@ LINK redis-server@b@ INSTALL redis-sentinel@b@ CC redis-cli.o@b@ LINK redis-cli@b@ CC redis-benchmark.o@b@ LINK redis-benchmark@b@ INSTALL redis-check-rdb@b@ INSTALL redis-check-aof@b@@b@Hint: It's a good idea to run 'make test' ;)@b@@b@make[1]: Leaving directory '/home/soft/redis-4.0.2/src'
4. make install安装[root@centos6 redis-4.0.2]# make install@b@cd src && make install@b@make[1]: Entering directory '/home/soft/redis-4.0.2/src'@b@ CC Makefile.dep@b@make[1]: Leaving directory '/home/soft/redis-4.0.2/src'@b@make[1]: Entering directory '/home/soft/redis-4.0.2/src'@b@@b@Hint: It's a good idea to run 'make test' ;)@b@@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install@b@make[1]: Leaving directory '/home/soft/redis-4.0.2/src'@b@@b@@b@[root@centos6 redis-4.0.2]# cd src && make install@b@@b@ @b@Hint: It's a good idea to run 'make test' ;)@b@@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install@b@ INSTALL install
5. 启动 redis-server命令测试[root@centos6 src]# redis-server@b@25838:C 17 Sep 17:41:59.430 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo@b@25838:C 17 Sep 17:41:59.430 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=25838, just started@b@25838:C 17 Sep 17:41:59.430 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf@b@25838:M 17 Sep 17:41:59.431 * Increased maximum number of open files to 10032 (it was originally set to 1024).@b@ _._ @b@ _.-''__ ''-._ @b@ _.-'' '. '_. ''-._ Redis 4.0.2 (00000000/0) 64 bit@b@ .-'' .-'''. '''\/ _.,_ ''-._ @b@ ( ' , .-' | ', ) Running in standalone mode@b@ |'-._'-...-' __...-.''-._|'' _.-'| Port: 6379@b@ | '-._ '._ / _.-' | PID: 25838@b@ '-._ '-._ '-./ _.-' _.-' @b@ |'-._'-._ '-.__.-' _.-'_.-'| @b@ | '-._'-._ _.-'_.-' | http://redis.io @b@ '-._ '-._'-.__.-'_.-' _.-' @b@ |'-._'-._ '-.__.-' _.-'_.-'| @b@ | '-._'-._ _.-'_.-' | @b@ '-._ '-._'-.__.-'_.-' _.-' @b@ '-._ '-.__.-' _.-' @b@ '-._ _.-' @b@ '-.__.-' @b@@b@25838:M 17 Sep 17:41:59.437 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.@b@25838:M 17 Sep 17:41:59.437 # Server initialized@b@25838:M 17 Sep 17:41:59.437 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.@b@25838:M 17 Sep 17:41:59.437 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.@b@25838:M 17 Sep 17:41:59.437 * Ready to accept connections
6. /etc/init.d/系统启动脚本配置[root@centos6 redis-4.0.2]# cd utils/@b@[root@centos6 utils]# ls -l redis_init_script@b@-rwxr-xr-x. 1 root root 1098 9月 21 2017 redis_init_script@b@[root@centos6 utils]# cp redis_init_script /etc/init.d/redis_6379@b@@b@[root@centos6 utils]# cat /etc/init.d/redis_6379@b@#!/bin/sh@b@#@b@# Simple Redis init.d script conceived to work on Linux systems@b@# as it does use of the /proc filesystem.@b@@b@REDISPORT=6379@b@EXEC=/usr/local/bin/redis-server@b@CLIEXEC=/usr/local/bin/redis-cli@b@@b@PIDFILE=/var/run/redis_${REDISPORT}.pid@b@CONF="/etc/redis/${REDISPORT}.conf"@b@@b@case "$1" in@b@ start)@b@ if [ -f $PIDFILE ]@b@ then@b@ echo "$PIDFILE exists, process is already running or crashed"@b@ else@b@ echo "Starting Redis server..."@b@ $EXEC $CONF@b@ fi@b@ ;;@b@ stop)@b@ if [ ! -f $PIDFILE ]@b@ then@b@ echo "$PIDFILE does not exist, process is not running"@b@ else@b@ PID=$(cat $PIDFILE)@b@ echo "Stopping ..."@b@ $CLIEXEC -p $REDISPORT shutdown@b@ while [ -x /proc/${PID} ]@b@ do@b@ echo "Waiting for Redis to shutdown ..."@b@ sleep 1@b@ done@b@ echo "Redis stopped"@b@ fi@b@ ;;@b@ *)@b@ echo "Please use start or stop as first argument"@b@ ;;@b@esac
7. 创建持久化&配置文件路径[root@centos6 utils]# mkdir /etc/redis@b@[root@centos6 utils]# mkdir /var/redis/@b@[root@centos6 utils]# mkdir /var/redis/6379
8. 修改配置文件(进行脚本#1、#2、#3、#4地方修改)[root@centos6 redis-4.0.2]# cp redis.conf /etc/redis/6379.conf@b@[root@centos6 redis-4.0.2]# vi /etc/redis/6379.conf@b@@b@#1.使Redis以守护进程模式运行(之前默认为no)@b@daemonize yes@b@@b@#2.设置Redis的PID文件位置@b@pidfile /var/run/redis_6379.pid@b@@b@#3.设置Redis监听的端口号(如默认就不需修改)@b@port 6379@b@@b@#4.设置持久化文件存放位置(默认是dir ./)@b@dir /var/redis/6379
9. 防火墙端口设置 & 验证启动和停止[root@centos6 redis-4.0.2]# vi /etc/sysconfig/iptables@b@..@b@#增加配置 端口@b@-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT@b@..@b@[root@centos6 redis-4.0.2]# service iptables restart@b@iptables:将链设置为政策 ACCEPT:filter [确定]@b@iptables:清除防火墙规则:[确定]@b@iptables:正在卸载模块:[确定]@b@iptables:应用防火墙规则:[确定]@b@@b@[root@centos6 redis-4.0.2]# /etc/init.d/redis_6379 start@b@Starting Redis server...@b@27087:C 17 Sep 18:08:25.736 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo@b@27087:C 17 Sep 18:08:25.736 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=27087, just started@b@27087:C 17 Sep 18:08:25.736 # Configuration loaded@b@@b@[root@centos6 redis-4.0.2]# /etc/init.d/redis_6379 stop@b@Stopping ...@b@Redis stopped
10. 配置开机启动redis服务[root@centos6 redis-4.0.2]# chkconfig redis_6379 on@b@[root@centos6 redis-4.0.2]# service redis_6379 start@b@Starting Redis server...@b@27434:C 17 Sep 18:13:45.642 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo@b@27434:C 17 Sep 18:13:45.642 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=27434, just started@b@27434:C 17 Sep 18:13:45.642 # Configuration loaded@b@ @b@[root@centos6 redis-4.0.2]# service redis_6379 stop@b@Stopping ...@b@Redis stopped@b@[root@centos6 redis-4.0.2]#
另:如报“nc: connect to 192.168.1.202 port 6379 (tcp) failed: Connection refused”连接拒绝,请参见其他文章页进行解决。
三、相关下载
redis-4.0.11.tar.gz 本地下载
redis-desktop-manager-0.8.2.3849.exe for windows 本地下载
redis-5.0.0.tar.gz 本地下载