github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/devenv/setupRHELonZ.sh (about) 1 #!/bin/bash 2 # 3 # Copyright IBM Corp. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 9 # Development on Z is done on the native OS, not in Vagrant. This script can be 10 # used to set things up in RHEL on Z, similar to devenv/setup.sh which does the 11 # same for Vagrant. 12 # See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/install.md 13 # 14 # To get started: 15 # sudo su 16 # yum install git 17 # mkdir -p $HOME/git/src/github.com/hyperledger 18 # cd $HOME/git/src/github.com/hyperledger 19 # git clone http://gerrit.hyperledger.org/r/fabric 20 # source fabric/devenv/setupRHELonZ.sh 21 # make peer unit-test behave 22 23 if [ xroot != x$(whoami) ] 24 then 25 echo "You must run as root (Hint: sudo su)" 26 exit 27 fi 28 29 if [ -n -d $HOME/git/src/github.com/hyperledger/fabric ] 30 then 31 echo "Script fabric code is under $HOME/git/src/github.com/hyperledger/fabric " 32 exit 33 fi 34 35 #TODO: should really just open a few ports.. 36 iptables -I INPUT 1 -j ACCEPT 37 sysctl vm.overcommit_memory=1 38 39 ################## 40 # Install Docker 41 cd /tmp 42 wget ftp://ftp.unicamp.br/pub/linuxpatch/s390x/redhat/rhel7.2/docker-1.10.1-rhel7.2-20160408.tar.gz 43 tar -xvzf docker-1.10.1-rhel7.2-20160408.tar.gz 44 cp docker-1.10.1-rhel7.2-20160408/docker /bin 45 rm -rf docker docker-1.10.1-rhel7.2-20160408.tar.gz 46 47 #TODO: Install on boot 48 nohup docker daemon -g /data/docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock& 49 50 ################################### 51 # Crosscompile and install GOLANG 52 cd $HOME 53 git clone http://github.com/linux-on-ibm-z/go.git 54 cd go 55 git checkout release-branch.go1.6 56 57 cat > crosscompile.sh <<HEREDOC 58 cd /tmp/home/go/src 59 yum install -y git wget tar gcc bzip2 60 export GOROOT_BOOTSTRAP=/usr/local/go 61 GOOS=linux GOARCH=s390x ./bootstrap.bash 62 HEREDOC 63 64 docker run --privileged --rm -ti -v $HOME:/tmp/home brunswickheads/openchain-peer /bin/bash /tmp/home/go/crosscompile.sh 65 66 export GOROOT_BOOTSTRAP=$HOME/go-linux-s390x-bootstrap 67 cd $HOME/go/src 68 ./all.bash 69 export PATH=$HOME/go/bin:$PATH 70 71 rm -rf $HOME/go-linux-s390x-bootstrap 72 73 ################ 74 #Install Basic build essential packages 75 yum install -y gcc-c++ python-devel device-mapper libtool-ltdl-devel libffi-devel openssl-devel 76 77 ################ 78 # PIP 79 yum install python-setuptools 80 curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" 81 python get-pip.py 82 pip install --upgrade pip 83 pip install behave nose docker-compose 84 85 ################ 86 #grpcio package 87 88 git clone https://github.com/grpc/grpc.git 89 cd grpc 90 pip install -rrequirements.txt 91 git checkout tags/release-0_13_1 92 sed -i -e "s/boringssl.googlesource.com/github.com\/linux-on-ibm-z/" .gitmodules 93 git submodule sync 94 git submodule update --init 95 cd third_party/boringssl 96 git checkout s390x-big-endian 97 cd ../.. 98 GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install . 99 100 # updater-server, update-engine, and update-service-common dependencies (for running locally) 101 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 pyOpenSSL==16.2.0 pysha3==1.0b1 102 103 #PIP packages required for some behave tests 104 pip install urllib3 ndg-httpsclient pyasn1 ecdsa python-slugify grpcio-tools jinja2 b3j0f.aop 105 106 cat >> ~/.bashrc <<HEREDOC 107 export PATH=$HOME/go/bin:$PATH 108 export GOROOT=$HOME/go 109 export GOPATH=$HOME/git 110 HEREDOC 111 112 source ~/.bashrc 113 114 # Build the actual hyperledger peer 115 cd $GOPATH/src/github.com/hyperledger/fabric 116 make clean peer