Go Tutorials & Tips

How to install the Go programming language on your server or VPS?

Assuming you’ve logged in as root in Debian 5.0, to install the Go programming language by Google,

  1. Add these environmental variables for Go in .bash_profile:
    export GOROOT=$HOME/go
    export GOARCH=386  # for 32 bit architectures. Use GOARCH=amd64 for 64 bit architectures
    export GOOS=linux
    export GOBIN=$HOME/bin
  2. Install the Mercurial ‘hg’ command:
    aptitude install mercurial
  3. Fetch the sources of Go and put them at $GOROOT:
    hg clone -r release $GOROOT
  4. Fetch compilers and related utilities:
    aptitude install bison gcc libc6-dev ed make
  5. Create the directory $HOME/bin by:
    mkdir $HOME/bin

    and compile Go:

    cd $GOROOT/src
    make all

Done. You can now go about writing your first hello world program. If you haven’t got a server yet, I recommend Linode VPS and Rackspace Cloud.