AI & Automation (vnROM)

Cover image for Hướng dẫn cài đặt Clawdbot trên Raspberry Pi (ARM64)
Duy Nghiện
Duy Nghiện

Posted on • Edited on • Originally published at facebook.com

Hướng dẫn cài đặt Clawdbot trên Raspberry Pi (ARM64)

Đây là chia sẻ của một bạn giấu tên

Việc chạy Clawdbot trên Raspberry Pi (RPI) tại nhà giúp bạn tiết kiệm chi phí thuê VPS (khoảng 5$/tháng) trong khi chi phí điện năng tiêu thụ chỉ rơi vào khoảng 20.000 VNĐ/tháng.

Yêu cầu hệ thống

  • Thiết bị: Raspberry Pi 4 hoặc 5.
  • Hệ điều hành: Raspberry Pi OS hoặc Ubuntu ARM64 (64-bit).
  • User: pi (hoặc user có quyền tương đương).
  • Node.js: Phiên bản 20 trở lên (Khuyến nghị Node 22).

0. Kiểm tra môi trường

Trước khi bắt đầu, hãy đảm bảo các thông số môi trường chuẩn xác:

node -v        # Kiểm tra Version >= 20
npm -v
uname -m       # Phải trả về kết quả là aarch64
Enter fullscreen mode Exit fullscreen mode

1. Cài đặt Clawdbot

Cài đặt gói clawdbot toàn cục thông qua npm:

npm install -g clawdbot
clawdbot --version
Enter fullscreen mode Exit fullscreen mode

2. Chuẩn bị thư mục và quyền truy cập

mkdir -p ~/.clawdbot
chmod 700 ~/.clawdbot
Enter fullscreen mode Exit fullscreen mode

3. Cấu hình Gateway chạy Local

Ép Clawdbot sử dụng chế độ gateway tại chỗ:

clawdbot config set gateway.mode local
Enter fullscreen mode Exit fullscreen mode

4. Khởi tạo Gateway Service

Sử dụng lệnh doctor để tự động tạo token và cấu hình service:

clawdbot doctor
Enter fullscreen mode Exit fullscreen mode

Khi được hệ thống hỏi, hãy chọn các tùy chọn sau:

  • Generate and configure a gateway token now? -> YES
  • Install gateway service now? -> YES
  • Gateway runtime -> Node

5. Kích hoạt Service bằng systemd

Chạy các lệnh sau để đảm bảo bot tự khởi động cùng hệ thống:

systemctl --user daemon-reload
systemctl --user enable --now clawdbot-gateway
systemctl --user status clawdbot-gateway --no-pager
Enter fullscreen mode Exit fullscreen mode

Trạng thái phải hiển thị "active (running)".

6. Kiểm tra kết nối Local

curl -I http://127.0.0.1:18789
Enter fullscreen mode Exit fullscreen mode

Nếu nhận được phản hồi HTTP/1.1 200 OK là thành công.

7. Truy cập UI từ máy tính cá nhân (Laptop)

Clawdbot UI chỉ cho phép truy cập qua localhost hoặc HTTPS. Bạn cần tạo một SSH tunnel từ Laptop:

Thực hiện trên Laptop:

ssh -L 18789:127.0.0.1:18789 pi@<IP_CỦA_RPI>
Enter fullscreen mode Exit fullscreen mode

Sau đó mở trình duyệt và truy cập: http://localhost:18789

8. Lấy Token đăng nhập UI

Trên terminal của Raspberry Pi, chạy lệnh sau để lấy mã token:

clawdbot config get gateway.auth.token
Enter fullscreen mode Exit fullscreen mode

Dán mã này vào giao diện Web để bắt đầu sử dụng.

9. Xử lý lỗi Token mismatch (nếu có)

Nếu giao diện không nhận token, hãy đồng bộ lại bằng lệnh:

TOKEN="$(clawdbot config get gateway.auth.token)"
clawdbot config set gateway.remote.token "$TOKEN"
systemctl --user restart clawdbot-gateway
Enter fullscreen mode Exit fullscreen mode

10. Cấu hình Google Antigravity Auth

Cài đặt plugin để sử dụng các model AI:

clawdbot plugins install google-antigravity-auth
clawdbot plugins enable google-antigravity-auth
systemctl --user restart clawdbot-gateway

# Đăng nhập OAuth
clawdbot models auth login --provider google-antigravity --set-default
Enter fullscreen mode Exit fullscreen mode

Làm theo hướng dẫn trên màn hình: Mở link Google login -> Đăng nhập -> Copy toàn bộ URL sau khi redirect -> Dán ngược lại vào terminal.

11. Cấu hình Telegram Bot

Lưu ý: Nên vào @BotFather và dùng lệnh /revoke để lấy Token mới nếu nghi ngờ token cũ bị lộ.

# Bật channel Telegram
clawdbot config set channels.telegram.enabled true
clawdbot config set channels.telegram.botToken "NHẬP_TOKEN_CỦA_BẠN"
clawdbot config set channels.telegram.dmPolicy pairing

# Cấp quyền cho User ID của bạn (Ví dụ ID: 6389398257)
clawdbot config set channels.telegram.allowFrom '[6389398257]'

# (Tùy chọn) Cấu hình cho phép dùng trong Group
clawdbot config set channels.telegram.groupPolicy allowlist
clawdbot config set channels.telegram.groupAllowFrom '[6389398257]'
 clawdbot config set channels.telegram.groups '{"*":{"requireMention":true}}'
Enter fullscreen mode Exit fullscreen mode

12. Khởi động lại và Pair Telegram

systemctl --user restart clawdbot-gateway
Enter fullscreen mode Exit fullscreen mode
  1. Mở Telegram, tìm bot của bạn và nhắn "hi".
  2. Trên Raspberry Pi, thực hiện phê duyệt:
clawdbot pairing list telegram
clawdbot pairing approve telegram <MÃ_PAIR_CODE_HIỆN_RA>
Enter fullscreen mode Exit fullscreen mode

13. Kiểm tra trạng thái cuối cùng

clawdbot status
Enter fullscreen mode Exit fullscreen mode

Đảm bảo các mục Gateway, Model và Telegram đều ở trạng thái hoạt động (Active/Reachable).


Lưu ý khi sử dụng:

  • Qua Telegram: Nhắn tin trực tiếp hoặc mention bot trong group.
  • Qua UI: Sử dụng tại địa chỉ localhost đã tunnel để quản lý agent và bộ nhớ.
  • Gỡ cài đặt: Để xóa toàn bộ, dùng lệnh systemctl --user stop clawdbot-gatewayrm -rf ~/.clawdbot.

Top comments (0)