Install Golang in Binary Package

Source: Internet
Author: User
Tags install go

Install Golang in Binary Package

Previously, we talked about Golang's source code compilation and installation on the arm platform. This time, we will supplement the Binary Package Installation Method on other platforms officially provided by Golang.

1. Download The golang Binary Package

First is to download the golang Binary Package, official: https://golang.org/dl/

Select the Binary Package for the corresponding platform. Currently, golang only provides Binary packages for the following platforms:

1.1 Mac OS X 386 + platform Binary Package Based on 10.6 or amd64 Processor

1.2 Binary Package of FreeBSD 8 + Platform Based on 386 or amd64 Processor

1.3 Binary Package for Linux 2.6.23 + Platform Based on 386 or amd64 processor. Note that CentOS/RedHat 5 platforms are not supported.

1.4 Windows XP + platform Binary Package Based on 386 or amd64 Processor

If your platform is not listed on the top, you cannot install it using the official Binary Package. You must directly compile the source code for installation.

2. Clear old golang versions

If you have installed the old version of golang, you need to clear the old version of golang before installing the new version. There are two steps:

2.1 Delete the old golang directory

Generally, the go directory of Linux, Mac OS X, or FreeBSD platform is in/usr/local/go, And the go directory of Window platform may be in C: \ go. It may also be in another custom path. Please delete it directly.

2.2 Delete version golang Environment Variables

You only need to delete the bin PATH of the old go directory from the PATH environment variable.

FreeBSD or Linux usually Modifies/etc/profile or $ HOME/. profile, which is determined based on the location of the configured PATH environment variable.

On Mac OS X, if the old version is installed using the package installation package, delete the/etc/paths. d/go file.

On the Window platform, configure the PATH variable in the advanced attribute of the system attribute.

3. Install the tar package on Linux, Mac OS X, or FreeBSD Platform

3.1 decompress the tar package

After downloading the corresponding tar package, run the following command to decompress the package to the/usr/local directory:

Sudo tar-C/usr/local-xzf goxxx.tar.gz

Specifically, goxxx.tar.gz downloads the go compressed Package for you. After decompression, the go directory is/usr/local/go.

3.2 configure Environment Variables

Configure the/usr/local/go/bin path to the path environment variable, which can be added to the/etc/profile or $ HOME/. profile file:

Export PATH = $ PATH:/usr/local/go/bin

After configuration, execute source/etc/profile or source $ HOME/. profile Based on the configured file to make the environment variable take effect.

3.3 customize the installation path

If you do not select the/usr/local directory, you can select another path. You only need to extract the compressed package to the directory you want, you only need to add one more GOROOT environment variable to specify your custom path. Therefore, the content of environment variable configuration is:

Export GOROOT = custom go path
Export PATH = $ PATH: $ GOROOT/bin

Similarly, run the source command to make the configured environment variables take effect.

Getting started with Linux-installing Go in Linux

Install Go Language Pack in Ubuntu

Go language programming (HD) full-version ebook

Go language and beauty-surpassing "Hello World"

Why do I like the Go language?

Implementation of the Go language memory distributor

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.