# How to Install V2Ray on Linux: A Complete Setup Guide

> Install V2Ray on Linux easily. Follow our guide for server setup using V2Fly and client configuration with the Fanqiang repository for a seamless experience.

- Repository: [如何翻墙/fanqiang](https://github.com/bannedbook/fanqiang)
- Tags: how-to-guide
- Published: 2026-09-06

---

**Use the official V2Fly install script for server setup and the Fanqiang repository's Clash (mihomo) guide for Linux client configuration.**

The **Fanqiang** repository by bannedbook is a comprehensive, open-source knowledge base for circumventing internet censorship. It organizes platform-specific tutorials under dedicated directories, with Linux installation workflows documented in [`linux/readme.md`](https://github.com/bannedbook/fanqiang/blob/main/linux/readme.md) and server deployment scripts maintained under `v2ss/`. This guide covers installing V2Ray on Linux using the repository's officially recommended methods.

## What the Fanqiang Repository Provides

The repository's architecture separates concerns by platform and use case:

- **`linux/`** — Client-side setup for Linux distributions using **Clash** (mihomo) or V2Ray core
- **`v2ss/`** — Server-side V2Ray installation scripts and self-hosted deployment guides
- **`windows/`**, **`macos/`**, **`android/`**, **`ios/`**, **`router/`**, **`game/`** — Cross-platform companion guides

For **installing V2Ray on Linux**, you'll typically combine two resources: the one-click server install script at `v2ss/V2ray官方一键安装脚本.md` and the client configuration steps in [`linux/readme.md`](https://github.com/bannedbook/fanqiang/blob/main/linux/readme.md).

## Server Installation: V2Fly Official Script

The Fanqiang repository recommends the community-maintained **V2Fly install-release script** for deploying V2Ray servers. This script handles binary distribution, systemd service creation, and geo-data downloads automatically.

Execute the official one-click installer:

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

```

The script performs the following operations as documented in `v2ss/V2ray官方一键安装脚本.md`【/cache/repos/github.com/bannedbook/fanqiang/master/v2ss/V2ray官方一键安装脚本.md†L1-L14】:

1. Detects your system architecture and distribution
2. Downloads the matching V2Ray binary from GitHub releases
3. Installs to `/usr/local/bin/` and creates systemd service files
4. Fetches geoip.dat and geosite.dat for routing rules

After installation, verify the service status:

```bash
systemctl status v2ray

```

## Client Setup: Clash (Mihomo) on Linux

The **Fanqiang** Linux guide prioritizes **Clash** (specifically the **mihomo** fork) as the recommended client for consuming V2Ray subscriptions. This approach decouples protocol handling from core management—mihomo supports V2Ray's VMess and VLESS protocols while providing a unified YAML configuration interface.

### Step 1: Create Configuration Directory

```bash
mkdir -p ~/.config/mihomo && cd ~/.config/mihomo

```

### Step 2: Download Mihomo Binary

```bash
wget -O clash-linux.gz \
  https://github.com/MetaCubeX/mihomo/releases/download/v1.17.0/mihomo-linux-amd64-v1.17.0.gz

```

Adjust the version string in the URL to match the latest release for your architecture.

### Step 3: Extract and Prepare

```bash
gzip -d clash-linux.gz
chmod +x clash-linux
./clash-linux

```

The initial run generates default configuration files. Terminate with `Ctrl-C` after startup completes【/cache/repos/github.com/bannedbook/fanqiang/master/linux/readme.md†L5-L73】.

### Step 4: Inject V2Ray Subscription

Replace the generated [`config.yaml`](https://github.com/bannedbook/fanqiang/blob/main/config.yaml) with your V2Ray provider's Clash-compatible subscription:

```bash
wget -U "Mozilla/6.0" -O ~/.config/mihomo/config.yaml \
  "https://your-clash-subscription.link/your-file.yaml"

```

### Step 5: Launch the Client

```bash
./clash-linux &

```

## Environment Configuration for System-Wide Proxying

The [`linux/readme.md`](https://github.com/bannedbook/fanqiang/blob/main/linux/readme.md) file【/cache/repos/github.com/bannedbook/fanqiang/master/linux/readme.md†L1-L34】 recommends exporting proxy environment variables for applications that respect `http_proxy`/`https_proxy`:

```bash
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7890

```

Mihomo's default mixed port is `7890`—verify your [`config.yaml`](https://github.com/bannedbook/fanqiang/blob/main/config.yaml) if this differs.

## Alternative: Direct V2Ray Core Installation

If you prefer running **V2Ray core directly** without the mihomo wrapper, install the official binary and manage [`config.json`](https://github.com/bannedbook/fanqiang/blob/main/config.json) manually:

```bash

# Using the same V2Fly install script

bash <(curl -fsSL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

# Generate config.json from your server details

sudo nano /usr/local/etc/v2ray/config.json

# Start the service

sudo systemctl start v2ray

```

This method is documented in the advanced server setup guide at `v2ss/自建V2ray服务器简明教程.md`.

## Key Configuration Files and Paths

| Path | Purpose |
|------|---------|
| `~/.config/mihomo/config.yaml` | Mihomo client routing and server definitions |
| [`/usr/local/etc/v2ray/config.json`](https://github.com/bannedbook/fanqiang/blob/main//usr/local/etc/v2ray/config.json) | Native V2Ray core configuration (if installed directly) |
| `/usr/local/bin/v2ray` | V2Ray server binary location |
| `/etc/systemd/system/v2ray.service` | Systemd service definition |

## Summary

- **Use the V2Fly install script** (`https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh`) for rapid server deployment—this is the method endorsed by `v2ss/V2ray官方一键安装脚本.md`
- **Prefer mihomo (Clash)** as your Linux client for simplified subscription management, following [`linux/readme.md`](https://github.com/bannedbook/fanqiang/blob/main/linux/readme.md)【/cache/repos/github.com/bannedbook/fanqiang/master/linux/readme.md†L1-L34】
- **Architecture matters**: Download binaries matching your system's `amd64`, `arm64`, or `armv7` architecture
- **Systemd integration**: Both V2Ray core and mihomo can run as user-level or system-level services for persistence

## Frequently Asked Questions

### What is the difference between V2Ray and Clash/mihomo?

**V2Ray** is the underlying proxy protocol suite (VMess, VLESS, Trojan). **Mihomo** (formerly Clash Meta) is a rule-based proxy client that *consumes* V2Ray protocols alongside others like Shadowsocks and Trojan. The Fanqiang repository recommends mihomo for Linux clients because it unifies multiple protocol handlers behind a single YAML configuration, while V2Ray core is typically deployed on servers.

### Does the official install script work on all Linux distributions?

The V2Fly install-release.sh script supports systemd-based distributions including Ubuntu, Debian, CentOS, RHEL, Fedora, and Arch Linux. It automatically detects your architecture and selects the appropriate binary. Non-systemd systems (Alpine, some containers) require manual binary extraction from GitHub releases.

### Where can I find free V2Ray servers for testing?

The Fanqiang repository maintains a wiki page with free V2Ray airport listings, cross-referenced from multiple tutorials. Production deployments should use self-hosted servers following `v2ss/自建V2ray服务器简明教程.md` for TLS and WebSocket configuration to ensure security and reliability.

### How do I update an existing V2Ray installation?

Re-run the install script with the `--force` flag to update to the latest release:

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --force

```

For mihomo clients, download the new binary and replace the existing file, preserving your [`config.yaml`](https://github.com/bannedbook/fanqiang/blob/main/config.yaml).