在 Linux 上安装 Redis 开源版
如何使用 RPM 安装 Redis 开源版
Redis 开源版 |
---|
使用 RPM 在 Red Hat、CentOS 或 Rocky Linux 上安装 Redis 开源版
请参阅 此页面,了解支持的 Red Hat/Rocky 平台的完整列表。请按照以下步骤安装 Redis 开源版。
-
创建文件
/etc/yum.repos.d/redis.repo
,内容如下。[Redis] name=Redis baseurl=http://packages.redis.io/rpm/rhel9 # replace rhel9 with the appropriate value for your platform and remove this comment enabled=1 gpgcheck=1
-
运行以下命令
curl -fsSL https://packages.redis.io/gpg > /tmp/redis.key sudo rpm --import /tmp/redis.key sudo yum install epel-release sudo yum install redis-server
Redis 不会自动启动,也不会在引导时启动。要实现自动启动,请运行以下命令。
sudo systemctl enable redis-server
sudo systemctl start redis-server