⚙️ OpenClaw · Ubuntu 进阶手册
Production-grade configuration · OCR pipeline · Automation · Tesseract integration
📘 Complete Guide: Configuring and Operating OpenClaw on Ubuntu (After Installation)
This guide focuses on post-installation configuration, operation, OCR integration, automation, optimization, troubleshooting, and production deployment of OpenClaw on Ubuntu.
1. Verify OpenClaw Installation
First ensure OpenClaw is properly installed and accessible.
openclaw --version
or:
which openclaw
Expected result: /usr/local/bin/openclaw
2. Recommended Ubuntu Environment
| Component | Recommended |
|---|---|
| Ubuntu | 22.04 LTS / 24.04 LTS |
| Python | 3.10+ |
| NodeJS | 20+ |
| RAM | Minimum 8 GB |
| CPU | 4 cores |
| GPU | Optional but recommended |
| Docker | Optional |
3. Create Working Directory
mkdir -p ~/openclaw-workspace
cd ~/openclaw-workspace
Recommended structure:
~/openclaw-workspace/
├── projects/
├── uploads/
├── outputs/
├── logs/
├── temp/
├── scripts/
└── models/
4. Configure OpenClaw
Main configuration usually uses openclaw.json. Create configuration:
nano openclaw.json
Example configuration:
{
"workspace": "/home/ubuntu/openclaw-workspace",
"memory": { "provider": "sqlite" },
"llm": { "provider": "openai", "model": "gpt-4.1" },
"logging": { "level": "info" },
"ocr": { "enabled": true, "engine": "tesseract" }
}
5. Configure Environment Variables
nano ~/.bashrc
Add:
export OPENAI_API_KEY="YOUR_API_KEY"
export OPENCLAW_HOME="$HOME/openclaw-workspace"
export TESSDATA_PREFIX="/usr/share/tesseract-ocr/5/tessdata"
Reload: source ~/.bashrc
6. Install OCR Dependencies (Important)
sudo apt update
sudo apt install -y tesseract-ocr libtesseract-dev tesseract-ocr-eng tesseract-ocr-ind tesseract-ocr-mya imagemagick poppler-utils ffmpeg
Verify: tesseract --version
List languages: tesseract --list-langs
Expected: eng ind mya
7. Configure Myanmar OCR
sudo apt install tesseract-ocr-mya
Test OCR: tesseract sample-myanmar.png stdout -l mya
Mixed languages: tesseract sample.png stdout -l eng+ind+mya
8. Improve OCR Accuracy
Recommended preprocessing:
- Convert to grayscale:
convert input.png -colorspace Gray output.png - Increase contrast:
convert input.png -brightness-contrast 20x40 output.png - Resize:
convert input.png -resize 300% output.png - Denoise:
convert input.png -despeckle output.png
9. Enable OpenClaw OCR Skill
openclaw plugins install tesseract-ocr
or openclaw skills install tesseract-ocr
Verify: openclaw plugins list
10. Running OpenClaw
Interactive Mode: openclaw
Project Mode: openclaw ./projects/myproject
Agent Mode: openclaw agent start
Debug Mode: openclaw --debug
11. Using OpenClaw with OCR
Example workflow: image upload → OCR extraction → LLM analysis → automation.
Example: openclaw analyze invoice.png
Outputs: text extraction, invoice analysis, translation, JSON generation, etc.
12. Telegram / WhatsApp Integration
Example Telegram configuration:
{ "telegram": { "enabled": true, "bot_token": "YOUR_BOT_TOKEN" } }
Start agent: openclaw telegram start
⚠️ OCR quality depends on image compression. Prefer file uploads and high-res screenshots.
13. Running OpenClaw as a Service
sudo nano /etc/systemd/system/openclaw.service
Content:
[Unit]
Description=OpenClaw Service
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/openclaw-workspace
ExecStart=/usr/local/bin/openclaw
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw
14. Logging and Monitoring
journalctl -u openclaw -f
or tail -f ~/openclaw-workspace/logs/openclaw.log
15. GPU Optimization (Optional)
Install OpenCL: Intel (intel-opencl-icd) or NVIDIA (nvidia-opencl-dev). Check with clinfo.
16. Docker Deployment
version: '3'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: always
ports:
- "8080:8080"
volumes:
- ./workspace:/workspace
environment:
- OPENAI_API_KEY=YOUR_API_KEY
Run: docker compose up -d
17. Security Hardening
| Item | Recommendation |
|---|---|
| User | Avoid root |
| Firewall | Enable UFW |
| SSH | Disable password login |
| API Keys | Store in .env |
| Plugins | Install only trusted |
| Workspace | Sandbox execution |
| Logs | Audit frequently |
18. Common Problems
- Tesseract Not Found:
sudo apt install tesseract-ocr - Missing Language: install
tesseract-ocr-indortesseract-ocr-mya - OCR Accuracy Bad: improve DPI, contrast, preprocess image
- OpenClaw Crash: debug with
openclaw --debugand check logs
19. Recommended Production Stack
Reverse Proxy: Nginx | SSL: Let's Encrypt | Container: Docker | Process Manager: systemd | OCR: Tesseract | Queue: Redis | Database: PostgreSQL | Monitoring: Prometheus+Grafana
20. Useful Operational Commands
| Function | Command |
|---|---|
| Start | openclaw |
| Debug | openclaw --debug |
| Check plugins | openclaw plugins list |
| OCR test | tesseract img.png stdout |
| Multi-lang OCR | tesseract img.png stdout -l eng+ind+mya |
| Logs | journalctl -u openclaw -f |
21. Example Complete Workflow
OCR Invoice Automation: Upload Invoice → OCR Extraction → Text Cleaning → AI Classification → JSON Output → Spreadsheet Export → ERP Integration
22. Advanced Integration Ideas
Selenium (browser automation), OpenCV (image preprocessing), Whisper (STT), MongoDB, PostgreSQL, Redis, Telegram Bot, WhatsApp Gateway.
23. Best Practices
- Use Docker for easier deployment
- Separate workspace for isolation
- Use GPU for faster OCR
- Preprocess images for higher accuracy
- Use systemd for auto-restart
- Monitor logs and limit plugin trust
24. Example Full Ubuntu Installation Bundle
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3 python3-pip git curl vim ffmpeg imagemagick poppler-utils docker.io docker-compose tesseract-ocr libtesseract-dev tesseract-ocr-eng tesseract-ocr-ind tesseract-ocr-mya
sudo systemctl enable docker && sudo systemctl start docker
25. Recommended Next Step
Enable OCR pipeline → Integrate Telegram/WhatsApp → Add Selenium automation → Vector memory database → Configure persistent agents → Build workflow automation → Monitoring + backup → Deploy behind Nginx reverse proxy.
⚡ Production ready OpenClaw on Ubuntu: optimised, secure and scalable.
Comments