Ubuntu24.04安装和配置Redis7.4 #切换到root用户 sudo su - #更新源 apt update apt upgrade #安装 lsb-release、curl 和 gpg ,以便能够添加 Redis 仓库 apt install lsb-release curl gpg #导入 Redis 的 GPG 密钥 curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg #添加 Redis 仓库到系统的软件源列表中 echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list #更新 apt update #安装Redis apt install redis #设置Redis配置文件,修改密码,bind IP,关闭保护模式 vim /etc/redis/redis.conf requirepass admin123 bind 192.168.31.80 protected-mode no #启动Redis systemctl start redis-server #查看Redis状态 systemctl status redis-server #开机自启动Redis systemctl enable redis-server #进入Redis redis-cli #开放Redis端口 ufw allow 6379 #查看Redis版本 redis-server --version #查看Redis ps -aux | grep redis ps -aux | grep 6379