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