Installing Google Go on Linux Ubuntu
2009
22
Nov
1
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
OR
Installing Pre-Requisites
- 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
bashcommand - Get the source files by running
hg clone -r release https://go.googlecode.com/hg/ $GOROOT cd $GOROOT/srcmkdir $GOBIN./all.bash- Now Go should be installed to the $GOBIN Directory.
Now you are ready to Go-nuts with Go!
Similar Posts
Related Searches

Comments
for Cent OS
do
yum installinstead ofapt-get installPost new comment