Operit AI 中文文档 下载 App

apt 包管理实战:Operit Ubuntu 里装软件

apt 基础命令

Operit 的 Ubuntu chroot 里,apt 的使用和标准 Ubuntu 桌面版基本一致。下面按最常用的场景给命令模板。

更新包列表

apt update

每次装新包之前先跑一遍 update,确保包索引是最新的。Operit 的镜像源默认是 Ubuntu 官方源,国内网络可能会慢,可以换国内镜像(见下方镜像源部分)。

安装单个包

apt install git -y
apt install python3 python3-pip -y
apt install vim curl wget -y

-y 参数自动确认,避免交互等待。

搜索包

apt search nodejs
apt search vim | head -20

apt search 会按关键词模糊搜索包名和描述,结果可能很多,配合 head 看前几条够用。

卸载包

apt remove git -y      # 卸载但保留配置
apt purge git -y        # 卸载并删除配置
apt autoremove -y       # 清理不再需要的依赖

升级系统

apt upgrade -y
apt full-upgrade -y     # 更彻底的升级(含包删除)

chroot 环境不建议频繁全量升级——镜像随 Operit APK 更新。日常只用 apt install 装你需要的额外工具。

清理缓存

apt clean               # 清理下载的 .deb 文件
apt autoremove -y       # 清理孤儿依赖

chroot 的存储空间有限,装完不需要的包及时清理。

常用开发工具安装清单

# Python 开发
apt install python3 python3-pip python3-venv -y

# Node.js(注意 Ubuntu 官方源的 nodejs 版本可能较旧)
apt install nodejs npm -y
# 或用 nvm 装最新版(推荐)
# apt install curl -y && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

# Git + SSH
apt install git openssh-client -y

# 编辑器
apt install vim nano -y

# 网络工具
apt install curl wget netcat-openbsd -y

# 文件处理
apt install unzip zip tar -y

# 构建工具
apt install build-essential -y

# Python 包管理增强
pip3 install --upgrade pip
pip3 install requests httpx playwright

pip 在 chroot 里的注意事项

chroot 里的 pip 安装位置和 Android 宿主完全隔离——你在 Ubuntu 里 pip install 的包,Android 主应用不直接可见。但 Operit 的 Agent 运行时可以通过工具调用在 chroot 进程里执行 Python 脚本,装在 chroot 里的包完全可用。

镜像源加速(国内网络)

如果 apt update 很慢,可以切到国内镜像源。编辑 /etc/apt/sources.list:

cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list

把 archive.ubuntu.com 替换成 mirrors.aliyun.com 或其他国内镜像地址后保存,再 apt update。

常见包在 chroot 里可能的问题