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
| Tool | Required | Purpose | Install |
|---|---|---|---|
xray | Yes | Managed Xray runtime and real-delay tests | XTLS/Xray-install |
sing-box | No | sing-box parsing and runtime-config preview for diagnostics | sing-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
| Requirement | Details |
|---|---|
| OS | Linux x86_64 or aarch64 |
| libc | None β release binaries are statically linked |
| SQLite | Bundled β no system SQLite needed |
| PostgreSQL | Optional β version 14+ if used instead of SQLite |
| Network | Outbound HTTPS for imports and release downloads |
Install
curl -fsSL https://raw.githubusercontent.com/mhyrzt/xrat/master/install.sh | bash
The installer will:
- Check for
xrayand warn if optionalsing-boxis missing. - Detect
x86_64oraarch64. - Download the latest GitHub release archive.
- Verify the archive against
SHASUMS256.txt. - Install
xratto~/.local/bin/xrat. - Offer to run
xrat init. - 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:
- Run
cargo build --releaseinside the checkout. - Generate man pages and shell completions from the built binary.
- Install
xratand extras the same way as the release path. - 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
| Path | Purpose | Override |
|---|---|---|
$HOME/.config/xrat/ | App root | XRAT_PATH env var |
$HOME/.config/xrat/config.toml | Configuration | --config flag |
$HOME/.config/xrat/db.sqlite | SQLite 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 |