Linux 系统 VMESS 搭建教程 - axcsz/Collect GitHub Wiki

Linux 系统 VMESS 搭建教程

待更新........

适用于 Debian & Ubuntu

一键安装

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

一键移除

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove

申请证书

一、有域名,申请证书

二、无域名,申请自签证书

openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /root/v2ray/server.key -out /root/v2ray/server.crt -subj "/CN=bing.com" -days 36500 && chown v2ray /root/v2ray/server.key && chown v2ray /root/v2ray/server.crt

启动服务

# 重新加载
systemctl daemon-reload

# 启动 V2Ray 服务
systemctl start v2ray

# 重启 V2Ray 服务
systemctl restart v2ray

# 设置开机启动
systemctl enable v2ray

# 检查 V2Ray 服务状态
systemctl status v2ray

服务端 vmess+tcp (不需要域名和证书)

{
  "inbounds": [
    {
      "port": 8388, 
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "af41686b-cb85-494a-a554-eeaa1514bca7",  
            "alterId": 0
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",  
      "settings": {}
    }
  ],
  "vmess-aead": true
}

服务端 vmess+ws (不需要域名和证书)

{
  "inbounds": [
    {
      "port": 8388, 
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "af41686b-cb85-494a-a554-eeaa1514bca7",  
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/v2ray"
          }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ],
  "vmess-aead": true
}

服务端 vmess+ws+tls (需要域名和证书)

{
  "inbounds": [
    {
      "port": 8388, 
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "af41686b-cb85-494a-a554-eeaa1514bca7",  
            "alterId": 0
          }
        ]
      },
        "streamSettings": {
          "network": "ws",
          "wsSettings": {
            "path": "/v2ray"
            },
          "security": "tls",
          "tlsSettings": {
            "certificates": [
              {
                "certificateFile": "/root/v2ray/server.crt", 
                "keyFile": "/root/v2ray/server.key" 
              }
            ]
          }
        }
      }
    ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ],
  "vmess-aead": true
}

服务端 vmess+tcp+tls (需要域名和证书)

{
  "inbounds": [
    {
      "port": 8388, 
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "af41686b-cb85-494a-a554-eeaa1514bca7",  
            "alterId": 0
          }
        ]
      },
        "streamSettings": {
          "network": "tcp",
          "security": "tls",
          "tlsSettings": {
            "certificates": [
              {
                "certificateFile": "/root/v2ray/server.crt", 
                "keyFile": "/root/v2ray/server.key" 
              }
            ]
          }
        }
      }
    ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ],
  "vmess-aead": true
}