Install go on Ubuntu

Source: Internet
Author: User
Tags command line install go mercurial root directory

Translated from: talkonsomething

This article shows you how to install the Google Go compiler on Ubuntu 9.10

The first step: Setup before installation

—————————————————————————————————————————————

A. $GOROOT: The root directory of Go

* At the command line to lose the following command

$ Export GOROOT=/HOME/YOUR-NAME/HG

—————————————————————————————————————————————

B. $GOOS: Operating system name

* Enter at command line

$ Export Goos=linux

—————————————————————————————————————————————

C. $GOARCH: Target Architecture

* AMD64 for AMD bit processor

* 386 (32-bit x86) Intel bit process and

* ARM (32-bit arm, an incomplete port)

Note: Set the target architecture based on your hardware situation

* Command-line Input

$ Export goarch=386

—————————————————————————————————————————————

D. $GOBIN: Specify the directory generated by the binary file

* New Directory/home/your-name/bin

* Assign full permissions.

$ chmod 777/home/your-name/bin

* Set $GOBIN Path

$ Export Gobin=/home/your-name/bin

* Set the $GOBIN path in $path

$ export path= $PATH:/home/your-name/bin

* To verify that the correct, please enter the first line below the command

$ Env|grep ' ^go '

You should return the parameters that are in the form

Gobin=/home/your-name/bin

Goarch=386

goroot=/home/your-name/hg/

Goos=linux

When you are finished setting, you can start the second step setting.

—————————————————————————————————————————————

Step 2: Get the installation package

* If you do not have Mercurial installed on your system, you can install it with the following command

$ sudo apt-get install mercurial

* Then run

$ HG clone-r release https://go.googlecode.com/hg/$GOROOT

—————————————————————————————————————————————

Step three: Before installing, make sure you have the following components GCC, standard C library, parser generator Bison.

$ sudo apt-get install bison gcc Libc6-dev ed

—————————————————————————————————————————————

Step Fourth: Run under the command line

$ cd $GOROOT/SRC

If the file unzip the package in the HG directory, copy it out

And then run:

$./all.bash

If you do not make an error, you will see

---CD. /test

N known bugs; 0 Unexpected bugs

Related Article

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.