下载Redis
wget http://download.redis.io/releases/redis-3.2.4.tar.gz
解压,并移到想要的位置
tar zxvf redis-3.2.4.tar.gz
mv redis-3.2.4 /usr/local/
进入redis目录,编译
cd /usr/local/redis-3.2.4
make
这是可能会遇到如下问题:
这是由于没有安装GCC,安装GCC
yum install gcc
安装完成后,再make,又遇到如下问题:
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
这是由于默认使用jemalloc分配器,但是系统没有jemalloc,可以使用如下命令强制使用libc解决:
make MALLOC=libc
好像一切不是那么顺利,又出现了下面这个错误:
找了半天不知道什么原因,网上查资料也没查到,根据以往的经验,删除,重新解压安装。
这次直接make,而不是make MALLOC=libc,就莫名其妙的好了,好了,好了。。。
安装完成后会提示,执行make test,检测安装是否成功。
接着执行make test,会有提示需要tcl
安装完tcl,再执行make test就没问题了。
终于编译完成了,接下来安装
make install
执行
redis-server
看到这个熟悉的画面了吗?到这里算是安装完成了。
参考:Redis