ontology - Install

install by source

  • this guilde is just based with ontology version 0.6

1.1. Setup Go

1.1.1 download golang

https://golang.org/dl/

  • download of golang version 1.9.4
  • macos
https://dl.google.com/go/go1.9.4.darwin-amd64.tar.gz
  • linux
wget https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz
  • unpack & install
tar -C /usr/local -xzf go1.9.4.linux-amd64.tar.gz

1.2 Setup ENV & work lib

1.2.1 the compile output lib is set to test , you can also change it as you like.
mkdir /opt/gopath
mkdir /opt/gopath/test
1.2.2 environment variables needed by other scripts & env Bashrc setup
  • setup environment
vim /root/.bashrc   ///etc/profile
  • add at the end of the file
export PATH=$PATH:/usr/local/go/bin
export GOBIN=/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPATH="/opt/gopath"
  • save and made effect
wq!
source /root/.bashrc

1.3 install glide(imports manager)

go get github.com/Masterminds/glide

1.4 clone & install ontology

you can use below script to fast clone & install

  • new a script
cd /opt/gopath/test
vim install.sh
  • filled with below
set -e
set -x

rm /opt/gopath/src/github.com/ontio -rf;
mkdir /opt/gopath/src/github.com/ontio;
cd /opt/gopath/src/github.com/ontio;
git clone https://github.com/ontio/ontology.git;
cd /opt/gopath/src/github.com/ontio/ontology;glide install;
go build -o /opt/gopath/test/ontology main.go;
go build -o /opt/gopath/test/nodectl nodectl.go;
cd /opt/gopath/test;

  • set install.sh to executeable.
chmod +777 ./install.sh
bash ./install.sh

install by binary

你可能感兴趣的:(ontology - Install)