22 Nov, 2009

Installing Google Go on Linux Ubuntu

One command install, Bash script to install Google Go in one Go

#!/bin/bash
ARCH=386 #CHANGE this setting to amd64 if you are on 64 bit.
sudo apt-get install bison make gcc libc6-dev ed mercurial
{
cat ~/.bashrc; cat <<EOF
export GOROOT=$HOME/go
export GOARCH=$ARCH
export GOOS=linux
export GOBIN=$HOME/gobin
export PATH=$PATH:$GOBIN
EOF
}  > ~/temp.bashrc

mv ~/.bashrc ~/.bashrc.old
mv ~/temp.bashrc ~/.bashrc

export GOROOT=$HOME/go
export GOARCH=$ARCH
export GOOS=linux
export GOBIN=$HOME/gobin
export PATH=$PATH:$GOBIN

mkdir $GOBIN
hg clone -r release https://go.googlecode.com/hg/ $GOROOT
cd $GOROOT/src
./all.bash

Installing Google Go in Steps

  • The following packages are required for installing Google Go : bison, make, gcc, libc6-dev, ed, mercurial. To install run the command
    sudo apt-get install bison make gcc libc6-dev ed mercurial
    
  • Edit the .bashrc file to set up the environment variables, .bashrc file resides in your home folder (/home/username/). Add the following lines if you are using ubuntu x86 (or unsure)
    export GOROOT=$HOME/go
    export GOARCH=386
    export GOOS=linux
    export GOBIN=$HOME/gobin
    export PATH=$PATH:$GOBIN
    

    If you are using 64bit ubuntu version append the following lines instead

    export GOROOT=$HOME/go
    export GOARCH=amd64
    export GOOS=linux
    export GOBIN=$HOME/gobin
    export PATH=$PATH:$GOBIN
    
  • exit the terminal and restart OR run the
    bash
    
    command
  • Get the source files by running
    hg clone -r release https://go.googlecode.com/hg/ $GOROOT
    
  • cd $GOROOT/src
    
  • mkdir $GOBIN
    
  • ./all.bash
    
  • Now Go should be installed to the $GOBIN Directory.
Now you are ready to Go-nuts with Go!
Comments (3) Post a comment
  • great post

    this information is just simply that I was looking for!!!

    By Web girl on 07 Jun, 2010 Reply
    • @Web girl ... Really ?

      I dont think so :P Which seo firm are you working for ?
      By digitalpbk on 07 Jun, 2010 Reply
  • for Cent OS

    do yum install instead of apt-get install
    By digitalpbk on 29 Nov, 2009 Reply
You may also like



Email Newsletter
Email:
Popular Posts
Recent Posts
Tags
Random photo
Tender Coconut water anyone ? Tender Coconut water anyone ? in Havelock Island Andaman
On Facebook
Recent Comments


digitalpbk