github.com/sykesm/fabric@v1.1.0-preview.0.20200129034918-2aa12b1a0181/docs/source/prereqs.rst (about) 1 Prerequisites 2 ============= 3 4 Before we begin, if you haven't already done so, you may wish to check that 5 you have all the prerequisites below installed on the platform(s) 6 on which you'll be developing blockchain applications and/or operating 7 Hyperledger Fabric. 8 9 Install Git 10 ----------- 11 Download the latest version of `git 12 <https://git-scm.com/downloads>`_ if it is not already installed, 13 or if you have problems running the curl commands. 14 15 Install cURL 16 ------------ 17 18 Download the latest version of the `cURL 19 <https://curl.haxx.se/download.html>`__ tool if it is not already 20 installed or if you get errors running the curl commands from the 21 documentation. 22 23 .. note:: If you're on Windows please see the specific note on `Windows 24 extras`_ below. 25 26 Docker and Docker Compose 27 ------------------------- 28 29 You will need the following installed on the platform on which you will be 30 operating, or developing on (or for), Hyperledger Fabric: 31 32 - MacOSX, \*nix, or Windows 10: `Docker <https://www.docker.com/get-docker>`__ 33 Docker version 17.06.2-ce or greater is required. 34 - Older versions of Windows: `Docker 35 Toolbox <https://docs.docker.com/toolbox/toolbox_install_windows/>`__ - 36 again, Docker version Docker 17.06.2-ce or greater is required. 37 38 You can check the version of Docker you have installed with the following 39 command from a terminal prompt: 40 41 .. code:: bash 42 43 docker --version 44 45 .. note:: The following applies to linux systems running systemd. 46 47 Make sure the docker daemon is running. 48 49 .. code:: bash 50 51 sudo systemctl start docker 52 53 Optional: If you want the docker daemon to start when the system starts, use the following: 54 55 .. code:: bash 56 57 sudo systemctl enable docker 58 59 Add your user to the docker group. 60 61 .. code:: bash 62 63 sudo usermod -a -G docker <username> 64 65 .. note:: Installing Docker for Mac or Windows, or Docker Toolbox will also 66 install Docker Compose. If you already had Docker installed, you 67 should check that you have Docker Compose version 1.14.0 or greater 68 installed. If not, we recommend that you install a more recent 69 version of Docker. 70 71 You can check the version of Docker Compose you have installed with the 72 following command from a terminal prompt: 73 74 .. code:: bash 75 76 docker-compose --version 77 78 .. _Golang: 79 80 Go Programming Language 81 ----------------------- 82 83 Hyperledger Fabric uses the Go Programming Language for many of its 84 components. 85 86 - `Go <https://golang.org/dl/>`__ version 1.13.x is required. 87 88 Given that we will be writing chaincode programs in Go, there are two 89 environment variables you will need to set properly; you can make these 90 settings permanent by placing them in the appropriate startup file, such 91 as your personal ``~/.bashrc`` file if you are using the ``bash`` shell 92 under Linux. 93 94 First, you must set the environment variable ``GOPATH`` to point at the 95 Go workspace containing the downloaded Fabric code base, with something like: 96 97 .. code:: bash 98 99 export GOPATH=$HOME/go 100 101 .. note:: You **must** set the GOPATH variable 102 103 Even though, in Linux, Go's ``GOPATH`` variable can be a colon-separated list 104 of directories, and will use a default value of ``$HOME/go`` if it is unset, 105 the current Fabric build framework still requires you to set and export that 106 variable, and it must contain **only** the single directory name for your Go 107 workspace. (This restriction might be removed in a future release.) 108 109 Second, you should (again, in the appropriate startup file) extend your 110 command search path to include the Go ``bin`` directory, such as the following 111 example for ``bash`` under Linux: 112 113 .. code:: bash 114 115 export PATH=$PATH:$GOPATH/bin 116 117 While this directory may not exist in a new Go workspace installation, it is 118 populated later by the Fabric build system with a small number of Go executables 119 used by other parts of the build system. So even if you currently have no such 120 directory yet, extend your shell search path as above. 121 122 Node.js Runtime and NPM 123 ----------------------- 124 125 If you will be developing applications for Hyperledger Fabric leveraging the 126 Hyperledger Fabric SDK for Node.js, version 8 is supported from 8.9.4 and higher. 127 Node.js version 10 is supported from 10.15.3 and higher. 128 129 - `Node.js <https://nodejs.org/en/download/>`__ download 130 131 .. note:: Installing Node.js will also install NPM, however it is recommended 132 that you confirm the version of NPM installed. You can upgrade 133 the ``npm`` tool with the following command: 134 135 .. code:: bash 136 137 npm install npm@5.6.0 -g 138 139 Python 140 ^^^^^^ 141 142 .. note:: The following applies to Ubuntu 16.04 users only. 143 144 By default Ubuntu 16.04 comes with Python 3.5.1 installed as the ``python3`` binary. 145 The Fabric Node.js SDK requires an iteration of Python 2.7 in order for ``npm install`` 146 operations to complete successfully. Retrieve the 2.7 version with the following command: 147 148 .. code:: bash 149 150 sudo apt-get install python 151 152 Check your version(s): 153 154 .. code:: bash 155 156 python --version 157 158 .. _windows-extras: 159 160 Windows extras 161 -------------- 162 163 If you are developing on Windows 7, you will want to work within the 164 Docker Quickstart Terminal. However, by default it uses an old `Git 165 Bash <https://git-scm.com/downloads>`__ and experience has shown this 166 to be a poor development environment with limited functionality. It is 167 suitable to run Docker based scenarios, such as 168 :doc:`getting_started`, but you will have difficulties with operations 169 involving the ``make`` and ``docker`` commands. 170 171 Instead, it is recommended to use the MSYS2 environment and run make 172 and docker from the MSYS2 command shell. To do so, `install 173 MSYS2 <https://github.com/msys2/msys2/wiki/MSYS2-installation>`__ 174 (along with the base developer toolchain and gcc packages using 175 pacman) and launch Docker Toolbox from the MSYS2 shell with the 176 following command: 177 178 :: 179 180 /c/Program\ Files/Docker\ Toolbox/start.sh 181 182 Alternatively, you can change the Docker Quickstart Terminal command 183 to use MSYS2 bash by changing the target of the Windows shortcut from: 184 185 :: 186 187 "C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" 188 189 to: 190 191 :: 192 193 "C:\msys64\usr\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" 194 195 With the above change, you can now simply launch the Docker Quickstart 196 Terminal and get a suitable environment. 197 198 On Windows 10 you should use the native Docker distribution and you 199 may use the Windows PowerShell. However, for the ``binaries`` 200 command to succeed you will still need to have the ``uname`` command 201 available. You can get it as part of Git but beware that only the 202 64bit version is supported. 203 204 Before running any ``git clone`` commands, run the following commands: 205 206 :: 207 208 git config --global core.autocrlf false 209 git config --global core.longpaths true 210 211 You can check the setting of these parameters with the following commands: 212 213 :: 214 215 git config --get core.autocrlf 216 git config --get core.longpaths 217 218 These need to be ``false`` and ``true`` respectively. 219 220 The ``curl`` command that comes with Git and Docker Toolbox is old and 221 does not handle properly the redirect used in 222 :doc:`getting_started`. Make sure you have and use a newer version 223 which can be downloaded from the `cURL downloads page 224 <https://curl.haxx.se/download.html>`__ 225 226 For Node.js you also need the necessary Visual Studio C++ Build Tools 227 which are freely available and can be installed with the following 228 command: 229 230 .. code:: bash 231 232 npm install --global windows-build-tools 233 234 See the `NPM windows-build-tools page 235 <https://www.npmjs.com/package/windows-build-tools>`__ for more 236 details. 237 238 Once this is done, you should also install the NPM GRPC module with the 239 following command: 240 241 .. code:: bash 242 243 npm install --global grpc 244 245 Your environment should now be ready to go through the 246 :doc:`getting_started` samples and tutorials. 247 248 .. note:: If you have questions not addressed by this documentation, or run into 249 issues with any of the tutorials, please visit the :doc:`questions` 250 page for some tips on where to find additional help. 251 252 .. Licensed under Creative Commons Attribution 4.0 International License 253 https://creativecommons.org/licenses/by/4.0/