想要了解 Redis 的最新特性, 可是 Windows 下的可以安装的版本最高为 3.2, 想要验证 Redis 的诸如 stream 特性的话, 就无能为力了.
解决方法之一在 Windows 上安装虚拟机, 然后再虚拟机上安装 Linux 操作系统, 如 CentOS,Ubuntu 等, 然后再其上面安装 Redis 最新版本. 这个有点麻烦, 如果不想如此麻烦, 该怎么做呢?
WSL 是由 Windows 内核团队与 Canonical 合作设计和开发的, 可以让 Windows 10 下的开发者们在拥有 Windows 中那些强力支持之外,
还能使用 Linux 下丰富的开发环境与工具, 而不用启动到另外的操作系统或者使用虚拟机. 这绝对是一个 "来自开发者, 服务开发者" 的 Windows 10 特色, 它的目的是让开发者们每天的开发工作都变得顺畅而便捷.
本文以 CentOS 为例, 进行演示
安装前准备工作
1. window10 下面安装 CentOS
安装步骤就按照提示进行即可
2.CentOS 安装 Redis 最新版本 5.0.5
2.1 进入 CentOS, 安装 wget
rpm -qa|grep "wget"
2.2 安装
yum -y install wget
2.3 下载 Redis 最新包
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
2.4 解压
tar xzf Redis-5.0.5.tar.gz
我是放到 / usr/local 目录下的
2.5 安装依赖
- yum groupinstall 'Development Tools'
- yum install gcc
- yum install gcc-c++
2.6 编译
进入 Redis-5.0.5 目录
make
报错:
fatal error: jemalloc/jemalloc.h: No such file or directory
处理报错
cd deps; make hiredis lua jemalloc linenoise
进入 Redis-5.0.5 目录, 重新编译, 安装
make make install
安装成功
- Hint: It's a good idea to run'make test'
- INSTALL install
- INSTALL install
- INSTALL install
- INSTALL install
- INSTALL install
2.7 修改 Redis.conf 配置文件
- protected-mode no # 关闭保护模式
- daemonize yes # 守护进程模式开启
- port 6381
2.8 启动 Redis
此时 / usr/local/bin 下面有 Redis-server,Redis-cli, 启动 Redis-server
/usr/local/bin/Redis-server Redis.conf
2.9 验证 Redis
进入 / usr/local/bin 目录
Redis-cli -h 127.0.0.1 -p 6381
执行 info
安装成功
3. 从 window10 上进行测试
设置 key, 在 CentOS 客户端可以获取到.
来源: https://www.cnblogs.com/davidwang456/p/11287986.html