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 | bashInstall 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 relayYou 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 --purgePre-built Binaries
Download the latest release for your platform from GitHub Releases.
Supported Platforms
| Platform | Architecture |
|---|---|
| Linux | x86_64, aarch64, armv7, i686 |
| Linux (musl) | x86_64, aarch64, armv7, i686 |
| macOS | x86_64, aarch64 (Apple Silicon) |
| Windows | x86_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 trojanThis 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 --releaseThe 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 analyticsVerify Installation
trojan --version
trojan --helpThe --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