IBM openblockchain學習(一)--obc-peer環境搭建

配置開發環境

當前開發環境使用varant來運行一個ubuntu鏡像,ubuntu中運行着docker容器。
主機->ubuntu->docker。

該模型可以使開發者使用它們自己喜歡的編輯器/操作系統,並且爲長期開發的團隊提供可控制的環境。

先前的準備

Git client (能夠ping通google)
Go(1.6或以上)
Vagrant(1.7.4之上)
Virtualbox(5.0之上)

BIOS開啓了虛擬化,對於未開啓虛擬化的電腦,可以在security中進行設置。

步驟

(1) 首先爲host配置gopath。
(2) 對於windows用戶而言,需要修改core.autocrlf這個字段。
通過git config --get core.autocrlf查看它的值
如果爲true,需要修改爲false

git config --global core.autocrlf false

(3)clone obc-peer項目

cd $GOPATH/src
mkdir -p github.com/openblockchain
cd github.com/openblockchain
git clone https://github.com/openblockchain/obc-peer.git

(4)clone obc-dev-env project
創建workspace目錄,不要再gopath路徑下

cd WORKSPACE
git clone https://github.com/openblockchain/obc-dev-env.git

(5)安裝虛擬機、推薦使用全局代理。
在WORKSPACE/obc-dev-env 目錄下執行

vagrant up

在這個過程中會下載鏡像及其它文件。這一過程中要保證良好的網速。由於需要下一些被牆了的包,務必使用代理。

沒有返回錯誤後,運行
Vagrant ssh。
初始密碼:vagrant
如果返回錯誤,則打開virtualbox,將下載的鏡像刪除,重新下載。

編譯運行

進入ubuntu的gopath路徑下,

cd $GOPATH/src/github.com/openblockchain/obc-peer
go build

進行編譯。

運行:

cd $GOPATH/src/github.com/openblockchain/obc-peer
./obc-peer

可以查到類似如下圖所示的命令行

執行相應指令即可運行。

常見問題

vagrant教程

go for eclipse

vagrant up報錯

vagrant安裝包

ld cannot find -lbz2

ld cannot find -lsnappy

linux go 安裝包

Vagrant Virtualbox windows版

出現這種錯誤往往是祕鑰不匹配的結果,在\obc-dev-env\目錄下輸入vagrant up 會自動生成一個.vagrant文件,然後在.vagrant\machines\default\virtualbox下新建一個文件private_key,

這個其中的祕鑰要和openchain鏡像中的vagrant_private_key中的內容保持一致

具體參考:http://serverfault.com/questions/586059/vagrant-error-connection-timeout-retrying

發佈了107 篇原創文章 · 獲贊 147 · 訪問量 51萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章