Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation Script

Use the installer script for a normal Linux install. It downloads the matching release archive, verifies the checksum, installs xrat, and can run first-time setup for you.

For other install paths, see Docker Install, Manual Binary Install, or Build From Source.

Requirements

Runtime dependencies

ToolRequiredPurposeInstall
xrayYesManaged Xray runtime and real-delay testsXTLS/Xray-install
sing-boxNosing-box parsing and runtime-config preview for diagnosticssing-box.app

Install xray:

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

Install sing-box (optional):

curl -fsSL https://sing-box.app/install.sh | sh

System requirements

RequirementDetails
OSLinux x86_64 or aarch64
libcNone – release binaries are statically linked
SQLiteBundled – no system SQLite needed
PostgreSQLOptional – version 14+ if used instead of SQLite
NetworkOutbound HTTPS for imports and release downloads

Install

curl -fsSL https://raw.githubusercontent.com/mhyrzt/xrat/master/install.sh | bash

The installer will:

  1. Check for xray and warn if optional sing-box is missing.
  2. Detect x86_64 or aarch64.
  3. Download the latest GitHub release archive.
  4. Verify the archive against SHASUMS256.txt.
  5. Install xrat to ~/.local/bin/xrat.
  6. Offer to run xrat init.
  7. Offer to install and start the systemd user daemon.

To install to a different directory:

INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/mhyrzt/xrat/master/install.sh | bash

Make sure the install directory is in PATH:

export PATH="$HOME/.local/bin:$PATH"

Add that line to ~/.bashrc, ~/.zshrc, or your shell’s equivalent startup file if needed.

Build and Install From Local Checkout

Set BUILD_FROM_SOURCE=1 to have the installer build the binary from the repository instead of downloading a release archive. Run the script directly from the repo root β€” piping from curl will not work because the script needs Cargo.toml present alongside it.

Requirements: cargo must be in PATH. git, curl, tar, and sha256sum are not needed.

git clone https://github.com/mhyrzt/xrat.git
cd xrat
BUILD_FROM_SOURCE=1 bash install.sh

To install to a different directory:

BUILD_FROM_SOURCE=1 INSTALL_DIR=/usr/local/bin bash install.sh

The script will:

  1. Run cargo build --release inside the checkout.
  2. Generate man pages and shell completions from the built binary.
  3. Install xrat and extras the same way as the release path.
  4. Offer first-time setup prompts.

For a pure Cargo-managed install or a development workflow, see Build From Source.

First-Time Setup

If you skipped the installer’s setup prompts, initialize xrat manually:

xrat init

To install the daemon later:

xrat daemon install --start

Then follow the Quickstart to import configs and connect.

State Paths

PathPurposeOverride
$HOME/.config/xrat/App rootXRAT_PATH env var
$HOME/.config/xrat/config.tomlConfiguration--config flag
$HOME/.config/xrat/db.sqliteSQLite database--database flag
$HOME/.config/xrat/runtime/Daemon socket, session state-
$HOME/.config/xrat/logs/Runtime logs[runtime.log].dir
$HOME/.config/xrat/mmdb/GeoIP data[mmdb].dir