
1.v2ray
路径
/usr/local/etc/v2rayV2Ray 提供了一个在 Linux 中的自动化安装脚本。这个脚本会自动检测有没有安装过 V2Ray,如果没有,则进行完整的安装和配置;如果之前安装过 V2Ray,则只更新 V2Ray 二进制程序而不更新配置。
以下指令假设已在 su 环境下,如果不是,请先运行 sudo su。
运行下面的指令下载并安装 V2Ray。当 yum 或 apt-get 可用的情况下,此脚本会自动安装 unzip 和 daemon。这两个组件是安装 V2Ray 的必要组件。如果你使用的系统不支持 yum 或 apt-get,请自行安装 unzip 和 daemon
bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)此脚本会自动安装以下文件:
/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 全系列。
运行脚本位于系统的以下位置:
/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 的运行。
2.config.json
{ "stats": { }, "log": { "loglevel": "info", "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log" }, "api": { "tag": "api", "services": [ "HandlerService", "LoggerService", "StatsService" ] }, "policy": { "levels": { "0": { "statsUserUplink": true, "statsUserDownlink": true }, "1": { "statsUserUplink": true, "statsUserDownlink": true } }, "system": { "statsInboundUplink": true, "statsInboundDownlink": true } }, "inbounds": [ { "tag": "the0st", "port": 10086, "protocol": "vmess", "settings": { "clients": [ { "email": "ershushu.endpoint.com", "id": "f3d68374-9e0f-4d2f-b13c-1c5e4e9021b1", "level": 1, "alterId": 64 } ] } }, { "tag": "the1st", "port": 10086, "protocol": "vmess", "settings": { "clients": [ { "email": "qiaoqiao.endpoint.com", "id": "2e7957c7-e00c-4887-a3bf-fc79395b3838", "level": 1, "alterId": 64 } ] } }, { "tag": "the2st", "port": 10086, "protocol": "vmess", "settings": { "clients": [ { "email": "pi.endpoint.com", "id": "54129a3f-4c87-45a5-bd68-127b93baca0c", "level": 1, "alterId": 64 } ] } }, { "tag": "the3st", "port": 10086, "protocol": "vmess", "settings": { "clients": [ { "email": "wuqun.endpoint.com", "id": "7fe10b62-7634-4322-88f9-c42aa9a265a7", "level": 1, "alterId": 64 } ] } } ], "outbounds": [ { "protocol": "freedom", "settings": { } }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ], "routing": { "rules": [ { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "blocked" } ] } }