Trojan Rust

Installation

How to install trojan-rs on your system

Quick Install

One-line install script that downloads the binary, creates config, and sets up systemd service:

curl -fsSL https://get.trojan.rs/scripts/install.sh | bash

Install a specific mode (server is the default):

# Install server
curl -fsSL https://get.trojan.rs/scripts/install.sh | bash

# Install client
curl -fsSL https://get.trojan.rs/scripts/install.sh | bash -s -- install client

# Install relay entry node
curl -fsSL https://get.trojan.rs/scripts/install.sh | bash -s -- install entry

# Install relay node
curl -fsSL https://get.trojan.rs/scripts/install.sh | bash -s -- install relay

You can also specify a version or use environment variables:

# Install specific version
TROJAN_VERSION=v0.1.0 bash <(curl -fsSL https://get.trojan.rs/scripts/install.sh)

# Prefer musl build
TROJAN_MUSL=1 bash <(curl -fsSL https://get.trojan.rs/scripts/install.sh)

Manage the installation:

# Update binary to latest version
./install.sh update

# Show status of all installed modes
./install.sh status

# Uninstall a specific mode
./install.sh uninstall relay

# Remove everything (binary, config, logs, user)
./install.sh uninstall --purge

Pre-built Binaries

Download the latest release for your platform from GitHub Releases.

Supported Platforms

PlatformArchitecture
Linuxx86_64, aarch64, armv7, i686
Linux (musl)x86_64, aarch64, armv7, i686
macOSx86_64, aarch64 (Apple Silicon)
Windowsx86_64

Extract and place the binary in your PATH:

tar xzf trojan-x86_64-unknown-linux-gnu.tar.gz
sudo mv trojan /usr/local/bin/

Install via Cargo

If you have a Rust toolchain installed:

cargo install trojan

This installs the latest published version from crates.io.

Build from Source

Clone and build:

git clone https://github.com/trojan-rust/trojan-rust
cd trojan-rs
cargo build --release

The binary is at target/release/trojan.

Optional Features

The build supports optional Cargo features:

# With certificate generation support
cargo build --release --features cert

# With self-upgrade support
cargo build --release --features upgrade

# With analytics support
cargo build --release --features analytics

Verify Installation

trojan --version
trojan --help

The --help flag shows all available subcommands:

trojan server   - Run the Trojan server
trojan client   - Run the Trojan client (SOCKS5 proxy)
trojan cert     - Certificate management
trojan auth     - User management (SQL backends)
trojan entry    - Run a relay entry node
trojan relay    - Run a relay node

On this page