trifid/website/docs/src/tfclient/install/linux.md

2.9 KiB

Linux Installation

1. Set up your compiler toolchain

In order to compile tfclient, you will need a functional Rust compiler and a functional C compiler suite. You will also need a copy of the git command-line tools.

If you don't have Rust installed, we highly recommend you use rustup:

curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh

Follow the instructions on-screen.

Before continuing, ensure you have a Rust compiler:

$ cargo -V

This command should display cargo's version. If it does not, ensure Rust is installed properly.

You will also need a functioning Go compiler, with CGo support, and libclang installed.

Ensure you have:

  • a functioning Rust compiler
  • a functioning Go compiler, with CGo support
  • libclang installed

2. Acquire a copy of the tfclient source code

First, determine the most recent release of tfclient. Visit the refs page, and find the most recent tfclient release.

For example, if you see tfclient-v0.2.3, the latest version of tfclient is 0.2.3.

Next, download the tfclient source code:

$ git clone https://git.e3t.cc/~core/trifid --depth 0 -b [desired tfclient version]
$ cd tfclient

3. Compile tfclient

Finally, compile the tfclient binary with:

$ cargo build --release --bin tfclient

This can take a very long time depending on your computer specs, and requires an internet connection.

4. Install tfclient system-wide

Once the build finishes, the resulting binary will be target/release/tfclient. Copy this to a location in the system PATH, such as /bin or /usr/bin.

(Optional) 5. Create a system service

The following section assumes you have installed tfclient to /usr/bin/tfclient, and you wish to use the upstream DN API, https://api.defined.net. You will need to change these values in the

This will vary depending on your system. See the below sections for examples.

SystemD

[Unit]
Description=A client for Defined Networking mesh networks
Wants=basic.target network.target
After=basic.target network.target network-online.target

[Service]
SyslogIdentifier=tfclient
ExecStart=/usr/bin/tfclient run --server https://api.defined.net --name tfclient
Restart=always

[Install]
WantedBy=multi-user.target

Place this file in /usr/lib/systemd/system/tfclient.service, and start and enable it with systemctl enable --now tfclient.

runit

Create a new folder named tfclient in your service directory. For example, on Void Linux, this is /etc/sv/.

Create a new executable file named run in this directory (Void Linux Example: /etc/sv/tfclient/run), with the following contents:

#!/bin/bash
exec 2>&1 /usr/bin/tfclient --server https://api.defined.net --name tfclient > /var/log/tfclient.log

Link the service folder to the runsvdir. For Void Linux, this is /var/service:

$ ln -s /etc/sv/tfclient /var/service/