Centos7 's Go language installation

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Installing with a binary file

1. Download binary files:

$ wget http://www.golangtc.com/static/go/1.6.2/go1.6.2.linux-amd64.tar.gz

2. Unzip and create the working directory:

$ TAR-ZXF go1.6.2.linux-amd64.tar.gz-c/usr/local/

$ mkdir/golang

3. Set Environment variables:

Add in/etc/profile:

Export Goroot=/usr/local/go then Execute

Export gobin= $GOROOT/bin

Export gopkg= $GOROOT/pkg/tool/linux_amd64

Export GOARCH=AMD64

Export Goos=linux

Export Gopath=/golang

Export path= $PATH: $GOBIN: $GOPKG: $GOPATH/bin

Source/etc/profile

Make it effective.

4. Write the demo program to verify:

4.1> Writing Demo Program:

VI Demo.go

Package Mainimport "FMT" Funcmain () {fmt. Printf ("Let's Go\n")}

4.2> Compile Run:

$ go Run demo.go

Run:

$./demo

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.