原创

麒麟操作系统安装redis7


依赖

yum update -y gcc make tcl

下载Redis7的安装包

wget http://download.redis.io/releases/redis-7.0.0.tar.gz

安装

## 解压缩
tar -vzxf redis-7.0.0.tar.gz

## 进入安装目录
cd redis-7.0.0/

## 安装
make
make install

## 启动服务
cd src
./redis-server

## 连接验证
./redis-cli
127.0.0.1:6379> ping
PONG
表示正常

配置

## 复制配置文件
cp redis.conf /usr/local/etc/redis/redis.conf


## 编辑配置文件
vim /usr/local/etc/redis/redis.conf

配置项:
	允许远程连接
	bind * -::*
	
	端口号,一般默认不用改
	port 6379
	
	懒加载,在后台运行
	daemonize yes
	
	设置连接密码
	requirepass 123456

生效并验证

## 重启
ps -ef|grep redis
kill -9 xxx(查到的进程id)

./redis-server /usr/local/etc/redis/redis.conf

./redis-cli -h 127.0.0.1 -a 123456
127.0.0.1:6379> ping
PONG
表示正常

其他

如果远程连接不上检查防火墙是否开放端口

查看防火墙状态
systemctl status firewalld

添加端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent

重启防火墙
systemctl restart firewalld

查看开放端口列表
firewall-cmd --zone=public --list-ports
Redis
麒麟操作系统
  • 作者:一介闲人(联系作者)
  • 发表时间: 2025-10-24 18:05
  • 版权声明:原创-转载需保持署名
  • 公众号转载:请在文末添加本文链接
  • 评论