How to install Golang in ubuntu with curl?
To install Go (Golang) on Linux using curl, you can follow these steps:
-
Open a terminal on your Linux system.
-
Download the latest version of Go using curl. First, I'll provide the command, and then I'll explain how to modify it:
curl -O https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz
You'll need to replace "1.21.3" with the latest version of Go. To find the latest version, you can check the official Go downloads page.
- Extract the downloaded archive to /usr/local:
sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
- Set up the Go environment by adding the following lines to your ~/.profile or ~/.bashrc file:
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
- Apply the changes to your current session:
source ~/.profile
(or source ~/.bashrc
if you added the lines to .bashrc)
- Verify the installation:
go version
This should display the installed Go version.