Installation on Ubuntu Linux
This guide details system prerequisites, environment setup, and installation steps for OpenCode Router on Linux.
Supported Operating Systems
| Distribution | Status | Architecture | Verification Notes |
|---|---|---|---|
| Ubuntu 24.04 LTS | Tested & Verified | x86_64 | Primary development, build, and test validation platform. |
| Ubuntu 22.04 LTS | Likely Compatible | x86_64 | Untested; requires Node.js >= 18.0.0. |
| Debian 12 (Bookworm) | Likely Compatible | x86_64 | Untested; standard Debian package dependencies apply. |
| Fedora / Arch Linux | Untested | x86_64 | Untested; curl and unzip dependencies apply. |
| macOS / Windows | Unsupported | Any | Linux-specific paths and launcher scripts utilized. |
Prerequisites
Before installing, ensure the required utilities and runtime environments are installed on your Ubuntu host:
bash
# Update package repositories
sudo apt update
# Install system utilities
sudo apt install -y curl unzip git
# Verify Node.js (version 22.12.0 or higher required)
node -v
npm -vIf Node.js is not installed, install it using the official NodeSource repository or nvm:
bash
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejsStep-by-Step Installation
1. Clone the Repository
bash
git clone https://github.com/EhsanCreator/OpenCode-Router.git
cd OpenCode-Router2. Install Node Dependencies
bash
npm install3. Run Automated Startup Script
bash
./start.shThe start.sh script automatically performs the following tasks:
- Xray-Core Provisioning: Detects host architecture (
x86_64orarm64) and downloads the official release ifbin/xrayis missing. - Frontend Compilation: Builds the Vite/React application if
dist/is not present. - Permissions Setup: Marks
bin/opencode-vpnexecutable. - Service Launch: Starts the backend Express service on port
3000. - Browser Launch: Opens
http://localhost:3000in your default desktop browser.
Desktop Integration (Optional)
To integrate OpenCode Router into your Ubuntu desktop and application launcher menu:
bash
./scripts/create-desktop-launcher.shThis generates:
~/Desktop/OpenCode-Router.desktop~/.local/share/applications/opencode-router.desktop
Making opencode-vpn Available Globally
To run the dedicated launcher from any terminal directory without entering the project path:
bash
mkdir -p ~/.local/bin
ln -sf "$(pwd)/bin/opencode-vpn" ~/.local/bin/opencode-vpnEnsure ~/.local/bin is in your shell $PATH.