最近openclaw很火,由于梯子的小机器太垃圾起不来,自己电脑也不想安装,之前看到有佬友提到可以在闲置安卓手机上安装,就打算自己折腾一下。
直接从github下载的,地址:Release v0.119.0-beta.3 · termux/termux-app · GitHub
同上,地址:Release v2.11.24 · MetaCubeX/ClashMetaForAndroid · GitHub
pkg install openssh -y
passwd # 设置一个 SSH 连接密码,自己记住
sshd # 启动后台 SSH 服务
ifconfig # 查看手机当前的局域网 IP(找到 wlan0 下面的 inet 地址,如 192.168.x.x)
电脑连接在一个wifi下,使用ssh工具,用户名root,登录
命令行输入termux-wake-lock
- 开启自启动:在桌面长按 Termux 图标 → 应用信息 → 开启“自启动”。
- 无限制省电:在应用信息里找到“省电策略”,将其改为“无限制”。
更新包管理器
pkg update && pkg upgrade -y
安装必要工具
pkg install proot-distro -y
安装 Ubuntu
proot-distro install ubuntu
进入ubuntu
proot-distro login ubuntu
安装ubuntu时,会出现如下报错,不影响
Configuring PPA repository for Firefox and Thunderbird…
Traceback (most recent call last):
File “/usr/bin/add-apt-repository”, line 632, in
sys.exit(0 if addaptrepo.main() else 1)
~~~~~~~~~~~~~~~^^
File “/usr/bin/add-apt-repository”, line 615, in main
shortcut = handler(source, **shortcut_params)
File “/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py”, line 40, in shortcut_handler
return handler(shortcut, **kwargs)
File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 89, in init
if self.lpppa.publish_debug_symbols:
^^^^^^^^^^
File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 133, in lpppa
self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 120, in lpteam
self._lpteam = self.lp.people(self.teamname)
^^^^^^^
File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 111, in lp
self._lp = login_func(“%s.%s” % (self.module, self.class.name),
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
service_root=‘production’,
^^^^^^^^^^^^^^^^^^^^^^^^^^
version=‘devel’)
^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 487, in login_anonymously
return cls(
credentials,
…<6 lines>…
version=version,
)
File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 223, in init
super().init(
~~~~~~~~~~~~~~~~^
credentials, service_root, cache, timeout, proxy_info, version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py”, line 511, in init
self._wadl = self._browser.get_wadl_application(self._root_uri)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 502, in get_wadl_application
response, content = self._request(url, media_type=wadl_type)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 441, in _request
response, content = self._request_and_retry(
~~~~~~~~~~~~~~~~~~~~~~~^
str(url), method=method, body=data, headers=headers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 400, in _request_and_retry
response, content = self._connection.request(
~~~~~~~~~~~~~~~~~~~~~~~~^
url, method=method, body=body, headers=headers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1724, in request
(response, content) = self._request(
~~~~~~~~~~~~~^
conn, authority, uri, request_uri, method, body, headers, redirections, cachekey,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 139, in _request
response, content = super()._request(args)
~~~~~~~~~~~~~~~~^^^^^^^
File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 204, in _request
return super(RestfulHttp, self)._request(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
conn,
^^^^^
…<7 lines>…
cachekey,
^^^^^^^^^
)
^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1444, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1366, in _conn_request
conn.connect()
~~~~~~~~~~~~^^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1158, in connect
self.sock = self._context.wrap_socket(sock, server_hostname=self.host)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.13/ssl.py”, line 455, in wrap_socket
return self.sslsocket_class._create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sock=sock,
^^^^^^^^^^
…<5 lines>…
session=session
^^^^^^^^^^^^^^^
)
^
File “/usr/lib/python3.13/ssl.py”, line 1076, in _create
self.do_handshake()
~~~~~~~~~~~~~~~~~^^
File “/usr/lib/python3.13/ssl.py”, line 1372, in do_handshake
self._sslobj.do_handshake()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1033)
[] Finished.
ai解释: 报错来自
add-apt-repository尝试连接 Launchpad PPA(Ubuntu 的软件源服务器),但在 proot 环境里 SSL 握手失败。这只是 Firefox/Thunderbird PPA 配置失败,不影响 Node.js 的安装。
更新 apt
apt update && apt upgrade -y
安装 curl
apt install -y curl git
安装 Node.js 22(必须是 22 版本)
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs验证版本
node --version # 应显示 v22.x.x
npm --version设置镜像
npm config set registry https://registry.npmmirror.com/
sharp图形库依赖解决
apt install -y python3 make g++ pkg-config libvips-dev
安装 OpenClaw
npm install -g openclaw@latest
验证安装
openclaw --version
期间会出现一些如下报错
Error: Setting in Start via TCSAFLUSH for stdin failed! - tcsetattr (13: Permission denied)
ai解释: proot 模拟 Linux 环境时,尝试对终端(stdin)设置属性,但 Android 的 Termux 不允许这个操作,所以报 Permission denied。这是警告性提示,不是致命错误。
openclaw onboard
就不详述了
在 Ubuntu 内安装 tmux
apt install tmux
新建一个 tmux 会话
tmux new -s openclaw
启动 Gateway
openclaw gateway --verbose
按 Ctrl+B 然后按 D 可以分离会话(Gateway 继续后台运行)
之后用 tmux attach -t openclaw 重新进入