Install the Go 1.3.1 example on Ubuntu 12.04

Source: Internet
Author: User
Tags install go

Use the sudo apt-get install go installation version is older, to install the latest version, only manual installation, nonsense not to say, directly listed installation steps.

1, download the source code

wget http://golangtc.com/static/go/go1.3.1.linux-amd64.tar.gz
Note: If a non 64-bit system is available, the corresponding version can be found above the http://golangtc.com/download.
When the download is complete, execute TAR-XF go1.3.1.linux-amd64.tar.gz and move the entire Go folder to the/usr/local directory to execute the command sudo mv go/usr/local

2, installation of related tools

sudo apt-get install Bison gawk gcc Libc6-dev make
Depending on the installation of the system itself, there will be a need to confirm whether to install, enter Y return.

3, modify the configuration

sudo vi ~/.BASHRC
At the end of the file, add the following:
#Golang environment variable
Export Goroot=/usr/local/go
Export GORACH=AMD64
Export Goos=linux
Export Path=${path}:/usr/local/go/bin
Export Gopath=/usr/local/go/application

Create a file sudo vi ~/.bash_profile
Content:
If [f ~/.BASHRC]; Then
. ~/.bashrc
Fi

4. Compile and install
Cd/usr/local/go/src
./all.bash

After compiling, testing, packaging, installing, and ending, you can run the Go version view to verify that the installation is completed correctly.

5, testing
CD ~
VI Hello.go

Copy the following content:

Package Main

Import (
"FMT"
)

Func Main () {
Fmt. Println ("Hello, World.") Http://itelite.com. ")
}
Save, exit, execute go run hello.go, and output:
Hello, world. Http://itelite.com.
Description installation OK, Kaniko open dry it!

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.