美文网首页
centos7.x安装Redis与配置

centos7.x安装Redis与配置

作者: 隔岸坐看云卷云舒 | 来源:发表于2019-03-30 23:21 被阅读0次

必备条件:Centos7.x版本系统

1.安装虚拟机服务器后获取虚拟机的固定IP

执行命令

ip addr
WechatIMG471.jpeg

2.链接服务器:
执行命令

ssh root@你服务器的ip
shumingjiandeMacBook-Pro-2:~ shumingjian$ ssh root@192.168.2.101
root@192.168.2.101's password: 
Last login: Sat Mar 30 22:53:59 2019
[root@localhost ~]# 

3.安装redis
如果需要下载新版先执行

yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum --enablerepo=remi install redis

OR

执行命令

yum install redis
[root@localhost ~]# yum install redis
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                     | 6.7 kB     00:00     
 * base: mirrors.aliyun.com
 * epel: ftp.jaist.ac.jp
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nwsuaf.edu.cn
base                                                     | 3.6 kB     00:00     
epel                                                     | 4.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
(1/3): updates/7/x86_64/primary_db                         | 3.4 MB   00:07     
(2/3): epel/x86_64/updateinfo                              | 1.0 MB   00:07     
(3/3): epel/x86_64/primary_db                              | 6.6 MB   06:05     
正在解决依赖关系
--> 正在检查事务
---> 软件包 redis.x86_64.0.3.2.12-2.el7 将被 安装
--> 正在处理依赖关系 libjemalloc.so.1()(64bit),它被软件包 redis-3.2.12-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 jemalloc.x86_64.0.3.6.0-1.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package           架构            版本                     源             大小
================================================================================
正在安装:
 redis             x86_64          3.2.12-2.el7             epel          544 k
为依赖而安装:
 jemalloc          x86_64          3.6.0-1.el7              epel          105 k

事务概要
================================================================================
安装  1 软件包 (+1 依赖软件包)

总下载量:648 k
安装大小:1.7 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): jemalloc-3.6.0-1.el7.x86_64.rpm                     | 105 kB   00:06     
(2/2): redis-3.2.12-2.el7.x86_64.rpm                       | 544 kB   00:01     
--------------------------------------------------------------------------------
总计                                                82 kB/s | 648 kB  00:07     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : jemalloc-3.6.0-1.el7.x86_64                                 1/2 
  正在安装    : redis-3.2.12-2.el7.x86_64                                   2/2 
  验证中      : redis-3.2.12-2.el7.x86_64                                   1/2 
  验证中      : jemalloc-3.6.0-1.el7.x86_64                                 2/2 

已安装:
  redis.x86_64 0:3.2.12-2.el7                                                   

作为依赖被安装:
  jemalloc.x86_64 0:3.6.0-1.el7                                                 

完毕!
[root@localhost ~]# 

4.修改配置文件
如果你是本地测试就不用 直接链接6379即可
这里划重点,如果是外网服务,必须修改端口,禁止6379默认与空口令,避免被挖矿脚本扫描到,进而提权

vim /etc/redis.conf

绑定本机内网ip

bind 127.0.0.1 192.168.2.101

修改端口

port 6380

增加密码

requirepass 227227

保存修改

:wq

设置开机启动与启动

systemctl enable redis.service
systemctl start redis

测试

[root@localhost ~]# /usr/bin/redis-cli -p 6380
127.0.0.1:6380> AUTH 227227
OK
127.0.0.1:6380> set test 1
OK
127.0.0.1:6380> del test
(integer) 1
127.0.0.1:6380> 

外网测试

shumingjiandeMacBook-Pro-2:~ shumingjian$ /usr/local/bin/redis-cli -p 6380 -h 192.168.2.101
192.168.2.101:6380> AUTH 227227
OK
192.168.2.101:6380> set test 2
OK
192.168.2.101:6380> del test
(integer) 1
192.168.2.101:6380> 

相关文章

  • Linux 安装

    Linux下安装mysql CentOS7.x系统安装Redis6.0.1 Linux安装redis和部署 Red...

  • centos7.x安装Redis与配置

    必备条件:Centos7.x版本系统 1.安装虚拟机服务器后获取虚拟机的固定IP 执行命令 2.链接服务器:执行命...

  • Redis的使用

    Redis的使用 如果还不会安装redis安装与配置的,请看本座之前写的redis的安装与配置。查找一下历史Blo...

  • springboot整合redis

    一、redis服务器安装与配置 1.redis安装 2.开启远程访问redis服务:修改redis.conf配置文...

  • Redis入门 -- Redis安装与配置

    Redis入门 -- Redis安装与配置 Redis的安装 Redis的安装,我这里使用的是虚拟机。 为了让主机...

  • redis 安装与配置

    redis 安装与配置 redis安装 源码编译安装 生成的可执行文件 redis-benchmark redi...

  • redis

    redis安装与配置 获取redis资源wget http://download.redis.io/redis-s...

  • 2018-11-21

    Ubuntu系统下Nginx服务器与Redis安装配置 一、Nginx安装与配置 1.安装 ...

  • Linux环境安装Redis服务

    CentOS环境上Redis的安装与配置 源码安装 yum安装gcc依赖 解压 编译安装 直接启动redis 以后...

  • Ubuntu安装配置Redis

    安装Redis 安装并启动 检查Redis是否运行 ubuntu安装Redis桌面管理器 Redis配置 查看配置...

网友评论

      本文标题:centos7.x安装Redis与配置

      本文链接:https://www.haomeiwen.com/subject/dheebqtx.html