用vagrant 搭建fabric

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/scylhy/article/details/81806851

用vagrant 搭建fabric

吐槽:由于Q的原因,很多东西超时,导致很多错误,其次书中的教程并没有详细的提供解决方案...

  • 经历的两次大坑

    1.grpcio长时间安装没有动静,因为经常启动时,经常发上超时失败,所以经常把这个长时间没有任何输出的,认为失败的状态。因为偷懒,看了会视频,返回看了一眼,居然过了。。。
    2.栽倒在gotools,查了资料,手动下载tools,并放到fabric/gotools下,但是fabric/gotools/build/gopath/src/golang.org/x/tools已经有个couchdb文件,认为不该动这个文件。。。最后放到这里试了一下成功了。。。
    3.vagrant up中不知道什么时候就来一个timeout!不知道什么时候就来一个新bug!


  • QAs:
    • Q1:长时间下载不完*.box virtual box虚拟机文件
    • Q2:* default: failed to create symbolic link ‘/usr/bin/gradle’*
    • Q3:pip安装grpcio时间很长
    • Q4:gotools makes时,找不到包
    • Q5:访问github-cloud.s3.amazonaws.com 超时

  • Q1:长时间下载不完*.box virtual box虚拟机文件
  • A:手动下载.box文件,并添加到box

    • box add

      vagrant box add ubuntu/xenial64 xenial-server-cloudimg-amd64-vagrant.box

      box

    • 虚拟机文字为 default
    • 虚拟机文件添加到了~/.vagrant.d/boxes/
          .
          └── ubuntu-VAGRANTSLASH-xenial64
              └── 0
                  └── virtualbox
                      ├── Vagrantfile
                      ├── box.ovf
                      ├── metadata.json
                      ├── ubuntu-xenial-16.04-cloudimg-configdrive.vmdk
                      ├── ubuntu-xenial-16.04-cloudimg.mf
                      └── ubuntu-xenial-16.04-cloudimg.vmdk
  • Q2:* default: failed to create symbolic link ‘/usr/bin/gradle’*

        default: + wget https://services.gradle.org/distributions/gradle-2.12-bin.zip -P /tmp --quiet
        default: + unzip -q /tmp/gradle-2.12-bin.zip -d /opt
        default: replace /opt/gradle-2.12/getting-started.html? [y]es, [n]o, [A]ll, [N]one, [r]ename: 
        default: error:  invalid response [exit]
        default: replace /opt/gradle-2.12/getting-started.html? [y]es, [n]o, [A]ll, [N]one, [r]ename: 
        default:  NULL
        default: (EOF or read error, treating as "[N]one" ...)
        default: + ln -s /opt/gradle-2.12/bin/gradle /usr/bin
        default: ln: 
        default: failed to create symbolic link '/usr/bin/gradle'
        default: : File exists
    
  • A:进入vagrant删除存在的链接

    vagrant ssh
    sudo rm /usr/bin/gradle
  • Q3:pip安装grpcio时间很长

  • A:安装时间确实很长,等就OK,不如去喝杯咖啡

  • Q4:gotools makes时,找不到包

        default: Building github.com/golang/lint/golint -> golint
        default: package golang.org/x/tools/go/ast/astutil: unrecognized import path "golang.org/x/tools/go/ast/astutil" (https fetch: Get https://golang.org/x/tools/go/ast/astutil?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
        default: package golang.org/x/tools/go/gcexportdata: unrecognized import path "golang.org/x/tools/go/gcexportdata" (https fetch: Get https://golang.org/x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
        default: Makefile:47: recipe for target 'gotool.golint' failed
        default: make[2]: Leaving directory '/opt/gopath/src/github.com/hyperledger/fabric/gotools'
        default: make[2]: *** [gotool.golint] Error 1
        default: Makefile:52: recipe for target '/opt/gopath/src/github.com/hyperledger/fabric/gotools/build/gopath/bin/golint' failed
        default: make[1]: Leaving directory '/opt/gopath/src/github.com/hyperledger/fabric/gotools'
        default: make[1]: *** [/opt/gopath/src/github.com/hyperledger/fabric/gotools/build/gopath/bin/golint] Error 2
        default: Makefile:118: recipe for target 'gotools' failed
        default: make: *** [gotools] Error 2
    The SSH command responded with a non-zero exit status. Vagrant
    assumes that this means the command failed. The output for this command
    should be in the log above. Please read the output to determine what
    went wrong.
  • A:手动下载tools包,并放到正确的位置上

    • 正常情况下,本地找不到go包,make会自动去官网下载,但golang.org是谷歌的,被Q了,我已经代理网络,包括虚拟机,还是没有成功
    • fabric/gotools/build/gopath/src/golang.org/x/tools已经存在,并有一个couchdb,下载tools后与其放在一起

      git clone https://github.com/golang/tools.git
    • 之前已经下载该文件,但是犯错位置了,放到本机的src/golang.org下了

  • Q5:访问github-cloud.s3.amazonaws.com 超时

  • A:这个是被Q了,加代理,不行就多试几次,或者手动解决

  • Others:

    • 安装vagrant-scp插件,可手动上传文件到虚拟机

      
      #default为未制定虚拟机名称时的名称
      
      vagrant scp ./test default:~
    • mac parallel虚拟机中安装ubuntu,然后在ubuntu中再安装virtualbox,进行vagrant up,会报VT-X错误:原因parallel不支持虚拟机内vt-x,换成virtualbox或者直接在mac进行vagrant up

  • 启动成功
    up


猜你喜欢

转载自blog.csdn.net/scylhy/article/details/81806851
今日推荐