折腾:
此时,需要去在CentOS中,安装redis
用于后续Flask中的开发。
Flask 如何安装 redis
用yum去安装了redis,又去删除了,因为发现版本太低:
只有2.4.10
而官网的:
最新版本是:
3.2.3
(SIPEvents) ➜ tools ll total 68M drwxrwxr-x 18 1000 1000 4.0K Aug 23 10:07 Python-2.7.12 -rw-r–r– 1 root root 68M Jun 26 05:59 Python-2.7.12.tar drwxrwxr-x 9 1000 1000 4.0K Aug 23 10:12 setuptools-26.0.0 -rw-r–r– 1 root root 618K Aug 21 06:28 setuptools-26.0.0.tar.gz -rw-r–r– 1 root root 196K Aug 17 15:35 wechat-python-sdk-master.tar.gz (SIPEvents) ➜ tools wget http://download.redis.io/releases/redis-3.2.3.tar.gz <div–<2016-09-03 21:12:19– http://download.redis.io/releases/redis-3.2.3.tar.gz Resolving download.redis.io… 109.74.203.151 Connecting to download.redis.io|109.74.203.151|:80… connected. HTTP request sent, awaiting response… 200 OK Length: 1541401 (1.5M) [application/x-gzip] Saving to: “redis-3.2.3.tar.gz” 100%[=============================================================================================================================================>] 1,541,401 592K/s in 2.5s 2016-09-03 21:12:23 (592 KB/s) – “redis-3.2.3.tar.gz” saved [1541401/1541401] (SIPEvents) ➜ tools tar xzf redis-3.2.3.tar.gz (SIPEvents) ➜ tools cd redis-3.2.3 (SIPEvents) ➜ redis-3.2.3 make cd src && make all make[1]: Entering directory `/root/tools/redis-3.2.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 (cd ../deps && make distclean) make[2]: Entering directory `/root/tools/redis-3.2.3/deps’ (cd hiredis && make clean) > /dev/null || true (cd linenoise && make clean) > /dev/null || true (cd lua && make clean) > /dev/null || true (cd geohash-int && make clean) > /dev/null || true (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true (rm -f .make-*) make[2]: Leaving directory `/root/tools/redis-3.2.3/deps’ (rm -f .make-*) echo STD=-std=c99 -pedantic -DREDIS_STATIC=” >> .make-settings echo WARN=-Wall -W >> .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 -O2 -g -ggdb -I../deps/geohash-int -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 geohash-int jemalloc) make[2]: Entering directory `/root/tools/redis-3.2.3/deps’ (cd hiredis && make clean) > /dev/null || true (cd linenoise && make clean) > /dev/null || true (… config.status: creating include/jemalloc/jemalloc_defs.h config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h config.status: creating test/include/test/jemalloc_test_defs.h config.status: executing include/jemalloc/internal/private_namespace.h commands config.status: executing include/jemalloc/internal/private_unnamespace.h commands config.status: executing include/jemalloc/internal/public_symbols.txt commands config.status: executing include/jemalloc/internal/public_namespace.h commands config.status: executing include/jemalloc/internal/public_unnamespace.h commands config.status: executing include/jemalloc/internal/size_classes.h commands config.status: executing include/jemalloc/jemalloc_protos_jet.h commands config.status: executing include/jemalloc/jemalloc_rename.h commands config.status: executing include/jemalloc/jemalloc_mangle.h commands config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands config.status: executing include/jemalloc/jemalloc.h commands =============================================================================== jemalloc version : 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c library revision : 2 CONFIG : –with-lg-quantum=3 –with-jemalloc-prefix=je_ –enable-cc-silence ‘CFLAGS=-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops ‘ LDFLAGS= CC : gcc CFLAGS : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -fvisibility=hidden CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT LDFLAGS : EXTRA_LDFLAGS : LIBS : -lpthread TESTLIBS : -lrt RPATH_EXTRA : XSLTPROC : /usr/bin/xsltproc XSLROOT : PREFIX : /usr/local BINDIR : /usr/local/bin DATADIR : /usr/local/share INCLUDEDIR : /usr/local/include LIBDIR : /usr/local/lib MANDIR : /usr/local/share/man srcroot : abs_srcroot : /root/tools/redis-3.2.3/deps/jemalloc/ objroot : abs_objroot : /root/tools/redis-3.2.3/deps/jemalloc/ JEMALLOC_PREFIX : je_ JEMALLOC_PRIVATE_NAMESPACE : je_ install_suffix : autogen : 0 cc-silence : 1 debug : 0 code-coverage : 0 stats : 1 prof : 0 prof-libunwind : 0 prof-libgcc : 0 prof-gcc : 0 tcache : 1 fill : 1 utrace : 0 valgrind : 0 xmalloc : 0 munmap : 0 lazy_lock : 0 tls : 1 cache-oblivious : 1 =============================================================================== cd jemalloc && make CFLAGS=”-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops ” LDFLAGS=”” lib/libjemalloc.a make[3]: Entering directory `/root/tools/redis-3.2.3/deps/jemalloc’ gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c … 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 make[3]: Leaving directory `/root/tools/redis-3.2.3/deps/jemalloc’ make[2]: Leaving directory `/root/tools/redis-3.2.3/deps’ CC adlist.o CC quicklist.o CC ae.o In file included from ae.c:53: ae_epoll.c: In function ‘aeApiAddEvent’: ae_epoll.c:75: warning: missing initializer ae_epoll.c:75: warning: (near initialization for ‘ee.data’) ae_epoll.c: In function ‘aeApiDelEvent’: ae_epoll.c:92: warning: missing initializer ae_epoll.c:92: warning: (near initialization for ‘ee.data’) CC anet.o anet.c: In function ‘anetSockName’: … anet.c:559: warning: dereferencing pointer ‘s’ does break strict-aliasing rules anet.c:557: note: initialized from here CC dict.o CC server.o … LINK redis-server INSTALL redis-sentinel CC redis-cli.o LINK redis-cli CC redis-benchmark.o LINK redis-benchmark INSTALL redis-check-rdb CC redis-check-aof.o LINK redis-check-aof Hint: It’s a good idea to run ‘make test’ 😉 make[1]: Leaving directory `/root/tools/redis-3.2.3/src’ |
再去运行试试,结果出错:
Flask-And-Redis — Flask-And-Redis 0.6 documentation
Getting started with Flask, Redis and wercker
[已解决]redis安装后去make test出错:You need tcl 8.5 or newer in order to run the Redis test
[已解决]安装完毕redis后出错:Warning: no config file specified using the default config
https://www.crifan.com/installed_redis_warning_no_config_file_specified_using_the_default_config
[已解决]运行redis-server出错:Creating Server TCP listening socket 6379 unable to bind socket
[总结]
去官网:
参考:
去:
1.从源码下载和安装
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make yum install -y tcl make test make install |
说明:
(1)其中make test是可选的
(2)安装tcl是为了make test
2.设置配置文件后再去运行
mkdir /etc/redis cp redis.conf /etc/redis redis-server /etc/redis/redis.conf |
说明:
1.运行cp redis.conf /etc/redis之前,确保是在redis的源码目录下,因为其下有个默认的配置文件redis.conf
2.此处直接使用redis-server,而不是:src/redis-server,是因为:
上面的make install时已经把redis-server拷贝到PATH环境变量所包含的路径:/usr/local/bin/中去了,所以命令行中可以直接使用redis-server
转载请注明:在路上 » [已解决]为Flask的后台任务而在CentOS中安装Redis