Redis实战——安装问题汇总

原文链接: http://www.cnblogs.com/onlymate/p/9052190.html

 

借鉴:https://www.cnblogs.com/liu2-/p/6914159.html

通用方法:迅速查看缺少的包的路径,并安装

  yum provides ***

  如 yum provides rx

已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirror.bit.edu.cn
* updates: mirrors.aliyun.com
base/7/x86_64/filelists_db | 6.9 MB 00:00:00
extras/7/x86_64/filelists_db | 603 kB 00:00:02
updates/7/x86_64/filelists_db | 3.3 MB 00:00:00
lrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programs
源 :base
匹配来源:
文件名 :/usr/bin/rx
   yum install -y lrzsz-0.12.20-36.el7.x86_64
  • 编译过程中出现报错

 

第一种:

[webapp@MyLinux redis-4.0.9]$ make
cd src && make all
make[1]: Entering directory `/home/webapp/redis-4.0.9/src'
    CC Makefile.dep
make[1]: Leaving directory `/home/webapp/redis-4.0.9/src'
make[1]: Entering directory `/home/webapp/redis-4.0.9/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 `/home/webapp/redis-4.0.9/deps'
(cd hiredis && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd linenoise && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd lua && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd jemalloc && [ -f Makefile ] && make distclean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(rm -f .make-*)
make[2]: Leaving directory `/home/webapp/redis-4.0.9/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 `/home/webapp/redis-4.0.9/deps'
(cd hiredis && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd linenoise && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd lua && make clean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(cd jemalloc && [ -f Makefile ] && make distclean) > <a style="color:#3465A4" href="/dev/null">/dev/nulla> || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/home/webapp/redis-4.0.9/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 `/home/webapp/redis-4.0.9/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/home/webapp/redis-4.0.9/deps'
make[1]: [persist-settings] Error 2 (ignored)
    CC adlist.o
<a style="color:#3465A4" href="/bin/sh">/bin/sha>: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/home/webapp/redis-4.0.9/src'
make: *** [all] Error 2

 

提示gcc命令未找到,这是因为redis没有安装gcc编译器没安装
这时候只要安装编译器即可

[webapp@MyLinux redis-4.0.9]# yum install -y gcc g++ gcc-c++ make

安装完成提示

nstalled:
  gcc.x86_64 0:4.4.7-18.el6_9.2        gcc-c++.x86_64 0:4.4.7-18.el6_9.2       

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6            cpp.x86_64 0:4.4.7-18.el6_9.2   
  libstdc++-devel.x86_64 0:4.4.7-18.el6_9.2    mpfr.x86_64 0:2.4.1-6.el6       
  ppl.x86_64 0:0.10.2-11.el6                  

Dependency Updated:
  libgcc.x86_64 0:4.4.7-18.el6_9.2        libgomp.x86_64 0:4.4.7-18.el6_9.2    
  libstdc++.x86_64 0:4.4.7-18.el6_9.2    

Complete!

 

第二种:

[root@bogon redis-3.2.8]# make  
cd src && make all  
make[1]: 进入目录“/usr/local/redis-3.2.8/src”  
    CC adlist.o  
In file included from adlist.c:34:0:  
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录  
 #include <jemalloc/jemalloc.h>  
                               ^  
编译中断。  
make[1]: *** [adlist.o] 错误 1  
make[1]: 离开目录“/usr/local/redis-3.2.8/src”  
make: *** [all] 错误 2  

原因分析: 

在README 有这个一段话

Allocator    
---------    
   
Selecting a non-default memory allocator when building Redis is done by setting    
the `MALLOC` environment variable. Redis is compiled and linked against libc    
malloc by default, with the exception of jemalloc being the default on Linux    
systems. This default was picked because jemalloc has proven to have fewer    
fragmentation problems than libc malloc.    
   
To force compiling against libc malloc, use:    
   
    % make MALLOC=libc    
   
To compile against jemalloc on Mac OS X systems, use:    
   
    % make MALLOC=jemalloc  
  
说关于分配器allocator, 如果有MALLOC  这个 环境变量, 会有用这个环境变量的 去建立Redis。  
  
而且libc 并不是默认的 分配器, 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。  
  
但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数。

我应该就是这个问题

没有jemalloc 而只有 libc 当然 make 出错。

这时候在编译过程时增加一个参数

[root@bogon redis-3.2.8]# make MALLOC=libc 

编译成功:

其中出现了两个警告

ldo.c: 在函数‘f_parser’中:  
ldo.c:496:7: 警告:未使用的变量‘c’ [-Wunused-variable]  
   int c = luaZ_lookahead(p->z);

liblua.a(loslib.o):在函数‘os_tmpname’中:  
loslib.c:(.text+0x28c): 警告:the use of `tmpnam' is dangerous, better use `mkstemp' 

 

第三种

Redis实战——安装问题汇总_第1张图片

wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz

sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/

cd /usr/local/tcl8.6.1/unix/

sudo ./configure

sudo make

sudo make install

转载于:https://www.cnblogs.com/onlymate/p/9052190.html

你可能感兴趣的:(Redis实战——安装问题汇总)