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