搞鼓了一下IBM的VM测试机s390机型,发现v2ray的一键脚本安装不上去,于是就编译安装了一下v2ray,随便写下来:

安装go:

wget https://go.dev/dl/go1.17.5.linux-s390x.tar.gz -O - | tar -xz -C /usr/local/

vi ~/.profile

export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$HOME/.cargo/bin
export GOROOT=/usr/local/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN

source ~/.profile

go version

编译v2ray

拉取源码:
git clone https://github.com/v2fly/v2ray-core.git

cd v2ray-core && go mod download

查看所有支持的系统与架构:

go tool dist list

可以看到有 linux/s390x 系统支持,那么下面就来构建v2ray:

CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -o $HOME/v2ray -trimpath -ldflags "-s -w -buildid=" ./main

编译好的v2ray二进制文件就在当前目录下,移动到运行目录:

mv v2ray /usr/bin/

v2ray 配置文件

mkdir /etc/v2ray

vi /etc/v2ray/config.json

下面是一个wss配置文件,你也可以改成tcp配置文件:

{
  "inbounds": [
    {
      "port": 8080,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "1613660c-5ca6-4955-ac9a-0c4b86a00fae"
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": "/v2path"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

前台运行:
v2ray run -config /etc/v2ray/config.json

配置后台 system 服务

vi /etc/systemd/system/v2ray.service

[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/bin/v2ray run -config /etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

重载 system 服务: systemctl daemon-reload

运行 v2ray: systemctl start v2ray

开机运行 v2ray: systemctl enable v2ray

  • io21 回复了此帖

    上述 需要是否需要 nginx 或 caddy 更改配置吗?

      小白表示好不容易开了机器,搞不会🥶

      1 个月 后
      20 天 后

      我注册好几天了,搞不定。姥爷有没有一键安装的,估计大家都在等

        七舅姥爷
        {
        “server”:[“[::0]”,“0.0.0.0”],
        “server_port”:10240,
        “password”:“cba4775f-778c-4958-be65-b725ead6a40e”,
        “timeout”:600,
        “method”:“chacha20-ietf-poly1305”
        }
        这样算成功了吗?