Merge pull request #2374 from geekpi/master

translated
This commit is contained in:
geekpi 2015-02-06 21:19:28 +08:00
commit 64595d6953
2 changed files with 96 additions and 98 deletions

View File

@ -1,98 +0,0 @@
translating----geekpi
Linux FAQs with Answers--How to install Go language on Linux
================================================================================
Go (also called "golang") is an open-source programming language initially developed by Google. It was born with several design principles in mind: simplicity, safety, and speed. The Go language distribution comes with various tools for debugging, testing, profiling and code-vetting. Nowadays the Go language and its tool chain are available in the base repositories of most Linux distributions, making it easy to install them with a default package manager.
### Install Go Language on Ubuntu, Debian or Linux Mint ###
The following **apt-get** command will install Go language and its development tools on Debian-based distributions.
$ sudo apt-get install golang
Check the version of Go language to verify installation.
$ go version
----------
go version go1.2.1 linux/amd64
Depending on your need, you may want to install additional Go tools using apt-get.
$ sudo apt-cache search golang
![](https://farm8.staticflickr.com/7430/15812762183_f094e3bf92_c.jpg)
### Install Go Language on Fedora, CentOS/RHEL ###
The following yum command will install Go language and its development tools on Red Hat based distributions.
$ sudo yum install golang
Check the version of Go language to verify installation.
$ go version
----------
go version go1.3.3 linux/amd64
Depending on your need, you can install additional Go tools using yum.
$ yum search golang
![](https://farm8.staticflickr.com/7373/16432817805_775010dc18_c.jpg)
### Install Go Language from the Official Website ###
Sometimes the version of Go language that comes with your Linux distribution may not be up-to-date. In that case, you can install the latest Go language from its official website. Here is how you can do it.
Go to the [official source][1] of Go language, and download pre-built binaries.
**For 64-bit Linux:**
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz
**For 32-bit Linux:**
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-386.tar.gz
**Install the binaries under /usr/local.**
$ sudo tar -xzf go1.4.1.linux-xxx.tar.gz -C /usr/local
Update the PATH environment variable system-wide by appending the following line in /etc/profile.
$ sudo vi /etc/profile
----------
export PATH=$PATH:/usr/local/go/bin
If you installed Go in a custom location other than /usr/local, you also need to set GOROOT environment variable to point to the custom location.
$ sudo vi /etc/profile
----------
export GOROOT=/path/to/custom/location
Check the version of Go language.
$ go version
----------
go version go1.4.1 linux/amd64
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-go-language-linux.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://golang.org/dl/

View File

@ -0,0 +1,96 @@
如何在Linux中安装Go语言
================================================================================
Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几个设计原则简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都有了用默认的包管理器就可以安装。
### 在Ubuntu、Debian 或者 Linux Mint上安装Go语言 ###
下面是在基于Debian的发行版上使用**apt-get**来安装Go语言和它的开发工具。
$ sudo apt-get install golang
检查Go语言的版本来验证安装。
$ go version
----------
go version go1.2.1 linux/amd64
按照你的需要你或许想要使用apt-get安装额外的Go工具。
$ sudo apt-cache search golang
![](https://farm8.staticflickr.com/7430/15812762183_f094e3bf92_c.jpg)
### 在Fedora、CentOS/RHEL中安装Go语言 ###
下面的命令会在基于Red Hat的发行版中安装Go语言和它的工具。
$ sudo yum install golang
检查Go语言的版本来验证安装。
$ go version
----------
go version go1.3.3 linux/amd64
按照你的需要你或许想要使用yum安装额外的Go工具。
$ yum search golang
![](https://farm8.staticflickr.com/7373/16432817805_775010dc18_c.jpg)
### 从官网安装Go语言 ###
有时发行版中的版本并不是最新的。为防这样你可以从官网安装最新的Go语言。下面是步骤。
进入Go语言的[官方源码][1],并下载预编译二进制代码。
**对于64位Linux:**
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz
**对于32位Linux:**
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-386.tar.gz
**在/usr/local下安装程序**
$ sudo tar -xzf go1.4.1.linux-xxx.tar.gz -C /usr/local
在/etc/profile中添加系统范围的PATH环境变量。
$ sudo vi /etc/profile
----------
export PATH=$PATH:/usr/local/go/bin
如果你在/usr/local之外安装了了Go你同样需要设置GOROOT环境变量来指向自定义的安装位置。
$ sudo vi /etc/profile
----------
export GOROOT=/path/to/custom/location
检查Go语言的版本
$ go version
----------
go version go1.4.1 linux/amd64
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-go-language-linux.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://golang.org/dl/