github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/docs/source/prereqs.md (about)

     1  # Prerequisites
     2  
     3  The following prerequisites are required to run a Docker-based Fabric test network on your local machine.
     4  
     5  ## Mac
     6  
     7  <!--- Indent entire section -->
     8  <div style="margin-left: 1.5em;">
     9  
    10  ### Homebrew
    11  
    12  For macOS, we recommend using [Homebrew](https://brew.sh) to manage the prereqs.
    13  
    14  ```shell
    15  $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    16  $ brew --version
    17  Homebrew 2.5.2
    18  ```
    19  
    20  The Xcode command line tools will be installed as part of the Homebrew installation.
    21  Once Homebrew is ready, installing the necessary prerequisites is very easy:
    22  
    23  ### Git
    24  
    25  Install the latest version of [git](https://git-scm.com/downloads) if it is not already installed.
    26  
    27  ```shell
    28  $ brew install git
    29  $ git --version
    30  git version 2.23.0
    31  ```
    32  
    33  ### cURL
    34  
    35  Install the latest version of [cURL](https://curl.haxx.se/download.html) if it is not already installed.
    36  
    37  ```shell
    38  $ brew install curl
    39  $ curl --version
    40  curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
    41  Release-Date: 2019-03-27
    42  ```
    43  
    44  ### Docker
    45  
    46  Install the latest version of [Docker Desktop](https://docs.docker.com/get-docker/) if it is not already installed.
    47  Since Docker Desktop is a UI application on Mac, use `cask` to install it.
    48  
    49  Homebrew v2.x:
    50  
    51  ```shell
    52  $ brew cask install --appdir="/Applications" docker
    53  ```
    54  
    55  Homebrew v3.x:
    56  
    57  ```shell
    58  $ brew install --cask --appdir="/Applications" docker
    59  ```
    60  
    61  Docker Desktop must be launched to complete the installation so be sure to open the application after installing it:
    62  
    63  ```shell
    64  $ open /Applications/Docker.app
    65  ```
    66  
    67  Once installed, confirm the latest versions of both `docker` and `docker-compose` executables were installed.
    68  
    69  ```shell
    70  $ docker --version
    71  Docker version 19.03.12, build 48a66213fe
    72  $ docker-compose --version
    73  docker-compose version 1.27.2, build 18f557f9
    74  ```
    75  
    76  > **Note:** Some users have reported errors while running Fabric-Samples with the Docker Desktop `gRPC FUSE for file sharing` option checked.
    77  > Please uncheck this option in your Docker Preferences to continue using `osxfs for file sharing`.
    78  
    79  ### Go
    80  
    81  Optional: Install the latest Fabric supported version of [Go](https://golang.org/doc/install) if it is not already
    82  installed (only required if you will be writing Go chaincode or SDK applications).
    83  
    84  ```shell
    85  $ brew install go@1.17.5
    86  $ go version
    87  go1.17.5 darwin/amd64
    88  ```
    89  
    90  ### JQ
    91  
    92  Optional: Install the latest version of [jq](https://stedolan.github.io/jq/download/) if it is not already installed
    93  (only required for the tutorials related to channel configuration transactions).
    94  
    95  ```shell
    96  $ brew install jq
    97  $ jq --version
    98  jq-1.6
    99  ```
   100  </div>
   101  
   102  ## **Linux**
   103  
   104  <!--- Indent entire section -->
   105  <div style="margin-left: 1.5em;">
   106  
   107  ### Git
   108  
   109  Install the latest version of [git](https://git-scm.com/downloads) if it is not already installed.
   110  
   111  ```shell
   112  $ sudo apt-get install git
   113  ```
   114  
   115  ### cURL
   116  
   117  Install the latest version of [cURL](https://curl.haxx.se/download.html) if it is not already installed.
   118  
   119  ```shell
   120  $ sudo apt-get install curl
   121  ```
   122  
   123  ### Docker
   124  
   125  Install the latest version of [Docker](https://docs.docker.com/get-docker/) if it is not already installed. 
   126  
   127  ```shell
   128  sudo apt-get -y install docker-compose
   129  ```
   130  
   131  Once installed, confirm that the latest versions of both Docker and Docker Compose executables were installed.
   132  
   133  ```shell
   134  $ docker --version
   135  Docker version 19.03.12, build 48a66213fe
   136  $ docker-compose --version
   137  docker-compose version 1.27.2, build 18f557f9
   138  ```
   139  
   140  Make sure the Docker daemon is running.
   141  
   142  ```shell
   143  sudo systemctl start docker
   144  ```
   145  
   146  Optional: If you want the Docker daemon to start when the system starts, use the following:
   147  
   148  ```shell
   149  sudo systemctl enable docker
   150  ```
   151  
   152  Add your user to the Docker group.
   153  
   154  ```shell
   155  sudo usermod -a -G docker <username>
   156  ```
   157  
   158  ### Go
   159  
   160  Optional: Install the latest version of [Go](https://golang.org/doc/install) if it is not already installed
   161  (only required if you will be writing Go chaincode or SDK applications).
   162  
   163  ### JQ
   164  
   165  Optional: Install the latest version of [jq](https://stedolan.github.io/jq/download/) if it is not already installed
   166  (only required for the tutorials related to channel configuration transactions).
   167  
   168  </div>
   169  
   170  ## **Windows**
   171  
   172  <!--- Indent entire section -->
   173  <div style="margin-left: 1.5em;">
   174  
   175  ### Docker
   176  
   177  Install the latest version of [Docker Desktop](https://docs.docker.com/get-docker/) if it is not already installed.
   178  
   179  ### WSL2
   180  
   181  Both the Fabric documentation and Fabric samples rely heavily on a `bash` environment. The recommended
   182  path is to use WSL2 (Windows Subsystem for Linux version 2) to provide a native Linux environment and then you can follow the Linux prerequisites section (excluding the Linux Docker prerequisite as you already have Docker Desktop) and install them into your WSL2 linux distribution.
   183  
   184  WSL2 may not be installed by default; you can check and install WSL2 by going into "Programs and Features", clicking on "Turn Windows features on or off" and ensuring that both "Windows Subsystem For Linux" and "Virtual Machine Platform" are selected.
   185  
   186  Next you will need to install a Linux distribution such as Ubuntu-20.04 and make sure it's set to using version 2 of WSL. Refer to [Install WSL](https://docs.microsoft.com/en-us/windows/wsl/install) for more information.
   187  
   188  Finally, you need to ensure Docker Desktop has integration enabled for your distribution so it can interact with Docker elements, such as a bash command window. To do this, open the Docker Desktop gui and go into settings, select `Resources` and them `WSL Integration` and ensure the checkbox for enable integration is checked. You should then see your WSL2 linux distribution listed (if you don't then it is probably because it is still a WSL1 distribution and needs to be converted to WSL2) and you can then toggle the switch to enable integration for that distro. Refer to [Docker Desktop WSL2 backend](https://docs.docker.com/desktop/windows/wsl/) for more information
   189  
   190  ### Microsoft VS Code (Optional)
   191  
   192  Microsoft VS Code provides an IDE that has tight integration with WSL2 Linux Distibutions. Search the Microsoft Marketplace in VS Code for the Remote Development extension pack for more information. This pack includes, among other things, the `Remote - WSL extension` and the `Remote - Containers` extension.
   193  
   194  ### Git For Windows (Optional)
   195  
   196  Although not required, if you do decide to install Git on Windows and manage the Fabric repositories natively (as opposed to within WSL2 and its Git installation), then make sure you configure Git as follows:
   197  
   198  Update the following `git` configurations:
   199  ```shell
   200  git config --global core.autocrlf false
   201  git config --global core.longpaths true
   202  ```
   203  
   204  You can check the setting of these parameters with the following commands:
   205  ```shell
   206  git config --get core.autocrlf
   207  git config --get core.longpaths
   208  ```
   209  These output from these commands should be false and true respectively.
   210  
   211  </div>
   212  
   213  ## **Notes**
   214  
   215  - These prerequisites are recommended for Fabric users. If you are a Fabric developer, please refer to the instructions for [Setting up the development environment](https://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/devenv.html).
   216  
   217  <!--- Licensed under Creative Commons Attribution 4.0 International License
   218  https://creativecommons.org/licenses/by/4.0/ -->