consul - sinherle/Recipes GitHub Wiki

Consul Build for SLES12 & RHEL7 & Ubuntu 16.04

Install Dependencies

  1. RHEL7

    sudo yum install git vi gcc tar wget
    
  2. SLES12

    sudo zypper install git vi gcc tar wget
    
  3. Ubuntu 16.04

    apt-get install git golang vim gcc tar wget
    
  4. GO >v1.5 (RHEL7 and SLES12)

    Building Go on z System

    GOPATH Set up environment variable $GOPATH

Note:

GODEPS:

Consul uses [godeps](https://github.com/tools/godep] as its internal 
dependencies management tool

GOX:

Gonsul uses [gox](https://github.com/mitchellh/gox) as its cross-compile tool

Building Consul from its source

  1. Make directory & clone the source code

    mkdir $GOPATH/src
    cd $GOPATH/src
    mkdir -p ./github.com/hashicorp
    cd $GOPATH/src/github.com/hashicorp
    git clone https://github.com/hashicorp/consul.git
    
  2. Modify build script

    cd $GOPATH/src/github.com/hashicorp/consul/scripts
    
  3. Modify file $GOPATH/src/github.com/hashicorp/consul/scripts/build.sh with your choice of editor

    replace line from 40 to 45 with "cd $DIR" and add "go install" to the following line
    

    These lines invoke tool gox and compile for different ARCH and OS combos.Unfortunately, gox does not support s390x arch for now.Therefore, in order to build consul for z System, it is required to use the native build tool of go.

  4. Replace sys package

     cd $GOPATH/src/github.com/hashicorp/consul/vendor/golang.org/x
     mv sys sys.bak
     git clone https://github.com/linux-on-ibm-z/sys.git
    
  5. Build consul

    cd $GOPATH/src/github.com/hashicorp/consul/
    make
    

There might be some error messages, but we can ignore them for now

  1. Verify build success

    cd $GOPATH/bin
    ./consul
    

 

Reference