云深处 发表于 2018-11-4 13:32:19

自动下载安装redis-linux

  由于开发的同事想在它本地的虚拟机玩一下redis缓存,当即给他写了一个脚本,现在贴在这里,有需要的朋友可以看看:(此脚本大致包含了创建用户以及密码,下载编译安装redis,修改配置文件,启动redis服务,还是比较简单的)
  ############################ install_redis.sh ###############################
  #!/bin/bash
  # define the function of create password
  create_passwd(){
  a=(a b c d e f A B C D E F @ $ % 0 1 2 3 4 5 6 7 8 9)
  for ((i=0;i> /home/redis/redis_password.txt
  echo $password | passwd --stdin redis
  # after download redis,compile and install redis
  yum -y install wget
  cd /root/src/ || mkdir -p /root/src && cd /root/src/
  wget http://download.redis.io/releases/redis-3.2.3.tar.gz
  tar xf redis-3.2.3.tar.gz
  cd /root/src/redis-3.2.3
  make
  make PREFIX=/usr/local/redis install
  cp /root/src/redis-3.2.3/redis.conf /usr/local/redis/
  sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/redis.conf
  # change the authority of redis-installed dir and startup redis service
  chown -R redis:redis /usr/local/redis/
  su - redis
  cd /usr/local/redis/bin/
  ./redis-server ../redis.conf
  echo "welcome to use redis service"
  大致上就这么多,具体脚本展示的美化部分,大家根据自己的审美看着来吧,到此一游.......

页: [1]
查看完整版本: 自动下载安装redis-linux