Xray + v2rayA

ENV
OS: Debian GNU/Linux 12 (bookworm) x86_64

一、 xray-core 部署

1.1 下载

https://github.com/XTLS/Xray-core/releases
根据自己的环境选择合适的版本

1.2 安装

注意: 本文xray安装的目录不符合 FHS规范

sudo mkdir /xray
sudo unzip Xray-linux-64.zip -d /usr/local/xray

1.3 使用systemd管理

# /etc/systemd/system/xray.service
[Unit]
Description=Xray Service
Documentation=https://github.com/xtls
After=network.target nss-lookup.target

[Service]
User=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/xray/xray run -config /usr/local/xray/config.json
Restart=on-failure
RestartPreventExitStatus=23
LimitNPROC=10000
LimitNOFILE=1000000

[Install]
WantedBy=multi-user.target

ln -s /usr/local/xray/xray.service /etc/systemd/system/
sudo systemctl daemon-reload

1.4 使用脚本安装以符合FHS规范

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

这个脚本在没有代理的情况下基本上无法实行,卡在下载过程,TMD这不是winrar.rar行为吗

手动使其符合FHS规范

按照下面目录移动文件,没有就新建

二、 V2RayA 部署

2.1 软件源安装

添加 V2RayA 公钥

wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc

添加 V2RayA 源

echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list

安装 V2RayA

sudo apt update && sudo apt install v2raya

2.2 deb 包安装

下载

https://github.com/v2rayA/v2rayA/releases

安装

sudo apt install ./$PATH/istaller_debian_amd64_2.0.5.deb

两种安装方式效果相同

三、 V2RayA 配置相关

确保V2RayA正常运行,xray可以不运行。

报错: 检测到geosite.dat, geoip.dat文件或v2ray-core 可能未正确配置

解决: 出现上述原因,大多数是因为 v2ray或xray没有按照 FHS的规范安装,导致 v2raya 找不到相关文件