下载安装
平台支持
Xray 在以下平台中可用:
- Windows 7 及之后版本(x86 / amd64 / arm32 / arm64);
- Windows 7 中使用 1.8.4、1.8.6 的常规版本以及 1.8.18 以后的
win7
版本需要系统安装有 KB4474419 更新方可使用;推荐同时安装 KB4490628 以便联网后接受后续的操作系统安全更新。
- Windows 7 中使用 1.8.4、1.8.6 的常规版本以及 1.8.18 以后的
- macOS 10.10 Yosemite 及之后版本(amd64 / arm64);
- Linux 2.6.23 及之后版本(x86 / amd64 / arm / arm64 / mips64 / mips / ppc64 / s390x / riscv64);
- 包括但不限于 Debian 7 / 8、Ubuntu 12.04 / 14.04 及后续版本、CentOS 7 / 8、Arch Linux 等;
- FreeBSD (x86 / amd64);
- OpenBSD (x86 / amd64);
下载 Xray
预编译的二进制 ZIP 格式压缩包可在 Github Releases 中找到。
下载对应平台的压缩包,解压后即可使用。
验证安装包
Xray 提供两种验证方式:
- ZIP 压缩包的 SHA1 / SHA256 摘要
- 可复现构建:请参照 编译 Xray
Windows 安装方式
- 在 Github Releases 下载适用于 Windows 平台的 ZIP 压缩包,解压后可得到可执行文件
xray.exe
,然后通过命令行带参数运行 即可 - 通过 Scoop 包管理器安装:Xray 已经被添加到 Mochi。
macOS 安装方式
- 在 Github Releases 下载适用于 macOS 平台的 ZIP 压缩包,解压后可得到可执行文件
xray
,然后通过命令行带参数运行 即可 - 通过 Homebrew 包管理器安装:
brew install xray
- homebrew-xray 感谢@N4FA
Linux 安装方式
安装脚本
Linux Script
- XTLS/Xray-install (官方脚本)
- tempest (支持
systemd
以及 OpenRC; 仅限 Linux 下使用)
One Click
Magisk
Arch Linux
Arch User Repository
需要使用 AUR helpers,以 yay 为例,可通过 yay -S xray
安装。
Arch Linux CN
首先添加 Arch Linux CN 仓库,然后在 root 用户下使用 pacman -S xray
安装。
Linuxbrew
Linuxbrew 包管理器的使用方式与 Homebrew 一致:brew install xray
Debian WIP
Gentoo
目前有三个第三方 Overlay 提供 Portage 安装脚本:
- CHN-beta/touchfish-os: 个人维护,适用于 systemD 系统
- Gentoo-zh: 社区维护,适用于 systemD 系统
- JuanCldCmt/Xray-Overlay:个人维护,适用于 openRC 系统,同时使用 xray 用户组运行以提高安全性
使用 layman 或 eselect-repository 添加 Overlay 至本地,然后即可安装。
Docker 安装方式
目前提供两种不同风格的 Docker 映像:
- teddysun/xray 有 root 权限、有 shell 环境、兼容所有 Alpine 支持的架构。由私人服务器 dl.lamp.sh 编译并构建。使用起来更便捷
- ghcr.io/xtls/xray-core 无 root 权限、无 shell 环境、支持更多的架构。由官方库编译并构建支持追溯。牺牲了便利性来追求更极端的安全性
Docker image 的文件结构
teddysun/xray 版本映像:
/usr/bin/xray
:Xray 主程序/etc/xray/config.json
:单一配置文件(其所在目录为挂载点)/usr/share/xray/
:资源文件目录,存放了 v2fly 版本地理位置数据文件- geoip.dat
- geosite.dat
ghcr.io/xtls/xray-core 版本映像:
/usr/local/bin/xray
:Xray 主程序(拥有者是 root:root、文件权限 755)/usr/local/etc/xray/
:配置文件目录(挂载点)(拥有者是 root:root、目录权限 755、文件权限 644)- 00_log.json
- 01_api.json
- 02_dns.json
- 03_routing.json
- 04_policy.json
- 05_inbounds.json
- 06_outbounds.json
- 07_transport.json
- 08_stats.json
- 09_reverse.json
/usr/local/share/xray/
:资源文件目录,存放了 Loyalsoldier 版本地理位置数据文件(权限同上)- geoip.dat
- geosite.dat
/var/log/xray/
:日志文件目录(挂载点)(目录拥有者是 root:root、权限 755;文件拥有者是 65532:65532、权限 600)- access.log
- error.log
图形化客户端
- OpenWrt
- Windows
- Android
- iOS & macOS arm64
- macOS arm64 & x64
- Linux
UUID 生成器
第三方的 UUID 生成器 uuidgenerator.net