How to Install Go language on Linux

By | October 6, 2015

Go or golang is a open source programming language develope at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It comes with a several principles: simplicity, safety and speed. Go Language comes with various tools for debugging and testing. The Language statically typed language with syntax closely derived from the C language. Nowadays Go language and it’s tool chain are available on most Linux repositories, make it easy to install them with default package manager.

How to Install Go language on Linux

How to Install Go language on Linux

How to Install Go Language on Ubuntu / Debian /  Mint / Elementary

For Debian based distribution its pretty easy to install Go, you can use your apt-get to do it and it will install Go language and its development tools automatically.

$ sudo apt-get install golang

After installation, check your go version with:

$ go version

Next step is create a workspace directory for your Go code, because Go code must be kept inside a work space and define GOPATH environment variable pointing to that directory. This is where the go tool builds source and install the binaries. Do this command to continue:

$ mkdir ~/workspace
$ echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
$ source ~/.bashrc

If you want to check what tools are available on Go, you can check it with apt-cache.

$ sudo apt-cache search golang

How to Install GO Language on RHEL / Fedora /CentOS

By default Red Had based distribution can install Go and its development tools easily by using Yum.

$ sudo yum install golang

Now, check your Go language version to verify the installation.

$ go version

Next, create a work space in your directory and define the GOPATH environment variable to point to the directory. So go tool can build the source and install the binaries through that directory.

$ mkdir ~/workspace
$ echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
$ source ~/.bashrc

Also, you could check what tools are available for your Go Language with:

$ yum search golang

How to Install Go Language on Arch Linux

On Arch Linux you can simply install it with your pacman, its available on the official repositories.

$ pacman -Sy go

Now check the version.

$ go version

And just like the previous, you must create  your workspace directort and add GOPATH environment variables.

$ mkdir ~/workspace
$ echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
$ source ~/.bashrc

You can also check what tools are available with:

$ sudo pacman -Ss go

Now after the installation you can have fun with it, I will cover the tutorial about Go Language someday, so wait for it and If you have some question you can leave it on the comment box below.

Thanks for your visit !

Leave a Reply

Your email address will not be published. Required fields are marked *