安装redis时出现的错误

在安装redis时出现了一些没见过错误:

第一

1 Redis为c语言编写,因此安装需要配置c语言编译环境gcc,查看linux是否安装了该编译环境,可以直接输入命令查看如下图所示:

安装redis时出现的错误

而如果提示commond not find则意味着本机并无该环境,因此需要安装gcc环境,采用yum install gcc-c++执行进行安装,

然后上传redis的安装包,并解压(别忘了关闭防火墙哦)。

然后当你输入命令make && make install 进行编译安装时又发现报如下错误:安装redis时出现的错误

这是因为在redis的根目录下有一个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 出错。 所以才会报错。

解决如下:安装redis时出现的错误

执行完成之后,开始编译安装就可以正常操作了OK了