shell一键安装redis

#!/bin/bash

#================================================================
#   Copyright (C) 2019  All rights reserved.
#   
#   File::redsi_install.sh
#   Author:RoES
#   Date:2019/07/2
#   Description:install redis
#
#================================================================

dir="/home/service"
redis_download_path="http://download.redis.io/releases/redis-4.0.8.tar.gz"
redis_name="redis-4.0.8.tar.gz"

 # download redis
  [ -e $dir ] && cd $dir
  wget $redis_download_path
  if [ -f $redis_name ]
    then
      echo 'redis download success'
      # tar file
      tar zxf $redis_name && cd redis-4.0.8
      echo "run make"
      make && cd src
      make install PREFIX=/usr/local/redis

      mkdir -p /usr/local/redis/etc
      cd .. && mv redis.conf /usr/local/redis/etc
      #vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
      sed -i 's/daemonize no/daemonize yes/' /usr/local/redis/etc/redis.conf
      #port 修改端口
      #sed -i 's/port 6379/port 7000/' redis.conf
      echo "/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf" >> etc/rc.local
      #start redis
      /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
      #nohup /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf &
   fi   
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容