|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Development on Power (ppc64le) systems is done outside of vagrant, on the |
| 4 | +# native OS. This script helps setup the dev env on ppc64le Ubuntu. |
| 5 | +# |
| 6 | +# See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/install.md#building-outside-of-vagrant- |
| 7 | +# |
| 8 | +# NOTE: This script assumes that |
| 9 | +# - OS specific apt-sources / repositories are already set appropriately. |
| 10 | +# - Host's GOPATH environment variable is set. |
| 11 | +# |
| 12 | +# To get started on a fresh Ubuntu install: |
| 13 | +# mkdir -p $GOPATH/src/github.com/hyperledger |
| 14 | +# cd $GOPATH/src/github.com/hyperledger |
| 15 | +# git clone http://gerrit.hyperledger.org/r/fabric |
| 16 | +# sudo ./fabric/devenv/setupUbuntuOnPPC64el.sh |
| 17 | +# cd $GOPATH/src/github.com/hyperledger/fabric |
| 18 | +# make dist-clean all |
| 19 | + |
| 20 | +if [ xroot != x$(whoami) ] |
| 21 | +then |
| 22 | + echo "You must run as root (Hint: Try prefix 'sudo' while executing the script)" |
| 23 | + exit |
| 24 | +fi |
| 25 | + |
| 26 | +if [ ! -d "$GOPATH/src/github.com/hyperledger/fabric" ] |
| 27 | +then |
| 28 | + echo "Ensure fabric code is under $GOPATH/src/github.com/hyperledger/fabric" |
| 29 | + exit |
| 30 | +fi |
| 31 | + |
| 32 | +##################################### |
| 33 | +# Install pre-requisite OS packages # |
| 34 | +##################################### |
| 35 | +apt-get update |
| 36 | +apt-get -y install software-properties-common curl git sudo wget |
| 37 | + |
| 38 | +##################################### |
| 39 | +# Install and setup Docker services # |
| 40 | +##################################### |
| 41 | +# Along with docker.io, aufs-tools also needs to be installed as 'auplink' which is part of aufs-tools package gets invoked during behave tests. |
| 42 | +apt-get -y install docker.io aufs-tools |
| 43 | + |
| 44 | +# Set DOCKER_OPTS and restart Docker daemon. |
| 45 | +sed -i '/#DOCKER_OPTS=/a DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"' /etc/default/docker |
| 46 | +systemctl restart docker |
| 47 | + |
| 48 | +#################################### |
| 49 | +# Install Go and set env variable # |
| 50 | +#################################### |
| 51 | +# Golang binaries for ppc64le are publicly available from Unicamp and is recommended as it includes certain platform specific tuning/optimization. |
| 52 | +# Alternativley package part of Ubuntu disto repo can also be used. |
| 53 | +wget ftp://ftp.unicamp.br/pub/linuxpatch/toolchain/at/ubuntu/dists/trusty/at9.0/binary-ppc64el/advance-toolchain-at9.0-golang_9.0-3_ppc64el.deb |
| 54 | +dpkg -i advance-toolchain-at9.0-golang_9.0-3_ppc64el.deb |
| 55 | +rm -f advance-toolchain-at9.0-golang_9.0-3_ppc64el.deb |
| 56 | + |
| 57 | +# Create links under /usr/bin using update-alternatives |
| 58 | +update-alternatives --install /usr/bin/go go /usr/local/go/bin/go 9 |
| 59 | +update-alternatives --install /usr/bin/gofmt gofmt /usr/local/go/bin/gofmt 9 |
| 60 | + |
| 61 | +# Set the GOROOT env variable |
| 62 | +export GOROOT="/usr/local/go" |
| 63 | + |
| 64 | +#################################### |
| 65 | +# Build and install RocksDB # |
| 66 | +#################################### |
| 67 | + |
| 68 | +apt-get -y install libsnappy-dev zlib1g-dev libbz2-dev "build-essential" |
| 69 | + |
| 70 | +cd /tmp |
| 71 | +git clone https://github.com/facebook/rocksdb.git |
| 72 | +cd rocksdb |
| 73 | +git checkout tags/v4.1 |
| 74 | +echo There were some bugs in 4.1. This was fixed in dev stream and newer releases like 4.5.1. |
| 75 | +sed -ibak 's/ifneq ($(MACHINE),ppc64)/ifeq (,$(findstring ppc64,$(MACHINE)))/g' Makefile |
| 76 | +PORTABLE=1 make shared_lib |
| 77 | +INSTALL_PATH=/usr/local make install-shared |
| 78 | +ldconfig |
| 79 | +cd - ; rm -rf /tmp/rocksdb |
| 80 | + |
| 81 | +################################################ |
| 82 | +# Install PIP tools, behave and docker-compose # |
| 83 | +################################################ |
| 84 | + |
| 85 | +apt-get -y install python-pip |
| 86 | +pip install --upgrade pip |
| 87 | +pip install behave nose docker-compose |
| 88 | + |
| 89 | +pip install -I flask==0.10.1 python-dateutil==2.2 pytz==2014.3 pyyaml==3.10 couchdb==1.0 flask-cors==2.0.1 requests==2.4.3 grpcio==0.13.1 |
0 commit comments