Welcome 微信登录

首页 / 数据库 / MySQL / Linux下安装Redis

准备安装

运行命令:

tar zxvf redis-3.0.4.tar.gz

进入解压后的文件夹:

cd redis-3.0.4

编译源码:

make

出错

如果出现下面错误:

[root@localhost redis-3.0.4]# makecd src && make allmake[1]: Entering directory `/root/redis-3.0.4/src‘CC adlist.o/bin/sh: cc: command not foundmake[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]# makecd src&& make allmake[1]: Entering directory `/root/redis-3.0.4/src‘CC adlist.oIn file included from adlist.c:34:zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directoryzmalloc.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下面关于Redis的文章您也可能喜欢,不妨参考下:Ubuntu 14.04下Redis安装及简单测试 http://www.linuxidc.com/Linux/2014-05/101544.htmRedis主从复制基本配置 http://www.linuxidc.com/Linux/2015-03/115610.htmRedis集群明细文档 http://www.linuxidc.com/Linux/2013-09/90118.htmUbuntu 12.10下安装Redis(图文详解)+ Jedis连接Redis http://www.linuxidc.com/Linux/2013-06/85816.htmRedis系列-安装部署维护篇 http://www.linuxidc.com/Linux/2012-12/75627.htmCentOS 6.3安装Redis http://www.linuxidc.com/Linux/2012-12/75314.htmRedis安装部署学习笔记 http://www.linuxidc.com/Linux/2014-07/104306.htmRedis配置文件redis.conf 详解 http://www.linuxidc.com/Linux/2013-11/92524.htmRedis 的详细介绍:请点这里
Redis 的下载地址:请点这里本文永久更新链接地址