Ubuntu18.04安装Fabric

本文介绍如何在Ubuntu18.04中搭建Fabric1.4实验环境,默认使用root用户。

1.安装Golang

  • 首先下载Golang安装包,安装包可以从这里下载。这里下载的是go1.13.4.linux-amd64.tar.gz
  • 安装:tar -zxvf go1.13.4.linux-amd64.tar.gz -C /usr/local/
  • 配置环境变量
    • 编辑$HOME/.bashrc,在末尾增加如下内容:

      export GOROOT=/usr/local/go
      export GOPATH=$HOME/go
      export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
    • 生效. $HOME/.bashrc
    • 查看go版本信息:go --version

2. 安装docker

  • 安装需要的包:apt install apt-transport-https ca-certificates software-properties-common curl
  • 添加GPG密钥,并添加Docker-ce软件源,这里使用中国科技大学提供的源

    curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | apt-key add -
    add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
    $(lsb_release -cs) stable"
  • 安装Docker-ce:apt update -y && apt install -y docker-ce docker-compose
  • 设置docker开机启动:systemctl enable docker && systemctl start docker
  • 测试执行:docker run hello-world

3. 安装Node.js

  • 下载二进制源码包:wget https://nodejs.org/dist/v12.13.0/node-v12.13.0-linux-x64.tar.xz
  • 安装:tar -xvf node-v12.13.0-linux-x64.tar.xz -C /opt/
  • 配置全局可用
    • 编辑$HOME/.bashrc,末尾添加如下内容:
    export NODEJS_HOME=/opt/node-v12.13.0-linux-x64
    export PATH=$NODEJS_HOME/bin:$PATH
    • 生效:source $HOME/.bashrc

4. Fabric-simples安装

  • 创建目录:mkdir -p $GOPATH/src/hyperledger && cd $GOPATH/src/hyperledger
  • 下载Fabric-simples:curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh > bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh
  • 查看拉取到的docker镜像:docker images

猜你喜欢

转载自www.cnblogs.com/lianshuiwuyi/p/11819131.html
今日推荐