首先你需要准备一台VPS,如果没有的话请【】

系统建议:

  • CentOS 7

首先安装wget(Vultr VPS已安装)

yum install -y wget

一键安装Trojan脚本

输入以下命令,回车执行(shift+insert可粘贴)

wget -N --no-check-certificate -q -O trojan_install.sh "https://raw.githubusercontent.com/xyz690/Trojan/master/trojan_install.sh" && chmod +x trojan_install.sh && bash trojan_install.sh

 

显示如下

图片[1]-VPS服务器配置Trojan一键安装脚本教程-onlycore核谷

输入1回车

输入你解析的域名,比如我解析的是www.demo.com,然后回车执行

图片[2]-VPS服务器配置Trojan一键安装脚本教程-onlycore核谷

如果解析不正常,可能是之前DNS解析还没生效,建议等几分钟重试。

显示一下信息代表安装成功:

图片[3]-VPS服务器配置Trojan一键安装脚本教程-onlycore核谷

查看运行状态(执行):

systemctl status trojan.service

成功运行会显示如下代码:

● trojan.service - trojan
   Loaded: loaded (/usr/lib/systemd/system/trojan.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-12-02 16:02:55 UTC; 37s ago
 Main PID: 8263 (trojan)
   CGroup: /system.slice/trojan.service
           └─8263 /usr/src/trojan/trojan -c /usr/src/trojan/server.conf

Dec 02 16:02:55 vultr.guest systemd[1]: Started trojan.
Dec 02 16:02:55 vultr.guest trojan[8263]: Welcome to trojan 1.16.0
Dec 02 16:02:55 vultr.guest trojan[8263]: [2022-12-02 16:02:55] [WARN] trojan service (server) started at 0.0.0.0:443
  • 查看配置文件(该配置在后面链接时使用):

输入以下命令,回车执行(shift+insert可粘贴)

cat /usr/src/trojan-macos/trojan/config.json

我的配置如下:

{
    "run_type": "client",
    "local_addr": "127.0.0.1",
    "local_port": 1080,
    "remote_addr": "www.demo.com",
    "remote_port": 443,
    "password": [
        "ae412345"
    ],
    "log_level": 1,
    "ssl": {
        "verify": true,
        "verify_hostname": true,
        "cert": "",
        "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:...",
        "cipher_tls13": "TLS_AES_128_GCM_SHA256:...",
        "sni": "",
        "alpn": [
            "h2",
            "http/1.1"
        ],
        "reuse_session": true,
        "session_ticket": false,
        "curves": ""
    },
    "tcp": {
        "no_delay": true,
        "keep_alive": true,
        "reuse_port": false,
        "fast_open": false,
        "fast_open_qlen": 20
    }
}

请重点关注配置文件中的如下参数:

  1. remote_addr:服务器地址(浏览器输入这个地址能打开网页)
  2. remote_port:端口
  3. password:密码

将这三个参数配置到客户端即可