logos-storage-docs/learn/quick-start.md
Slava 291d65a865
Add Download Flow (#29)
* Add mermaid support

* Add Download Flow

* Adjust outline to show all the headers for Run Codex

* Update doc links to the internal ones
2024-10-01 13:49:11 +03:00

7.0 KiB

Quick start

To run Codex through this guide we would need to perform the following steps:

Get Codex binary

For quick a start we will use precompiled binaries from GitHub release page. If you prefer to compile from the sources, please check Build Codex.

Please follow the steps for your OS from the list:

Linux/macOS

  1. Download binary and checksum for your platform/architecture

    version=v0.1.4
    platform=$(echo `uname -s` | awk '{print tolower($0)}')
    architecture=$([[ `uname -m` == 'x86_64' ]] && echo amd64 || echo arm64)
    
    # Binary
    curl -LO https://github.com/codex-storage/nim-codex/releases/download/${version}/codex-${version}-${platform}-${architecture}.tar.gz
    
    # Checksum
    curl -LO https://github.com/codex-storage/nim-codex/releases/download/${version}/codex-${version}-${platform}-${architecture}.tar.gz.sha256
    
  2. Verify checksum

    Linux

    sha256sum -c codex-${version}-${platform}-${architecture}.tar.gz.sha256
    

    macOS

    shasum -a 256 -c codex-${version}-${platform}-${architecture}.tar.gz.sha256
    

    Make sure you get OK in the result

    codex-v0.1.4-linux-amd64.tar.gz: OK
    
  3. Extract binary

    tar -zxvf codex-${version}-${platform}-${architecture}.tar.gz
    
  4. Copy binary to the appropriate folder

    sudo install codex-${version}-${platform}-${architecture} /usr/local/bin/codex
    
  5. Install dependencies

    # Debian-based Linux
    sudo apt update && sudo apt install libgomp1
    
  6. Check the result

    codex --version
    
    Codex version:  v0.1.4
    Codex revision: 484124d
    Nim Compiler Version 1.6.14 [Linux: amd64]
    
  7. Cleanup

    rm -f \
      codex-${version}-${platform}-${architecture} \
      codex-${version}-${platform}-${architecture}.tar.gz \
      codex-${version}-${platform}-${architecture}.tar.gz.sha256
    

Windows

  1. Download binary and checksum for your platform/architecture

    Warning

    For Windows, only amd64 architecture is supported now.

    set version=v0.1.4
    set platform=windows
    if %PROCESSOR_ARCHITECTURE%==AMD64 (set architecture=amd64) else (set architecture=arm64)
    
    :: Binary
    curl -LO https://github.com/codex-storage/nim-codex/releases/download/%version%/codex-%version%-%platform%-%architecture%-libs.zip
    
    :: Checksum
    curl -LO https://github.com/codex-storage/nim-codex/releases/download/%version%/codex-%version%-%platform%-%architecture%-libs.zip.sha256
    
  2. Verify checksum

    for /f "delims=" %a in ('certUtil -hashfile codex-%version%-%platform%-%architecture%-libs.zip SHA256 ^| findstr -vrc:"[^0123-9aAb-Cd-EfF ]"') do @set ACTUAL_HASH=%a
    for /f "tokens=1" %a in (codex-%version%-%platform%-%architecture%-libs.zip.sha256) do set EXPECTED_HASH=%a
    if %ACTUAL_HASH% == %EXPECTED_HASH% (echo. && echo codex-%version%-%platform%-%architecture%-libs.zip: OK) else (echo. && echo codex-%version%-%platform%-%architecture%-libs.zip: FAILED)
    

    Make sure you get OK in the result

    codex-v0.1.4-windows-amd64-libs.zip: OK
    
  3. Extract binary and libraries

    if not exist %LOCALAPPDATA%\Codex mkdir %LOCALAPPDATA%\Codex
    tar -xvf codex-%version%-%platform%-%architecture%-libs.zip -C %LOCALAPPDATA%\Codex
    
    
  4. Rename binary and update user path variable

    :: Rename binary
    move /Y %LOCALAPPDATA%\Codex\codex-%version%-%platform%-%architecture%.exe %LOCALAPPDATA%\Codex\codex.exe
    
    :: Add folder to the path permanently
    setx PATH %PATH%%LOCALAPPDATA%\Codex;
    
    :: Add folder to the path for the current session
    PATH %PATH%%LOCALAPPDATA%\Codex;
    
  5. Check the result

    codex --version
    
    Codex version:  v0.1.4
    Codex revision: 484124d
    Nim Compiler Version 1.6.14 [Windows: amd64]
    Compiled at 2024-06-27
    Copyright (c) 2006-2023 by Andreas Rumpf
    
    git hash: 38640664088251bbc88917b4bacfd86ec53014b8
    active boot switches: -d:release
    
  6. Cleanup

    del codex-%version%-%platform%-%architecture%-libs.zip ^
      codex-%version%-%platform%-%architecture%-libs.zip.sha256
    

Run Codex

We may run Codex in different modes, and for a quick start we will run Codex node, to be able to share files in the network.

  1. Run Codex

    Linux/macOS

    codex \
    --data-dir=datadir \
    --disc-port=8090 \
    --listen-addrs=/ip4/0.0.0.0/tcp/8070 \
    --nat=`curl -s https://ip.codex.storage` \
    --api-cors-origin="*" \
    --bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P
    

    Windows

    :: Get Public IP
    for /f "delims=" %a in ('curl -s https://ip.codex.storage') do @set nat=%a
    
    :: Run
    codex ^
    --data-dir=datadir ^
    --disc-port=8090 ^
    --listen-addrs=/ip4/0.0.0.0/tcp/8070 ^
    --nat=%nat% ^
    --api-cors-origin="*" ^
    --bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P
    

    Tip

    In the example above we use Codex Testnet bootstrap nodes and thus we join Testnet. If you would like to join a different network, please use appropriate value.

  2. Configure port-forwarding for the TCP/UDP ports on your Internet router

    Protocol Service Port
    UDP Discovery 8090
    TCP Transport 8070

If you would like to purchase or sell storage, please consider to run Codex node with marketplace support or Codex storage node.

Interact with Codex

When your Codex node is up and running you can interact with it using Codex Marketplace UI for files sharing.

Also, you can interact with Codex using Codex API and for a walk-through of the API, consider following the Using Codex guide.

Stay in touch

Want to stay up-date, or looking for further assistance? Try our discord-server.

Ready to explore Codex functionality? Please Join Codex Testnet.

If you want to run Codex locally without joining the Testnet, consider trying the Codex Two-Client Test or the Running a Local Codex Network with Marketplace Support.