安裝fabric 1.4版本

安裝fabric 1.4版本

剛開始接觸區(qū)塊鏈,跟著網(wǎng)上的教程搭建hyperledger fabric ,下載的是1.0版本,最近運行GitHub上的例子,發(fā)現(xiàn)有些需要高的版本,所以決定更新版本到1.4,看了官網(wǎng)的更新文檔都是相近版本的更新,沒有找到從1.0更新到1.4的,所以決定按照官網(wǎng)文檔指導(dǎo)重新安裝。

其實掌握了搭建hyperledger fabric 1.0,安裝1.4是很簡單的,主要注意一下刪除之前的鏡像,重新安裝就可以。

刪除鏡像指令:

$ docker rm -f $(docker ps -aq)

$ docker rmi -f $(docker images -q)

參考https://hyperledger-fabric.readthedocs.io/en/latest/install.html

一、準備

要求版本:

go1.11 以及以上版本

docker 17.06.2-ce 以及以上版本

docker-compose?1.14.0 以及以上版本

go和docker的版本都很新,這里就不再贅述了。具體的安裝方法可以參考搭建hyperledger-fabric環(huán)境

更新docker-compose

安裝fabric源碼

lqr@lqr-VirtualBox:~$ mkdir -p ~/go/src/github.com/hyperledger

lqr@lqr-VirtualBox:~$ cd ~/go/src/github.com/hyperledger

lqr@lqr-VirtualBox:~/go/src/github.com/hyperledger$ git clonehttps://github.com/hyperledger/fabric.git

docker 鏡像安裝

進入到fabric目錄中,然后輸入

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

$ curl -sSL https://bit.ly/2ysbOFE | bash -s -- 1.4.0

$ docker images

二、構(gòu)建第一個網(wǎng)絡(luò)

$?cd fabric-samples/first-network

byfn.sh腳本的幫助文檔:

根據(jù)配置文件生成各種文件

$ sudo ./byfn.sh -m generate


Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds

Continue? [Y/n] y

proceeding ...

/home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/../bin/cryptogen

##########################################################

##### Generate certificates using cryptogen tool #########

##########################################################

+ cryptogen generate --config=./crypto-config.yaml

org1.example.com

org2.example.com

+ res=0

+ set +x

/home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/../bin/configtxgen

##########################################################

#########??Generating Orderer Genesis block ##############

##########################################################

CONSENSUS_TYPE=solo

+ '[' solo == solo ']'

+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block

2019-04-02 17:00:33.497 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration

2019-04-02 17:00:33.547 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo

2019-04-02 17:00:33.547 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.590 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo

2019-04-02 17:00:33.591 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.593 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block

2019-04-02 17:00:33.596 CST [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block

+ res=0

+ set +x

#################################################################

### Generating channel configuration transaction 'channel.tx' ###

#################################################################

+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel

2019-04-02 17:00:33.649 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration

2019-04-02 17:00:33.692 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.746 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo

2019-04-02 17:00:33.751 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.751 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx

2019-04-02 17:00:33.753 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 006 Writing new channel tx

+ res=0

+ set +x

#################################################################

#######????Generating anchor peer update for Org1MSP???##########

#################################################################

+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP

2019-04-02 17:00:33.811 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration

2019-04-02 17:00:33.865 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.917 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo

2019-04-02 17:00:33.917 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:33.917 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update

2019-04-02 17:00:33.917 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update

+ res=0

+ set +x

#################################################################

#######????Generating anchor peer update for Org2MSP???##########

#################################################################

+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP

2019-04-02 17:00:33.969 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration

2019-04-02 17:00:34.015 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:34.068 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo

2019-04-02 17:00:34.068 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/lqr/go/src/github.com/hyperledger/fabric/fabric-samples/first-network/configtx.yaml

2019-04-02 17:00:34.068 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update

2019-04-02 17:00:34.068 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update

+ res=0

+ set +x

啟動網(wǎng)絡(luò)

$ sudo ./byfn.sh up

出現(xiàn)上圖表示成功啦!

關(guān)閉網(wǎng)絡(luò)

$ sudo ./byfn.sh down


提示:
如果出現(xiàn)文件夾鎖住的情況可以通過一下指令修改權(quán)限,例如修改 fabric-sample的權(quán)限

lqr@lqr-VirtualBox:~/go/fabric-samples$ sudo chmod -R 777 fabric-samples

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容