使用Chocolatey(Windows包管理工具)安装
官方安装说明 https://chocolatey.org/install
两种方法
- 在Cmd命令中键入
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
- 在PowerShell命令中输入
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
安装Redis
官方安装说明 https://chocolatey.org/packages/redis-64/
在命令中键入
choco install redis-64
默认安装目录 C:\ProgramData\chocolatey\lib\redis-64。安装目录中有相关介绍文档《Redis on Windows.docx》、《Redis on Windows Release Notes》、《Windows Service Documentation.docx》
在Windows服务中运行Redis
参考安装目录中的文档《Windows Service Documentation.docx》
安装到Windows服务
在当前目录命令中键入
redis-server --service-install redis.windows.conf
以读取配置文件 redis.windows.conf ,中包括端口号(port 端口号)、授权秘钥(requirepass 秘钥)等
启动服务
在当前目录命令中键入
redis-server --service-start