69
Go Installation
You can install Go programming on different operating systems like Windows, Linux, Mac etc. This is a link of binary distribution of the Go programming for FreeBSD (release 8-STABLE and above), Linux, Mac OS X (10.8 and above), and Windows operating systems for the 32-bit (386) and 64-bit (amd64) architectures.
If you do not found configuration of your combination, try installing from source or installing gccgo instead of gc.
In Linux
- We should choose the required archive file for installation. For Example, if we are installing Go version 1.6.1 for 64-bit x86 on Linux, the archive would be go1.2.1.linux-amd64.tar.gz.
- Now download the archive and extract it in /usr/local directory. We need to create a Go tree in /usr/local/go directory through following command:
- To set path, add /usr/local/go/bin to the PATH environment variable. We can do this by adding following line to the command line:
In Windows
- Choose the required archive file for Windows installation.
- Download zip file and extract it into the directory (Like c:Go).
- If you have choosed a different directory other than c:Go, you must set the GOROOT environment variable to your chosen path.
- Add the bin subdirectory of your Go root (for example, c:Gobin) to your PATH environment variable.
In Mac OS X
- Choose the required archive file for Mac installation.
- Open the downloaded package file, and follow the prompts to install the Go tools. The package installs the Go distribution to /usr/local/go.
- The package should locate the /usr/local/go/bin directory to your PATH environment variable. You may need to restart the opened terminal sessions to make the change.
Go Installation in Ubuntu
Step 1: Run the command sudo apt-get install golang
Step 2: Press ‘y’ when you asked
Now, Go installation is done, You can check the version by the command: go version.
Next TopicGo Hello World