搭建和使用 v2ray
准备
- Github 项目地址:https://github.com/v2ray/v2ray-core
- 系统要求:
Debian 9(推荐)
Ubuntu 14
Ubuntu 16
CentOS 7
其他 Linux 版本不建议 - VIM 快捷键使用:
输入 i 进入编辑模式,修改完毕,Esc 键退出编辑模式,输入:w 保存文件,输入:q 退出 vim 编辑。
一键安装脚本
- sudo -i
- bash <(curl -s -L https://git.io/v2ray.sh)
注意
如果提示 curl: command not found
请安装 Curl
ubuntu/debian 系统安装 Curl 方法: apt-get update -y && apt-get install curl -y
centos 系统安装 Curl 方法: yum update -y && yum install curl -y
协议很多,可以搜索了解下,也可以直接用默认的。有的需要有域名(websocket tls),有的就不用(tcp,mkcp)
没啥需求就用 TCP
追求更加安全就用 WS + TLS
ISP 多作怪用动态端口
VPS 网络不好就用 mKCP
基本上按照提示一步步选择,回车就可以搞定了。
配置及管理展开目录
V2Ray 配置文件路径:/etc/v2ray/config.json
V2ray 常用管理命令
v2ray info 查看 V2Ray 配置信息
v2ray config 修改 V2Ray 配置
v2ray link 生成 V2Ray 配置文件链接
v2ray infolink 生成 V2Ray 配置信息链接
v2ray qr 生成 V2Ray 配置二维码链接
v2ray ss 修改 Shadowsocks 配置
v2ray ssinfo 查看 Shadowsocks 配置信息
v2ray ssqr 生成 Shadowsocks 配置二维码链接
v2ray status 查看 V2Ray 运行状态
v2ray start 启动 V2Ray
v2ray stop 停止 V2Ray
v2ray restart 重启 V2Ray
v2ray log 查看 V2Ray 运行日志
v2ray update 更新 V2Ray
v2ray update.sh 更新 V2Ray 管理脚本
v2ray uninstall 卸载 V2Ray
各平台客户端展开目录
- Win
V2rayN:https://github.com/2dust/v2rayN/releases/latest
记得选择 v2rayN-Core.zip 下载,不然还得单独下载 core(下面 “坑二” 有讲到)
规则推荐:https://github.com/Loyalsoldier/v2ray-rules-dat - MAC
V2RayX:https://github.com/Cenmrev/V2RayX - ios
shadowrockets - 安卓
v2rayNG:https://github.com/2dust/v2rayNG/releases
v2flyNG
坑一之国内网络死循环展开目录
北京腾讯云服务器安装 v2ray, 但是国内服务器不好访问 github,脚本也执行不了
解决办法就是修改服务器 host,让服务器能访问 github
1. 修改 host- sudo vi /etc/hosts
- i
2. 在末行添加
- # GitHub Start
- 52.74.223.119 github.com
- 192.30.253.119 gist.github.com
- 54.169.195.247 api.github.com
- 185.199.111.153 assets-cdn.github.com
- 185.199.109.133 raw.githubusercontent.com
- 151.101.108.133 user-images.githubusercontent.com
- 151.101.76.133 gist.githubusercontent.com
- 151.101.76.133 cloud.githubusercontent.com
- 151.101.76.133 camo.githubusercontent.com
- 151.101.76.133 avatars0.githubusercontent.com
- 151.101.76.133 avatars1.githubusercontent.com
- 151.101.76.133 avatars2.githubusercontent.com
- 151.101.76.133 avatars3.githubusercontent.com
- 151.101.76.133 avatars4.githubusercontent.com
- 151.101.76.133 avatars5.githubusercontent.com
- 151.101.76.133 avatars6.githubusercontent.com
- 151.101.76.133 avatars7.githubusercontent.com
- 151.101.76.133 avatars8.githubusercontent.com
- # GitHub End
3. 保存退出
- esc:
- wq
4. 按教程执行脚本
坑二之 Windows 下 v2rayN-core 的问题展开目录
若你下载的 v2rayN 出现了以下提示
- 启动服务(2021/6/10 11:51:15)...
- 找不到Core,下载地址: https://github.com/v2fly/v2ray-core/releases
则说明你没有安装 v2ray-core(核心)因为 V2Ray Windows 客户端主要有两个,一个是 v2ray-core(v2ray 核心,官方客户端),另一个是 v2rayN(基于 v2ray-core 的开一个 GUI 可视化客户端),其中 v2ray-core 可以单独使用,而 v2rayN 则是基于 v2ray-core 的一个辅助可视化工具。
解决方法:
你需要打开 https://github.com/v2ray/v2ray-core/releases 下载你对应的 v2ray-core,然后把 V2Ray-core zip 包里面的东西移动到 V2rayN 的文件夹里,或者将 v2rayN 里的 v2rayN.exe 拖入到 V2Ray-core 文件夹内
然而最简单的办法则是直接下载 V2rayN 完整版(选择 v2rayN-Core.zip):
https://github.com/2dust/v2rayN/releases/latest