linux安装redisdesktopmanager(linux登录redis)

生活常识 2023-05-15 11:58生活常识www.xinxueguanw.cn

如何在Linux中安装Redis服务器 linux安装redis

服务器配置

系统CentOS 7.6配置4核8G、硬盘500G

下载redis安装包

https://download.redis.io/releases/redis-6.2.4.tar.gz复制安装包到服务器

确认服务器可以访问互联网

[root@localhost /usr]# ping www.baidu.comPING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=48 time=11.0 ms64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=48 time=11.0 ms64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=48 time=11.0 ms

安装编译环境

# yum install gcc-c++# 遇到确认都输入 y继续执行

解压安装

# tar -xvf redis-6.2.4.tar.gz -C /usr/local# cd /usr/local/redis-5.0.4# make# cd src# make PREFIX=/usr/local/redis install# 移动配置文件到安装目录下# cd ../# mkdir /usr/local/redis/etc# cp redis.conf /usr/local/redis/etc

配置后台服务启动

# vim /usr/local/redis/etc/redis.conf# 将daemonize no 改成daemonize yes

启动

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

查看

[root@localhost /]# ps -ef|grep redisroot 15162 1 0 12:21 ? 00:00:01 /usr/local/redis/bin/redis-server 127.0.0.1:6379root 17958 6646 0 12:47 pts/0 00:00:00 grep --color=auto redis

停止

# pkill redis-server或者# /usr/local/redis/bin/redis-cli shutdown

客户端登录

[root@localhost /]# /usr/local/redis/bin/redis-cli127.0.0.1:6379gt # 退出# exit

以上可以正常使用,如果要设置密码需要修改配置

配置密码

# vim /usr/local/redis/etc/redis.conf# 将requirepass test 注释去掉,修改test为自己设置的密码

重启redis

# /usr/local/redis/bin/redis-cli shutdown# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

如果要开启外网访问

# vim /usr/local/redis/etc/redis.conf# bind注释掉,即#bind 127.0.0.1# 将protected-mode 改为no# 重启redis

linux登录redis linux卸载redis

Copyright@2015-2025 www.xinxueguanw.cn 心血管健康网版板所有