Install TinyChain
Install the TinyChain host software

Client

Most users will only need to run the TinyChain Python client, not a TinyChain host. See the Python client introduction for instructions to install the client.

Host

Easy install

The quick and easy way to get TinyChain up and running to try it out is to use Docker:
1
# build the Dockerfile from the GitHub repo, then run a new container with TinyChain listening on host port 8702
2
# the "-it" option also opens an interactive terminal
3
docker run -it -p 8702:8702/tcp $(docker build https://github.com/haydnv/tinychain.git -q) ./tinychain --address=0.0.0.0
Copied!
You can check that your installation succeeded by loading http://127.0.0.1:8702/state/scalar/value/string?key="Hello, World!" in your browser.

Automatic install (Ubuntu)

An install script is provided for Ubuntu (only tested on Ubuntu 20.04):
1
curl https://raw.githubusercontent.com/haydnv/tinychain/master/bin/install.sh -sSf | bash
Copied!

Manual install (Ubuntu)

  1. 1.
    If you need CUDA support for GPU acceleration, first install CUDA 11 by following the instructions here: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation. If you're not sure, skip this step.
  2. 3.
    Install cargo by following the instructions here: https://doc.rust-lang.org/cargo/getting-started/installation.html
  3. 4.
    Install TinyChain by running cargo install tinychain --features=tensor

Manual install (other OS)

Installation on other operating systems has not been tested and may not be straightforward. If you need to install TinyChain on an operating system other than 64-bit x86 Ubuntu Linux, please Ask for help.
  1. 1.
    If you need CUDA support for GPU acceleration, make sure to install CUDA first. If you're not sure, skip this step.
  2. 2.
    Install ArrayFire by following the instructions here: https://arrayfire.org/docs/installing.htm
  3. 3.
    Install cargo by following the instructions here: https://doc.rust-lang.org/cargo/getting-started/installation.html
  4. 4.
    Install TinyChain by running cargo install tinychain --features=tensor
The ArrayFire library requires the environment variables AF_PATH and LD_LIBRARY_PATH to be set at build time and at run time. The vast majority of installation failures happen as a result of missing or incorrect environment variables. If you have any problems with your TinyChain installation, the first thing to check is that AF_PATH is set to the ArrayFire installation root directory and included in LD_LIBRARY_PATH.
Example:
1
export AF_PATH=/opt/arrayfire
2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64
Copied!

systemd configuration

To use TinyChain in production, you'll probably want to configure systemd so that TinyChain will automatically restart in the case of a crash or a host machine restart. You can find detailed instructions on how to configure a new service with systemd here. You can customize this example systemd config file for your use-case:
1
# This is an example systemd service config for TinyChain.
2
3
[Unit]
4
Description=Tinychain
5
After=network.target
6
StartLimitIntervalSec=0
7
8
[Service]
9
Type=simple
10
Restart=always
11
RestartSec=2
12
13
# change this user name!
14
User=root
15
16
# change this path to match your Tinychain install path
17
# you'll probably also want to include the --address, --data_dir, and --cluster flags, at a minimum
18
ExecStart=/root/tinychain/host/target/release/tinychain --cache_size=4G
19
20
[Install]
21
WantedBy=multi-user.target
Copied!