blob: e87a79138b65ba528e715b3b8e621db1632b8b45 [file] [log] [blame] [view]
Albert Wangcfdc57f2016-03-12 16:33:05 -08001## Install package `golang`
2
3The `golang` Debian package may have already made its way into your Ubuntu distribution. Try this:
4
5```
Ihor Dvoretskyi7759cbe2016-09-19 18:00:06 +03006sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
7sudo apt-get update
8sudo apt-get install golang
Albert Wangcfdc57f2016-03-12 16:33:05 -08009```
10
Marty Chang0731afe2016-03-22 14:37:53 -040011Note there is golang in Ubuntu but it is not up to date. An up-to-date version may be found at
Albert Wangcfdc57f2016-03-12 16:33:05 -080012https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxd-stable
13
14That is all you need to get `go` working on your system. (You can use `go env GOROOT` to be sure where the Go files are, if you're curious.) Don't forget to create your GOPATH.
15
16
17## If that didn't work
18
19See http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go
世外桃源2421f182016-10-14 01:26:14 +080020
21Using the GVM for installation and compile natively.
世外桃源2ed81e52016-10-14 01:31:11 +080022
23## compile native
24http://www.hostingadvice.com/how-to/install-golang-on-ubuntu/
25
世外桃源c6bf79c2016-10-14 01:32:02 +080026## How to uninstall from the apt manager Uninstall just golang-go from [Universe](http://installion.co.uk/ubuntu/vivid/universe/index.html)
世外桃源2ed81e52016-10-14 01:31:11 +080027
28### This will remove just the golang-go package itself.
29`sudo apt-get remove golang-go`
30
世外桃源2ed81e52016-10-14 01:31:11 +080031### Uninstall golang-go and its dependencies
32`sudo apt-get remove --auto-remove golang-go`
33
34### Purging your config/data too
世外桃源08ca3102016-10-14 01:36:31 +080035`sudo apt-get purge golang-go` or `sudo apt-get purge --auto-remove golang-go`
36
37### install for 1.7.1
世外桃源cd35be22016-10-14 09:53:58 +080038I recommend to check out this [note](http://www.itzgeek.com/how-tos/linux/centos-how-tos/install-go-1-7-ubuntu-16-04-14-04-centos-7-fedora-24.html).
39
世外桃源6246d162016-10-14 09:50:53 +080040### Download the package
41`wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz`
42### extract the package
43`sudo tar -zxvf go1.7.1.linux-amd64.tar.gz -C /usr/local/`
44### Added by Go Path
世外桃源4f600cd2016-10-14 09:51:09 +080045
世外桃源6246d162016-10-14 09:50:53 +080046`echo 'export GOROOT=/usr/local/go' >> ~/.bashrc`
世外桃源4f600cd2016-10-14 09:51:09 +080047
世外桃源6246d162016-10-14 09:50:53 +080048`echo 'export GOPATH=$HOME/go' >> ~/.bashrc`
世外桃源4f600cd2016-10-14 09:51:09 +080049
世外桃源6246d162016-10-14 09:50:53 +080050`echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.bashrc`