Albert Wang | cfdc57f | 2016-03-12 16:33:05 -0800 | [diff] [blame] | 1 | ## Install package `golang` |
| 2 | |
| 3 | The `golang` Debian package may have already made its way into your Ubuntu distribution. Try this: |
| 4 | |
| 5 | ``` |
Ihor Dvoretskyi | 7759cbe | 2016-09-19 18:00:06 +0300 | [diff] [blame] | 6 | sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable |
| 7 | sudo apt-get update |
| 8 | sudo apt-get install golang |
Albert Wang | cfdc57f | 2016-03-12 16:33:05 -0800 | [diff] [blame] | 9 | ``` |
| 10 | |
Marty Chang | 0731afe | 2016-03-22 14:37:53 -0400 | [diff] [blame] | 11 | Note there is golang in Ubuntu but it is not up to date. An up-to-date version may be found at |
Albert Wang | cfdc57f | 2016-03-12 16:33:05 -0800 | [diff] [blame] | 12 | https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxd-stable |
| 13 | |
| 14 | That 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 | |
| 19 | See http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go |
世外桃源 | 2421f18 | 2016-10-14 01:26:14 +0800 | [diff] [blame] | 20 | |
| 21 | Using the GVM for installation and compile natively. |
世外桃源 | 2ed81e5 | 2016-10-14 01:31:11 +0800 | [diff] [blame] | 22 | |
| 23 | ## compile native |
| 24 | http://www.hostingadvice.com/how-to/install-golang-on-ubuntu/ |
| 25 | |
世外桃源 | c6bf79c | 2016-10-14 01:32:02 +0800 | [diff] [blame] | 26 | ## How to uninstall from the apt manager Uninstall just golang-go from [Universe](http://installion.co.uk/ubuntu/vivid/universe/index.html) |
世外桃源 | 2ed81e5 | 2016-10-14 01:31:11 +0800 | [diff] [blame] | 27 | |
| 28 | ### This will remove just the golang-go package itself. |
| 29 | `sudo apt-get remove golang-go` |
| 30 | |
世外桃源 | 2ed81e5 | 2016-10-14 01:31:11 +0800 | [diff] [blame] | 31 | ### Uninstall golang-go and its dependencies |
| 32 | `sudo apt-get remove --auto-remove golang-go` |
| 33 | |
| 34 | ### Purging your config/data too |
世外桃源 | 08ca310 | 2016-10-14 01:36:31 +0800 | [diff] [blame] | 35 | `sudo apt-get purge golang-go` or `sudo apt-get purge --auto-remove golang-go` |
| 36 | |
| 37 | ### install for 1.7.1 |
世外桃源 | cd35be2 | 2016-10-14 09:53:58 +0800 | [diff] [blame] | 38 | I 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 | |
世外桃源 | 6246d16 | 2016-10-14 09:50:53 +0800 | [diff] [blame] | 40 | ### 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 |
世外桃源 | 4f600cd | 2016-10-14 09:51:09 +0800 | [diff] [blame] | 45 | |
世外桃源 | 6246d16 | 2016-10-14 09:50:53 +0800 | [diff] [blame] | 46 | `echo 'export GOROOT=/usr/local/go' >> ~/.bashrc` |
世外桃源 | 4f600cd | 2016-10-14 09:51:09 +0800 | [diff] [blame] | 47 | |
世外桃源 | 6246d16 | 2016-10-14 09:50:53 +0800 | [diff] [blame] | 48 | `echo 'export GOPATH=$HOME/go' >> ~/.bashrc` |
世外桃源 | 4f600cd | 2016-10-14 09:51:09 +0800 | [diff] [blame] | 49 | |
世外桃源 | 6246d16 | 2016-10-14 09:50:53 +0800 | [diff] [blame] | 50 | `echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.bashrc` |