Go
Install
Check latest version on GoLang and change it if you want latest. Here, the Go version is 1.21.5
.
You have to know CPU architecture, you can check it with uname -m
command.
x86_64
is AMDaarch64
is ARMarm64
is ARM
You can have another architecture, check it on GoLang website.
AMD
wget -c https://golang.org/dl/go1.21.5.linux-amd64.tar.gz -O go.tar.gz
Delete old Go installation and extract new one.
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go.tar.gz
Add to PATH, if you haven't ZSH, you can use ~/.bashrc
instead of ~/.zshrc
.
vim ~/.zshrc
~/.zshrc
export PATH=$PATH:/usr/local/go/bin
export GOPATH="$HOME/go"
PATH="$GOPATH/bin:$PATH"
source ~/.zshrc
You can check Go version with go version
command.
go version
Now you can delete Go archive.
rm go.tar.gz
Update
Download new version of Go.
wget -c https://golang.org/dl/go1.21.5.linux-amd64.tar.gz -O go.tar.gz
Delete old Go installation and extract new one.
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go.tar.gz