ServerBox README

The project's README from github.com/madeye/ServerBox. As one markdown file: README.md.

ServerBox

Turn a used Android phone into a Linux server, no root required.

An old phone is a small, quiet, low-power computer with a battery backup and Wi-Fi built in. ServerBox puts a real Linux distribution on it and keeps an SSH server running, so you can use it like any other box on your network: host services, run scripts and cron jobs, or tinker.

ServerBox is a fork of UserLAnd by CypherpunkArmory (UserLAnd Technologies, LLC) and, like UserLAnd, is licensed under the GPLv3.

What it does

Screenshots

Apps New filesystem Server settings
Apps tab listing the Linux distributions and the coding agents Creating a filesystem with a user name and password Server settings: start on boot, SSH from the network, authorized keys

Download

Get the APK from Releases. ServerBox needs Android 8.0 or later. Every distribution is available for 64-bit ARM (nearly all current phones) and x86_64; 32-bit support varies by distribution.

Releases are signed with this certificate (SHA-256), which you can check with apksigner verify --print-certs serverbox-<version>.apk:

55:40:C1:F2:4F:5D:44:86:C5:96:EF:76:0A:8C:E9:8C:8E:68:FE:45:AF:C9:E9:54:1C:C6:3D:EF:3E:7A:76:B5

Builds from before 1.0 were signed with a different key, so Android can't update them to a release: uninstall the old build first. Uninstalling deletes its distributions and sessions.

Getting started

  1. Install ServerBox and open it.
  2. Pick a distribution on the Apps tab. ServerBox downloads it (the setup log shows each step) and opens a terminal.
  3. Open the Sessions tab for the SSH command, user and password.
  4. To connect from your computer, turn on Settings → Allow SSH from the network, then run the command shown on the Sessions tab.

Keeping the server running

Android pauses background apps to save battery, which makes a server stop answering once the screen is off. When ServerBox first runs a server it asks to be exempted from battery optimization; allow it. Some vendors add their own restrictions on top:

Keep the phone on a charger, and consider reserving its IP address in your router so the SSH address stays the same.

Building

Builds need JDK 17.

./gradlew :app:assembleServerBoxDebug
./gradlew testServerBoxDebugUnitTest :terminal:testDebugUnitTest lintServerBoxDebug

Instrumented tests (Room migrations and DAOs, the terminal's PTY) run on a connected device or emulator:

./gradlew :library:connectedServerBoxDebugAndroidTest :terminal:connectedDebugAndroidTest

./gradlew :app:assembleServerBoxRelease signs the release APK when a keystore is configured in local.properties (or the same names as environment variables); without one it builds unsigned:

KEYSTORE_PATH=/path/to/keystore
KEYSTORE_PASSWORD=...
KEY_ALIAS=...
KEY_PASSWORD=...

The distribution images are built in madeye/ServerBox-Images and published to ghcr.io/madeye/serverbox-<distro>.

Credits

ServerBox is forked from UserLAnd and its library (UserLAndLibrary) by CypherpunkArmory (UserLAnd Technologies, LLC), who hold the copyright on the original code. ServerBox's changes are copyright Max Lv. Like UserLAnd, ServerBox is released under the GNU General Public License v3; the full text is in LICENSE and the copyright notices are in COPYRIGHT.

ServerBox (madeye/ServerBox)

Searching Database…

这是什么?ServerBox 是一款 Android 应用,无需 root 就能把旧手机变成 Linux 服务器,运行 Alpine、Arch、Debian、Kali 或 Ubuntu,并带有常驻的 SSH 服务器。
它是 root 工具,还是原生系统手机就能用?不需要 root:这些 Linux 发行版完全通过 PRoot 运行在用户空间,就像原生 Android 之上的一层容器。
怎么在手机上跑起一个 Linux 服务器?安装 APK,在“应用”标签页选一个发行版(它会自动下载并打开终端),然后在“会话”标签页查看 SSH 命令、用户名和密码。
我的旧手机必须是特定型号吗?任何运行 Android 8.0 或更高版本的手机都可以;发行版面向 64 位 ARM(当前大多数手机)和 x86_64 构建,32 位支持程度不一。
屏幕熄灭后 SSH 服务器还能继续运行吗?屏幕熄灭后,Android 的电池优化通常会杀掉后台应用,所以你必须把 ServerBox 加入豁免名单;部分厂商(如小米/MIUI)还需要额外设置自启动和省电选项,才能保住会话。
它预装了 AI 编程代理吗?Claude 和 Codex 应用是预装了 Anthropic 的 Claude Code 或 OpenAI 的 Codex CLI 的 Debian 镜像,另外还有 Node.js、git 和 ripgrep。你只需 SSH 连入,用自己的账号或 API 密钥登录即可。
能让某个服务随服务器自动启动吗?可以,把可执行文件放进发行版内的 /etc/serverbox/autostart.d,它们就会在该服务器每次启动时运行,日志记录在 /var/log/serverbox-autostart.log。
发行版能以真正的虚拟机而不是 PRoot 方式运行吗?在支持 Android Virtualization Framework 的手机上,发行版还可以通过一个配套应用以完整虚拟机的方式运行。
在 Linux 发行版里能访问手机存储中的文件吗?可以,共享的手机存储会挂载到每个发行版内的 /sdcard,程序首次需要访问时,ServerBox 会提示你授予文件夹访问权限。
Creator
madeye
Size
41.5 MB
Stars
264
Age
22d
Commits · 90 Days