ubunut install golang

ubunut install golang

来源 https://www.cnblogs.com/dream397/p/13535058.html

参考 https://golang.google.cn/

 

If you're using Ubuntu 18.04 LTS or 20.04 LTS on amd64, arm64, armhf or i386, then you can use the longsleep/golang-backports PPA and update to Go 1.15.

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go

Note that golang-go installs latest Go as default Go. If you do not want that, install golang-1.15 instead and use the binaries from /usr/lib/go-1.15/bin.

If that's too new for you, try: (Ubuntu 19.04 max)

$ sudo add-apt-repository ppa:gophers/archive
$ sudo apt update
$ sudo apt install golang-1.11-go

Note that golang-1.11-go puts binaries in /usr/lib/go-1.11/bin. If you want them on your PATH, you need to make that change yourself.

Using snaps also works quite well:

$ sudo snap install --classic go

A restart may or may not be required for the command to be recognized depending on your system.

Using getgo (proof-of-concept command-line installer for Go):

curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer

 

复制代码
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/lsgx/.cache/go-build"
GOENV="/home/lsgx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/lsgx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/lsgx/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build522554850=/tmp/go-build -gno-record-gcc-switches"
复制代码

 

export GOROOT="/usr/lib/go-1.15"
export PATH=$PATH:$GOROOT/bin

export GO111MODULE=on
export GOPROXY="https://goproxy.cn"

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

 

=========== End

 

posted @   lsgxeva  阅读(207)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2018-12-21 call/cc 总结 | Scheme
2018-12-21 用call/cc合成所有的控制流结构
2018-12-21 词法作用域 vs 动态作用域
2018-12-21 Y分钟入门lambda演算
2018-12-21 计算机编程书籍
2018-12-21 Racket Cheat Sheet
2018-12-21 scheme 教程 #lang racket
点击右上角即可分享
微信分享提示