/
โš™๏ธ
Install latest GoLang on Ubuntu
Search
Duplicate
Try Notion
โš™๏ธ
Install latest GoLang on Ubuntu
We are going to install the last version of Go on a Ubuntu system.
First update your repositories list.
sudo apt-get update
Shell
Go the the downloads page and select the latest version, right now the last version is 1.19.2.
Download, extract the file and move the go folder to the /usr/local/ directory.
wget https://go.dev/dl/go1.19.2.linux-amd64.tar.gz tar -xvf go1.19.2.linux-amd64.tar.gz sudo mv go /usr/local/ rm go1.19.2.linux-amd64.tar.gz
Shell
Update the PATH variable to point to our bin folder, we are going to update the ~/.bashrc file so the binary can be used directly typing go in a terminal.
export GOROOT=/usr/local/go export GOPATH=$HOME/devel/goproject export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Shell
We can test that everything is working using running the following command
$ which go /usr/local/go/bin/go $ go version go version go1.19.2 linux/amd64
Shell
Note: If the go path is /usr/bin/go, itโ€™s because there is another version of go already installed in your system, maybe using apt. We can just uninstall that version with:
sudo apt-get remove golang sudo apt autoremove
Shell
After removing the old golang version, close the terminal and reopen it.