Setting up the development environment¶
Prerequisites¶
Go - version 1.12.x
(macOS) Xcode must be installed
Docker - 17.06.2-ce or later
Docker Compose - 1.14.0 or later
(macOS) you may need to install gnutar, as macOS comes with bsdtar as the default, but the build uses some gnutar flags. You can use Homebrew to install it as follows:
brew install gnu-tar
(macOS) If you install gnutar, you should prepend the “gnubin” directory to the $PATH environment variable with something like:
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH
(macOS) Libtool. You can use Homebrew to install it as follows:
brew install libtool
(only if using Vagrant) - Vagrant - 1.9 or later
(only if using Vagrant) - VirtualBox - 5.0 or later
BIOS Enabled Virtualization - Varies based on hardware
Note: The BIOS Enabled Virtualization may be within the CPU or Security settings of the BIOS
Steps¶
Set your GOPATH¶
Make sure you have properly setup your Host’s GOPATH environment variable. This allows for both building within the Host and the VM.
In case you installed Go into a different location from the standard one your Go distribution assumes, make sure that you also set GOROOT environment variable.
Note to Windows users¶
If you are running Windows, before running any git clone
commands,
run the following command.
git config --get core.autocrlf
If core.autocrlf
is set to true
, you must set it to false
by
running
git config --global core.autocrlf false
If you continue with core.autocrlf
set to true
, the
vagrant up
command will fail with the error:
./setup.sh: /bin/bash^M: bad interpreter: No such file or directory
Cloning the Hyperledger Fabric source¶
Since Hyperledger Fabric is written in Go
, you’ll need to
clone the source repository to your $GOPATH/src directory. If your $GOPATH
has multiple path components, then you will want to use the first one.
There’s a little bit of setup needed:
cd $GOPATH/src
mkdir -p github.com/hyperledger
cd github.com/hyperledger
Recall that we are using Gerrit
for source control, which has its
own internal git repositories. Hence, we will need to clone from
Gerrit.
For brevity, the command is as follows:
git clone ssh://LFID@gerrit.hyperledger.org:29418/fabric && scp -p -P 29418 LFID@gerrit.hyperledger.org:hooks/commit-msg fabric/.git/hooks/
Note: Of course, you would want to replace LFID
with your own
Linux Foundation ID.