<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://www.pidexe.com/</id>
  <title type="text">Firefly</title>
  <subtitle type="text">fang523</subtitle>
  <updated>2026-10-25T00:00:00.000Z</updated>
  <author><name>fang523</name></author>
  <link rel="alternate" href="https://www.pidexe.com/"/>
  <link rel="self" href="https://www.pidexe.com/atom.xml"/>
  <generator uri="https://github.com/CuteLeaf/Firefly">Firefly v6.16.8</generator>
    <entry>
      <id>https://www.pidexe.com/posts/%E5%B0%81%E8%A3%85windows10%E7%B3%BB%E7%BB%9F/</id>
      <title type="text">[教程]教大家封装一个只属于自己的Windows10系统(含小部分优化过程)</title>
      <published>2025-03-18T00:00:00.000Z</published>
      <updated>2025-03-18T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/%E5%B0%81%E8%A3%85windows10%E7%B3%BB%E7%BB%9F/"/>
      <summary type="text">介绍封装系统的方法，windows其他版本也适用，不适用于linux。</summary>
      <content type="html"><![CDATA[<section><h1>丑话说在前<a href="#丑话说在前"><span>#</span></a></h1><ul>
<li>本教程默认你会装系统 (“装系统”和”封装系统”不是一回事)，如果有不熟悉的麻烦在评论区提出，人数多的话我再单独发一个教程。<br /></li>
<li>系统优化方面总是争议不断的，属于建议，您可听可不听，重点是封装系统的过程，不是系统优化的话题，有不符合您使用习惯的 请理性讨论。<br /></li>
<li>此方法理论上适用于任何版本的Windows系统，但是我只爱win10，其他版本没有测试过(不适用于Linux)。<br /></li>
</ul></section>
<section><h1>一：准备工作<a href="#一准备工作"><span>#</span></a></h1><p>1：纯净的系统镜像，在 <a href="https://www.microsoft.com/zh-cn/software-download/windows10" target="_blank">微软官方网站</a> 下载一个<strong>Windows10安装程序</strong>，在里面选择<strong>为另一台电脑创建安装介质(U盘、DVD或ISO文件)</strong>，即可获得一个纯净的系统镜像。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/1.jpg" alt="image" /><figcaption>image</figcaption></figure>
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/2.jpg" alt="image" /><figcaption>image</figcaption></figure>
2：一台x86电脑(可以是虚拟机也可以是实体机)，用于装系统然后在里面做任何修改，最后封装成iso镜像。<br />
3：准备好带dism++的PE，我用的是<strong>Hikari_PE_9.0</strong>(Preview版)，<a href="https://hikaripe-sc.hikaricalyx.com/" target="_blank">点此跳转官网</a><br />
4：iso编辑器<strong>UltraISO</strong>，<a href="https://www.ultraiso.com/download.html" target="_blank">点此跳转官网</a><br />
5：iso写盘工具(非必须)，我用的是<strong>rufus</strong>，<a href="https://rufus.ie/zh/" target="_blank">点此跳转官网</a>。<br />
6：一个32G的U盘(如果虚拟机则不需要)<br /><p></p></section>
<section><h1>二：开始定制系统<a href="#二开始定制系统"><span>#</span></a></h1><p>1：用写盘工具将微软原版系统写到U盘，按正常流程装系统，<strong>注意这台机器只能有1块硬盘并且不分区</strong>。<br />
2：启用本地账户，不要用微软账号登录，修改成符合使用习惯的任何设置，比如修改时区，修改浏览器搜索引擎，将nas所在ip段和文件夹路径添加到windows安全中心信任地址/浏览器信任地址，打开远程桌面，设置开机密码，安装常用软件等。<br />
3：一些建议，<br /></p><ul>
<li>最好是在策略组里面将系统更新指定为某个版本(比如Windows10 22H2)，静置几个小时，以便收到安全更新的推送，这样就相当于关掉版本更新，但是保留安全更新。<br /></li>
<li>建议不要装太多软件(特别是idm之类的一机一码的软件，或者经常需要更新的软件，或者是steam之类需要配合其他硬盘才能爽玩的软件)。<br /></li>
<li>建议安装pixpin，7zip-zstd，potplayer，Everything，Microsoft Office，Acrobat DC。<br /></li>
<li>驱动只需要通用驱动，避免英伟达显卡驱动和AMDsoftware以及主板的芯片组驱动，这些都是单一品牌专用的，而且容易冲突，别折腾这个，不用过多集成。<br /></li>
<li>运行一下磁盘清理。<br /></li>
</ul><p>4：删除这个文件<strong>C:\Windows\System32\Recovery\ReAgent.xml</strong>，它包含BitLocker的缓存，如果不删会导致所封装的系统在任何机器上都无法启用BitLocker。<br /></p></section>
<section><h1>三：开始系统封装<a href="#三开始系统封装"><span>#</span></a></h1><p>1：先关机再插 PE 和 用来存放系统镜像的U盘/虚拟机硬盘 ，如果它有D盘，封装完之后在其他机器装机就没有D盘了，强迫症表示很难受，(盘符D已经被分配了，uuid已经被记录在系统中了，这块硬盘并不在新电脑上)。<br />
2：切换到PE里面操作(开机时记得按任意键)，插上U盘，如果是虚拟机 关机后新增1块硬盘在PE里面分区也是可以的。<br />
3：在新的U盘里新建两个文件夹(tmp和esd)，然后修改PE环境变量，右键此电脑-高级系统设置-环境变量-找到tmp和temp两个-编辑变量-选择目录，将它们都修改为刚才新建的那个tmp目录。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/3.jpg" alt="image" /><figcaption>image</figcaption></figure>
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/4.jpg" alt="image" /><figcaption>image</figcaption></figure>
4：打开dism++选择装了系统的硬盘-工具箱-系统备份-浏览-选择刚才新建的esd文件夹，保存类型<strong>选极限压缩映像(.esd)</strong>，文件名必须是<strong>install</strong>(有空再改名也行)，不需要勾 卷影复制 和 可启动。<br />
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/5.jpg" alt="image" /><figcaption>image</figcaption></figure>
5：点保存，之后就会开始备份整个系统了，到这个界面可能会很久，过程很吃CPU算力，我的5900hx分配了8核需要半小时左右，可以打开文件夹检查一下install.esd有没有开始生成。<br />
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/6.jpg" alt="image" /><figcaption>image</figcaption></figure>
6：若保存失败(提示句柄无效)，在X\Program Files\DISMPP\Config\dism++.log里面有日志，检查一下是哪个文件导致保存失败，Windows系统临时文件有时候是很奇怪的，没有文件头什么的，可以在日志里找到罪魁祸首直接删掉，或者搜一下有没有用处再删。<br />
若成功保存，就得到了一个install.esd文件，这个就是整个系统的全部内容了，但是它还不能安装，把这个文件备份一下(pe里支持ftp，也可以直接用U盘拷走)。<br />
7：拿着这个install.esd文件到一台正常的电脑上，用管理员权限打开iso编辑器UltraISO，载入一开始的微软官方镜像文件iso,将这个install.esd替换掉sources文件夹里面的install.esd，然后另存为iso文件即可大功告成(注意另存为的时候不要去重命名，有概率导致软件卡死，保存完再改名字吧)<br />
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/7.jpg" alt="image" /><figcaption>image</figcaption></figure>
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250317/8.jpg" alt="image" /><figcaption>image</figcaption></figure><p></p></section>
<section><h1>四：题外话<a href="#四题外话"><span>#</span></a></h1><ul>
<li>虽然不建议集成太多驱动，但是网卡驱动我觉得还是有点必要的，可以单独下载一个dism++回公司到处抠驱动，然后在PE里面导入，否则你就会感受到开机没有网卡驱动，装网卡驱动又需要先联网的尴尬场景，我是常备一个驱动人生(旧版比较纯净),然后用手机USB共享网络，有网了就什么驱动都有了。<br /></li>
<li>有已root手机的推荐下载一个<a href="https://www.pidex.top/pd/images/nodeseek/250317/DriveDroid.apk" target="_blank">DirveDroid</a>，用手机给电脑装系统，出门再也不用带U盘了。<br /></li>
<li>封装之前可以设置开机密码，这样别人用你的iso装完机也有密码。<br /></li>
</ul></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/xray/</id>
      <title type="text">xray安装和使用</title>
      <published>2026-10-25T00:00:00.000Z</published>
      <updated>2026-10-25T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/xray/"/>
      <summary type="text">官方脚本安装，配置，维护命令</summary>
      <content type="html"><![CDATA[本文已加密保护，请访问网站查看。]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/acme/</id>
      <title type="text">用acme脚本自动签发ssl证书</title>
      <published>2026-10-24T00:00:00.000Z</published>
      <updated>2026-10-24T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/acme/"/>
      <summary type="text">自动签发，多域名，多机器部署</summary>
      <content type="html"><![CDATA[<section><h4>创建 SSH 目录<a href="#创建-ssh-目录"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>install -d -o root -g root -m 700 /root/.ssh</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>移动私钥<a href="#移动私钥"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>mv /opt/o13_key /root/.ssh/o13_key</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>设置所有者和权限<a href="#设置所有者和权限"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chown root:root /root/.ssh/o13_key</span></div></div></code></pre><div><div></div><div></div></div></figure></div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chmod 600 /root/.ssh/o13_key</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>测试连接（显示0就表示成功）<a href="#测试连接显示0就表示成功"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ssh -i /root/.ssh/o13_key -o IdentitiesOnly=yes root@129.129.129.129 'id -u'</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>创建ssh机器别名<a href="#创建ssh机器别名"><span>#</span></a></h4><p>创建文件</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>nano /root/.ssh/config</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>添加这几行(ctrl+o保存，ctrl+x退出)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>Host o13</span></div></div><div><div><div>2</div></div><div><span><span>    </span></span><span>HostName 129.129.129.129</span></div></div><div><div><div>3</div></div><div><span><span>    </span></span><span>User root</span></div></div><div><div><div>4</div></div><div><span><span>    </span></span><span>IdentityFile /root/.ssh/o13_key</span></div></div><div><div><div>5</div></div><div><span><span>    </span></span><span>IdentitiesOnly yes</span></div></div><div><div><div>6</div></div><div><span><span>    </span></span><span>BatchMode yes</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>设置权限<a href="#设置权限"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chmod 600 /root/.ssh/config</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>测试别名<a href="#测试别名"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ssh o13 'id -u'</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>配置部署证书的参数<a href="#配置部署证书的参数"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>export DEPLOY_SSH_USER="root"</span></div></div><div><div><div>2</div></div><div><span>export DEPLOY_SSH_SERVER="o13"</span></div></div><div><div><div>3</div></div><div>
</div></div><div><div><div>4</div></div><div><span>export DEPLOY_SSH_KEYFILE="/opt/ssl/_.pidex.top_key.key"</span></div></div><div><div><div>5</div></div><div><span>export DEPLOY_SSH_FULLCHAIN="/opt/ssl/_.pidex.top_chain.crt"</span></div></div><div><div><div>6</div></div><div>
</div></div><div><div><div>7</div></div><div><span>export DEPLOY_SSH_USE_SCP="yes"</span></div></div><div><div><div>8</div></div><div><span>export DEPLOY_SSH_BACKUP="yes"</span></div></div><div><div><div>9</div></div><div>
</div></div><div><div><div>10</div></div><div><span>export DEPLOY_SSH_REMOTE_CMD='chmod 600 /opt/ssl/_.pidex.top_key.key &amp;&amp; chmod 644 /opt/ssl/_.pidex.top_chain.crt &amp;&amp; nginx -t &amp;&amp; systemctl reload nginx'</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>部署证书<a href="#部署证书"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>/root/.acme.sh/acme.sh --deploy -d '*.pidex.top' --deploy-hook ssh --ecc</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h4>取消部署<a href="#取消部署"><span>#</span></a></h4><p>1.取消单个服务器：重新<code>配置部署证书的参数</code>，在<code>export DEPLOY_SSH_SERVER="o13"</code>这一行里删除不再需要证书的机器，然后重新部署证书即可<br />
2.取消这个域名的全部远程部署<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>sed -i "/^Le_DeployHook=/d; /^Le_Deploy_ssh_/d; /^SAVED_DEPLOY_SSH_/d" /root/.acme.sh/*.pidex.top_ecc/*.pidex.top.conf</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E5%BC%80%E6%9C%8D2/</id>
      <title type="text">[factorio]用安卓手机开服，无需root</title>
      <published>2026-10-19T00:00:00.000Z</published>
      <updated>2026-10-19T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E5%BC%80%E6%9C%8D2/"/>
      <summary type="text">用安卓手机联机开服的方法</summary>
      <content type="html"><![CDATA[<section><h4>前言<a href="#前言"><span>#</span></a></h4><p><strong>游戏从2.1.18版本开始，无头版服务端重新支持了arm架构的cpu。</strong><br />
直奔正题吧，基础知识就不科普了，比如联机房的房间名在哪设置，异星工厂账号怎么获得，怎么更新游戏版本之类的，老手直接跳过，新手请参考这篇文章<br />
<a href="https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E8%81%94%E6%9C%BA%E5%BC%80%E6%9C%8D%E6%95%99%E7%A8%8B/">异星工厂联机开服教程</a><br /></p></section>
<section><h4>准备工作<a href="#准备工作"><span>#</span></a></h4><p>1.一台安卓手机，无需root，运行内存大点就行，硬盘2G足够了。<br />
2.异星工厂正版账号<br />
3.一台windows电脑(不用电脑也行，就是手机打字太麻烦而已)<br />
4.良好的网络环境，不要说你连游戏官网都打不开，服务端程序都下载不了，那可就尴尬了<br /></p></section>
<section><h4>开始安装<a href="#开始安装"><span>#</span></a></h4><section><h5>1.打开这个网址下载<code>Termux</code>，选择<code>arm64-v8a.apk</code><a href="#1打开这个网址下载termux选择arm64-v8aapk"><span>#</span></a></h5><p><a href="https://github.com/termux/termux-app/releases" target="_blank">https://github.com/termux/termux-app/releases</a><br /></p></section><section><h5>2.安装好先设置一下，在手机设置-应用管理里面，将它的省电策略改为”无限制”，自启动无所谓，有后台权限就够了<a href="#2安装好先设置一下在手机设置-应用管理里面将它的省电策略改为无限制自启动无所谓有后台权限就够了"><span>#</span></a></h5><p>设置好之后打开Termux，会显示这个界面。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_10-21-08.png" alt="images" /><figcaption>images</figcaption></figure><br /><p></p></section><section><h5>3.先更新一下软件列表并安装ssh服务，(Termux支持直接粘贴命令的)<a href="#3先更新一下软件列表并安装ssh服务termux支持直接粘贴命令的"><span>#</span></a></h5><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>pkg update &amp;&amp; pkg install -y termux-services openssh &amp;&amp; sshd &amp;&amp; sv-enable sshd</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h5>4.设置ssh密码(输入密码的时候屏幕没反应是正常的，确保没输错就行)<a href="#4设置ssh密码输入密码的时候屏幕没反应是正常的确保没输错就行"><span>#</span></a></h5><p>运行<code>passwd</code>然后按回车，输入两次密码就会显示这个界面，就设置完成了<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_10-28-41.png" alt="images" /><figcaption>images</figcaption></figure><p></p></section><section><h5>5.运行<code>whoami</code>找到ssh用户名，这个<code>u0_a235</code>就是我的用户名<br /><a href="#5运行whoami找到ssh用户名这个u0_a235就是我的用户名"><span>#</span></a></h5><p></p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_10-33-01.png" alt="images" /><figcaption>images</figcaption></figure><p></p></section><section><h5>6.ssh连接<a href="#6ssh连接"><span>#</span></a></h5><p>ssh软件我用的是putty+winscp，大家也可以用其他的，ssh连接只是方便打字，不用putty也可以的，但是传文件最好还是用winscp，如果想直接在手机上操作文件，又要下载文件管理器，又要考虑某些文件夹需要root权限才能打开，不如直接用电脑的winscp传文件更加方便。<br />
<strong>Termux默认的ssh端口是8022</strong><br />
连接之后会自动进入home文件夹。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_13-47-24.jpg" alt="images" /><figcaption>images</figcaption></figure><p></p></section><section><h5>7.下载factorio服务端程序，先打开<a href="https://factorio.com/download/archive/2.1.22?show_experimental=1" target="_blank">官网下载页面</a><a href="#7下载factorio服务端程序先打开官网下载页面"><span>#</span></a></h5><p>测试版需要勾上<code>Show experimental versions</code>才会显示出来，然后选择最新版就可以了<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_11-05-30.jpg" alt="images" /><figcaption>images</figcaption></figure>
往下拉，找到arm无头版，下载下来，上传到手机的home目录<br />
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_11-04-59.jpg" alt="images" /><figcaption>images</figcaption></figure>
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_13-47-24.jpg" alt="images" /><figcaption>images</figcaption></figure><p></p></section><section><h5>8.解压和安装<a href="#8解压和安装"><span>#</span></a></h5><p>先执行解压命令<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>tar -xJvf factorio-headless_linux-arm64_2.1.22.tar.xz</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>更新一下系统自带软件和工具(如果中途卡住了就输入y然后回车，输入几次之后就更新完成了)<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>apt update &amp;&amp; apt full-upgrade -y</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>安装常用软件和工具包<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>pkg install -y curl tar wget lsof sudo vim</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>安装gbibc最新版(工厂服务端的依赖)<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>pkg update &amp;&amp; pkg install -y glibc-repo &amp;&amp; pkg install -y glibc glibc-runner</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h5>9.上传存档，MOD，服务器设置，管理员列表<a href="#9上传存档mod服务器设置管理员列表"><span>#</span></a></h5><p>这些文件在我之前的 <a href="https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E8%81%94%E6%9C%BA%E5%BC%80%E6%9C%8D%E6%95%99%E7%A8%8B/">异星工厂联机开服教程</a> 里面都有解释<br />
<strong>注意在服务器设置里面只修改用户名，房间名，token这三项就可以了，其他保持默认</strong><br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_13-48-19.jpg" alt="images" /><figcaption>images</figcaption></figure><br /><p></p></section></section>
<section><h4>启动游戏服务端<a href="#启动游戏服务端"><span>#</span></a></h4><p>执行这行命令启动服务端，想要长时间运行 建议直接在Termux里面粘贴运行，如果在ssh里面执行  断开ssh之后服务器就退出了<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd ~/factorio &amp;&amp; grun ./bin/arm64/factorio --executable-path "$HOME/factorio/bin/arm64/factorio" --start-server-load-latest --server-settings ./data/server-settings.json --server-adminlist ./data/server-adminlist.json --port 34197</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>显示<code>confirmed by pingpong</code>就是启动完成了，启动完成后直接在游戏里找到IP直连，输入手机的IP就可以连接了。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250108/PixPin_2026-10-18_14-04-46.jpg" alt="images" /><figcaption>images</figcaption></figure><p></p></section>
<section><h4>剩下的就是维护和外网访问的问题了<a href="#剩下的就是维护和外网访问的问题了"><span>#</span></a></h4><section><h5>后台运行<a href="#后台运行"><span>#</span></a></h5><ul>
<li>我的建议是直接在Termux里面执行开服命令，在设置里面改了省电策略之后，Termux是不会自动退出的，想退出就要找到手机设置-应用管理-Termux-结束运行。当然，也可以问问ai：<code>nohup命令如何使用</code>，这样在ssh中也可以设置后台运行，但是如果Termux本身被关闭了，游戏服务端还是会被关闭。<br /></li>
</ul></section><section><h5>外网访问<a href="#外网访问"><span>#</span></a></h5><ul>
<li>开了服之后正常来说是可以在游戏大厅进入的，但那是正常情况，某些地区的网络环境从来就没正常过，所以就需要frp或者ipv6公网了，有个好消息，大部分手机流量都是默认开通ipv6的，可以在手机设置里面找到ipv6地址，复制发给其他人，如果他也有ipv6就能在游戏里直连进入房间，缺点是ipv6是动态的，地址变了就要重新发给好基友。(本人只测试过wifi的ipv6，未测试过手机流量的ipv6)<br /></li>
<li>也可以做ipv6-ddns，但是需要域名，要花钱，建议在阿里云或者cloudflare购买，这个就不在本次教程之内了。<br /></li>
<li>最稳定的方式就是可以找人合租云服务器，可以考虑合租腾讯锐驰，性能差但是网络带宽给的足(虽然偶尔限速挺恶心的)，直接在云服务器上运行游戏服务端不太现实，但是用来做网络穿透足够5~6个服务器，每个服务器2~3人用了，可以参考这个<a href="https://10.10.10.21/posts/frp%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/" target="_blank">FRP教程</a><br /></li>
</ul><p><strong>[至此，教程结束，去愉快的玩耍吧！]</strong></p></section></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/linux/</id>
      <title type="text">linux常用命令</title>
      <published>2026-09-19T00:00:00.000Z</published>
      <updated>2026-09-19T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/linux/"/>
      <summary type="text">系统日常维护，保养，新装所用的命令</summary>
      <content type="html"><![CDATA[<section><h3>常用命令<a href="#常用命令"><span>#</span></a></h3>

<table><thead><tr><th>linux自带BBR</th><th></th></tr></thead><tbody><tr><td>查看linux内核版本(4.09以上)</td><td>uname -r</td></tr><tr><td>启用BBR</td><td>echo “net.core.default_qdisc=fq” &gt;&gt; /etc/sysctl.conf</td></tr><tr><td>启用BBR</td><td>echo “net.ipv4.tcp_congestion_control=bbr” &gt;&gt; /etc/sysctl.conf</td></tr><tr><td>启用BBR</td><td>sysctl -p</td></tr><tr><td>查看BBR状态</td><td>`lsmod</td></tr><tr><td>关闭BBR</td><td></td></tr><tr><td>编辑文件</td><td>vi /etc/sysctl.conf</td></tr><tr><td>注释这两行</td><td># net.core.default_qdisc = fq</td></tr><tr><td>注释这两行</td><td># net.ipv4.tcp_congestion_control = bbr</td></tr></tbody></table></section>
<section><h3>初始设置<a href="#初始设置"><span>#</span></a></h3>

<table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新源列表</td><td>apt update</td></tr><tr><td>更新软件</td><td>apt upgrade -y</td></tr><tr><td>安装常用工具</td><td>apt install -y curl tar wget gnupg2 lsof sudo vim iperf3  at</td></tr><tr><td>查看缓存文件夹大小</td><td>du -sh /var/cache/apt/archives</td></tr><tr><td>清理缓存</td><td>apt clean</td></tr><tr><td>自动清理缓存</td><td>apt autoclean -y</td></tr><tr><td>自动删除安装包</td><td>apt autoremove -y</td></tr></tbody></table></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/%E5%BC%82%E5%9C%B0%E7%BB%84%E7%BD%91/</id>
      <title type="text">[教程]看看我的异地组网方案</title>
      <published>2026-09-16T00:00:00.000Z</published>
      <updated>2026-09-16T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/%E5%BC%82%E5%9C%B0%E7%BB%84%E7%BD%91/"/>
      <summary type="text">异地组网，无缝切换，无需每个软件独立设置，出门也和在家一样</summary>
      <content type="html"><![CDATA[<section><h3>前言<a href="#前言"><span>#</span></a></h3><p>异地组网有很多方案，有openvpn，tailscale，还有向日葵，WireGuard，太多太多了，咱不讨论孰优孰劣，适合自己的就好。<br />
教程不算特别详细，所以实际操作需要有一定的linux基础知识，比如防火墙怎么开，端口如何选择，uuid怎么生成，怎么查看自己有没有公网ip之类简单的问题，不太熟悉的可以在这两个网站自行查询。<br />
<a href="https://www.google.com/" target="_blank">https://www.google.com/</a><br />
<a href="https://chatgpt.com/" target="_blank">https://chatgpt.com/</a><br />
主要特点：<br />
1.不用额外装软件，你平时用什么看油管，现在就用什么来组网。<br />
2.不用记ip地址，比如你平时在家访问nas用的是192.168.2.2，那外出的时候也是访问同一个ip地址，不用额外设置，也不用记那么多地址。<br />
3.分流灵活，无感组网+上网，没有哪个正经软件的分流体验比得上openclash/singbox的。<br />
缺点：wol网络唤醒的数据包是不支持代理转发的，想远程开机还得在当地找台设备安装一个wol软件。<br /></p></section>
<section><h3>废话不多说，准备工具<br /><a href="#废话不多说准备工具"><span>#</span></a></h3><p>组网大概需要以下几个东西<br /></p><ul>
<li>linux系统的小主机一台(软路由也行)，用来装服务端软件(我用的xray服务端)<br /></li>
<li>域名1个 <br /></li>
<li>ddns+ipv6 或 frp+云服务器，冷知识：域名是可以双栈的，也就是说一个域名可以同时绑定1个ipv4地址和1个ipv6地址。<br /></li>
<li>客户端软件(小火箭，openclash，v2rayng都行，反正有啥用啥)<br /></li>
</ul></section>
<section><h3>服务端搭建<br /><a href="#服务端搭建"><span>#</span></a></h3><p>服务端就是被访问的机器，比如人在外面逛街，突然想看家里的nas里下载好的电影，要远程公司的电脑处理工作，要远程帮老家的父母改一下wifi密码，那服务端就建议是买3台三四百元小主机 分别丢在这3个地方24小时开机，当然，有软路由就不需要再单独买小主机了。<br /></p><p>服务端有2种情况<br /></p><section><h4>1.linux服务端<br /><a href="#1linux服务端"><span>#</span></a></h4><p>标准的linux系统可以直接用官方脚本装xray服务端。<br />
一键安装命令</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>装好之后找到配置文件 <strong>/usr/local/etc/xray/config.json</strong> ,替换成这个配置文件(自行修改uuid)。<br />
<a href="https://www.pidex.top/pd/images/nodeseek/250113/config.json-xray260916" target="_blank">点此下载文件(自行改后缀)</a></p><p>启动服务端：<code>systemctl restart xray</code><br />
开机自启：<code>systemctl enable xray</code><br />
至此服务端就算搭建完成了，也就一两分钟的事。<br /></p></section><section><h4>2. openwrt服务端<a href="#2-openwrt服务端"><span>#</span></a></h4><p>可以直接用passwall插件，前面的基本设置/规则列表那些全是客户端的，不用管，直接点击”服务端-添加”。<br />
我在软路由上用的vless+tls+vision，没用reality，具体参数比如协议和uuid这些就不多介绍了，跟平时用面板没什么区别。<br /></p><ul>
<li>ssl证书可以随便找一个，过期的，自签的，找邻居妹子借的，网上随便下载的都行，xxx.crt是证书文件，xx.key就是配套的私钥，都放到/opt/ssl文件夹里。<br /></li>
<li>接口名字随便写，不要用中文就行，我写的utun。<br /></li>
<li><strong>注意: 必须勾选”接受局域网访问”</strong> <br />
<figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-16_19-03-01.jpg" alt="images" /><figcaption>images</figcaption></figure></li>
</ul><p>保存之后在网络-防火墙-常规设置，将入站数据改为接受(路由器本身作为服务端的话，转发可以拒绝，其他防火墙设置不需要全抄我的)，点一下保存并应用，服务端就算搭建完成了。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-16_19-10-38.jpg" alt="images" /><figcaption>images</figcaption></figure><p></p></section></section>
<section><h3>设置公网访问<a href="#设置公网访问"><span>#</span></a></h3><p>网络连接方面也有2种情况<br /></p><section><h4>1.有公网ip，不管是ipv4还是ipv6都行。<a href="#1有公网ip不管是ipv4还是ipv6都行"><span>#</span></a></h4><p>有公网IP自然就是做ddns啦(动态域名解析)。<br />
ddns脚本在网上一抓一大把，我用的是这个脚本，主要是它ipv6的解析比较稳定，github上有使用说明，大家也可以用其他的。<br />
<a href="https://github.com/NewFuture/DDNS" target="_blank">https://github.com/NewFuture/DDNS</a></p></section><section><h4>2.无公网ip，那就需要内网穿透。<a href="#2无公网ip那就需要内网穿透"><span>#</span></a></h4><p>内网穿透又分为服务器转发和p2p，但是我家的宽带做不了p2p穿透，只能用frp了。<br />
frp使用方法不复杂，我单独写了一个简单的教程，可以参考一下。<br />
<a href="https://www.pidexe.com/posts/frp%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/#%E4%B8%8B%E8%BD%BDfrp">frp使用教程</a></p><p><strong>也可以ddns和frp一起上，ddns解析ipv6，再手动把ipv4解析到frp那台小鸡上，正常的电脑都是默认ipv6优先的，而且大多数客户端软件都支持故障转移，直接用故障转移也是可以的。</strong><br /></p></section></section>
<section><h3>客户端连接<a href="#客户端连接"><span>#</span></a></h3><p>没错，客户端就是大家平时用的那种，小火箭，v2ray，openclash，都是可以的。<br /></p><section><h4>1.openclash<a href="#1openclash"><span>#</span></a></h4><p>假如是手搓的配置文件，则需要修改一下<br />
<code>proxies:</code>是节点配置信息，在它里面加上你的回家节点<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span><span>  </span></span><span>- {name: "北京老家", type: vless, server: www.ggggg.com, servername: www.icloud.com, port: 12345, uuid: b13cd17a-32bc-4d98-bc80-29557c7df2ab, network: tcp, tls: true, udp: true, flow: xtls-rprx-vision, skip-cert-verify: true, client-fingerprint: chrome}</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p><code>proxy-groups:</code>是节点分组，在这里新增几个分组，用于异地组网。<br />
每个分组的书写格式都是这样的<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span><span>  </span></span><span>- name: ② 异地组网</span></div></div><div><div><div>2</div></div><div><span><span>    </span></span><span>type: select</span></div></div><div><div><div>3</div></div><div><span><span>    </span></span><span>proxies:</span></div></div><div><div><div>4</div></div><div><span><span>      </span></span><span>- "北京老家"</span></div></div><div><div><div>5</div></div><div><span><span>      </span></span><span>- "🎯 全球直连"</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p><code>rules:</code>是分流规则，在它里面找到局域网直连的那几行，删掉。<br />
这里科普一下，互联网行业有个惯例，就是192.168.1.1/16，10.0.0.0/8，172.16.0.0/12 等ip会被认为是内网ip，默认走交换机，不需要路由，所以我们需要在规则里删掉它。<br />
参考资料：<a href="https://www.google.com/search?q=rfc1918" target="_blank">搜索rfc1918</a><br />
比如我的几个局域网是10.10.10.1/24，10.10.11.1/24，10.10.16.1/24所以我需要删除10.0.0.0/8这一行。<br />
如果你的局域网是192.168.2.1/24，那就需要删除192.168.1.1/16这一行。<br />
删除完之后加上你自己的规则,就变成这样了：<br /></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>rules:</span></div></div><div><div><div>2</div></div><div><span><span> </span></span><span>- IP-CIDR,10.10.10.1/24,① 异地组网</span></div></div><div><div><div>3</div></div><div><span><span> </span></span><span>- IP-CIDR,10.10.11.1/24,② 异地组网</span></div></div><div><div><div>4</div></div><div><span><span> </span></span><span>- IP-CIDR,10.10.16.1/24,③ 异地组网</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p><strong>注意：不同地点之间，必须用不同网段，如果你3个地方都是统一用的192.168.1.1/24，那同一内网的流量直接用mac地址通讯了，根本不需要ip地址，也就没法组网了。</strong><br />
到这里配置文件也就准备完成了，这是完整的配置文件<br />
<a href="https://www.pidex.top/pd/images/nodeseek/250113/260916-config.yaml" target="_blank">config.yaml</a><br />
别着急，光有配置文件还不能组网，还需要找到 openclash-插件设置-流量控制-本地ipv4绕过地址，根据实际所用网段删掉10.0.0.0/8，192.168.2.1/24这几行，否则流量根本不经过clash内核，辛辛苦苦写的分流规则就派不上用场了。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-16_17-25-39.jpg" alt="images" /><figcaption>images</figcaption></figure><br />
如果是用的机场订阅，那不能直接在软件里填订阅地址，也是要用这个配置文件，在<code>proxy-providers:</code>这一行下面加上你的订阅链接，然后再新增一个分组引用它的path(路径)，然后在其他分组里将这个分组名字当作一个节点名字写进去就可以了。我发的配置文件里写好了模板，自行替换订阅链接然后取消注释就可以用了。<br /><p></p></section><section><h4>2.小火箭(ios的同类软件用法接近)<a href="#2小火箭ios的同类软件用法接近"><span>#</span></a></h4><p>配置文件是一样的，先导入配置，就会出现在”本地文件”里面了，点一下，编辑配置-通用，往下拉会有一个”跳过代理”，删掉10.0.0.0/8，192.168.2.1/24这几行(根据实际情况)。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-16_17-40-35.jpg" alt="images" /><figcaption>images</figcaption></figure>
然后点屏幕右上角的√保存，再点一下这个文件，使用配置，然后返回首页将全局路由改成”配置”，启动总开关即可组网成功。<br /><p></p></section><section><h4>3.安卓v2rayng<a href="#3安卓v2rayng"><span>#</span></a></h4><p>安卓手机v2rayng分流比较麻烦，我这里直接不用配置文件，手动输入节点，然后找到设置-预定义规则- <strong>不要选”绕过局域网”</strong> ，喜欢全局还是绕过大陆都可以，只是这样就不能同时组网多个地方了，除非做详细分流(俺也不会)。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-16_17-54-40.jpg" alt="images" /><figcaption>images</figcaption></figure><br /><p></p></section><section><h4>4.linux客户端<br /><a href="#4linux客户端"><span>#</span></a></h4><p>linux系统可以用这个项目<br />
<a href="https://github.com/juewuy/ShellCrash" target="_blank">https://github.com/juewuy/ShellCrash</a><br />
这就是个内核管理脚本，和直接跑内核差不多，安装完之后执行命令<code>crash</code>就可以进入功能界面。<br /></p><p>1.按顺序选择 6-a-2-a上传配置文件，然后返回主界面<br />
2.选择 6-1-e “直接使用此文件作为配置文件（不使用本地生成）”<br />
3.选择 9-4 安装Dashboard面板，启动就可以用了。<br /></p><p>如果启动成功，提示了 <code>管理面板： http://10.10.10.1:9999/ui</code>  ，但是打不开管理面板地址，那可能是默认仅允许本机访问，用nginx反代一下就可以访问了。<br />
面板密码在你上传的配置文件里的<code>secret:</code>这一行可以找到。<br />
</p><figure><img src="https://www.pidex.top/pd/images/nodeseek/250113/PixPin_2026-09-17_09-50-29.jpg" alt="images" /><figcaption>images</figcaption></figure><br />
到这里，组网完成，哪怕是出差/旅游，都可以随时看家里的小电影，随时往公司的电脑里塞垃圾文件了…<br /><p></p></section></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/fail2ban/</id>
      <title type="text">安装fail2ban防御网络攻击</title>
      <published>2026-01-14T00:00:00.000Z</published>
      <updated>2026-01-14T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/fail2ban/"/>
      <summary type="text">用fail2ban保护sshd和nginx</summary>
      <content type="html"><![CDATA[<section><h3>安装nginx<a href="#安装nginx"><span>#</span></a></h3>

<table><thead><tr><th>步骤</th><th>命令</th></tr></thead><tbody><tr><td>1.更新软件列表</td><td>apt update</td></tr><tr><td>2.安装fail2ban和依赖</td><td><code>apt install -y fail2ban rsyslog</code></td></tr><tr><td>3.启动rsyslog(ssh记录日志需要它)</td><td>systemctl start rsyslog</td></tr><tr><td>4.开机自启</td><td>systemctl enable rsyslog</td></tr><tr><td>⭐配置文件位置</td><td><code>/etc/fail2ban</code></td></tr><tr><td>5.启动fail2ban</td><td>systemctl start fail2ban</td></tr><tr><td>6.重启fail2ban</td><td>systemctl restart fail2ban</td></tr><tr><td>7.开机自启</td><td>systemctl enable fail2ban</td></tr><tr><td>8.取消开机自启</td><td>systemctl disable fail2ban</td></tr><tr><td>----------------------------------</td><td>-------------------------------------</td></tr><tr><td>查看封禁列表</td><td>fail2ban-client status sshd</td></tr><tr><td>解封命令</td><td>fail2ban-client set sshd unbanip 8.8.8.8</td></tr></tbody></table></section>
<section><h3>配置文件解析<a href="#配置文件解析"><span>#</span></a></h3><section><h4><code>/etc/fail2ban/jail.local</code><a href="#etcfail2banjaillocal"><span>#</span></a></h4><p>配置文件，开启或关闭某一项防御都写在里面。</p></section><section><h4><code>/etc/fail2ban/jail.d/*</code><a href="#etcfail2banjaild"><span>#</span></a></h4><p>配置文件，作用和jail.local相同，但优先级更高，并且文件夹里可以拆分成多个文件，方便管理。</p></section><section><h4><code>/etc/fail2ban/jail.conf</code><a href="#etcfail2banjailconf"><span>#</span></a></h4><p>这是默认配置文件，优先级低于手动创建的 <code>/etc/fail2ban/jail.local</code> ，所以一般不修改它，只将它当作配置模板。</p></section><section><h4><code>/etc/fail2ban/filter.d/*</code><a href="#etcfail2banfilterd"><span>#</span></a></h4><p>监狱：也就是匹配规则，文件名即是监狱名称，支持正则表达式，安装时自带，也可自行编写或者修改。</p></section></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/docker%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/</id>
      <title type="text">docker安装和使用</title>
      <published>2025-12-23T00:00:00.000Z</published>
      <updated>2025-12-23T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/docker%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/"/>
      <summary type="text">docker和docker-compose的安装和使用。</summary>
      <content type="html"><![CDATA[<section><h3>安装docker<a href="#安装docker"><span>#</span></a></h3><section><h4>1.使用脚本安装<a href="#1使用脚本安装"><span>#</span></a></h4><p>debian安装docker</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>curl -fsSL https://get.docker.com | bash -s docker</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>debian安装docker(国内源)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>curl -sSL https://get.daocloud.io/docker | sh</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h4>2.使用apt安装<a href="#2使用apt安装"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>apt install docker-ce</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h4>3.查看当前版本<a href="#3查看当前版本"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>docker --version</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h4>4.更新版本<a href="#4更新版本"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>apt install docker-ce docker-ce-cli containerd.io</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section></section>
<section><h3>安装docker-compose<a href="#安装docker-compose"><span>#</span></a></h3><section><h4>x86<a href="#x86"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h4>arm<a href="#arm"><span>#</span></a></h4><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-armv7 -o /usr/local/bin/docker-compose</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section></section>
<section><h3>容器操作<a href="#容器操作"><span>#</span></a></h3>

<table><thead><tr><th><strong>查看容器</strong></th><th></th></tr></thead><tbody><tr><td>查看正在运行的容器</td><td><code>docker ps</code></td></tr><tr><td>查看所有容器</td><td><code>docker ps -a</code></td></tr><tr><td>进入容器(也可以用容器ID)</td><td><code>docker exec -it alist bash</code></td></tr><tr><td>优雅的关闭容器</td><td><code>docker stop frps</code></td></tr><tr><td>粗鲁的关闭容器</td><td><code>docker kill frps</code></td></tr><tr><td>重启容器</td><td><code>docker restart frps</code></td></tr><tr><td>删除容器</td><td><code>docker rm frps</code></td></tr><tr><td><strong>修改容器</strong></td><td></td></tr><tr><td>docker-compose启动容器</td><td><code>docker-compose -f verysync.yaml up -d</code></td></tr><tr><td>修改自启</td><td><code>docker update --restart=always verysync</code></td></tr><tr><td>修改端口</td><td><code>/var/lib/docker/containers/363ff2d*</code></td></tr><tr><td>docker-compose升级镜像</td><td><code>docker-compose pull</code></td></tr><tr><td>docker-compose升级容器</td><td><code>docker-compose -f /opt/alist/alist.yaml up -d</code></td></tr></tbody></table></section>
<section><h3>镜像操作<a href="#镜像操作"><span>#</span></a></h3>

<table><thead><tr><th>用途</th><th>命令</th></tr></thead><tbody><tr><td>查看镜像</td><td><code>docker image ls</code></td></tr><tr><td>删除镜像</td><td><code>docker image rm 容器id前缀</code></td></tr><tr><td>保存镜像</td><td><code>docker commit -m=alist230227 alist alist230227</code></td></tr><tr><td>打包镜像</td><td><code>docker save -o /opt/image/alist230227 alist230227</code></td></tr><tr><td>加载镜像</td><td><code>docker load -I /opt/image/alist230227.tar</code></td></tr></tbody></table></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/bot_on_anything/</id>
      <title type="text">GPT接入微信公众号</title>
      <published>2025-12-01T00:00:00.000Z</published>
      <updated>2025-12-01T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/bot_on_anything/"/>
      <summary type="text">github项目：bot_on_anything</summary>
      <content type="html"><![CDATA[<p>github项目地址<br />
<a href="https://github.com/zhayujie/bot-on-anything" target="_blank">https://github.com/zhayujie/bot-on-anything</a></p>

<table><thead><tr><th>步骤</th><th>命令</th></tr></thead><tbody><tr><td>进入opt文件夹</td><td><code>cd /opt</code></td></tr><tr><td>更新软件库</td><td><code>apt update</code></td></tr><tr><td>克隆代码</td><td><code>git clone https://github.com/zhayujie/bot-on-anything</code></td></tr><tr><td>进入文件夹</td><td><code>cd bot-on-anything</code></td></tr><tr><td>复制配置文件</td><td><code>cp config-template.json config.json</code></td></tr><tr><td>安装pip3</td><td><code>apt-get install python3-pip</code></td></tr><tr><td>安装chatGPT依赖</td><td><code>pip3 install --upgrade openai</code></td></tr><tr><td>个人订阅号依赖</td><td><code>pip3 install werobot</code></td></tr><tr><td>web依赖</td><td><code>pip3 install PyJWT flask</code></td></tr><tr><td>进入项目文件夹</td><td><code>cd /opt/bot-on-anything</code></td></tr><tr><td>启动</td><td><code>python3 /opt/bot-on-anything/app.py</code></td></tr><tr><td>后台启动</td><td><code>cd /opt/bot-on-anything &amp;&amp; nohup python3 /opt/bot-on-anything/app.py &gt; /opt/bot-on-anything/nohup.log 2&gt;&amp;1 &amp;</code></td></tr><tr><td>查询进程ID</td><td><code>ps -ef | grep 'python3 /opt/bot-on-anything/app.py'</code></td></tr></tbody></table>
<p>创建开机启动</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>vim /etc/systemd/system/bot-on-anything.service</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
<p>填入内容</p>
<div><div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[Unit]</span></div></div><div><div><div>2</div></div><div><span>Description=Bot on Anything</span></div></div><div><div><div>3</div></div><div><span>After=network.target</span></div></div><div><div><div>4</div></div><div>
</div></div><div><div><div>5</div></div><div><span>[Service]</span></div></div><div><div><div>6</div></div><div><span>User=root</span></div></div><div><div><div>7</div></div><div><span>WorkingDirectory=/opt/bot-on-anything</span></div></div><div><div><div>8</div></div><div><span>ExecStart=/usr/bin/python3 /opt/bot-on-anything/app.py</span></div></div><div><div><div>9</div></div><div><span>Restart=always</span></div></div><div><div><div>10</div></div><div><span>StandardOutput=syslog</span></div></div><div><div><div>11</div></div><div><span>StandardError=syslog</span></div></div><div><div><div>12</div></div><div><span>SyslogIdentifier=bot-on-anything</span></div></div><div><div><div>13</div></div><div>
</div></div><div><div><div>14</div></div><div><span>[Install]</span></div></div><div><div><div>15</div></div><div><span>WantedBy=multi-user.target</span></div></div></code></pre><div><div></div><div></div></div></figure><div></div></div><span>展开</span><span>收起</span></div></div>
<p>重新加载 Systemd 配置文件</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl daemon-reload</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
<p>启动服务</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl start bot-on-anything</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
<p>查看服务</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl status bot-on-anything</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
<p>开机自启</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl enable bot-on-anything</span></div></div></code></pre><div><div></div><div></div></div></figure></div>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/linux%E8%AE%BE%E7%BD%AEssh%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95/</id>
      <title type="text">linux设置ssh密钥登录</title>
      <published>2025-12-01T00:00:00.000Z</published>
      <updated>2025-12-01T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/linux%E8%AE%BE%E7%BD%AEssh%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95/"/>
      <summary type="text">配置文件位置，常见参数说明</summary>
      <content type="html"><![CDATA[<section><h4>ssh配置文件位置：<strong>/etc/ssh</strong><a href="#ssh配置文件位置etcssh"><span>#</span></a></h4><p>1.修改ssh配置文件：<strong>/etc/ssh/sshd_config</strong></p>

<table><thead><tr><th>参数</th><th>代码</th></tr></thead><tbody><tr><td>允许root登录</td><td><code>PermitRootLogin prohibit-password</code></td></tr><tr><td>允许密钥登录</td><td><code>PubkeyAuthentication yes</code></td></tr><tr><td>禁止密码登录</td><td><code>PasswordAuthentication no</code></td></tr><tr><td>定时发送心跳包</td><td><code>ClientAliveInterval 30</code></td></tr><tr><td>重试次数</td><td><code>ClientAliveCountMax 3</code></td></tr><tr><td>日志文件</td><td><code>SyslogFacility AUTH</code></td></tr><tr><td>日志记录等级</td><td><code>LogLevel INFO</code></td></tr></tbody></table><p>2.用软件puttygen生成密钥，将公钥并上传至<code>/opt</code>文件夹<br />
3.创建公钥存放路径：<code>mkdir ~/.ssh</code><br />
4.公钥安装：<code>cat /opt/c01.pub &gt;&gt; ~/.ssh/authorized_keys</code><br />
5.重启ssh服务：<code>service sshd restart</code></p></section>
<section><h4>其他命令<a href="#其他命令"><span>#</span></a></h4><p>查看系统登录失败次数：<code>lastb|wc -l</code><br />
生成密钥对：<code>ssh-keygen -m PEM -t rsa -C "fang523"</code><br />
生成后的密钥路径：<code>/root/.ssh</code></p></section>
<section><h4>甲骨文root登录<a href="#甲骨文root登录"><span>#</span></a></h4><p>复制opc用户密钥至root文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cp -r /home/opc/.ssh/authorized_keys /root/.ssh/authorized_keys</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>编辑文件：<code>/root/.ssh/authorized_keys</code><br />
将<code>ssh-rsa AAAAB3NzaC</code>前面的内容全部删掉<br />
重启ssh服务即可</p></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/nginx%E5%AE%89%E8%A3%85%E4%BB%A5%E5%8F%8A%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E/</id>
      <title type="text">nginx安装以及参数说明</title>
      <published>2025-12-01T00:00:00.000Z</published>
      <updated>2025-12-01T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/nginx%E5%AE%89%E8%A3%85%E4%BB%A5%E5%8F%8A%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E/"/>
      <summary type="text">用apt安装，添加GPG密钥，下载签名文件，参数说明，路径匹配方式</summary>
      <content type="html"><![CDATA[<section><h3>安装nginx<a href="#安装nginx"><span>#</span></a></h3>

<table><thead><tr><th>步骤</th><th>命令</th></tr></thead><tbody><tr><td>1.更新软件列表</td><td>apt update</td></tr><tr><td>2.安装常用工具</td><td>apt install -y curl tar wget gnupg2 lsb-release</td></tr><tr><td>3.安装nginx</td><td>apt install nginx</td></tr><tr><td>⭐配置文件位置</td><td><code>/etc/nginx/conf.d</code></td></tr><tr><td>4.启动nginx</td><td>systemctl start nginx</td></tr><tr><td>5.开机自启</td><td>systemctl enable nginx</td></tr><tr><td>6.取消开机自启</td><td>systemctl disable nginx</td></tr></tbody></table></section>
<section><h3>nginx管理命令<a href="#nginx管理命令"><span>#</span></a></h3>

<table><thead><tr><th>步骤</th><th>命令</th></tr></thead><tbody><tr><td>启动nginx</td><td>nginx -c /etc/nginx/nginx.conf</td></tr><tr><td>停止</td><td>nginx -s quit</td></tr><tr><td>强制停止</td><td>nginx -s stop</td></tr><tr><td>重新加载</td><td>nginx -s reload</td></tr></tbody></table></section>
<section><h3>无法安装的解决办法<a href="#无法安装的解决办法"><span>#</span></a></h3><p><span>若无法通过apt安装，可是软件源设置问题 </span><br />
1.下载nginx PGP签名文件：<code>wget http://nginx.org/keys/nginx_signing.key</code><br />
2.安装nginx PGP签名文件：<code>apt-key add nginx_signing.key</code><br />
3.添加官方源到你的源列表：</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>echo "deb http://nginx.org/packages/debian/ $(lsb_release -cs) nginx" | tee /etc/apt/sources.list.d/nginx.list</span></div></div></code></pre><div><div></div><div></div></div></figure></div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>echo "deb-src http://nginx.org/packages/debian/ $(lsb_release -cs) nginx" | tee -a /etc/apt/sources.list.d/nginx.list</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>然后再次更新软件列表，运行安装命令即可。</p></section>
<section><h3>在非标准linux系统中启动nginx<a href="#在非标准linux系统中启动nginx"><span>#</span></a></h3><p>例如openwrt，无法使用systemctl管理系统中的服务。<br />
<strong>先通过opkg软件包管理程序安装nginx。</strong></p>

<table><thead><tr><th>步骤</th><th>命令</th></tr></thead><tbody><tr><td>授权开机自启</td><td>chmod 755 /etc/init.d/nginx</td></tr><tr><td>启动服务</td><td>service nginx start</td></tr><tr><td>停止服务</td><td>service nginx stop</td></tr><tr><td>开机自启服务</td><td>service nginx enable</td></tr><tr><td>取消开机自启</td><td>service nginx disable</td></tr></tbody></table></section>
<section><h3>匹配规则和优先级<a href="#匹配规则和优先级"><span>#</span></a></h3>

<table><thead><tr><th>代码</th><th>解释</th></tr></thead><tbody><tr><td>location =</td><td>#精准匹配</td></tr><tr><td>location ^~</td><td>#带参前缀匹配</td></tr><tr><td>location ~</td><td>#正则匹配（区分大小写）</td></tr><tr><td>location ~*</td><td>#正则匹配（不区分大小写）</td></tr><tr><td>location /a</td><td>#普通前缀匹配，优先级低于带参数前缀匹配。</td></tr><tr><td>location /</td><td>#任何没有匹配成功的，都会匹配这里处理</td></tr></tbody></table></section>
<section><h3>参数说明<a href="#参数说明"><span>#</span></a></h3>

<table><thead><tr><th>参数</th><th>解释</th></tr></thead><tbody><tr><td>$args</td><td>这个变量等于请求行中的参数，同$query_string</td></tr><tr><td>$content_length</td><td>请求头中的Content-length字段。</td></tr><tr><td>$content_type</td><td>请求头中的Content-Type字段。</td></tr><tr><td>$document_root</td><td>当前请求在root指令中指定的值。</td></tr><tr><td>$host</td><td>请求主机头字段，否则为服务器名称。</td></tr><tr><td>$http_user_agent</td><td>客户端agent信息</td></tr><tr><td>$http_cookie</td><td>客户端cookie信息</td></tr><tr><td>$limit_rate</td><td>这个变量可以限制连接速率。</td></tr><tr><td>$request_method</td><td>客户端请求的动作，通常为GET或POST。</td></tr><tr><td>$remote_addr</td><td>客户端的IP地址。</td></tr><tr><td>$remote_port</td><td>客户端的端口。</td></tr><tr><td>$remote_user</td><td>已经经过AuthBasicModule验证的用户名。</td></tr><tr><td>$request_filename</td><td>当前请求的文件路径，由root或alias指令与URI请求生成。</td></tr><tr><td>$scheme</td><td>HTTP方法（如http，https）。</td></tr><tr><td>$server_protocol</td><td>请求使用的协议，通常是HTTP/1.0或HTTP/1.1。</td></tr><tr><td>$server_addr</td><td>服务器地址，在完成一次系统调用后可以确定这个值。</td></tr><tr><td>$server_name</td><td>服务器名称。</td></tr><tr><td>$server_port</td><td>请求到达服务器的端口号。</td></tr><tr><td>$request_uri</td><td>包含请求参数的原始URI，不包含主机名，如：”/foo/bar.php?arg=baz”。</td></tr><tr><td>$uri</td><td>不带请求参数的当前URI，$uri不包含主机名，如”/foo/bar.html”。</td></tr><tr><td>$document_uri</td><td>与$uri相同。</td></tr></tbody></table></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/frp%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/</id>
      <title type="text">frp安装使用方法</title>
      <published>2025-01-01T00:00:00.000Z</published>
      <updated>2025-01-01T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/frp%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/"/>
      <summary type="text">frp安装使用方法。</summary>
      <content type="html"><![CDATA[<section><h3>下载frp<a href="#下载frp"><span>#</span></a></h3><p><a href="https://github.com/fatedier/frp/releases" target="_blank">github下载</a></p></section>
<section><h3>linux服务端<a href="#linux服务端"><span>#</span></a></h3><p>上传至服务器/opt文件夹<br />
进入opt文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd /opt</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>执行命令解压(注意文件名)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>tar -zxvf /opt/frp_0.59.0_linux_amd64.tar.gz</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>进入frp目录</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd /opt/frp</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>客户端程序：<code>frpc</code><br />
客户端配置文件：<code>frpc.toml</code><br />
服务端程序：<code>frps</code><br />
客户端配置文件：<code>frps.toml</code></p><p>删除文件夹内其他文件，只保留<code>frps</code>和<code>frps.toml</code>两个</p><p>在配置文件中填入以下内容</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[common]</span></div></div><div><div><div>2</div></div><div><span>bind_port = 7000</span></div></div><div><div><div>3</div></div><div><span>bind_udp_port = 7001</span></div></div><div><div><div>4</div></div><div><span>kcp_bind_port = 7000</span></div></div><div><div><div>5</div></div><div><span>tcp_mux = true</span></div></div><div><div><div>6</div></div><div><span>token = "yaY4eab54datVWI"  #连接密码</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>运行服务器(测试)，测试完按ctrl+c退出测试程序</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>./frps -c frps.toml</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>创建frp服务(文件)(开机自启)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>touch /usr/lib/systemd/system/frps.service</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>在文件中填入以下内容</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[Unit]</span></div></div><div><div><div>2</div></div><div><span>Description=frps service</span></div></div><div><div><div>3</div></div><div><span>After=network.target syslog.target</span></div></div><div><div><div>4</div></div><div><span>Wants=network.target</span></div></div><div><div><div>5</div></div><div>
</div></div><div><div><div>6</div></div><div><span>[Service]</span></div></div><div><div><div>7</div></div><div><span>Type=simple</span></div></div><div><div><div>8</div></div><div><span>ExecStart=/opt/frp/frps -c /opt/frp/frps.toml</span></div></div><div><div><div>9</div></div><div>
</div></div><div><div><div>10</div></div><div><span>[Install]</span></div></div><div><div><div>11</div></div><div><span>WantedBy=multi-user.target</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>启动服务：<code>systemctl start frps</code><br />
开机自启：<code>systemctl enable frps</code><br />
关闭开机自启：<code>systemctl disable frps</code><br />
查看进程：<code>ps auxw</code></p></section>
<section><h3>linux客户端<a href="#linux客户端"><span>#</span></a></h3><p>与linux服务端一样上传解压，删除其他文件，只保留<code>frpc</code>和<code>frpc.toml</code>两个<br />
在配置文件中填入以下内容</p><div><div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[common]</span></div></div><div><div><div>2</div></div><div><span>server_addr = "服务器IP或域名"</span></div></div><div><div><div>3</div></div><div><span>server_port = 7000</span></div></div><div><div><div>4</div></div><div><span>token = "yaY4eab54datVWI"</span></div></div><div><div><div>5</div></div><div><span>user = 127  #用户名，不和其他客户端重复即可</span></div></div><div><div><div>6</div></div><div><span>tcp_mux = true</span></div></div><div><div><div>7</div></div><div><span>tls_enable = true</span></div></div><div><div><div>8</div></div><div><span>login_fail_exit = false</span></div></div><div><div><div>9</div></div><div>
</div></div><div><div><div>10</div></div><div><span>[aaaaa1]</span></div></div><div><div><div>11</div></div><div><span>type = tcp            #协议</span></div></div><div><div><div>12</div></div><div><span>remote_port = 3391    #服务器上占用端口</span></div></div><div><div><div>13</div></div><div><span>local_ip = 127.0.0.1  #本地服务的实际IP</span></div></div><div><div><div>14</div></div><div><span>local_port = 3389     #本地服务的实际端口</span></div></div><div><div><div>15</div></div><div><span>use_encryption = false  #加密，远程桌面本身就有加密，则这里不需要开启</span></div></div><div><div><div>16</div></div><div><span>use_compression = false #压缩</span></div></div><div><div><div>17</div></div><div>
</div></div><div><div><div>18</div></div><div><span>[bbb2bb]</span></div></div><div><div><div>19</div></div><div><span>type = udp    #协议</span></div></div><div><div><div>20</div></div><div><span>remote_port = 3391</span></div></div><div><div><div>21</div></div><div><span>local_ip = 127.0.0.1</span></div></div><div><div><div>22</div></div><div><span>local_port = 3389</span></div></div><div><div><div>23</div></div><div><span>use_encryption = false</span></div></div><div><div><div>24</div></div><div><span>use_compression = false</span></div></div></code></pre><div><div></div><div></div></div></figure><div></div></div><span>展开</span><span>收起</span></div></div><p>运行服务器(测试)，测试完按ctrl+c退出测试程序</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>./frpc -c frpc.toml</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>创建frp服务文件(开机自启)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>touch /usr/lib/systemd/system/frpc.service</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>在客户端配置文件填入以下内容</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[Unit]</span></div></div><div><div><div>2</div></div><div><span>Description=fraps service</span></div></div><div><div><div>3</div></div><div><span>After=network.target syslog.target</span></div></div><div><div><div>4</div></div><div><span>Wants=network.target</span></div></div><div><div><div>5</div></div><div>
</div></div><div><div><div>6</div></div><div><span>[Service]</span></div></div><div><div><div>7</div></div><div><span>Type=simple</span></div></div><div><div><div>8</div></div><div><span>ExecStart=/opt/frp/frpc -c /opt/frp/frpc.toml</span></div></div><div><div><div>9</div></div><div>
</div></div><div><div><div>10</div></div><div><span>[Install]</span></div></div><div><div><div>11</div></div><div><span>WantedBy=multi-user.target</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>启动服务：<code>systemctl start frpc</code><br />
开机自启：<code>systemctl enable frpc</code><br />
关闭开机自启：<code>systemctl disable frpc</code><br />
查看进程：<code>ps auxw</code></p></section>
<section><h3>windows客户端<a href="#windows客户端"><span>#</span></a></h3><p>下载解压后得到<code>frpc.exe</code>和<code>frpc.toml</code><br />
配置文件里面填写内容和linux客户端一样。<br />
新建一个文本文件，填入以下内容。</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>.\frpc.exe -c .\frpc.toml</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>将此文件另存为<code>start.bat</code>，<strong>注意后缀</strong>，它就是启动文件了
将客户端程序，配置文件，启动文件放到同一个文件夹，路径不要用中文。
双击启动文件即可启动客户端。</p></section>
<section><h3>windos服务端<a href="#windos服务端"><span>#</span></a></h3><p>配置文件和linux服务端一样，启动方法和windows一样，将frpc替换frps即可。
连接成功后访问服务器的IP加3391端口，等于访问本地机器的3389端口。</p></section>
<section><h3>打开防火墙<a href="#打开防火墙"><span>#</span></a></h3><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ufw allow 7000</span></div></div></code></pre><div><div></div><div></div></div></figure></div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ufw allow 3391</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>
<section><h3>docker安装frp<a href="#docker安装frp"><span>#</span></a></h3><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>docker run --restart=always -d --net=host --name frpc  -v /opt/frp/frpc.ini:/frp/frpc.ini stilleshan/frpc:latest</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E8%81%94%E6%9C%BA%E5%BC%80%E6%9C%8D%E6%95%99%E7%A8%8B/</id>
      <title type="text">[factorio]联机开服教程</title>
      <published>2024-12-30T00:00:00.000Z</published>
      <updated>2024-12-30T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E8%81%94%E6%9C%BA%E5%BC%80%E6%9C%8D%E6%95%99%E7%A8%8B/"/>
      <summary type="text">详细讲解factorio联机开服的各种方法</summary>
      <content type="html"><![CDATA[<p><strong>首先，工厂开服有6种方式：</strong></p>
<p>1：游戏内直接创建房间。<br />
2：使用ZeroTier虚拟局域网 或者 游侠等对战平台。<br />
3：通过steam好友加入。<br />
4：使用有公网IP的linux电脑开服。<strong>(体验最好)</strong><br />
5：使用有公网IP的windows电脑开服。(公网IPV6也算!!)<br />
6：用家里无公网IP的电脑开服。(反向代理)</p>
<p>PS: 本教程重点是第四种方法，由于篇幅限制，其他的几种方法会略显简陋，谢谢理解。</p>
<section><h4>1：游戏内创建房间。<a href="#1游戏内创建房间"><span>#</span></a></h4><p>工厂官方会提供一个NAT握手服务，直接游戏内选择多人游戏-搭建服务器创建房间，没啥技术含量，打开互联网开关就行，别人可以在联机大厅找到你。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/01.jpg" alt="01" /><figcaption>01</figcaption></figure><p></p><p>但是由于工厂的NAT握手服务器在外国，所以NAT打孔经常失效，成功率视你家网络环境而定，优点是上手简单，成本低。</p><p><strong>缺点是成功率低，还不稳定容易掉线，此方法早已被大部分玩家抛弃。
看见这个”组局服务器连接已恢复”，就说明成功了。</strong></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/02.jpg" alt="02" /><figcaption>02</figcaption></figure><p></p></section>
<section><h4>2：使用ZeroTier把大家连接成一个局域网，然后在游戏内创建房间，勾选局域网。<a href="#2使用zerotier把大家连接成一个局域网然后在游戏内创建房间勾选局域网"><span>#</span></a></h4><p>或者用游侠等对战平台，游侠会有服务器全程帮你们转发所有数据，而不仅仅是”帮你们握个手”。<br />
由于此方法使用的是”局域网”连接功能，可以关闭”正版验证”，据我所知一般都是盗版玩家使用比较多，其实正版用户也能用。<br />
但是我本人没用过游侠，不知道稳定性和收费如何，缺点是每个玩家都要装这个第三方软件。</p></section>
<section><h4>3：通过steam好友加入，由steam提供NAT握手服务，steam在国内有服务器，所以连接成功率比官方游戏大厅高一点。<a href="#3通过steam好友加入由steam提供nat握手服务steam在国内有服务器所以连接成功率比官方游戏大厅高一点"><span>#</span></a></h4><p>方法也是<strong>游戏内创建房间，把steam勾上</strong>就行，别人直接在steam右键你的头像就能加入，也可以主动邀请好友加入。<br />
优点是免费而且稳定性还行，使用体验较佳，<strong>缺点是要加好友</strong>，但是很多人开服就是想和别人一起玩，想认识新朋友的话，就不能用这种方法了。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/03.jpg" alt="03" /><figcaption>03</figcaption></figure><p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/04.jpg" alt="04" /><figcaption>04</figcaption></figure><p></p></section>
<section><h4>4：使用有公网IP的linux电脑开服。<a href="#4使用有公网ip的linux电脑开服"><span>#</span></a></h4><p><strong>据我所知，此方法是目前异星工厂最多人使用的，这是游戏体验最佳的开服方式，除了需要金钱支持，需要一点技术，其他全是优点。</strong>
<strong>这是最难的一种开服方式，但是别怕，3个小时以内，一般人都能学会。</strong><br />
有公网，还是linux，如果你家的电脑同时符合这两个条件的话，那你肯定是个大佬，也不需要看我的教程了。<br />
所以这里指的是云服务器，目前国内有好多云服务器提供商。<br />
<a href="https://curl.qcloud.com/B0OWUAOf" target="_blank">腾讯云 (tencent.com) </a><br />
<a href="https://www.aliyun.com/daily-act/ecs/fy22-12-yure?userCode=mbjbx82r" target="_blank">阿里云 (aliyun.com)  </a><br />
<a href="https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=fe178737-34a3-42ef-b76c-489829d67fc3&amp;utm_source=aHc5MTAzNDAxNw===&amp;utm_medium=cps&amp;utm_campaign=201905" target="_blank">华为云 (huaweicloud.com)</a></p><section><h5>第1步&lt;购买服务器&gt;<a href="#第1步"><span>#</span></a></h5><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/05.jpg" alt="05" /><figcaption>05</figcaption></figure><p></p><ul>
<li>系统：debian10或以上</li>
<li>内存：8G(少了不够用，多了浪费钱，千瓶万瓶才需要更多内存)</li>
<li>CPU：双核或以上</li>
<li>网络带宽：8Mbps以上。</li>
<li>硬盘：10G就够用，但是一般最低档都20G了。</li>
<li>地理位置：<strong>不要选香港台湾</strong>，其他地区无所谓，离你越近越好。</li>
</ul><p>登录后台管理界面，<strong>找到你的服务器公网IP，记录下来</strong>。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/06.jpg" alt="06" /><figcaption>06</figcaption></figure><p></p></section><section><h5>第2步：连接服务器<a href="#第2步连接服务器"><span>#</span></a></h5><p>点击”登录”，显示”用户名@电脑名”，就说明连接成功了</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/07.jpg" alt="07" /><figcaption>07</figcaption></figure><p></p></section><section><h5>第3步：设置ssh登录<a href="#第3步设置ssh登录"><span>#</span></a></h5><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>设置你的SSH密码，以下命令直接输入，然后回车就行</span></div></div><div><div><div>2</div></div><div><span>输入命令：passwd root</span></div></div><div><div><div>3</div></div><div><span>输入密码：87654321 输入的时候屏幕没反应是正常的，你键盘按下去了就行了</span></div></div><div><div><div>4</div></div><div><span>再输入一次密码：87654321</span></div></div><div><div><div>5</div></div><div><span>输入命令重启ssh服务：service sshd restart</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h5>第5步：工具准备。<a href="#第5步工具准备"><span>#</span></a></h5><p>1：准备正版工厂账号的用户名和密码，但是我更加建议使用”<strong>用户名+token</strong>”，而不是”用户名+密码”。<br />
token翻译过来也是密码的意思，也能说是”授权码”。<br />
区别就是：如果别人盗了你的密码，他除了能用来开服，还能改密码，能用你账号去论坛发表傻逼言论，能随意修改你的个人资料。<br />
但是如果泄露的是token，他只能用来开服，其他啥也干不了。</p><p>那么token在哪里获得呢？在工厂官网个人资料上面可以查看，点一下这个”reveal”就能显示出来了，如果没有这个按钮，就点击网页下边那个绑定steam，绑定之后就会有了。<br />
<a href="https://factorio.com/profile" target="_blank">个人资料-Factorio</a></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/08.jpg" alt="08" /><figcaption>08</figcaption></figure><p></p><p>2：准备一个ssh工具，用于远程控制云服务器，这里我用的是putty。<br />
<a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html" target="_blank">putty下载</a><br />
3：一个文件传输工具，我使用的是winscp。<br />
<a href="https://winscp.net/eng/download.php" target="_blank">winscp下载</a><br />
4：准备工厂的linux安装包。<br />
<a href="https://factorio.com/download" target="_blank">官网下载链接</a><br />
选择<strong>图标是个企鹅，但是没有头</strong>的那个，俗称”无头版”，因为去除了图形界面，只有80M大小，别怀疑，就是它。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/09.jpg" alt="09" /><figcaption>09</figcaption></figure><p></p></section><section><h5>第6步(ssh连接服务器)<a href="#第6步ssh连接服务器"><span>#</span></a></h5><p>工具已经准备好了，开始ssh远程连接到你的服务器，putty是纯英文软件，但是默认设置已经是很好用了，咱这一步不需要设置什么，也就不用学习英文了，认两个按钮就行。<br />
1：打开putty<br />
2：输入<strong>用户名@服务器IP地址</strong>，输入备注(机器名字)<br />
3：点一下save保存，免得每次都要输入IP地址，太麻烦<br />
4：双击或者选中之后点open，进行远程控制。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/10.jpg" alt="10" /><figcaption>10</figcaption></figure><p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/11.jpg" alt="11" /><figcaption>11</figcaption></figure><p></p><p>输入密码之后显示这个界面，就是连接成功了</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/12.jpg" alt="12" /><figcaption>12</figcaption></figure><p></p></section><section><h5>第7步：上传并解压<a href="#第7步上传并解压"><span>#</span></a></h5><p>把安装包上传到云服务器的 <strong>/opt文件夹</strong> 里，然后运行命令解压。</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>tar -xJvf /opt/factorio-headless_linux_2.1.22.tar.xz -C /opt</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>解压之后查看一下文件夹内容</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/13.jpg" alt="13" /><figcaption>13</figcaption></figure><p></p><p>你会看到很多个文件，需要先学习几个嘤文单词：<br />
server=服务器，settings=设置，example=模板，admin=管理员，list=列表，mods=模组，saves=存档，map=地图，white=白名单</p><p>学会这几个嘤语单词之后你一眼就能看出来，<strong>server-settings.json</strong>服务器配置文件，打开它。<br />
也可能只有server-settings.example.json，就是”服务器设置模板”的意思嘛，你改一下文件名，把”模板“这个单词删掉就好了</p><p>文本编辑器最好别用windows自带的记事本，你可以随便下载一个别的，这里我用的是notepad3，也可以用VS Code或者Notepad++<br />
<a href="https://github.com/rizonesoft/Notepad3/releases" target="_blank">Notepad3 (github)</a><br />
<a href="https://code.visualstudio.com/" target="_blank">VS Code(code.visualstudio.com)</a><br />
<a href="https://notepad-plus-plus.org/" target="_blank">Notepad++ (notepad-plus-plus.org)</a></p><p><strong>只需要改这三个地方，其他的保持默认就行了</strong>，name是房间名，username是你的用户名，token刚才已经解释过了。<br />
<strong>只需要改这三个地方，其他的保持默认就行了</strong>，name是房间名，username是你的用户名，token刚才已经解释过了。<br />
<strong>只需要改这三个地方，其他的保持默认就行了</strong>，name是房间名，username是你的用户名，token刚才已经解释过了。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/14.jpg" alt="14" /><figcaption>14</figcaption></figure><p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/15.jpg" alt="15" /><figcaption>15</figcaption></figure><p></p><p>还差一个文件，啊对，管理员，总不能自己开服却没有管理员权限吧，那可真尴尬了，我的老伙计。<br />
<strong>server-adminlist.json</strong>是管理员列表，打开它，把你的游戏名字写上去。<br />
假如找不到server-adminlist.json，也找不到模板，可以直接将”服务器白名单列表”这个文件<strong>复制改名</strong>成server-adminlist.json</p><p>用这行命令复制并改名</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cp /opt/factorio/data/server-whitelist.example.json /opt/factorio/data/server-adminlist.json</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/16.jpg" alt="16" /><figcaption>16</figcaption></figure><p></p><p>配置文件好了，恭喜你，现在可以开始游戏了。<br />
首先得准备一个存档是吧？<br />
在你的电脑创建一个呗，如果我没猜错，你的电脑应该是windows系统的，一般情况下存档都会保存在 %appdata%\factorio\saves 文件夹下<br />
上传到云服务器/opt/factorio/saves文件夹下面，如果没有saves文件夹，就自己创建一个。</p></section><section><h5>第8步：输入命令开始游戏<a href="#第8步输入命令开始游戏"><span>#</span></a></h5><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>/opt/factorio/bin/x64/factorio --start-server-load-latest --server-settings /opt/factorio/data/server-settings.json --server-adminlist /opt/factorio/data/server-adminlist.json --port 34197</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>然后看到你的IP，后面写着”by pingpong1”之类的，就说明服务器创建成功了，可以愉快的玩耍了，游戏大厅里可以进你的服务器了，直连也可以，你的公网IP就是直连IP。</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>#这是一些参数说明，如果你有兴趣知道这行命令是什么意思的话就看一下。</span></div></div><div><div><div>2</div></div><div><span>/opt/factorio/bin/x64/factorio    #游戏在哪</span></div></div><div><div><div>3</div></div><div><span>--start-server-load-latest        #开始-服务-加载-最新(存档)</span></div></div><div><div><div>4</div></div><div><span>--server-adminlist    #管理员列表</span></div></div><div><div><div>5</div></div><div><span>--server-settings     #配置文件在哪</span></div></div><div><div><div>6</div></div><div><span>--port 34197          #端口，默认是34197</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/17.jpg" alt="17" /><figcaption>17</figcaption></figure><p></p><p>如果有显示”goodbye”，就是再见的意思，就是你的服务器出错了。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/18.jpg" alt="18" /><figcaption>18</figcaption></figure><p></p><p>新手最容易犯的错，是你配置文件里没填用户名和密码，要么就是存档都没传上去
稍微难一点的就是是缺少gilbc2.18，你就看提示，有没有提示gilbc2.18，如果有提示，那就要手动编译gilbc2.18</p><p><strong>以下是编译glibc-2.18的命令，没报错的跳过，提示了gilbc2.18的话就一行一行执行以下代码。</strong><br />
安装编译所需的常用软件</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>apt install  -y gcc automake autoconf libtool make wget</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>进入opt文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd /opt</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>下载glibc</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>解压</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>tar -zxvf glibc-2.18.tar.gz</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>进入glibc文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd glibc-2.18</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>准备一个编译文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>mkdir build</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>进入编译文件夹</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd build</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>配置编译参数/路径</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>编译安装(可能会很慢)</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>make &amp;&amp; make install</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>查看glibc支持的版本</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>strings libc.so | grep GLIBC</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>编译安装完glibc-2.18之后，重新执行开服命令就可以开服成功了。</p><p><strong>如果你明明开服成功了，但就是进不了房间，那很可能是防火墙问题。</strong>
国内的云服务器一般有两层防火墙，第一层防火墙是云服务商提供的，需要在云服务器的管理后台打开。
找到你的云服务器管理后台，阿里云的叫”安全组”，腾讯云的叫”防火墙”，其实就是同一个东西。
<strong>打开TCP协议的27015端口和UDP协议的34197端口。</strong></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/19.jpg" alt="19" /><figcaption>19</figcaption></figure><p></p><p>打开了云服务器的安全组之后，可以尝试一下能不能进游戏房间，如果还是不能进，那说明你的云服务器系统自带有防火墙。
系统自带的防火墙每个云服务器不一样，我这里只说比较常见的ufw防火墙。</p><p><strong>输入这行命令先查看防火墙状态</strong>，如果显示一堆看不懂的嘤文，就说明防火墙正在运行</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ufw status</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/21.jpg" alt="21" /><figcaption>21</figcaption></figure><p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/22.jpg" alt="22" /><figcaption>22</figcaption></figure>
用这两行命令打开防火墙端口<p></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ufw allow 34197/udp</span></div></div><div><div><div>2</div></div><div><span>ufw allow 27015/tcp</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>然后重启防火墙</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>ufw reload</span></div></div></code></pre><div><div></div><div></div></div></figure></div></section><section><h5>至此，开服成功，接下来就是维护的问题了。<a href="#至此开服成功接下来就是维护的问题了"><span>#</span></a></h5><ul>
<li>有人问了，我要启用MOD怎么办，在你的电脑saves旁边不是有一个mods文件夹吗，和上传存档一样，把它上传到云服务器的saves旁边，也新建一个文件夹叫”mods”就行了。</li>
<li>我要启用DLC怎么办？众所周知，DLC也是一个MOD，服务器安装包里面自带的，开关在<strong>mod-list.json</strong>里面，你刚才上传MOD的时候已经把DLC设置和MOD设置也一起上传了。</li>
</ul><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/23.jpg" alt="23" /><figcaption>23</figcaption></figure><p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/24.jpg" alt="24" /><figcaption>24</figcaption></figure><p></p><ul>
<li>那开服命令太长，我记不住咋办？<br />
没问题的，刚刚启动服务器的命令复制下来，放到一个文本里，改名成server-start.sh，放到云服务器的/opt/factorio文件夹里面。<br />
但是这样前台运行，远程连接一关，服务器也会关，所以我们需要让它后台运行，就是在命令的前面加上nohub，在后面加上&amp;就行了</li>
</ul><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/25.jpg" alt="25" /><figcaption>25</figcaption></figure><p></p><p>以后开服的时候，运行server-start.sh脚本就行，运行方法就是复制路径，然后直接运行就行，如果提示权限不足，那就修改权限成可执行
执行开服脚本</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>/opt/factorio/server-start.sh</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>提升权限命令</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chmod +x /opt/factorio/server-start.sh</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/26.jpg" alt="26" /><figcaption>26</figcaption></figure><p></p><ul>
<li>那如果还想开机自启动咋办？也简单，以debian系统为例，先将 <a href="https://www.pidex.top/pd/images/nodeseek/250113/factorio.service" target="_blank">这个文件</a> 放到<code>/etc/systemd/system</code>目录下</li>
</ul><p>设置权限</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chown root:root /etc/systemd/system/factorio.service</span></div></div></code></pre><div><div></div><div></div></div></figure></div><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>chmod 644 /etc/systemd/system/factorio.service</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>刷新服务</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl daemon-reload</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>启动服务</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl restart factorio</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>停止服务</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl stop factorio</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>开机自启</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>systemctl enable factorio</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>查看日志</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>journalctl -u factorio</span></div></div></code></pre><div><div></div><div></div></div></figure></div><ul>
<li>
<p>那如果要更新游戏怎么办？<br />
重新去官网下载游戏安装包(无头版)，上传到云服务器，<strong>先关闭游戏，再解压覆盖</strong>就行。</p>
</li>
<li>
<p>那如果要更新MOD怎么办？<br />
工厂官方有推荐两个模组更新器，随便选一个。<br />
<a href="https://github.com/pdemonaco/factorio-mod-updater" target="_blank">Python Mod Updater</a><br />
<a href="https://github.com/astevens/factorio-mod-updater" target="_blank">Ruby Mod Updater</a><br />
但是由于众所周知的原因，在国内云服务器上并不好用，还是直接在你自己的电脑下载，然后上传到云服务器直接覆盖文件吧，也可以使用winscp的”同步”功能。</p>
</li>
<li>
<p>那怎么关闭服务器呢？<br />
用这行命令查看进程ID</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>lsof -i:34197</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
<p>用这行命令关闭进程，其中”32554”是上一步查看端口占用得到的进程编号</p>
<div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>kill -9 32554</span></div></div></code></pre><div><div></div><div></div></div></figure></div>
</li>
</ul></section></section>
<section><h4>5：使用有公网IP的windows电脑开服。<a href="#5使用有公网ip的windows电脑开服"><span>#</span></a></h4><p>windows就简单多了，看了linux开服，你已经知道配置文件的文件名是什么了，找到它，和linux开服一样只需要修改三个地方。
windows就直接装个steam，安装游戏，游戏的安装目录下同样会有配置文件的模板，一样这么改。<br />
连开服命令都差不多，不过Windows运行命令不方便，直接把命令保存到文本里，仅仅是路径书写格式不一样而已，需要把\替换成/
但是windows保存文件的文件名后缀是bat，而不是sh。<br />
同样的，<strong>准备存档，修改配置文件，检查MOD文件夹，然后开服。</strong></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>start /wait bin/x64/factorio.exe --start-server-load-latest --server-settings "server-settings.json" --port 34197  --no-log-rotation</span></div></div><div><div><div>2</div></div><div><span>pause</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>将上面这行代码保存到文本里改名3.bat，然后脚本<strong>一定要放到异星工厂的安装目录(D:\Steam\steamapps\common\Factorio)</strong>，双击运行就行。</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>#这是一些参数说明，如果你有兴趣知道这行命令是什么意思的话就看一下。</span></div></div><div><div><div>2</div></div><div><span>start    #开始程序</span></div></div><div><div><div>3</div></div><div><span>/wait bin/x64/factorio        #游戏在哪(相对路径)</span></div></div><div><div><div>4</div></div><div><span>--start-server-load-latest    #开始-服务-加载-最新(存档)</span></div></div><div><div><div>5</div></div><div><span>--server-adminlist    #管理员列表</span></div></div><div><div><div>6</div></div><div><span>--server-settings     #配置文件在哪</span></div></div><div><div><div>7</div></div><div><span>--port 34197          #端口，默认是34197</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/27.jpg" alt="27" /><figcaption>27</figcaption></figure>
租云服务器就别玩什么windows了，Linux多香啊。<br />
windows用脚本开服，稳定性并不好，不建议这么做。<br />
当然，如果你有公网IPV6，还是很香的，防火墙打开方法很简单，请自行搜索。<p></p></section>
<section><h4>6：使用无公网IP的电脑开服。(反向代理，不需要打开windows防火墙)<a href="#6使用无公网ip的电脑开服反向代理不需要打开windows防火墙"><span>#</span></a></h4><p>有的小伙伴家里没有公网IP，并且，众所周知，国内的云服务器贼贵，国外的又网络不太行的样子。<br />
如果自己家里有一台性能不错的电脑，但是没公网IP，那就可以租一台稍微差点的云服务器，只要有公网IP就行，利用它来把数据转发到你家的电脑上。<br />
这里就可以选择低配套餐，建议选择”轻量服务器”，带宽大，配置差，但是数据转发并不需要多少性能。<br />
开服过程和上面说到的一样，只是要多装一个FRP反向代理。<br />
FRP是一个开源的反向代理程序，非常出名，这里是github项目地址。(网络不好可能打不开这个网页，找网友帮你下载吧)<br />
<a href="https://github.com/fatedier/frp/releases" target="_blank">https://github.com/fatedier/frp/releases</a><br />
下载你对应的版本，云服务器一般是linux-amd-64，家用电脑就是windows，两个都要下载</p><p>下面是Linux服务端的安装过程<br />
<strong>将FRP安装包上传到云服务器的/opt目录</strong></p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>cd /opt</span></div></div><div><div><div>2</div></div><div><span>tar -zxvf frp_0.36.2_linux_amd64.tar.gz</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>然后你会看到几个文件。<br />
frps就是服务端程序<br />
frps.toml就是服务端配置文件<br />
frpc就是客户端程序<br />
frpc.toml就是客户端配置文件<br />
咱们打开服务端配置文件<br />
</p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/28.jpg" alt="28" /><figcaption>28</figcaption></figure>
如果你觉得嘤文太多，可以从解压出来的配置模板里面找到一样的代码，复制代码然后自己修改参数。<br />
如果复制都懒得复制，你可以下载我的配置文件来修改<br />
<a href="https://www.pidex.top/pd/images/factorio/ini/241229/frps.toml" target="_blank">frps.toml</a><br />
设置好就可以开始运行服务端了。<p></p><p>进入frp目录：cd /opt/frp<br />
测试运行frp服务：./frps -c frps.ini<br />
退出服务：按ctrl+c<br />
打开开机自启文件：vi /lib/systemd/system/frps.service<br />
按I进入编辑模式 按I，是i不是 L<br />
加入以下代码</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>[Unit]</span></div></div><div><div><div>2</div></div><div><span>Description=fraps service</span></div></div><div><div><div>3</div></div><div><span>After=network.target syslog.target</span></div></div><div><div><div>4</div></div><div><span>Wants=network.target</span></div></div><div><div><div>5</div></div><div>
</div></div><div><div><div>6</div></div><div><span>[Service]</span></div></div><div><div><div>7</div></div><div><span>Type=simple</span></div></div><div><div><div>8</div></div><div><span>ExecStart=/opt/frp/frps -c /opt/frp/frps.ini</span></div></div><div><div><div>9</div></div><div>
</div></div><div><div><div>10</div></div><div><span>[Install]</span></div></div><div><div><div>11</div></div><div><span>WantedBy=multi-user.target</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>按ESC退出编辑模式，输入 <strong></strong> 保存（别少打个冒号）</p><div><figure><figcaption></figcaption><pre><code><div><div><div>1</div></div><div><span>启动服务    systemctl start frps</span></div></div><div><div><div>2</div></div><div><span>开机自启    systemctl enable frps</span></div></div><div><div><div>3</div></div><div><span>取消开机自启    systemctl disable frps</span></div></div><div><div><div>4</div></div><div><span>查看进程    ps auxw</span></div></div></code></pre><div><div></div><div></div></div></figure></div><p>至此，反向代理服务器搭建完成</p><p>刚才已经下载FRP的windows安装包了，windows运行软件就简单多了
客户端配置文件如下<br />
</p><figure><img src="https://www.pidex.top/pd/images/factorio/251127/29.jpg" alt="29" /><figcaption>29</figcaption></figure><br />
你可以下载我的配置文件来修改<br />
<a href="https://www.pidex.top/pd/images/factorio/ini/241229/frpc.toml" target="_blank">frpc.toml</a><br />
确定FRP服务端和客户端配置文件都没问题之后，启动frpc。<br />
windows启动frpc需要用cmd，也就是也要命令行，所以，还是直接保存命令到文本里边吧。<br />
‘frpc.exe -c frpc.ini’
保存到frpc.bat里面，然后frpc.bat一定要放到frp的根目录下，双击运行就行。<br />
你可以下载我的脚本(不需要修改)<br />
<a href="https://www.pidex.top/pd/images/factorio/ini/frpc.bat" target="_blank">frpc.bat</a><p></p><p>然后开工厂服务器也是和上面的一样，别人在游戏大厅可以直接进，或者选直连然后输入你的云服务器IP也能和你联机。
这种方法适合家里没有公网IP，买了云服务器也没别的用途的人，是一种折中的用法。
优点是便宜，缺点是多一层数据转发，对你家的网络稳定性有要求，对你家电脑的性能也是一种考验。</p><p>[至此，教程结束，去愉快的玩耍吧！]</p></section>]]></content>
    </entry>
    <entry>
      <id>https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E4%BF%A1%E5%8F%B7%E7%BD%91%E7%BB%9C%E7%94%B5%E8%B7%AF%E6%95%99%E7%A8%8B/</id>
      <title type="text">[factorio]信号网络电路教程</title>
      <published>2021-04-02T00:00:00.000Z</published>
      <updated>2021-04-02T00:00:00.000Z</updated>
      <author><name>fang523</name></author>
      <link rel="alternate" href="https://www.pidexe.com/posts/%E5%BC%82%E6%98%9F%E5%B7%A5%E5%8E%82%E4%BF%A1%E5%8F%B7%E7%BD%91%E7%BB%9C%E7%94%B5%E8%B7%AF%E6%95%99%E7%A8%8B/"/>
      <summary type="text">factorio游戏内信号网络的用法，基本电路的原理。</summary>
      <content type="html"><![CDATA[<section><h4>目录<a href="#目录"><span>#</span></a></h4><p>一：红绿信号线。<br />
二：判断运算器。<br />
三：加减乘除。<br />
四：余数，次方。<br />
五：左移右移。<br />
六：按位与，按位或，按位异或。<br />
这游戏的信号网络，怎么说，算是最具灵魂的玩法之一了，直奔正题吧。</p></section>
<section><h4>一：红绿信号线。<a href="#一红绿信号线"><span>#</span></a></h4><p>一个基本的控制系统，最少需要三种元素”输出信号”,“信号传输”,“接收信号”。<br />
在factorio游戏里，最简单的用法就是化工厂的重油裂解了。<br />
用一根线连接储液管和管道泵，将重油裂解的管道泵设置成”重油大于轻油”则启用，将轻油裂解的泵设置成”轻油大于石油气”则启用，一个智能化工厂就完成了。<br />
在这里储液罐就是输出端，红绿信号线相当于传输，管道泵就是接收信号(被控端)。</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/01.jpg" alt="图1" /><figcaption>图1</figcaption></figure><p></p></section>
<section><h4>二：判断运算器。<a href="#二判断运算器"><span>#</span></a></h4><p>判断运算器算是基本电路用法了，有大于小于等于，接收装置本身就自带一个判断。
但是判断运算器的玩法有很多，有时候只设置接收装置的判断是不够的，比如：“SR锁存”,“寄存器”,“自循环”。<br />
只要分清楚输出”常量1”和”输入数值”有什么区别就可以了。<br />
常量1就是只要判断通过，就输出指定信号，值为1。<br />
选择”输入数值”就相当于开关，判断通过，就让信号通过。这一部分有很多教程，自学简单，如果你真的有兴趣，请多花点时间。<br />
</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/02.jpg" alt="图2" /><figcaption>图2</figcaption></figure><p></p></section>
<section><h4>三：加减乘除。<a href="#三加减乘除"><span>#</span></a></h4><p>讲算术运算器之前，我们先一起来学一下”数学”，数学在很多地方都是通用的，只不过每个场景的表达方式不一样，其实它们都是一个东西，我整理了一些数据，这里面每一行所对应的就是同一种计算。</p><p>“1+2”是加法，“一加二”也是加法，“C=A+B”也是加法，只不过是书写方式不一样。
</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/03.jpg" alt="图3" /><figcaption>图3</figcaption></figure>
<strong>加减乘除</strong>：顾名思义，就是读书时候学的加减乘除，没有什么区别。结合判断运算器，我这里有一份铀增值蓝图，如果你能告诉我它的”优点”,“缺点”和”适应场景”分别是什么，你的工厂电路就算入门了，请注意，此蓝图不是最终方案，仅用于研究电路的，请勿引战。<br />
<figure><img src="https://www.pidex.top/pd/images/factorio/210402/04.jpg" alt="图4" /><figcaption>图4</figcaption></figure>
<a href="https://www.pidex.top/pd/images/factorio/210402/%E9%93%80%E5%A2%9E%E5%80%BC%E8%93%9D%E5%9B%BE.txt" target="_blank">铀增殖蓝图代码</a><br />
<strong>余数，次方</strong>：其实这两个也是初中的知识。<br />
余数是什么，假如你有230压岁钱，异星工厂游戏99元一份，最多能买2份，剩32元，32就是余数（大于99就再买一份，一直买，最后有点实在用不完的，就是余数）。<br />
次方，5的4次方=5x5x5x5，5的3次方=5x5x5。<br />
余数其实是很有用的一种运算，一般我是用来”分组”，比如说有20个地方需要铁板，有5辆火车，那么我只要给每个需求站和火车定一个编号，然后车站编号”余”火车编号，就很清楚知道，这个站需要铁板的时候派哪一辆车出发。AAI玩家表示无脑吹就是了。<p></p></section>
<section><h4>四：左移右移。<a href="#四左移右移"><span>#</span></a></h4><p>左移右移其实很好理解，先将十进制数字转换成二进制，然后看下图。<br />
<img src="https://www.pidex.top/pd/images/factorio/210402/05.jpg" alt="图5" width="403" />
左移右移就是这样。</p><p><strong>进制转换</strong>，举个栗子，我们用瓶子装水，假如有1688毫升水。<br />
每个瓶子能装10毫升，10个瓶子装一箱，10箱一车，这就是十进制，就等于1车+6箱+8瓶+8毫升，十进制就是1688。<br />
同理，如果一个瓶子能装16毫升，16瓶一箱，16箱一车，这就是十六进制，就等于6箱+9瓶+8毫升，十六进制就是698。<br />
那么二进制就是11010011000，没毛病吧。<br />
</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/06.jpg" alt="图6" /><figcaption>图6</figcaption></figure>
目前最常见的有二进制，八进制，十进制，十六进制，但是这都是人为定义的，如果你愿意，你可以自己写一个9进制，完全没问题，只是不够通用，别人表示不想理你。
在二进制计算里面，由于CPU负载，硬盘容量等各方面原因，不仅仅要定义”进制”，还要定义”位数”，就是说这个数值最大是多少位，还要定义”正负符号怎么写”,电脑只认识0和1，它不认识”+“和”-“。<br />
这就是”函数”，每个函数给数值的定义不一样，异星工厂里的运算器采用的是”int”函数，这是一个32位，第一位是符号位的函数。参考资料：游戏安装目录\doc-html\Builtin-Types.html<br />
用77为例，在带符号位的函数里，第一位表示正负，后面的表示数值。<br />
正数用普通的二进制数表示，那么lnt函数的77二进制是：  00000000000000000000001110110011,<br />
<strong>负数用”补码”形式保存，补码=取反+1，所以负77的二进制是  11111111111111111111110001001101。</strong><br />
<figure><img src="https://www.pidex.top/pd/images/factorio/210402/07.jpg" alt="图7" /><figcaption>图7</figcaption></figure>
左移右移可以分为”算术移位”,“逻辑移位”,“循环移位”。<br />
它们的区别就是：<br />
<strong>循环移位</strong>，不考虑符号位，挤出去的用来补后面的。<br />
<strong>逻辑移位</strong>，挤出去的扔了，拿0来补。<br />
<strong>算术移位</strong>，左移和逻辑移位一样，右移时挤出去的不要了，符号位无限复制，用来补。<br />
游戏里的运算器是什么运算器，大佬们比我更清楚。<br />
有没有发现，如果进行移位，会有一部分跑数据跑屏幕外边了，然后有一部分空格没有内容。<br />
有趣的地方来了，进行左移运算的时候，前面的数据是有可能跑到符号位去的，就比如77左移25位。<br />
结果就是，电脑看到符号位是1，就觉得这是个负数，就一顿猛如虎的操作，减1取反试图还原，结果还原成这个鬼样子。<br />
<figure><img src="https://www.pidex.top/pd/images/factorio/210402/08.jpg" alt="图8" /><figcaption>图8</figcaption></figure>
<figure><img src="https://www.pidex.top/pd/images/factorio/210402/09.jpg" alt="图9" /><figcaption>图9</figcaption></figure><p></p></section>
<section><h4>六：按位与，按位或，按位异或。<a href="#六按位与按位或按位异或"><span>#</span></a></h4><p>与或非门其实没有想象中那么难，它就是字面意思，不需要编程知识的。<br />
“与”就是 并且，而且。“或”，就是或者。“非”，就是不一样。<br />
唯一需要注意的就是，与门也分为”逻辑与”,“按位与”两种。<br />
逻辑与就是只考虑0和1两种情况，只有”yes”和”no”，或者说是”真”,“假”，也能写成”true”,“flash”，不要换一种写法就看不懂了，一般用于判断。<br />
按位与就是两个数字，对应个十百千万位，每一位进行判断，然后输出结果(当然，是二进制的个十百千万)。<br />
在逻辑运算中：<br />
与门(AND)：只有2个数字都是1，结果才是1。<br />
或门( OR )：只要2个数字其中一个是1，结果就是1。<br />
非门(NOT)：非门只有一个数字，给我1就还你0，给我0就还你1。<br />
异或(XOR)：两个数字不一样，结果就是1。<br />
同或(XNOR)：两个数字一样，结果就是1。<br />
门电路其实不止这么几种，但是其它的复杂门可以用这几种”基本零件”组合而成，所以工厂的电路系统还是偷工减料了啊。<br />
就拿按位与为例。<br />
算术运算的按位运算就是对应每一位进行运算，然后最终结果转换成十进制显示出来，不管是按位与按位或还是其它的什么，道理都是一样的，包括符号位。<br />
这些”门”真的就是字面意思，我们完全不需要看什么真值表，只不过很多时候我们就是下意识的觉得太复杂了，没有用心去研究。<br />
</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/10.jpg" alt="图10" /><figcaption>图10</figcaption></figure>
至此，本帖接近尾声，下面是一些验证。<p></p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/11.jpg" alt="图11-16" /><figcaption>图11-16</figcaption></figure><p></p><p>77左移2位等于308。</p><p></p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/12.jpg" alt="图12" /><figcaption>图12</figcaption></figure><p></p><p>77右移两位等于19。  </p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/13.jpg" alt="图13" /><figcaption>图13</figcaption></figure><p></p><p>77左移25位，左移的时候某个1跑到符号位了，由于储存方式问题，读取出来显示时就会变成负数。</p><figure><img src="https://www.pidex.top/pd/images/factorio/210402/14.jpg" alt="图14" /><figcaption>图14</figcaption></figure><br />
<figure><img src="https://www.pidex.top/pd/images/factorio/210402/15.jpg" alt="图15" /><figcaption>图15</figcaption></figure><p></p><p>由于截图容易放大了看不清，贴上所用的excel表格，大家按需取用。<br />
<a href="https://www.pidex.top/pd/images/factorio/210402/%E7%A4%BA%E4%BE%8B.xlsx" target="_blank">示例.xlsx</a></p></section>]]></content>
    </entry>
</feed>
