linux命令行环境使用clash的替代品-v2raya踩坑日记
linux命令行环境使用clash的替代品-v2raya踩坑日记
官方文档
https://v2raya.org/docs/prologue/introduction/
安装
建议使用apt安装
添加公钥
wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/keyrings/v2raya.asc
添加 V2RayA 软件源
echo "deb [signed-by=/etc/apt/keyrings/v2raya.asc] https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list
sudo apt update
安装 V2RayA
sudo apt install v2raya v2ray ## 也可以使用 xray 包#
启动 v2rayA / 设置 v2rayA 自动启动
从 1.5 版开始将不再默认为用户启动 v2rayA 及设置开机自动。
启动 v2rayA
sudo systemctl start v2raya.service
设置开机自动启动
sudo systemctl enable v2raya.service
网页设置
进入http://ip:2017
管理后台
按照图片配置
因为习惯clash的7890端口,所有将端口改成和clash相同的
透明代理不需要手动设置代理端口,所有流量自动判断是否走v2ray
系统内设置代理
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 # all_proxy=socks5://127.0.0.1:7891 # all_proxy可以不设置
为了方便使用,在环境变量中为改命令设置一个别名
在~/.bashrc文件中添加
alias daili='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891'
alias daili_no='unset http_proxy https_proxy all_proxy'
然后重新加载环境变量
hu@onecloud:~$ source ~/.bashrc
这样可以直接在命令行输入daili
设置代理,输入daili_no
取消代理
输入curl -i google.com
查看是否成功翻墙
输入
env | grep proxy
可以查看当前环境中的代理情况
可能遇到的问题
W: GPG error: https://apt.v2raya.org v2raya Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 354E516D494EF95F
因为没有成功添加密钥,添加密钥时报错tee: /etc/apt/keyrings/v2raya.asc: No such file or directory
在添加密钥之前创建/etc/apt/keyrings
文件夹即可
sudo mkdir -p /etc/apt/keyrings