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"
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": 1234,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "91dd47d0-f305-4c8f-8f89-ea8019e76721",
                        "level": 0,
                        "email": "love@v2fly.org"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "dest": 8001
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp"
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        }
    ]
}

3、启动

// 启动
systemctl start v2ray
// 开机自启
systemctl enable v2ray
// 重启
systemctl restart v2ray

// 查看防火墙状态
firewall-cmd --state

// 停止firewall
systemctl stop firewalld.service

// 禁止firewall开机启动
systemctl disable firewalld.service

4.加速

wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh"

chmod +x tcp.sh

./tcp.sh

参考

自建v2ray服务器教程