码上灵感
  • 经验

    • 服务器

      • 操作系统
      • 网络配置
      • ssh配置
      • 压力测试
      • IPMI
    • 基础工具

      • xshell
      • xftp
    • 基础环境

      • anaconda
      • v2ray
      • cuda
      • docker
      • nginx
      • ufw
      • git lfs 大文件
    • ubuntu

      • virtualbox
    • minio

      • 安装
    • postgres

      • 安装
    • AI相关折腾

      • maxkb
      • huggingface
      • vllm
      • ktransformers
      • wan2.1
    • 疑难杂症

      • ubuntu自动更新
      • xshell隧道转发失败
      • video自动播放不成功的问题
      • 3d模型快速生成

v2ray

以ubuntu 24为例

1. 下载v2ray-core

curl -LO https://github.com/v2ray/v2ray-core/releases/download/v4.28.2/v2ray-linux-64.zip

2. 解压

unzip v2ray-linux-64.zip

3. 移动v2ray文件到/usr/local/bin/

sudo mv v2ray /usr/local/bin/

4. 移动v2ctl文件到/usr/local/bin/

sudo mv v2ctl /usr/local/bin/

5. 在/etc目录下创建v2ray文件夹

sudo mkdir -p /etc/v2ray

6. 创建config.json文件

sudo vim /etc/v2ray/config.json

config.json内容,以v2rayN为例,代理节点请自行搞定,由于法律问题,本文不能讲解代理节点 步骤图片


7. 创建v2ray的systemd守护进程

sudo vim /etc/systemd/system/v2ray.service

内容如下

[Unit]
Description=V2Ray
After=network.target

[Service]
ExecStart=/usr/local/bin/v2ray -config /etc/v2ray/config.json
Restart=on-failure
User=root

[Install]
WantedBy=multi-user.target

8. 下载路由规则文件

wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/202502072211/geoip.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/202502072211/geosite.dat


9. 移动路由规则文件

sudo mv geosite.dat /usr/local/bin/
sudo mv geoip.dat /usr/local/bin/

10. 给路由规则文件授权

sudo chmod 644 /usr/local/bin/geosite.dat
sudo chmod 644 /usr/local/bin/geoip.dat

11. 测试配置文件是否正确

sudo /usr/local/bin/v2ray -config /etc/v2ray/config.json

12. 加载配置

sudo systemctl-daemon-reload

13. 开机自启动

sudo systemctl enable v2ray

14. 启动

sudo systemctl start v2ray

15. 查看状态

sudo systemctl status v2ray
Prev
anaconda
Next
cuda