一、Window安装
1. 安装vagrant
1) 下载和安装
下载地址:https://www.vagrantup.com/downloads.html
Windows版本下载URL:https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.msi
下载完成之后,直接双击下载的vagrant_1.8.4.msi安装包即可。
2) 基本使用
帮助文档:https://www.vagrantup.com/docs/
搜索box的URL : https://atlas.hashicorp.com/boxes/search
1) Install box
Adding a box from the catalog is very easy. Each box shows you instructions with how to add it, but they all follow the same format:
$ vagrant box add USER/BOX |
For example: vagrant box add hashicorp/precise64. You can also quickly initialize a Vagrant environment with vagrant init hashicorp/precise64.
另外,如果直接下载了box,可以通过如下命令安装:
$ vagrant box add xxx.box |
2) vagrant up
It is time to boot your first Vagrant environment. Run the following from your terminal:
$ vagrant up |
In less than a minute, this command will finish and you will have a virtual machine running Ubuntu.
3) vagrant ssh
This command will drop you into a full-fledged SSH session.
$ vagrant ssh |
The SSH session can be terminated with CTRL+D.
2. 安装virtualbox
1) 下载
http://download.virtualbox.org/virtualbox/5.1.0/VirtualBox-5.1.0-108711-Win.exe
2) 安装
直接双击exe文件安装即可。
3. 安装go
1) 下载
https://storage.googleapis.com/golang/go1.6.2.windows-amd64.msi
2) 安装
双击下载的msi文件即可完成安装。
3) 配置环境变量
貌似不用单独配置,安装的时候就已经配置好了。
4. Git安装
1) 下载
https://github.com/git-for-windows/git/releases/download/v2.9.0.windows.1/Git-2.9.0-64-bit.exe
2) 安装
直接双击下载的exe文件即可。
5. 源码下载
1) 下载hyperledger/fabric源代码
a) 通过git:git clone https://github.com/hyperledger/fabric.git
b) 或者直接下载zip包:https://github.com/hyperledger/fabric/archive/master.zip
2) 运行安装对应的环境
参考文档:https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devenv.md
下载源码之后,进入fabric-master/devenv文件夹。然后运行vagrant up命令启动Ubuntu镜像。
3) 镜像启动完成之后,就可以运行vagrant ssh进入Ubuntu命令行。
或者通过virtualbox启动镜像,然后进入命令行,这种情况下需要输入用户名和密码:vagrant/vagrant。
Once inside the VM, you can find the peer project under $GOPATH/src/github.com/hyperledger/fabric (as well as /hyperledger).
6. Docker安装
执行下面两个命令:
$ sudo apt-get update $ sudo apt-get install -y docker.io |
二、Linux安装
1.Go安装
通过下面三个命令安装go:
$ sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable $ sudo apt-get update $ sudo apt-get install golang |
安装完成之后,执行which go,查看安装的路径:
查看版本:
三、运行chaincore示例
【参考:https://github.com/hyperledger/fabric/blob/master/docs/Setup/Chaincode-setup.md】