zoukankan      html  css  js  c++  java
  • linux下安装redis

    1.下载redis
    下载目录 /usr/local/src
      [root@root src]# wget http://download.redis.io/releases/redis-5.0.4.tar.gz

    2.解压

      [root@root src]# tar -zxvf redis-5.0.4.tar.gz

    3.安装

      [root@root src]# cd redis-5.0.4

      [root@root redis-5.0.4]# make

      如果编译报以下错误:

        make[3]: 警告:检测到时钟错误。您的创建可能是不完整的。
        make[3]: Leaving directory `/usr/local/src/redis-5.0.4/deps/jemalloc'
        make[2]: 警告:检测到时钟错误。您的创建可能是不完整的。

        处理:

          请更新Linux系统时间(相关更新方法移步:https://www.cnblogs.com/IT-Crowd/articles/10626577.html)

      [root@root redis-5.0.4]# cd src

      [root@root src]# make install PREFIX=/usr/local/redis

    4.复制配置文件到安装目录下

      [root@root src]# cd ../

      [root@root redis-5.0.4]# mkdir /usr/local/redis/etc

      [root@root redis-5.0.4]# cp redis.conf /usr/local/redis/etc

    5.配置redis为后台启动

      [root@root redis-5.0.4]# vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes

        # By default Redis does not run as a daemon. Use 'yes' if you need it.
        # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
        daemonize yes

        # If you run Redis from upstart or systemd, Redis can interact with your

    6.将redis加入到开机启动

      [root@root redis-5.0.4]# vi /etc/rc.local

        //在里面添加以下redis服务启动领命:

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

    7.启动redis服务

      [root@root redis-5.0.4]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

    8.建立软链(/usr/bin/ 已加入环境变量,创建的软链相当于将redis加入环境变量中)

      [root@root redis-5.0.4]# ln -s /usr/local/redis/bin/redis-server /usr/bin/redis-server

      [root@root redis-5.0.4]# ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis-cli

  • 相关阅读:
    PHP基础学习笔记(一)
    安装wampserver之后,浏览器中输入localhost页面显示IIS7解决办法
    HTML5常识总结(一)
    AngularJs中的服务
    AngularJs中的directives(指令part1)
    Happy Number——LeetCode
    Binary Tree Zigzag Level Order Traversal——LeetCode
    Construct Binary Tree from Preorder and Inorder Traversal——LeetCode
    Construct Binary Tree from Inorder and Postorder Traversal——LeetCode
    Convert Sorted Array to Binary Search Tree——LeetCode
  • 原文地址:https://www.cnblogs.com/IT-Crowd/p/10626765.html
Copyright © 2011-2022 走看看