Google created the compiled, statically typed programming language known as Go. You must be wondering why the language is called “Go” The language has two names: Go and Golang. Go is the name of the language. The name “Golang” was given to the website since its initial domain name was golang.org. The steps to download Go are as shown below: Other guides can accessed here: How to install and configure Apache Cassandra on Linux Server and how to install Gradle on Ubuntu
Step 1: Downloading Go binary files
To obtain the most recent Go binary from the official download website, use
curl -O https://storage.googleapis.com/golang/go1.18.3.linux-amd64.tar.gz
The Go version you should download is 1.18.3. However, if necessary, any other version may be used in its place. The output is as shown below:
root@ubuntu:/home/rdgmh# curl -O https://storage.googleapis.com/golang/go1.18.3.linux-amd64.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 135M 100 135M 0 0 286k 0 0:08:03 0:08:03 --:--:-- 362k root@ubuntu:/home/rdgmh#
Step 2: Taking out data from the tar.gz file
To open the package, use
tar. The downloaded tar.gz file will be opened, expanded, and a folder with the package name created using the tar tool using the following command:
tar -xvf go1.18.3.linux-amd64.tar.gz
next, move the folder to /usr/local
sudo mv go /usr/local
Go is now in your $PATH for Linux thanks to the Go package, which is located in /usr/local.
Step 3: Setting paths
We must now create some paths for Go. The paths listed in this step are all positioned relative to the /usr/local directory where the Go installation is located.In order to tell Go where to look for its files, the root value must first be set. To open the file in your preferred editor, run the command below:
sudo vim ~/.profile
At the document’s end opened by the command above, include the following lines:
export GOPATH=$HOME/work export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Any directory can be used in place of $HOME/work. You will be able to use the Go language’s features from this location.
save and close the file then refresh with the command below:
Step 4: Verify that Go is installed
Checking to check if your installation was successful is always a smart idea. You may accomplish this by looking up the Go language version that is currently installed on your machine.
The terminal will show the Go version that is currently installed on your computer just as shown from the screenshot below:
We installed Go on a Linux system by following a series of steps as described above.