github.com/leonlxy/hyperledger@v1.0.0-alpha.0.20170427033203-34922035d248/devenv/setupUbuntuOnPPC64le.sh (about)

     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 "build-essential" zlib1g-dev libbz2-dev
    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/xenial/at10.0/binary-ppc64el/advance-toolchain-golang-at_10.0-2_ppc64el.deb
    54  dpkg -i advance-toolchain-golang-at_10.0-2_ppc64el.deb
    55  rm -f advance-toolchain-golang-at_10.0-2_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 10
    59  update-alternatives --install /usr/bin/gofmt gofmt /usr/local/go/bin/gofmt 10
    60  
    61  # Set the GOROOT env variable
    62  export GOROOT="/opt/go"
    63  ln -s /usr/local/go $GOROOT
    64  
    65  ################################################
    66  # Install PIP tools, behave and docker-compose #
    67  ################################################
    68  
    69  apt-get -y install python-pip libssl-dev libffi-dev libltdl-dev
    70  pip install --upgrade pip
    71  pip install behave nose docker-compose
    72  
    73  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==1.0.4 pyOpenSSL==16.2.0 pysha3==1.0b1
    74  
    75  #PIP packages required for some behave tests
    76  pip install urllib3 ndg-httpsclient pyasn1 ecdsa python-slugify grpcio-tools jinja2 b3j0f.aop six