How to install Golang in Linux and Windows

Share

Golang or Go programming language is an open-source programming language supported by Google. Go is clear, simple, expressive, and productive. Its innovative type system enables flexible and modular program creation, and its concurrency techniques make it simple to write programs that take full advantage of multicore and networked devices. Go swiftly converts to machine code and has run-time reflection strength and convenience as well as garbage collection. It is a quick, statically typed, compiled language that has the feel of an interpreted, dynamically typed language.

In this blog, we will see how to install Go on Linux and Windows systems.

Installing in Linux

  • Download the GoLang package using the following command.
sudo wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
  • To download the latest version, visit the following link.
https://go.dev/dl/
  • Use the following command to verify the tarball checksum.
sha256sum go1.19.1.linux-amd64.tar.gz
  • Extract the tarball to /usr/local directory.
sudo tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz
  • Now, create a go.sh file in the/etc/profile.d directory and set the environment variable globally by adding the following line in the file.
sudo vi /etc/profile.d/go.sh
export PATH=$PATH:/usr/local/go/bin
  • Next, define the environment variable in .bash_profile file.
sudo vi ~/.bash_profile

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
  • Run the following command to reload the updated profiles.
source /etc/profile.d/go.sh
source ~/.bash_profile
  • Verify the installation with the following command.
go  version

Installing Golang in Windows

  • Go to the following link and download MSI installer for windows.
https://go.dev/dl/
  • After, downloading the msi file, double-click on it.
  • Follow the prompts for installation.
  • Click Next, and accept the license agreement.

Golang

  • Select the destination folder for installation.

Golang

  • Click Install to begin the installation.

Golang

Golang

  • Open the command prompt or Powershell and run the following command to verify the installation.
go version

Golang

Please contact our technical consultants if you have anything related to cloud DevOps infrastructure to be discussed.

Leave a Reply

Your email address will not be published.

*