CentOS Steam 9安装 Redis

CentOS Steam 9安装 Redis

1. 安装Redis服务

shell 复制代码
yum install redis

2. 启动/关闭/重启 Redis 服务

  • 启动 Redis 服务命令:

    shell 复制代码
    systemctl start redis.service
  • 关闭 Redis 服务命令:

    shell 复制代码
    systemctl stop redis.service
  • 重启 Redis 服务命令:

    shell 复制代码
    systemctl restart redis.service
  • 注意:Redis 启动成功后如下

3. 设置开机启动

shell 复制代码
systemctl enable redis.service

4. 设置 Redis 密码

  • 编辑配置文件

    shell 复制代码
    vi /etc/redis/redis.conf
  • 找到 "# requirepass foobared",去掉前面的 "#",并把 "foobared" 改成你的密码。

  • 保存文件,重启 Redis 服务

    shell 复制代码
    systemctl restart redis.service
  • 验证密码

5. 开启远程连接

  • 编辑配置文件

    shell 复制代码
    vi /etc/redis/redis.conf
  • 找到 bind 127.0.0.1 将其注释

  • 找到 protected-mode yes 将其改为 protected-mode no

  • 保存文件,重启 Redis 服务

    shell 复制代码
    systemctl restart redis.service
  • 开放 6379 端口 重点

    注意:CentOS Stream系统默认开启了防火墙,若需要远程能登录,需开放6379端口。

    shell 复制代码
    firewall-cmd --zone=public --add-port=6379/tcp --permanent
    shell 复制代码
    firewall-cmd --reload
  • 若为云服务器需设置 安全组,若未设置依旧无法远程连接。

相关推荐
啊吧怪不啊吧21 分钟前
UU远程协助迎来升级!第一期更新实测
运维·服务器·远程工作
C_心欲无痕6 小时前
ts - tsconfig.json配置讲解
linux·前端·ubuntu·typescript·json
冰西瓜6007 小时前
国科大2025操作系统高级教程期末回忆版
linux
HIT_Weston7 小时前
93、【Ubuntu】【Hugo】搭建私人博客:面包屑(一)
linux·运维·ubuntu
cuijiecheng20188 小时前
Linux下Beyond Compare过期
linux·运维·服务器
喵叔哟8 小时前
20.部署与运维
运维·docker·容器·.net
HIT_Weston8 小时前
92、【Ubuntu】【Hugo】搭建私人博客:侧边导航栏(六)
linux·运维·ubuntu
CodeAllen嵌入式8 小时前
Windows 11 本地安装 WSL 支持 Ubuntu 24.04 完整指南
linux·运维·ubuntu
期待のcode8 小时前
前后端分离项目 Springboot+vue 在云服务器上的部署
服务器·vue.js·spring boot
AI 智能服务8 小时前
第6课__本地工具调用(文件操作)
服务器·人工智能·windows·php