ubuntu安装redis
Posted dahu的菜园子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu安装redis相关的知识,希望对你有一定的参考价值。
方式一:
下载地址:http://redis.io/download,下载最新文档版本。
本教程使用的最新文档版本为 2.8.17,下载并安装:
$ wget http://download.redis.io/releases/redis-2.8.17.tar.gz
$ tar xzf redis-2.8.17.tar.gz
$ cd redis-2.8.17
$ make
make 完后 redis-2.8.17 目录下会出现编译后的 redis 服务程序 redis-server, 还有用于测试的客户端程序 redis-cli, 两个程序位于安装目录 src 目录下:
下面启动 redis 服务.
$ cd src
$ ./redis-server
注意这种方式启动 redis 使用的是默认配置。也可以通过启动参数告诉 redis 使用指定配置文件使用下面命令启动。
$ cd src
$ ./redis-server redis.conf
redis.conf 是一个默认的配置文件。我们可以根据需要使用自己的配置文件。
启动 redis 服务进程后,就可以使用测试客户端程序 redis-cli 和 redis 服务交互了。 比如:
$ cd src
$ ./redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
方式二:
在 Ubuntu 系统安装 Redi 可以使用以下命令:
$sudo apt-get update
$sudo apt-get install redis-server
启动 Redis
$ redis-server
查看 redis 是否启动?
$ redis-cli
以上命令将打开以下终端:
redis 127.0.0.1:6379>
127.0.0.1 是本机 IP ,6379 是 redis 服务端口。现在我们输入 PING 命令。
redis 127.0.0.1:6379> ping
PONG
以上说明我们已经成功安装了 redis。
安装可视化工具
Redis Desktop Manager,这个工具操作redis还是蛮好用的,如下图。
免费下载链接:http://pan.baidu.com/s/1cA3jWU
再说安装过程
ubuntu10+以上,才支持额。
方法一
双击安装即可,如果安装不上,说明缺少依赖组建,按照第二种方法即可。
方法二
1. sudo dpkg -i redis-desktop-manager_0.8.3-120_amd64.deb
2. 可能安装不成功,提示要安装zlibc,终端命令安装:执行 sudo apt-get install zlib1g-dev
3. sudo apt-get -f install
我这里显示缺少libicu52依赖包,安装它即可:sudo apt-get -f install libicu52
我这里显示,没有安装候选,说明,我的ubuntu源里面没有这个包,果断换网易的ubuntu源,步骤如下:
1.首先打开终端,用root登陆。
2.切换到/etc/apt/目录下,执行:cd /apt/get/
3.将里面的sources.list复制一下,为了安全备份一下。cp sources.list sources.list1
4.用vim或gedit编辑sources.list文件,删除里面所有的东西,吧163的源链接(文章底部提供)全部复制进去,保存即可。
5.最后执行:apt-get update。更新163源到当前系统
2.这时候,我们继续安装缺少的依赖包libicu52 命令:sudo apt-get -f install libicu52,安装完成后,在执行
sudo dpkg -i redis-desktop-manager_0.8.3-120_amd64.deb,完事。
停止redis ./redis-cli -h 127.0.0.1 -p 6379 -a simon.zhang shutdown
提供 redis 集群环境解决方法
http://blog.163.com/a12333a_li/blog/static/87594285201304103257837/
如何使用?
打开之后,点击绿色的 + 号,创建链接即可。
163源:
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.163.com/ubuntu/trusty-proposed main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
aliyun源:
deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse Precise(12.04) deb http://mirrors.aliyun.com/ubuntu/precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse Oneiric(11.10) deb http://mirrors.aliyun.com/ubuntu/ oneiric main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ oneiric-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ oneiric-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ oneiric-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ oneiric-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ oneiric main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ oneiric-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ oneiric-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ oneiric-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ oneiric-backports main restricted universe multiverse Natty(11.04) deb http://mirrors.aliyun.com/ubuntu/ natty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ natty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ natty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ natty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ natty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ natty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ natty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ natty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ natty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ natty-backports main restricted universe multiverse
以上是关于ubuntu安装redis的主要内容,如果未能解决你的问题,请参考以下文章