Skip to content

Instantly share code, notes, and snippets.

@samuelralak
Created August 7, 2015 10:29
Show Gist options
  • Save samuelralak/154c15257cd3e7ce1e70 to your computer and use it in GitHub Desktop.
Save samuelralak/154c15257cd3e7ce1e70 to your computer and use it in GitHub Desktop.
installing go using gvm
1. Clone the Repo and Add to User Directory
1
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
This command uses cURL to grab the GitHub repo and install it into your user directory. The file that this repo is placed in is ~/.gvm.
2. Open Your ~/.bashrc and Source the GVM Directory
1
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
All we are doing here is linking the gvm binary to our environmental variables. This allows you to run GVM from any path on your command line.
3. Logout and Login with Your User
The easiest way to make the changes in your .bashrc take effect is to just log out and log back into your shell.
4. Check to Make Sure that GVM is Installed
1
2
$ gvm version
Go Version Manager v1.0.22 installed at /home/myuser/.gvm
This command will tell you what version of GVM is installed. If it reports a version back, then you have successfully installed GVM. Well-done!
5. Install Go (Golang)
First let’s check the versions of Go that are available.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ gvm listall
...
go1.2rc5
go1.3
go1.3.1
go1.3.2
go1.3.3
go1.3beta1
go1.3beta2
go1.3rc1
go1.3rc2
go1.4
go1.4beta1
go1.4rc1
go1.4rc2
As you can see, GVM includes the beta versions of software and release candidates (rc).
Let’s install Go 1.4.
1
2
3
4
$ gvm install go1.4
Downloading Go source...
Installing go1.4...
* Compiling...
6. Tell GVM Which Version of Go to Use
Now that we have Go installed on our system, let’s let GVM know we wish to use that version.
1
2
$ gvm use go1.4
Now using version go1.4
Sweet. Everything is going great so far.
7. Verify Go Is Installed Correctly
1
2
$ go version
go version go1.4 linux/amd64
We are done! GVM makes this process simple and upgrading, changing versions and uninstalling Go is now simple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment