ubuntu 上的 Hyperledger fabric src 文件夹安装目录

Hyperledger fabric src folder installation dir on ubuntu

问候 hyperledger 开发者,

我正在尝试安装 fabric 项目的先决条件。大多数工具都在工作,包括 curl、docker、docker-compose、npm、go。

我已经在 usr/local/go 中安装了 go 并将 goroot 设置到该文件夹​​。

我的面料项目位于我的主目录中的单独文件夹中。

我是否需要在 go 根文件夹中移动 fabric src 代码,因为我在 运行

时收到以下错误

make cryptogen

can't load package: package github.com/hyperledger/fabric/core/chaincode/shim: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of: /usr/local/go/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOROOT) /usr/local/go/bin/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOPATH) find: ‘/usr/local/go/bin/src/github.com/hyperledger/fabric/core/chaincode/shim’: No such file or directory

它起作用了。不得不放下

/usr/local/go

要遵循的步骤。

created new folder inside /usr/local/go/src

mkdir github.com

mkdir hyperledger

cd hyperledger/

git clone -b master https://github.com/hyperledger/fabric-samples.git

curl Platform-specific Binaries from website.

export PATH=/usr/local/go/src/hyperledger/bin:$PATH

cd fabric-samples/first-network

./byfn.sh -m generate

而且我可以得到漂亮的控制台输出。 :)

fabric-samples 源代码树可以安装在 $GOROOT 之外。为此,您可以使用 $GOPATH 变量指定可以安装各种 golang 项目的路径。例如

export GOPATH=/home/someacct/go
mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger
git clone -b master https://github.com/hyperledger/fabric-samples.git
cd fabric-samples
...

然后可以从以下位置访问 fabric-samples 源树:

$GOPATH/src/github.com/hyperledger/fabric

请注意,这是更常见的处理方式。

要获取 Hyperledger Fabric 资源,您只需 运行 以下命令,顺便说一句,这是安装 go 包的正确方法:

go get github.com/hyperledger/fabric

那你应该可以

cd $GOPATH/src/github.com/hyperledger/fabric

并执行

make cryptogen

或使用 make 文件来构建实验所需的任何内容。例如:

make peer orderer

将分别生成 peer 和 orderer 二进制文件。

二进制工件将在 $GOPATH/src/github.com/hyperledger/fabric/build/bin 可用,当然要使用它们,您必须在 $PATH.

中提供它们

当然,您可以只下载平台特定的二进制文件并立即使用它们 w/o 进行任何本地编译。