CentOS7.0+Fabricv1.0.0区块链超级账本环境.docx_第1页
CentOS7.0+Fabricv1.0.0区块链超级账本环境.docx_第2页
CentOS7.0+Fabricv1.0.0区块链超级账本环境.docx_第3页
CentOS7.0+Fabricv1.0.0区块链超级账本环境.docx_第4页
CentOS7.0+Fabricv1.0.0区块链超级账本环境.docx_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第一步 主机环境,以Centos7以例。1.1安装VMware虚拟机。我安装的VMware12是 VMware-workstation-full-12.5.7-5813279.exe,其他的虚拟机也可以。安装虚拟机的时候需要注意的是1、 内存=2GB,硬盘=40GB。因为首先运行Fabric的环境需要安装很多东西,其次如果有较多的链码则需要更多容器,预留足够的硬盘空间(我建议40GB或更多)以存储区块文件。1.2安装centos7我安装的是CentOS-7-x86_64-DVD-1804.iso第二步 登陆Centos 配置基础环境2.1新建用户最好不要使用root用户操作bigtreelocalhost $ sudo -ssudo bigtree 的密码:bigtree 不在 sudoers 文件中。此事将被报告。bigtreelocalhost $ su root密码:rootlocalhost bigtree# vi /etc/sudoersrootlocalhost bigtree# exit2.2安装gitGit 干啥就不多介绍了,文中以后的安装软件内容的截屏不是特殊情况就不拷贝了。rootlolhost bigtree# yum install git已加载插件:fastestmirror, langpacksDetermining fastest mirrors * base: * extras: * updates: .省略导入 GPG key 0xF4A80EB5: 用户ID : CentOS-7 Key (CentOS 7 Official Signing Key) 指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 软件包 : centos-release-7-5.1804.el7.centos.x86_64 (anaconda) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7.省略作为依赖被升级: perl-Git.noarch 0:-14.el7_5 2.3安装curl 这个也可以不装,可以采用其他的方式rootlocalhost bigtree# yum install curl2.4安装pip更新pip时可以会有版本不对提示,这时可暂时不处理,在安装Docker时同步处理rootlocalhost bigtree# yum -y install epel-releaserootlocalhost bigtree# yum install python-piprootlocalhost bigtree# pip install -upgrade pip第三步 区块链的运行调试环境3.1Update一下新的软件包列表文件,更新本地软件包缓存信息rootlocalhost bigtree# yum update3.2安装需要的软件包一般来说这不需要做这步,做了更好,yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的。rootlocalhost bigtree# yum install -y yum-utils device-mapper-persistent-data lvm23.3设置yum源 rootlocalhostbigtree# yum-config-manager -add-repo /linux/centos/docker-ce.repo3.4 docker安装3.4.1查看所有docker版本 rootlocalhost bigtree# yum list docker-ce -showduplicates | sort r已加载插件:fastestmirror, langpacks可安装的软件包 * updates: Loading mirror speeds from cached hostfile * extras: * epel: docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stabledocker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stabledocker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stabledocker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable * base: 3.4.2安装dockerrootlocalhost bigtree# yum install docker-ce3.4.3 docker versionrootlocalhost bigtree# docker version如果有以下红字提示,执行3.7Client: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:23:03 2018 OS/Arch: linux/amd64 Experimental: falseCannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?3.4.4启动docker,在看一下doucker版本rootlocalhost bigtree# service docker startrootlocalhost bigtree# docker versionClient: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:23:03 2018 OS/Arch: linux/amd64 Experimental: falseServer: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:25:29 2018 OS/Arch: linux/amd643.4.5启动docker以及开机自启动rootlocalhost bigtree# systemctl start dockerrootlocalhost bigtree# systemctl enable docker3.5docker-compose安装rootlocalhost bigtree# pip install docker-compose更新时如果有以下红字提示,必须解决,执行3.5.1,如果没有执行3.6节 3.5.1检查pip安装,记性好的可以不做,我还是看看是不是忘记安装了,进入 pip-10.0.1 目录rootlocalhost bigtree# pip install -upgrade pip3.5.2安装jinja下载rootlocalhost bigtreewget /packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz解压rootlocalhost bigtree# tar xvf Jinja2-2.7.3.tar.gz安装rootlocalhost Jinja2-2.7.3# python setup.py install3.5.3安装pyudev下载pyudev rootlocalhost bigtree# git clone /lunaryorn/pyudev.git进入 pyudev文件夹rootlocalhost bigtree# cd pyudev安装 rootbogon pyudev# python setup.py install3.5.4安装dnspython下载dnspython rootlocalhost bigtree# wget /kits/1.15.0/dnspython-1.15.0.tar.gz 解压 rootlocalhost bigtree# tar -zxvf dnspython-1.15.0.tar.gz进入 rootlocalhost bigtree# cd dnspython-1.15.0安装rootlocalhost dnspython-1.15.0# python setup.py install再来一次pip installrootlocalhost dnspython-1.15.0# cd .rootlocalhost /# pip install -ignore-installed requests3.6 go语言 安装我用了两种方式安装第一种方式安装的go语言是1.9的版本,后续出了好多版本问题,还得逐一解决。建议采用第二种方式使用更高的版本1.10.3。第一种方式rootlocalhost bigtree# yum install golang y第二种方式自己下载采取解压安装的方式。3.6.1 下载安装包自己上网找吧,我安装的是go1.10.3.linux-amd64.tar.gz3.6.2解压安装rootlocalhost home# tar -C /usr/local -zxf go1.10.3.linux-amd64.tar.gz3.6.3修改环境变量rootlocalhost bigtree# vim /etc/profileexport PATH=$PATH:/usr/local/go/binexport GOROOT=/usr/local/goexport GOPATH=$HOME/goexport PATH=$PATH:$HOME/go/bin3.6.4然后source一下,立即生效rootlocalhost bigtree# source /etc/profile3.6.5查看版本rootlocalhost bigtree# go versiongo version go1.10.3 linux/amd643.6.6查看环境rootlocalhost bigtree# go env3.7安装node.js(1)下载nodejs rootlocalhost bigtree# wget /mirrors/node/v9.9.0/node-v9.9.0.tar.gz(2)解压 rootlocalhost bigtree# tar -C /usr/local -xzf node-v9.9.0.tar.gz(3)安装编译软件 rootlocalhost bigtree# yum install gcc gcc-c+(4)查看编译软件版本 rootlocalhost bigtree# gcc -v这块需要注意,安装完版本还是那样,我这块搞了半天,应该是gcc 版本 8.1.0 (GCC),这块没有截屏,我特意上网找了个相似的图片。(5)4.8.5版本过低,若已为最新版请跳过至步骤,升级gcc,前往/gnu/gcc/下载你想要的版本(6)下载新版本rootlocalhost bigtree# wget /gnu/gcc/gcc-8.1.0/gcc-8.1.0.tar.gz(7)解压 rootlocalhost bigtree# tar -C /usr/local -xzf gcc-8.1.0.tar.gz(8)rootlocalhost bigtree# cd /usr/local/gcc-8.1.0(9)root localhost gcc-8.1.0# ./contrib/download_prerequisites(10) rootlocalhost gcc-8.1.0# mkdir build & rootlocalhost gcc-8.1.0# cd build(11)rootlocalhost build# ./configure -enable-checking=release -enable-languages=c,c+ -disable-multilib (12)rootlocalhost build# yum groupinstall Development Tools(13)这一步会超慢,如果正赶上下班你就赶快回家吧,我就等了一个多小时,后来还是先回家了。rootlocalhost build# make(14)rootlocalhost build#make install(15)重启系统(16)查看gcc的版本 rootlocalhost bigtree# gcc v使用内建 specs。COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.1.0/lto-wrapper目标:x86_64-pc-linux-gnu配置为:./configure -enable-checking=release -enable-languages=c,c+ -disable-multilib线程模型:posixgcc 版本 8.1.0 (GCC)(17)rootlocalhost /# cd /usr/local/node-v9.9.0/ 进入node安装的目录(18)rootbogon node-v9.9.0# ./configure(19)rootbogon node-v9.9.0# make(20)rootbogon node-v9.9.0# make install3.8安装npm(1)rootlocalhost# npm install npm g(2)root localhost# npm v第四步 到Fabric了4.1下载fabric源码(1)rootlocalhost /# mkdir -p $GOPATH/src//hyperledger(2)root localhost /# cd $GOPATH/src//hyperledger(3)root localhost hyperledger# git clone /hyperledger/fabric.git4.2切换到v1.0.0版本这个必须得切,我试过其他版本,会有些麻烦,而且由于Fabric一直在更新,所有我们并不需要最新最新的源码,需要切换到v1.0.0版本的源码即可root localhost hyperledger# cd fabricroot localhost fabric# git checkout v1.0.04.3下载docker镜像注意文件路径,需要跟着上一步 从fabric目录开始root localhost fabric /examples/e2e_cli/root localhost fabric source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0如果镜像不全可以自己比较一下,用以下命令自己下载docker pull hyperledger/fabric-tools:x86_64-1.0.0docker pull hyperledger/fabric-couchdb:x86_64-1.0.0docker pull hyperledger/fabric-kafka:x86_64-1.0.0docker pull hyperledger/fabric-orderer:x86_64-1.0.0docker pull hyperledger/fabric-peer:x86_64-1.0.0docker pull hyperledger/fabric-ca:x86_64-1.0.0docker pull hyperledger/fabric-ccenv:x86_64-1.0.0docker pull hyperledger/fabric-baseimage:x86_64-0.4.7docker pull hyperledger/fabric-baseos:x86_64-0.4.7docker pull hyperledger/fabric-zookeeper:x86_64-1.0.0docker pull hyperledger/fabric-javaenv:x86_64-1.0.0docker pull hyperledger/fabric-membersrvc:latest查看docker镜像的命令,有些镜像是可以不用下载的,我pull了这些镜像最后启动Fabric网络并完成ChainCode的测试(1)开启fabric客户端rootlocalhost e2e_cli# ./network

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论