您现在的位置是:首页> 操作系统> Linux

手动安装V2ray

  • 29571人已阅读
  • 时间:2021-12-05 22:19:19
  • 分类:Linux
  • 作者:祥哥

相关官网

V2Rray 官网:https://www.v2ray.com/

V2Rray 下载地址:https://github.com/v2ray/v2ray-core/releases

在线生成UUID网址:https://www.uuidgenerator.net/

linux命令生成

cat /proc/sys/kernel/random/uuid

V2RayN:https://github.com/2dust/v2rayN

1.查看时间、时区

date -R

2.修改时区

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

3.修改成自己的时间命令格式

date -s "2021-09-12 17:57:22"

4.安装wget unzip

yum install wget unzip

5.下载V2Ray的发行版程序

wget https://github.com/v2fly/v2ray-core/releases/download/v4.31.0/v2ray-linux-64.zip

6.解压

mkdir v2ray
unzip -d v2ray v2ray-linux-64.zip

7.准备安装在/usr/local/v2ray下

mkdir /usr/local/v2ray

复制必须的程序到安装文件夹

cp v2* /usr/local/v2ray/
cp geo* /usr/local/v2ray/
mkdir /etc/v2ray
cp vpoint_vmess_freedom.json /etc/v2ray/config.json

详细说明:

V2Ray的程序目录文件详情情况:

其中v2ray和v2ctl是V2Ray的主程序和控制程序;

geoip.dat和geosite.dat是程序所需要数据文件;

systemd和systemv两个目录中包含了用于生成服务的文件。

最后一条命令是将当前的vpoint_vmess_freedom.json配置文件复制到指定位置,并修改其为config.json。

由于V2Ray是不区分服务端和客户端的,同一个程序可以配置成服务器也可以配置成客户端

程序目录中的vpoint_vmess_freedom.json一般用于配置服务器

而vpoint_socks_vmess.json用于配置成为客户端。

8.修改服务文件

[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target

[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/v2ray/v2ray -config /etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

主要修改v2ray和配置文件的路径,根据自己情况修改

cp v2ray.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl enable v2ray
systemctl start v2ray

基本就启动了。

自己修改配置文件内容,可以用上面的网站或命令修改uuid

Top