首先去官网下载redis安装包:下载redis
准备安装
运行命令:
tar zxvf redis-3.0.4.tar.gz
进入解压后的文件夹:
cd redis-3.0.4
编译源码:
make
出错
如果出现下面错误:
[root@localhost redis-3.0.4]# make
cd src && make all
make[1]: Entering directory `/root/redis-3.0.4/src‘
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127make[1]: Leaving directory `/root/redis-3.0.4/src‘
make: *** [all] Error 2
则需要安装gcc
如果出现下面错误:
[root@localhost redis-3.0.4]# make
cd src&& make all
make[1]: Entering directory `/root/redis-3.0.4/src‘
CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1make[1]: Leaving directory `/root/redis-3.0.4/src‘
make: *** [all] Error 2
则更改make命令,为 make MALLOC=libc
安装
安装完成后,执行make install,执行文件被复制到了/usr/local/bin中,
需要手动复制配置文件'
cp redis.conf /usr/local/bin
启动服务器:
./redis-server redis.conf
启动客户端:
./redis-cli
本文转自博客园xingoo的博客,原文链接:Linux下安装Redis,如需转载请自行联系原博主。