在Linux Centos上安装REDIS

CENTOS 7.9
# 安装Redis
sudo yum install redis -y
# 启动服务并设置开机自启
sudo systemctl start redis
sudo systemctl enable redis

 

修改Redis配置文件
编辑配置文件(路径:/etc/redis.conf):
# 允许外部访问
bind 0.0.0.0            # 注释或替换为 0.0.0.0
protected-mode no       # 关闭保护模式

# 设置访问密码
requirepass your_strong_password  # 取消注释并修改密码

 

重启Redis生效
# yum安装方式
sudo systemctl restart redis

 

##如果使用云服务器,需要确保6379端口开通访问
posted @ 2025-06-03 16:21  Terry841119  阅读(34)  评论(0)    收藏  举报