zoukankan      html  css  js  c++  java
  • golang 安装脚本

    #!/bin/bash env
    
    sudo yum -y install wget curl
    
    
    echo "download golang ..."
    # 获取最新的golangurl
    url=`curl https://golang.google.cn/dl/ | grep -i -o -E 'href=".+?linux-amd64.tar.gz"' | head -n 1| egrep -i -o -E 'http[^"]+'`
    wget $url
    
    echo "解压glang安装包..."
    name=`echo $url | egrep -i -o -E '[^/]+linux-amd64.tar.gz'`
    echo "开始启动... "
    sudo mv $name /usr/local
    cd /usr/local
    sudo tar zvxf $name
    
    echo "配置golang 的环境变量..."
    
    cd ~/
    
    sed -i '$aGOPATH=~/workspace/go' ~/.bash_profile
    sed -i '$aGOROOT=/usr/local/go'  ~/.bash_profile
    sed -i '$aPATH=$PATH:$GOROOT/bin:$GOPATH/bin'  ~/.bash_profile
    sed -i '$aexport GOPATH' ~/.bash_profile
    sed -i '$aexport PATH' ~/.bash_profile
    source ~/.bash_profile
    
    echo "创建GOPATH目录"
    mkdir -p ~/workspace/go
    cd $GOPATH
    
    mkdir src bin pkg
    
    
    source ~/.bash_profile
    
  • 相关阅读:
    8.20Java之反射机制的基本概念
    8.18Go语言之字符串
    Debug
    Feign
    Nacos
    SpringCloud Alibaba
    SpringCloud
    Maven
    Maven
    Jenkins
  • 原文地址:https://www.cnblogs.com/lurenq/p/11987157.html
Copyright © 2011-2022 走看看