首先进入/etc/yum.repos.d查看repo源

cd /etc/yum.repos.d/
ls

image-Pajk.png

然后在yum.repos.d 执行vim redis.repo(作者把打成了R,可参考官网用小写)。
redis官网配置

https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/rpm/

作者使用的龙蜥8所以对应的也是CentOS8,所以使用RockyLinux8的源

[Redis]
name=Redis
baseurl=https://packages.redis.io/rpm/rockylinux8
enabled=1
gpgcheck=1

image-baQL.png

注意:官网给的是http而不是https,原封不动使用http会连接超时
repo配置完后安装官网教程添加key

image-UgNB.png
执行安装命令,无法发现redis8。

image-obxP.png

清除dnf缓存重新加载包

dnf clean all
dnf makecache

image-fxHv.png
依旧无法发现。

image-Celo.png
因为repo文件命名是Redis.repo因此小写无效(按官网来则不会有这个问题)

dnf  list --disablerepo=* --enablerepo=Redis

image-vzvH.png
拉到最下面,其实是有redis8,但是没有AppStream优先级高。(可以尝试修改repo的优先级,但是我懒得弄,习惯性的使用了yum,新写法应该是dnf,问题不大。)

image-OZgw.png

指定源安装,成功安装redis8

dnf  --disablerepo="*" --enablerepo="Redis"  install redis

image-zVEW.png

后面只需要安装官网配置开机自启和启动即可。

systemctl enable redis
systemctl start redis