v2ray官方新老脚本安装

v2ray官方新老脚本安装

下载 V2Ray

  1. Github Release: github.com/v2ray/v2ray-core
  2. Github 分流: github.com/v2ray/dist
  3. Homebrew: github.com/v2ray/homebrew-v2ray
  4. Arch Linux: packages/community/x86_64/v2ray
  5. Snapcraft: snapcraft.io/v2ray-core
  6. 原安装脚本已被弃置,由 fhs-install-v2ray替换。

老版本安装

1
bash <(curl -L -s https://install.direct/go.sh)

此脚本会自动安装以下文件:

1
2
3
4
5
/usr/bin/v2ray/v2ray:V2Ray 程序;
/usr/bin/v2ray/v2ctl:V2Ray 工具;
/etc/v2ray/config.json:配置文件;
/usr/bin/v2ray/geoip.dat:IP 数据文件
/usr/bin/v2ray/geosite.dat:域名数据文件

此脚本会配置自动运行脚本。自动运行脚本会在系统重启之后,自动运行 V2Ray。目前自动运行脚本只支持带有 Systemd 的系统,以及 Debian / Ubuntu 全系列。

运行脚本位于系统的以下位置:

1
2
/etc/systemd/system/v2ray.service: Systemd
/etc/init.d/v2ray: SysV

脚本运行完成后,你需要:
编辑 /etc/v2ray/config.json 文件来配置你需要的代理方式;
运行 service v2ray start 来启动 V2Ray 进程;
之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。

新版本安装

debian

安装依赖

1
2
apt update
apt install curl

centos7

安装依赖

1
2
yum makecache
yum install curl

centos或者debian安装完毕依赖执行下面代码

1
2
curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh

安装和更新V2Ray

1
bash install-release.sh

文件路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
info: unzip is installed.
info: Extract the V2Ray package to /tmp/tmp.RS0y2YR2ZS/ and prepare it for installation.
installed: /usr/local/bin/v2ray
installed: /usr/local/bin/v2ctl
installed: /usr/local/lib/v2ray/geoip.dat
installed: /usr/local/lib/v2ray/geosite.dat
installed: /usr/local/etc/v2ray/00_log.json
installed: /usr/local/etc/v2ray/01_api.json
installed: /usr/local/etc/v2ray/02_dns.json
installed: /usr/local/etc/v2ray/03_routing.json
installed: /usr/local/etc/v2ray/04_policy.json
installed: /usr/local/etc/v2ray/05_inbounds.json
installed: /usr/local/etc/v2ray/06_outbounds.json
installed: /usr/local/etc/v2ray/07_transport.json
installed: /usr/local/etc/v2ray/08_stats.json
installed: /usr/local/etc/v2ray/09_reverse.json
installed: /var/log/v2ray/
installed: /etc/systemd/system/v2ray.service
installed: /etc/systemd/system/[email protected]

安裝最新發行的 geoip.dat 和 geosite.dat

1
bash install-dat-release.sh

创建编辑配置文件

1
cd /usr/local/etc/v2ray

在/usr/local/etc/v2ray下面创建一个新的config.json配置文件
复制以下代码到config.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12345, //请在防火墙开启对应的端口
"protocol": "vmess", //vmess协议
"settings": {
"clients": [
{
"id": "db790014-700d-9b1c-d987-5aed2afa60ae", //UUid 这个ID可以通过v2ray客户端生成new替换
"level": 1,
"alterId": 52 //额外id
}
]
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [],
"outboundDetour": [
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "blocked"
}
]
}
}
}

v2ray调试

1
2
sudo systemctl restart v2ray
sudo systemctl status -l v2ray

设置v2ray开机启动

1
systemctl enable v2ray

BBr安装

1
wget "https://raw.githubusercontent.com/ComeBey/rootfw-bbr/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh

如果想卸载V2Ray执行下面代码

1
bash install-release.sh --remove

 
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×