• yum下载安装redis


    有时需要离线安装redis,所以需要redis离线安装包,不同的centos版本和redis版本,依赖包不同,本例中,centos: CentOS Linux release 7.0.1406 (Core),Basic Web Server版本,自动下载的redis版本为3.2.12

    1、检查是否存在redis安装包

    yum search redis

    2、若未找到redis安装包,则安装epel-release源

    yum -y install epel-release

    3、再次查询仓库中是否存在redis,若出现如下异常,则在/usr/lib/python2.7/site-packages/urlgrabber/grabber.py中1510行左右将elif errcode in (42, 55, 56) 改为elif errcode == 42 ,然后再次查询

    [root@localhost ~]# yum search redis
    Loaded plugins: fastestmirror, langpacks
    epel/x86_64/metalink                                                                                                                                                  | 6.9 kB  00:00:00     
    epel                                                                                                                                                                  | 4.7 kB  00:00:00     
    epel/x86_64/primary_db         FAILED                                          
    https://mirror.lzu.edu.cn/epel/7/x86_64/repodata/d1d0107c74472c4a2af56fa4436caafe3c76a57c446b11b54901609d26893a17-primary.sqlite.bz2: [Errno 14] curl#35 - "Cannot communicate securely with peer: no common encryption algorithm(s)."
    Trying other mirror.
    Traceback (most recent call last):
      File "/usr/libexec/urlgrabber-ext-down", line 75, in <module>
        main()
      File "/usr/libexec/urlgrabber-ext-down", line 61, in main
        fo = PyCurlFileObject(opts.url, opts.filename, opts)
      File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1258, in __init__
        self._do_open()
      File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open
        self._do_grab()
      File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab
        self._do_perform()
      File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform
        raise KeyboardInterrupt
    KeyboardInterrupt

    4、正常查询,出现

    redis.x86_64 : A persistent key-value database

    则源安装成功

    5、下载安装包

    yum install --downloadonly --downloaddir=/work redis

    出现

    exiting because "Download Only" specified

    下载结束,查看redis

    [root@localhost ~]# whereis redis
    redis:[root@localhost ~]# ll /work/
    total 660
    -rw-r--r--. 1 root root 107040 Apr  2  2014 jemalloc-3.6.0-1.el7.x86_64.rpm
    -rw-r--r--. 1 root root 556969 Oct 26 15:10 redis-3.2.12-2.el7.x86_64.rpm
    [root@localhost ~]# 

    redis安装包及依赖包下载完成,并且没有安装

    6、安装

    rpm -ivh /work/*

    安装结束后,查看redis安装情况

    [root@localhost ~]# whereis redis
    redis: /etc/redis.conf

    7、启动redis(开机启动文件在redis安装完成后,自动放入/usr/lib/systemd/system/中)

    systemctl start redis

    /usr/lib/systemd/system/redis.service

    [Unit]
    Description=Redis persistent key-value database
    After=network.target
    After=network-online.target
    Wants=network-online.target
    
    [Service]
    ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
    ExecStop=/usr/libexec/redis-shutdown
    Type=notify
    User=redis
    Group=redis
    RuntimeDirectory=redis
    RuntimeDirectoryMode=0755
    
    [Install]
    WantedBy=multi-user.target

    8、登录

    [root@localhost ~]# redis-cli 
    127.0.0.1:6379>

    这种方式看似方便,但redis官方不推荐这种方式来安装redis,因为这种方式安装的redis不是当前最新的可用版本。当前稳定版本是5.0.4,但目前通过yum下载到的版本是3.2.12.

  • 相关阅读:
    leetcode 1 Two sum
    hdu1099
    hdu1098
    函数执行顺序
    浏览器滚动条
    2048的制作
    JavaScript--对象-检查一个对象是否是数组
    JavaScript--格式化当前时间
    JavaScript--模拟验证码
    JavaScript--模拟网络爬虫
  • 原文地址:https://www.cnblogs.com/qq931399960/p/10583267.html
Copyright © 2020-2023  润新知