yum安装
切换国内镜像,配置yum源
# 备份源镜像
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
# 下载阿里云Base镜像以及EPEL镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 清理和生成缓存
yum clean all && yum makecache
安装redis
- 安装命令
yum install -y redis
- 默认端口:6379
- 配置文件
vi /etc/redis.conf
设置远程访问
- 方案1、注释bind,关闭保护模式,此方案适合测试开发环境
vi /etc/redis.conf
注释 bind 127.0.0.1
设置protected-mode no
- 方案2、绑定具体使用redis服务IP,配置密码
- 重启服务
systemctl restart redis
注:如果设置了requirepass,则远程连接必须包括密码,无论protected-mode是yes/no
参考:网上各种redis安装教程整合