Debian / Ubuntu 部署 v2rayA 与 Xray 完整指南
本文档记录了在 Debian/Ubuntu 环境下,通过本地下载的方式安装 v2rayA 主程序、配置 Xray 内核,并手动补全路由规则文件的全过程。此方法可有效避开官方 APT 源报错、内核下载中断以及首次进入网页卡在“正在下载规则文件”等常见坑点。
1. 基础环境清理与准备
切换到 root 用户(如果当前不是 root):
su -清理过期的源文件(防止后续执行 apt update 时报错):
rm -f /etc/apt/sources.list.d/v2raya.list更新系统列表并安装必要的依赖工具:
apt update && apt install -y curl wget sed gnupg jq unzip2. 安装 v2rayA 主程序
自动获取 GitHub 上 v2rayA 的最新版本号:
LATEST_V=$(curl -s [https://api.github.com/repos/v2rayA/v2rayA/releases/latest](https://api.github.com/repos/v2rayA/v2rayA/releases/latest) | jq -r .tag_name)下载最新版的 deb 安装包(适用于 x64 架构):
wget [https://github.com/v2rayA/v2rayA/releases/download/$](https://github.com/v2rayA/v2rayA/releases/download/$){LATEST_V}/installer_debian_x64_${LATEST_V#v}.deb安装下载好的 deb 包(apt 会自动解决并安装缺少的系统依赖):
apt install -y ./installer_debian_x64_${LATEST_V#v}.deb清理已安装的 deb 包以释放空间:
rm installer_debian_x64_${LATEST_V#v}.deb3. 安装 Xray 内核与路由规则 (核心修复步)
设置临时终端代理(解决拉取 GitHub 报错以及资源下载卡住的问题)。
注意:请将 10.0.0.66:7897 替换为你实际可用的代理地址;如果服务器处于海外网络良好可跳过此步:
export https_proxy=[http://10.0.0.66:7897](http://10.0.0.66:7897)
export http_proxy=[http://10.0.0.66:7897](http://10.0.0.66:7897)使用官方脚本一键安装 Xray 内核:
curl -L [https://github.com/XTLS/Xray-install/raw/main/install-release.sh](https://github.com/XTLS/Xray-install/raw/main/install-release.sh) | bash创建资源目录,并手动下载 geoip.dat 和 geosite.dat(解决网页端一直提示下载中的问题):
mkdir -p /usr/local/share/xray/
wget -O /usr/local/share/xray/geoip.dat [https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat](https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat)
wget -O /usr/local/share/xray/geosite.dat [https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat](https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat)安装完成后,取消临时代理设置:
unset https_proxy http_proxy4. 启动服务与开机自启
重新加载 systemd 守护进程:
systemctl daemon-reload设置 v2rayA 开机自动启动:
systemctl enable v2raya启动(或重启)v2rayA 服务:
systemctl restart v2raya查看服务运行状态(出现绿色的 active (running) 即代表成功运行):
systemctl status v2raya5. 防火墙放行配置 (按需执行)
放行 2017 端口(如果你使用的是 ufw 防火墙):
ufw allow 2017/tcp放行 2017 端口(如果你使用的是 iptables 防火墙):
iptables -I INPUT -p tcp --dport 2017 -j ACCEPT6. 验证与使用
- 打开浏览器,访问管理后台:
http://你的服务器IP:2017 - 首次进入系统,请根据提示创建管理员账号和密码。
- 进入后台后,点击右上角的 Import 导入节点链接或订阅。
- 选中节点,点击左上角的 Ready -> Start 即可开启代理连接。

扫码打赏
