# Install TinyChain

## Client

Most users will only need to run the TinyChain Python client, not a TinyChain host. See the [Python client introduction](/guides/python-client-introduction.md) 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:

```
# build the Dockerfile from the GitHub repo, then run a new container with TinyChain listening on host port 8702
# the "-it" option also opens an interactive terminal
docker run -it -p 8702:8702/tcp $(docker build https://github.com/haydnv/tinychain.git -q) ./tinychain --data_dir=/tmp/data
```

You can check that your installation succeeded by loading [http://127.0.0.1:8702/state/scalar/value/string?key="Hello, World!"](http://127.0.0.1:8702/state/scalar/value/string?key=%22Hello,%20World!%22) in your browser.

### Automatic install (Ubuntu)

An install script is provided for Ubuntu (only tested on Ubuntu 20.04):

```
curl https://raw.githubusercontent.com/haydnv/tinychain/master/bin/install.sh -sSf | bash
```

### Manual install

1. (optional) 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. Install cargo by following the instructions here: <https://doc.rust-lang.org/cargo/getting-started/installation.html>
3. Install TinyChain by running `cargo install tinychain`

## systemd configuration

To use TinyChain in production, you'll probably want to configure [systemd](https://en.wikipedia.org/wiki/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](https://www.linode.com/docs/guides/start-service-at-boot/). You can customize this example systemd config file for your use-case:

```toml
# This is an example systemd service config for TinyChain.

[Unit]
Description=Tinychain
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=2

# change this user name!
User=root

# change this path to match your Tinychain install path
ExecStart=/root/tinychain/host/target/release/tinychain --data_dir=/tmp/data --cache_size=4G

[Install]
WantedBy=multi-user.target
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tinychain.net/fundamentals/install-tinychain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
