• 常用服务部署脚本(nodejs,pyenv,go,redis,)


    根据工作总结的常用安装脚本,要求linux-64系统

    #!/bin/bash
    path=/usr/local/src
    
    node () {
      cd $path
      #wget https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz
    <<<<<<< HEAD
      curl -O  https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz
    =======
      curl -O https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz
    >>>>>>> f55f1324b629c9be4f9166780e3cebc0f15c8975
      xz -d node-v8.11.4-linux-x64.tar.xz
      tar -xf node-v8.11.4-linux-x64.tar -C /usr/local/
      ln -s /usr/local/node-v8.11.4-linux-x64 /usr/local/node
      echo 'export PATH=/usr/local/node/bin:$PATH' >>/etc/profile
      source /etc/profile
      npm install -g yarn pm2 forever
    }
    
    redis () {
      echo "install redis  y/n?"
      read  -t 5 -p "(Default option: y):" option
      [ -z "${option}" ] && option="y"
      if [ "${option}" == "y" ] || [ "${option}" == "Y" ]; then
          cd $path
          wget http://download.redis.io/releases/redis-4.0.10.tar.gz
          tar -zxvf redis-4.0.10.tar.gz -C /usr/local/
          ln -s /usr/local/redis-4.0.10 /usr/local/redis
          cd /usr/local/redis
          make
          find /usr/local/redis/src/ -perm 0755 -exec  ln -s {} /bin/ ;
          cp redis.conf /etc/
      fi
    }
    
    pyenv () {
      git clone https://github.com/pyenv/pyenv.git ~/.pyenv
      echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
      echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
      echo -e 'if command -v pyenv 1>/dev/null 2>&1; then
      eval "$(pyenv init -)"
    fi' >> ~/.bash_profile
      exec "$SHELL"
    }
    pyenv_virtual (){
      git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
      echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
      exec "$SHELL"
    }
    
    go (){
    	cd $path
    	sudo wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
    	sudo tar -C /usr/local -xzf go1.11.4.linux-amd64.tar.gz
    	export PATH=$PATH:/usr/local/go/bin
    }
    
    soft=$1
    case $soft in
      node)
        node
        ;;
      redis)
        redis
        ;;
      pyenv)
        pyenv
        ;;
      virtual)
        pyenv_virtual
        ;;
      go)
        go
        ;;
      *)
        echo $0 "node|redis|pyenv"
        ;;
    esac
    
  • 相关阅读:
    棋盘问题 简单搜索DFS
    Equivalent Strings
    素数环
    LeetCode Maximum Product Subarray
    UVA 725 – Division
    矩形嵌套问题
    ACM最大子串和问题
    ACM装箱问题
    ACM田胫赛马
    ACM雷达安放问题
  • 原文地址:https://www.cnblogs.com/johnsonjie/p/10876309.html
Copyright © 2020-2023  润新知