How to install golang to Ubuntu 20.04
2021/5/31 7:26:02
本文主要是介绍How to install golang to Ubuntu 20.04,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Download
wget -c https://golang.org/dl/go1.16.4.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
Or
sudo tar -C /usr/local/ -xzf go1.16.4.linux-amd64.tar.gz
Configuration
Add the go_path variable to the configuration file
sudo tee /etc/profile.d/go.sh <<-'EOF' export GOROOT=/usr/local/go export GOPATH=~/Public/project/default export PATH=$PATH:$GOROOT/bin:$GOPATH EOF
Enable the ability to automatically append GOPATH at boot
tee -a ~/.bashrc <<-'EOF' if [ -f /etc/profile.d/go.sh ]; then . /etc/profile.d/go.sh fi EOF
Make environment variables take effect
source .bashrc
Verification
Verification results
lwk@qwfys:~$ echo $GOPATH /home/lwk/Public/project/default lwk@qwfys:~$ echo $GOROOT /usr/local/go lwk@qwfys:~$ go version go version go1.16.4 linux/amd64 lwk@qwfys:~$
这篇关于How to install golang to Ubuntu 20.04的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26解决google chrome helper 内存占用较高!
- 2024-04-01got an unexpected keyword argument
- 2024-03-30维多利亚的秘密 golang入坑系统
- 2024-03-29mongodb sort by date
- 2024-03-29go swagger
- 2024-03-25mongodb cdc
- 2024-03-25how to use go in vscode
- 2024-03-22mongooseserverselectionerror: connect econnrefused ::1:27017
- 2024-03-21pymongo insert_many
- 2024-03-18projection mongodb