Skip to content

Commit d5a9784

Browse files
committed
FEAT: add post raspberry pi openclaw
1 parent 9130c21 commit d5a9784

File tree

1 file changed

+171
-0
lines changed
  • content/posts/2026-03-09-raspberry-pi-openclaw

1 file changed

+171
-0
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
---
2+
title: "Raspberry Pi 4B 折腾记录之 OpenClaw"
3+
date: 2026-03-09T14:07:08+08:00
4+
# weight: 1
5+
# aliases: ["/first"]
6+
tags: ["Server", "System", "DIY", "AI", "OpenClaw"]
7+
author: "Square Zhong"
8+
showToc: true
9+
TocOpen: false
10+
draft: false
11+
hidemeta: false
12+
comments: false
13+
description: "生命不息,折腾不止。"
14+
canonicalURL: "https://canonical.url/to/page"
15+
disableHLJS: true # to disable highlightjs
16+
disableShare: false
17+
disableHLJS: false
18+
hideSummary: false
19+
searchHidden: false
20+
ShowReadingTime: true
21+
ShowBreadCrumbs: true
22+
ShowPostNavLinks: true
23+
ShowWordCount: true
24+
ShowRssButtonInSectionTermList: true
25+
UseHugoToc: true
26+
cover:
27+
image: "<image path/url>" # image path/url
28+
alt: "<alt text>" # alt text
29+
caption: "<text>" # display caption under cover
30+
relative: false # when using page bundles set this to true
31+
hidden: true # only hide on current single page
32+
editPost:
33+
URL: "https://github.com/squarezhong.github.io/content"
34+
Text: "Suggest Changes" # edit text
35+
appendFilePath: true # to append file path to Edit link
36+
---
37+
38+
主要参考[Raspberry Pi - OpenClaw](https://docs.openclaw.ai/platforms/raspberry-pi)
39+
40+
硬件:
41+
- Raspberry Pi 4B 2GB 内存
42+
- 三星 128GB 白卡
43+
## 准备工作
44+
### 系统安装
45+
使用官方工具 [Raspberry Pi Imager](https://www.raspberrypi.com/software/) 将系统烧录至 tf 卡。
46+
安装的系统版本为 Raspberry Pi OS Lite (64-bit)
47+
- Kernel version: 6.12
48+
- Debian version: 13 (trixie)
49+
### 修改镜像源
50+
该版本的镜像源采用 DEB822 格式
51+
#### Debian 镜像源修改
52+
参考[debian | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror](https://mirrors.tuna.tsinghua.edu.cn/help/debian/)
53+
```shell
54+
sudo nano /etc/apt/sources.list.d/debian.sources
55+
```
56+
注释原内容后添加以下内容:
57+
```
58+
Types: deb
59+
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
60+
Suites: trixie trixie-updates trixie-backports
61+
Components: main contrib non-free non-free-firmware
62+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
63+
64+
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
65+
# Types: deb-src
66+
# URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
67+
# Suites: trixie trixie-updates trixie-backports
68+
# Components: main contrib non-free non-free-firmware
69+
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
70+
71+
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
72+
Types: deb
73+
URIs: https://security.debian.org/debian-security
74+
Suites: trixie-security
75+
Components: main contrib non-free non-free-firmware
76+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
77+
78+
# Types: deb-src
79+
# URIs: https://security.debian.org/debian-security
80+
# Suites: trixie-security
81+
# Components: main contrib non-free non-free-firmware
82+
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
83+
```
84+
#### Raspberrypi 镜像源修改
85+
```shell
86+
sudo nano /etc/apt/sources.list.d/raspi.sources
87+
```
88+
注释原 `URIs` 行后修改为以下内容:
89+
```
90+
# URIs: http://archive.raspberrypi.com/debian/
91+
URIs: https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/
92+
```
93+
#### 应用修改
94+
```shell
95+
sudo apt update
96+
```
97+
### 包升级与安装
98+
```shell
99+
sudo apt upgrade
100+
sudo apt install vim
101+
sudo apt install -y git curl build-essential
102+
103+
# node
104+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
105+
sudo apt install -y nodejs
106+
# verify
107+
node --version
108+
npm --version
109+
```
110+
### 添加 swap 文件及内存优化
111+
```shell
112+
# Create 2GB swap file
113+
sudo fallocate -l 2G /swapfile
114+
sudo chmod 600 /swapfile
115+
sudo mkswap /swapfile
116+
sudo swapon /swapfile
117+
118+
# Make permanent
119+
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
120+
121+
# Optimize for low RAM (reduce swappiness)
122+
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
123+
sudo sysctl -p
124+
```
125+
## 安装 OpenClaw
126+
**龙虾,启动!**
127+
128+
```shell
129+
curl -fsSL https://openclaw.ai/install.sh | bash
130+
```
131+
此刻跟随命令行交互进行设置或者稍后运行 `openclaw config` 进行配置。
132+
安装完成后你需要重启客户端或者运行 `source ~/.bashrc`
133+
## OpenClaw 配置
134+
没有特意列出的选项均为默认
135+
136+
### Model
137+
OpenRouter -> StepFun: Step 3.5 Flash (free)
138+
测试场景,选一个免费、推理速度快、性能尚可的模型。
139+
### Gateway
140+
- port: 18789
141+
- bind mode: All interface (LAN)
142+
### Channels
143+
#### 飞书
144+
在大陆还是使用飞书或者钉钉比较方便,没有网络问题。
145+
参考[OpenClaw飞书官方插件](https://www.feishu.cn/content/article/7613711414611463386)完成飞书插件的安装以及飞书机器人的接入。
146+
### Skills
147+
按需安装。
148+
### Dashboard
149+
通过 `http://<raspberry-pi IP>:18789` 访问 OpenClaw Dashboard,如遇到问题请参考 [Troubleshooting](#troubleshooting)
150+
将上一步配置 Gateway 时生成的 toekn 填入 [Overview]-[Gateway Access]-[Gateway Token]
151+
## 应用场景
152+
TODO
153+
## Troubleshooting
154+
### 浏览器访问 Dashboard 显示安全问题
155+
由于树莓派安装的是 server 版本的系统,我们通过设备的浏览器以 `http://<raspberry-pi IP>:18789` 的地址访问 dashboard,通常会遇到以下两个问题:
156+
1. `origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)`
157+
2. `control ui requires device identity (use HTTPS or localhost secure context)`
158+
159+
解决方案:
160+
- 允许特定源 & 禁用设备身份检查。
161+
```shell
162+
openclaw config set gateway.controlUi.allowedOrigins '["http://<your-droplet-ip>:18789"]' --strict-json
163+
openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true
164+
openclaw gateway restart
165+
```
166+
**请注意该解决方案并不安全,仅供测试使用!**
167+
168+
更安全的方案应该是 **SSH Tunnel** 或者 **Tailscale**
169+
170+
171+

0 commit comments

Comments
 (0)