个人笔记记录(常用)

个人笔记


Trojan安装

<p><strong>1、安装BBR加速</strong> 一键安装脚本</p> <pre><code>wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/bbr.sh &amp;&amp; chmod +x bbr.sh &amp;&amp; bash bbr.sh</code></pre> <p><strong>2、下载并解压</strong></p> <pre><code>wget https://github.com/trojan-gfw/trojan/releases/download/v1.14.0/trojan-1.14.0-linux-amd64.tar.xz&amp;&amp;tar -xvf trojan-1.14.0-linux-amd64.tar.xz&amp;&amp;cd trojan</code></pre> <p><strong>3、申请letsencrypt证书</strong> 在根目录下执行,把电子邮件及域名更改为你自己的,域名解析时不要使用第三方的DNS及国内的DNS,电子邮件也不要使用国内的。</p> <pre><code>git clone https://github.com/letsencrypt/letsencrypt cd letsencrypt ./certbot-auto --help all ./letsencrypt-auto certonly --standalone --email oneleaf520@gmail.com -d mfzy.gq -d www.mfzy.gq</code></pre> <p>安装过程有两个地方需要进行交互:</p> <p>如果一切正常,安装完成后以下信息,两个红色框的信息下一步会用到。</p> <p><strong>4、编辑配置文件</strong></p> <pre><code>vi /usr/local/etc/trojan/config.json</code></pre> <p><strong>5、试运行</strong></p> <pre><code>cd /root/trojan/build ./trojan -c /usr/local/etc/trojan/config.json</code></pre> <p><strong>6、把命令运行为server</strong> 因为命令./trojan -c /usr/local/etc/trojan/config.json是运行在前台的,我们需要利用systemd来把该命令运行为service,运行下面命令</p> <pre><code>vi /etc/systemd/system/trojan.service</code></pre> <p>其内容为:</p> <pre><code>[Unit] After=network.target [Service] ExecStart=/root/trojan/build/trojan -c /usr/local/etc/trojan/config.json Restart=always [Install] WantedBy=multi-user.target</code></pre> <p><strong>7、运行</strong></p> <ul> <li> <p>启动Trojan:</p> <p>systemctl start trojan</p> </li> <li> <p>设置开机启动:</p> <p>systemctl enable trojan</p> </li> <li> <p>查看运行状态:</p> <p>systemctl status trojan</p> </li> </ul>

页面列表

ITEM_HTML