当前位置:   article > 正文

redis下载与安装_redis 7.0.5 下载

redis 7.0.5 下载

redis下载与安装

  1. redis下载地址:https://github.com/redis/redis/archive/7.0.5.tar.gz

  2. 解压:tar -zxvf redis-7.0.5.tar.gz

  3. 编译:

    	make  
    	#需要有gcc支持,否则会编译失败 
    
    • 1
    • 2
  4. 清除编译:

    	make distclean
    	#make失败后重新make的时候之前用一下
    	make 
    
    • 1
    • 2
    • 3
  5. 安装:make PREFIX=/opt/redis7 install

安装redis服务

  • 前置,配置环境变量

    1. 打开环境配置: vi /etc/profile
    2. 在环境配置文件中最后追加:
    	export REDIS_HOME=/opt/redis7
    	export PATH=$PATH:$REDIS_HOME/bin	
    
    • 1
    • 2
    1. 让配置生效:source /etc/profile

    2. 查看环境变量PATH:echo $PATH

      配置完环境变量redis命令可以在任意目录执行了

  • 安装

    1. 进入redis安装根目录utils下:cd utils

    2. 执行install_server.sh 命令: ./install_server.sh

      	这个地方可能会报错
      	
      	vi install_server.sh
      	注释掉下面几行
      
      	#_pid_1_exe="$(readlink -f /proc/1/exe)"
      	
      	#if [ "${_pid_1_exe##*/}" = systemd ]
      	
      	#then
      
      	# echo "This systems seems to use systemd."
      	
      	# echo "Please take...them. Sorry!"
      	
      	# exit 1
      	
      	#fi
      
      	保存退出,即可解决问题
      
      	继续执行 ./install_server.sh
      
      	Please ...port for this instance: [6379] 
      	让我们选择端口号,我们选择默认,回车继续...	    	
      	
      	Copied /tmp/6379.conf => /etc/init.d/redis_6379
      	Installing service...
      	Successfully added to chkconfig!
      	Successfully added to runlevels 345!
      	Starting Redis server...
      	Installation successful!
      	
      	完成后会在/etc/init.d/下生成一个redis_6379可执行文件。
      	
      
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
      • 32
      • 33
      • 34
      • 35
      • 36
    3. redis_6379文件内容如下

      #!/bin/sh
      #Configurations injected by install_server below....
      
      EXEC=/opt/redis7/bin/redis-server
      CLIEXEC=/opt/redis7/bin/redis-cli
      PIDFILE=/var/run/redis_6379.pid
      CONF="/etc/redis/6379.conf"
      REDISPORT="6379"
      ###############
      # SysV Init Information
      # chkconfig: - 58 74
      # description: redis_6379 is the redis daemon.
      ### BEGIN INIT INFO
      # Provides: redis_6379
      # Required-Start: $network $local_fs $remote_fs
      # Required-Stop: $network $local_fs $remote_fs
      # Default-Start: 2 3 4 5
      # Default-Stop: 0 1 6
      # Should-Start: $syslog $named
      # Should-Stop: $syslog $named
      # Short-Description: start and stop redis_6379
      # Description: Redis daemon
      ### END INIT INFO
      
      
      case "$1" in
          start)
              if [ -f $PIDFILE ]
              then
                  echo "$PIDFILE exists, process is already running or crashed"
              else
                  echo "Starting Redis server..."
                  $EXEC $CONF
              fi
              ;;
          stop)
              if [ ! -f $PIDFILE ]
              then
                  echo "$PIDFILE does not exist, process is not running"
              else
                  PID=$(cat $PIDFILE)
                  echo "Stopping ..."
                  $CLIEXEC -p $REDISPORT shutdown
                  while [ -x /proc/${PID} ]
                  do
                      echo "Waiting for Redis to shutdown ..."
                      sleep 1
                  done
                  echo "Redis stopped"
              fi
              ;;
          status)
              PID=$(cat $PIDFILE)
              if [ ! -x /proc/${PID} ]
              then
                  echo 'Redis is not running'
              else
                  echo "Redis is running ($PID)"
              fi
              ;;
          restart)
              $0 stop
              $0 start
              ;;
          *)
          echo "Please use start, stop, restart or status as first argument"
          ;;
      esac
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
      • 32
      • 33
      • 34
      • 35
      • 36
      • 37
      • 38
      • 39
      • 40
      • 41
      • 42
      • 43
      • 44
      • 45
      • 46
      • 47
      • 48
      • 49
      • 50
      • 51
      • 52
      • 53
      • 54
      • 55
      • 56
      • 57
      • 58
      • 59
      • 60
      • 61
      • 62
      • 63
      • 64
      • 65
      • 66
      • 67
      • 68
    4. 执行开启redis只需要执行service redis_6379 start …

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/875870
推荐阅读
相关标签
  

闽ICP备14008679号