前置条件购买一台墙外的服务器,本文在搬瓦工上购买了一台VPS。操作系统为 Ubuntu 18.04,之前没有装过v2ray必要的Linux操作经验,熟悉vim,vi, nano其中任意一种文本编辑明白JSON,Shell是什么主要步骤执行一些shell脚本需要以sudoer的身份。如果你用root登录,那么没问题,如果不是。请执行以下命令sudo su更新和安装curl,如果安装了curl请忽略,执行下一步apt updateapt install curl下载安装脚本curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh执行安装脚本,保证此时你和上一步骤在同一目录下,否则自行更好安装脚本路径bash install-release.sh安装成功后会有比较多的output。这些还是蛮有用的记录下info: Installing V2Ray v4.42.2 for x86_64Downloading V2Ray archive: https://github.com/v2fly/v2ray-core/releases/download/v4.42.2/v2ray-linux-64.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 626 100 626 0 0 2353 0 –:–:– –:–:– –:–:– 2344100 13.1M 100 13.1M 0 0 24.3M 0 –:–:– –:–:– –:–:– 24.3MDownloading verification file for V2Ray archive: https://github.com/v2fly/v2ray-core/releases/download/v4.42.2/v2ray-linux-64.zip.dgstReading package lists… DoneBuilding dependency tree Reading state information… DoneSuggested packages: zipThe following NEW packages will be installed: unzip0 upgraded, 1 newly installed, 0 to remove and 163 not upgraded.Need to get 168 kB of archives.After this operation, 567 kB of additional disk space will be used.Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 unzip amd64 6.0-21ubuntu1.1 [168 kB]Fetched 168 kB in 0s (418 kB/s)Selecting previously unselected package unzip.(Reading database … 46352 files and directories currently installed.)Preparing to unpack …/unzip_6.0-21ubuntu1.1_amd64.deb …Unpacking unzip (6.0-21ubuntu1.1) …Processing triggers for mime-support (3.60ubuntu1) …Setting up unzip (6.0-21ubuntu1.1) …info: unzip is installed.info: Extract the V2Ray package to /tmp/tmp.552WHvXNF0 and prepare it for installation.info: Systemd service files have been installed successfully!warning: The following are the actual parameters for the v2ray service startup.warning: Please make sure the configuration file path is correctly set.~~~~~~~~~~~~~~~~[Unit]Description=V2Ray ServiceDocumentation=https://www.v2fly.org/After=network.target nss-lookup.target[Service]User=nobodyCapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICEAmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICENoNewPrivileges=trueExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.jsonRestart=on-failureRestartPreventExitStatus=23[Install]WantedBy=multi-user.target# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html[Service]ExecStart=ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json~~~~~~~~~~~~~~~~warning: The systemd version on the current operating system is too low.warning: Please consider to upgrade the systemd or the operating system.installed: /usr/local/bin/v2rayinstalled: /usr/local/bin/v2ctlinstalled: /usr/local/share/v2ray/geoip.datinstalled: /usr/local/share/v2ray/geosite.datinstalled: /usr/local/etc/v2ray/config.jsoninstalled: /var/log/v2ray/installed: /var/log/v2ray/access.loginstalled: /var/log/v2ray/error.loginstalled: /etc/systemd/system/v2ray.serviceinstalled: /etc/systemd/system/v2ray@.service

从上述信息中不难看出,v2ray安装脚本考虑的比较完善,并且告知你安装了哪些v2ray工具和相关日志,配置在哪里,并且做了systemd的service。你可以很方便的通过service来查看v2ray服务的状态。

一些有用的工具,比如 v2ctl, 你可以通过v2ctl去生成client id(uuid) . v2ctl uuidv2ray server 的config file位置 installed: /usr/local/etc/v2ray/config.json。 从输出可以看出配置文件在 /usr/local/etc/v2ray/config.json 日志文件位置 /var/log/v2rayv2ray service配置文件所在位置 /etc/systemd/system/v2ray.service

此时,已经安装成功了。但是v2ray service没有启动起来而且配置文件是空的。接下来我们看服务启动部分和配置部分

注意点v2ray服务安装成功后并不是自动启动v2ray安装成功后配置为空v2ray 对server和client的时差有要求,不能大于90秒。所以自行查看服务器端配置以下配置只是最简单的配置,如果想看更多复杂的玩法,请参考参考资料中的官方链接{ “inbounds”: [{ “port”: 10086, “protocol”: “vmess”, “settings”: { “clients”: [{ “id”: “a0c78a8b-404d-2e85-0e92-44eb25778d04” }] } }], “outbounds”: [{ “protocol”: “freedom”, “settings”: {} }]}Client 端配置替换配置中的 your server ip, 并且保证user id 的值和服务端 client id 值保持一致。{ “log”: { “error”: “”, “loglevel”: “info”, “access”: “” }, “inbounds”: [ { “sniffing”: { “enabled”: true, “destOverride”: [ “tls”, “http” ] }, “listen”: “127.0.0.1”, “protocol”: “socks”, “settings”: { “udp”: true, “auth”: “noauth” }, “port”: “1080” }, { “sniffing”: { “enabled”: true, “destOverride”: [ “tls”, “http” ] }, “listen”: “127.0.0.1”, “protocol”: “http”, “settings”: { “timeout”: 360 }, “port”: “1087” } ], “outbounds”: [ { “mux”: { “enabled”: true, “concurrency”: 8 }, “protocol”: “vmess”, “streamSettings”: { “network”: “tcp”, “tcpSettings”: { “header”: { “type”: “none” } }, “security”: “none” }, “tag”: “proxy”, “settings”: { “vnext”: [ { “address”: “your server ip address”, “users”: [ { “id”: “a0c78a8b-404d-2e85-0e92-44eb25778d04”, “alterId”: 0, “level”: 0, “security”: “auto” } ], “port”: 10086 } ] } }, { “tag”: “direct”, “protocol”: “freedom”, “settings”: { “domainStrategy”: “UseIP”, “userLevel”: 0 } }, { “tag”: “block”, “protocol”: “blackhole”, “settings”: { “response”: { “type”: “none” } } } ], “dns”: {}, “routing”: { “settings”: { “domainStrategy”: “AsIs”, “rules”: [] } }, “transport”: {}}多平台客户端Mac 客户端有v2rayU 其他终端直接参考v2ray客户端 防止以后被墙,截个图留念下参考资料GitHub – v2ray/v2ray-core at v4.31.0前言 · V2Ray 配置指南|V2Ray 白话文教程新手上路 · Project V 官方网站Migrate from the old script to this · v2fly/fhs-install-v2ray Wiki


比丘资源网 » v2Ray Install Guide

提供最优质的资源集合

立即查看 了解详情