如何安装最新稳定版本的 Redis?

如何安装最新稳定版本的 Redis?

我是 redis 新手。我刚刚按照 cli 安装了 redis sudo apt-get install redis。但安装服务器版本是2.2.12。如果我想更新此版本并想安装,redis 2.7 +那么我该怎么做,请帮忙。我正在研究ubuntu 12.04

答案1

从编译来源.deb或者通过以下方式构建包fpm

安装fpm方式gem

# apt-get install rubygems
# gem install fpm

编译Redis:

# cd /usr/local/src/
# wget http://redis.googlecode.com/files/redis-2.4.16.tar.gz
# tar zxvf redis-2.4.16.tar.gz 
# cd redis-2.4.16/
# make

构建.deb包:

# mkdir -p /tmp/redis-$VERSION.$$/usr/bin
# mkdir -p /tmp/redis-$VERSION.$$/etc

# cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-server} /tmp/redis-$VERSION.$$/usr/bin

# cp redis.conf /tmp/redis-$VERSION.$$/etc/redis.conf
# cd ..

# fpm -s dir -t deb -n redis-server -v 2.4.16 -C /tmp/redis-2.4.16.18597/ -p redis-server-2.4.16_amd64.deb usr/bin/

升级 Redis:

# dpkg -i redis-server-2.4.16_amd64.deb
dpkg: warning: downgrading redis-server from 2:2.2.12-1build1 to 2.4.16.
(Reading database ... 148744 files and directories currently installed.)
Preparing to replace redis-server 2:2.2.12-1build1 (using redis-server-2.4.16_amd64.deb) ...
Stopping redis-server: redis-server.
Unpacking replacement redis-server ...
dpkg: warning: unable to delete old directory '/var/log/redis': Directory not empty
dpkg: warning: unable to delete old directory '/etc/redis': Directory not empty
Setting up redis-server (2.4.16) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...

检查版本:

# /usr/bin/redis-server -v
Redis server version 2.4.16 (00000000:0)

来源:https://gist.github.com/944216

答案2

我按照这个安装了checkinstall 教程,我遵循的步骤如下:

  1. 安装检查安装及其依赖项:

    sudo apt-get install build-essential automake autoconf libtool pkg-config libcurl4-openssl-dev intltool libxml2-dev libgtk2.0-dev libnotify-dev libglib2.0-dev libevent-dev checkinstall

  2. 制作软件包并安装.deb 文件

    ./配置&&制作&&sudo检查安装

对我来说效果很好。

答案3

redis 服务器软件包也由 ubuntu 维护。因此,您可以使用以下命令进行安装

apt-get install redis-server

相关内容