Linux 阿里云CentOS7.6 安装 redis6.2.1 及使用客户端工具连接

1、升级gcc

查看gcc版本[root@iZocyatej9zjeyZ ~]# gcc -v,如果未安装执行[root@iZocyatej9zjeyZ ~]# yum -y install gcc,版本过低升级执行

[root@iZocyatej9zjeyZ ~]# yum -y install centos-release-scl
[root@iZocyatej9zjeyZ ~]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
[root@iZocyatej9zjeyZ ~]# scl enable devtoolset-9 bash
[root@iZocyatej9zjeyZ ~]# echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile

然后查看版本,可以看到已经是 9.3.1 版本的 gcc 了
在这里插入图片描述

2、下载redis安装包并上传至Linux

下载 Redis 源码包,官网下载地址:https://redis.io/download
在这里插入图片描述
下载完后,用ftp工具将压缩包上传到 服务器,这里推荐MobaXterm,安装及使用参考这篇blog,http://www.fobgavin.com/mobaxterm-instruction-1.html

3、安装redis

解压[root@iZocyatej9zjeyZ opt]# tar -zxf redis-6.2.1.tar.gz,进入 解压后的目录[root@iZocyatej9zjeyZ opt]# cd redis-6.2.1,执行 make 命令[root@iZocyatej9zjeyZ redis-6.2.1]# make,然后会进行编译,稍等片刻看到打印出如下内容,便是已经编译成功
在这里插入图片描述
进入到 src 目录下[root@iZocyatej9zjeyZ redis-6.2.1]# cd src/,进行安装
[root@iZocyatej9zjeyZ src]# make install,安装完后启动一下 Redis ,输入如下命令:[root@iZocyatej9zjeyZ src]# redis-server ../redis.conf,打印以上内容,则 Redis 已经正常启动

4、编辑配置文件

此时启动不是后台运行, Ctrl+c先退出redis。执行[root@iZocyatej9zjeyZ redis-6.2.1]# vim ./redis.conf打开redis.conf 这个文件中进行常规配置
开放IP,注释掉 bind 127.0.0.1
在这里插入图片描述
打开后台运行
在这里插入图片描述
关闭保护模式
在这里插入图片描述
编辑完后Esc+:+wq+enter保存,重启redis[root@iZocyatej9zjeyZ redis-6.2.1]# src/redis-server redis.conf,查看进程[root@iZocyatej9zjeyZ redis-6.2.1]# ps aux|grep redis检查redis是否启动
在这里插入图片描述

5、使用 Redis 客户端工具远程链接

打开阿里云防火墙
在这里插入图片描述
安装Redis 客户端工具
安装及使用参考这篇blog,https://www.jianshu.com/p/6895384d2b9e,如果里面的安装包链接失效就用这个https://wws.lanzous.com/izmmbitobzc
测试
在这里插入图片描述

原文地址:https://www.cnblogs.com/nqdxt/p/14552108.html