简介:

Redis是一个内存中键值存储,以其灵活性、性能和广泛的语言支持而闻名。它通常用作数据库、缓存和消息代理,并支持各种数据结构。

本教程是演示如何再Ubuntu 18.04上用源码安装和配置Redis

#STEP1:安装依赖项

下载源码之前,必须满足构建依赖性
$ sudo apt update
$ sudo apt install build-essential tcl

#STEP2:下载、编译和安装Redis
安装依赖项以后,就可以下载源码了。用curl下载Redis最稳定的版本。最新的版本始终能在稳定的下载链接中找到

$ curl -O http://download.redis.io/redis-stable.tar.gz

解压缩:

$ tar zxvf  redis-stable.tar.gz

执行以下操作进入解压后的redis文件夹编译安装

$ cd redis-stable
$ make
$ make test
$ sudo make install

安装完成之后,开始配置。在etc目录中创建新的文件夹,并复制源码中的示例redis配置文件到新文件夹

sudo mkdir /etc/redis
sudo cp  redis-stable/redis.conf   /etc/redis		//源码所在目录

编辑配置文件

sudo vim /etc/redis/redis.conf
. . .

# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the \'dbfilename\' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /var/lib/redis

. . .
收藏 打印