背景
最近openclaw很火,由于梯子的小机器太垃圾起不来,自己电脑也不想安装,之前看到有佬友提到可以在闲置安卓手机上安装,就打算自己折腾一下。
安装步骤
Termux安装
直接从github下载的,地址:Release v0.119.0-beta.3 · termux/termux-app · GitHub
clash meta for android
同上,地址:Release v2.11.24 · MetaCubeX/ClashMetaForAndroid · GitHub
开启ssh,电脑直接操作,命令粘贴比较方便
pkg install openssh -ypasswd # 设置一个 SSH 连接密码,自己记住sshd # 启动后台 SSH 服务ifconfig # 查看手机当前的局域网 IP(找到 wlan0 下面的 inet 地址,如 192.168.x.x)
电脑连接在一个wifi下,使用ssh工具,用户名root,登录
后台运行
Termux 持久锁
命令行输入termux-wake-lock
手机设置
- 开启自启动
:在桌面长按 Termux 图标 → 应用信息 → 开启“自启动”。 - 无限制省电
:在应用信息里找到“省电策略”,将其改为“无限制”。
安装依赖环境
更新包管理器
pkg update && pkg upgrade -y
安装必要工具
pkg install proot-distro -y
安装 Ubuntu 环境
安装 Ubuntuproot-distro install ubuntu进入ubuntuproot-distro login ubuntu
安装ubuntu时,会出现如下报错,不影响
Configuring PPA repository for Firefox and Thunderbird…Traceback (most recent call last):File “/usr/bin/add-apt-repository”, line 632, insys.exit(0 if addaptrepo.main() else 1)~~~~~~~~~~~~~~~^^File “/usr/bin/add-apt-repository”, line 615, in mainshortcut = handler(source, **shortcut_params)File “/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py”, line 40, in shortcut_handlerreturn handler(shortcut, **kwargs)File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 89, in initif self.lpppa.publish_debug_symbols:^^^^^^^^^^File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 133, in lpppaself._lpppa = self.lpteam.getPPAByName(name=self.ppaname)^^^^^^^^^^^File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 120, in lpteamself._lpteam = self.lp.people(self.teamname)^^^^^^^File “/usr/lib/python3/dist-packages/softwareproperties/ppa.py”, line 111, in lpself._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_anonymouslyreturn cls(credentials,…<6 lines>…version=version,)File “/usr/lib/python3/dist-packages/launchpadlib/launchpad.py”, line 223, in initsuper().init(~~~~~~~~~~~~~~~~^credentials, service_root, cache, timeout, proxy_info, version^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^)^File “/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py”, line 511, in initself._wadl = self._browser.get_wadl_application(self._root_uri)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 502, in get_wadl_applicationresponse, content = self._request(url, media_type=wadl_type)~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 441, in _requestresponse, 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_retryresponse, 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 _requestresponse, content = super()._request(args)~~~~~~~~~~~~~~~~^^^^^^^File “/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py”, line 204, in _requestreturn 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_requestconn.connect()~~~~~~~~~~~~^^File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1158, in connectself.sock = self._context.wrap_socket(sock, server_hostname=self.host)~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File “/usr/lib/python3.13/ssl.py”, line 455, in wrap_socketreturn self.sslsocket_class._create(~~~~~~~~~~~~~~~~~~~~~~~~~~~~^sock=sock,^^^^^^^^^^…<5 lines>…session=session^^^^^^^^^^^^^^^)^File “/usr/lib/python3.13/ssl.py”, line 1076, in _createself.do_handshake()~~~~~~~~~~~~~~~~~^^File “/usr/lib/python3.13/ssl.py”, line 1372, in do_handshakeself._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 的安装。
安装 Node.js 和 OpenClaw
更新 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.xnpm --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初始化流程
openclaw onboard就不详述了
使用tmux 保持Gateway 后台运行
在 Ubuntu 内安装 tmux
apt install tmux
新建一个 tmux 会话
tmux new -s openclaw
启动 Gateway
openclaw gateway --verbose
按 Ctrl+B 然后按 D 可以分离会话(Gateway 继续后台运行)之后用 tmux attach -t openclaw 重新进入
夜雨聆风