From 0567e65a2378da285b30c6d3890b328634329a14 Mon Sep 17 00:00:00 2001 From: Sjshi763 Date: Sun, 16 Nov 2025 04:15:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=96=87=E4=BB=B6md?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/astrbot/termux.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/deploy/astrbot/termux.md b/deploy/astrbot/termux.md index 3e3c189..3e05273 100644 --- a/deploy/astrbot/termux.md +++ b/deploy/astrbot/termux.md @@ -161,8 +161,6 @@ uv run main.py >```bash >echo 'export UV_LINK_MODE=copy' >> ~/.bashrc ->``` ->```bash >source ~/.bashrc >``` From 682a648dd73be12d4cec7564a4586a8cb757ef87 Mon Sep 17 00:00:00 2001 From: Sjshi763 Date: Fri, 21 Nov 2025 19:44:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20AstrBot=20term=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/astrbot/termux.md | 225 --------------------------------------- 1 file changed, 225 deletions(-) delete mode 100644 deploy/astrbot/termux.md diff --git a/deploy/astrbot/termux.md b/deploy/astrbot/termux.md deleted file mode 100644 index 8014d4b..0000000 --- a/deploy/astrbot/termux.md +++ /dev/null @@ -1,225 +0,0 @@ -# 使用 Termux 部署 AstrBot - -> [!WARNING] -> 本教程所使用的方法仅可在安卓机上使用,苹果设备并没有真正意义的`Termux` - ->[!TIP] ->本教程中若未说明,`Do you want to continue?[Y/n]`(或类似)一律填`Y`或`y` -# 准备步骤 - -## Bash 基础 - -### 进入目录 - -```bash -cd /path/to/dir -``` - -### 列举目录 - -```bash -ls -``` - -### 删除文件或目录 - -```bash -rm -r /path/to/dir/or/file -``` - -### 运行 `.sh` (`Shell`) 文件 - -```bash -bash xxx.sh -``` - -## 安装 `Termux` - -在[Termux 官网](https://termux.dev/cn) 可选择在[GitHub](https://github.com/termux/termux-app/releases)或[F-Droid](https://f-droid.org/en/packages/com.termux/)下载Termux - -## 换源 (可选) - ->[!TIP] ->建议更换源以获得更好的安装体验 ->但此换源并不会使`git clone`变得更快 - -```bash -termux-change-repo -``` -选择第一个`Mirror group Rotate between several mirrors` - -随后选择第三个`Mirrors in Chinese Mainland All in Chinese Mainland`等待跑完即可 - -# 正式部署 - -## 安装 `proot-distro` 及 其他必须组件 - -首先安装`uv`、`git`和`proot-distro` - -```bash -pkg install uv git proot-distro -``` - -### 使用 `proot-distro` 安装 `ubuntu环境` - ->[!TIP] ->中国大陆概率访问`GitHub`,故建议使用加速器或代理 - -```bash -proot-distro install ubuntu -``` - -### 登录 `Ubuntu环境` - -下载及配置完成会有提示`Log in with: proot-distro login ubuntu`,输入相同的即可登入 - -即: -```bash -proot-distro login ubuntu -``` - -此时便进入了`Ubuntu环境`,我们需使用`apt`命令安装软件包了 - -## 添加第三方PPA - ->[!TIP] ->`Python 3.10`并不在官方的软件源中,而`uv`所要求的Python版本为3.10 ,所以进行此步为必须 - - ### 使用`apt`安装`software-properties-common` (添加PPA前置) - - - - - -```bash -apt update && apt install software-properties-common -``` - -### 添加`deadsnakes`PPA(Python官方维护) - -```bash -add-apt-repository ppa:deadsnakes/ppa && apt update -``` -添加时你可能会看到:`Press [ENTER] to continue or Ctrl-c to cancel.` ,此时按下回车(换行)即可 - -## 安装 `Python` - -在进行完以上步骤后,即可安装`Python 3.10` - -```bash -apt install python3.10 -``` - -## 克隆 `AstrBot` 仓库 - -直到这里,您所处的路径应为 `~#` 而不是其他次级目录,以防找不到项目目录 - -```bash -git clone https://github.com/AstrBotDevs/AstrBot.git && cd AstrBot -``` - -如果一切顺利的话,您应该进入到了 `~/AstrBot#` 下,可以进入到下一步了 - ->[!NOTE] ->如果 `git clone` 失败,那么其后的 `cd` 命令也不会生效,故在运行命令时请注意路径是否正确 -> ->如果需要再次执行如上命令,建议先执行 -> ->```bash ->rm -r AstrBot ->``` -> ->之后再运行上述命令 - -## 运行 `AstrBot` - -```bash -uv run main.py -``` - ->[!TIP] ->如果使用 `uv` 下载软件包时速度慢,可以更换源 (以 `清华源` 为例) ->```bash ->export UV_DEFAULT_INDEX="https://pypi.tuna.tsinghua.edu.cn/simple" ->``` - -## 🎉 大功告成! - -如果没有报错,那么你可以看到`uv`在安装所需的包后出现类似 `WebUI 已启动,可访问` 并附带了几条链接。 - -如果有,那么恭喜你,你已经部署好了`AstrBot`并且运行了 - -接下来你可以尝试访问[localhost:6185](http://localhost:6185)验证可用性 - ->[!TIP] ->`Termux`与主机共享一个网络,即:`Termux`的IP地址就是主机的IP地址,你也可使用`ifconfig`查看主机IP地址 -> -> 默认用户名和密码是 `astrbot` 和 `astrbot`。 - -# 后记 - -## 退出 - -如需退出`proot-distro`,可以使用 - -```bash -exit -``` - -## 重新启动 - -每次重新进入`Termux`时需重新打开 `proot` 环境并启动 `AstrBot` - -可以使用命令如下: - -```bash -proot-distro login ubuntu -cd AstrBot && uv run main.py -``` - -## 挂后台 - -### 开启 - -如需在一个session里面同时运行多个进程(eg. `AstrBot` 和 `Napcat`),可以使用 - -```bash -uv run main.py & -...... -``` - -### 关闭 - -上文运行后会有类似`[1] 1145`的输出,如需关闭进程,则可使用 - -```bash -kill -9 1145 -``` - -或 - -```bash -pkill -9 -f "uv run main.py" -``` - - - ->[!TIP] ->也可以使用`screen`命令,较`&`更易操控 ->```bash ->apt install screen #安装screen ->screen -S #创建新的会话 ->screen -r #重新连接会话 ->screen -ls #列举会话 ->screen -X -S quit #关闭会话 ->Ctrl + a + d #退出当前窗口 ->``` - ->[!WARNING] -> 在退出时,请注意保存自己的任务,以防数据丢失 - -## 后台存活 - -如需让服务端在后台存活,可以在`设置`->`应用和服务`->`应用启动管理`->`Termux`改为`手动管理`并`允许后台活动`(或类似选项) - -接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。