1、安装

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

2、编辑配置

官方模板

安装完成后需进行配置,命令如下:

vi /usr/local/etc/v2ray/config.json

示例:WS配置

ws需只需配置uuid,需搜下生成器生成。

{
    "log": {
        "loglevel": "warning"
    },
    "routing": {
        "domainStrategy": "AsIs",
        "rules": [
            {
                "type": "field",
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "block"
            }
        ]
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": 1234,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "6cd29fce-0a63-4d40-6df5-80c9ddcabec0"
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "security": "none"
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}

3、启动

// 启动
systemctl start v2ray
// 开机自启
systemctl enable v2ray
// 重启
systemctl restart v2ray
// 关闭防火墙
ufw disable