Installation go - SkycoinWikis/CX GitHub Wiki

CX HOME » CX » GETTING STARTED » INSTALLATION GO

Installing Go

Table of Contents

Windows

Source: https://skywug.net/forum/Thread-Skywire-node-on-Windows

Installation

Download Go from https://golang.org/dl/ and install it.

Setup Environment Variables

  1. Press WIN + R and type in C:\Windows\System32\systempropertiesadvanced.exe

  2. Select the GOPATH variable and change it's value to:

    %USERPROFILE%\go
    
  3. Make a new variable called GOBIN with the value:

    %USERPROFILE%\go\bin
    

macOS

Source: https://raw.githubusercontent.com/skycoin/skycoin/develop/INSTALLATION.md

Source: https://skywug.net/forum/Thread-How-to-set-up-Skywire-on-a-Mac

Installation

  1. First you need to have homebrew installed, if you don't have it yet.
    Press + Space and type in Terminal to start Terminal.
    Type in the following command:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Then, let's install the latest version of go.

    brew install go
  3. Lastly, let's install Mercurial and Bazaar

    brew install mercurial bzr

Setup Environment Variables

  1. Press + Space and type in Terminal to start Terminal.
    Type in the following command:

    sudo nano ~/.bash_profile #(enter your password and then press enter)
  2. Now you should see a black screen in your terminal. Enter the following text:

    export GOPATH=$HOME/go
    export GOBIN=$HOME/go/bin
  3. Press + X and then Y and then Enter

  4. Press + Space and type in Terminal to start Terminal.
    Type in the following command:

    source ~/.bash_profile

Linux

Source: https://raw.githubusercontent.com/skycoin/skycoin/develop/INSTALLATION.md

We need to install linux dependencies on the correct distribution.

Ubuntu and Debian

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y curl git mercurial make binutils gcc bzr bison libgmp3-dev screen gcc build-essential

Centos and Fedora

sudo yum update -y && sudo yum upgrade -y
sudo yum install -y git curl make gcc mercurial binutils bzr bison screen
if [[ "$(cat /etc/redhat-release | grep -o CentOS)" == "CentOS" ]]; then sudo yum install -y build-essential libgmp3-dev; else sudo yum groupinstall -y "Development Tools" "Development Libraries" && sudo yum install -y gmp; fi;

Archlinux

First update the system and ensure the dependancies are met

sudo pacman -Syy && sudo pacman -Syu
sudo pacman -S base-devel

Install the latest version of go on Archlinux with:

sudo pacman -S go

Install Go manually

Let's go to home directory and declare go's version that you want to download.

cd ~
export GOV=1.11.1 # golang version

After that, let's download and uncompress golang source.

curl -sS https://storage.googleapis.com/golang/go$GOV.linux-amd64.tar.gz > go$GOV.linux-amd64.tar.gz
tar xvf go$GOV.linux-amd64.tar.gz
rm go$GOV.linux-amd64.tar.gz

lastly, let's install go.

sudo mv go /usr/local/go
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
sudo ln -s /usr/local/go/bin/godoc /usr/local/bin/godoc
sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt

Note: Find any golang source version at Go Website

Setup your GOPATH

The $GOPATH environment variable specifies the location of your workspace. It defaults to a directory named go inside your home directory, so $HOME/go on Unix.

Create your workspace directory with it's respective inner folders:

mkdir -p $HOME/go
mkdir -p $HOME/go/bin
mkdir -p $HOME/go/src
mkdir -p $HOME/go/pkg

Setup $GOPATH variable, add it to ~/.bashrc. After editing, run source ~/.bashrc or open a new tab.

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

Test your Go installation

Create and run the hello.go application described here: https://golang.org/doc/install#testing to check if your Go installation is working.

⚠️ **GitHub.com Fallback** ⚠️