Deploying AI Inference Platform with Ubuntu 24.04 and Integrating Chinese Large Language Models: A Practical Guide
This guide provides step-by-step instructions for deploying an AI inference platform on Ubuntu 24.04 LTS, with special focus on integrating Chinese large language models (LLMs). The tutorial covers system requirements, platform installation, model configuration, security considerations, and performance optimization.
System Requirements
Server Specifications
- Recommended configuration: 8-core CPU, 32GB RAM physical server or cloud instance
- Operating system: Ubuntu 24.04 LTS (Long Term Support)
- User management: Create dedicated deployment user (example uses root for demonstration)
# Create dedicated user with sudo privilegesadduser aiadminusermod -aG sudo aiadminsu - aiadmin
Network Configuration
- Open SSH port (default 22)
- Configure firewall rules to restrict external access to specific IPs
- Ensure public internet access for model API calls (or VPN tunnel)
AI Inference Platform Deployment
Node.js Installation
Use nvm for version management:
# Install nvmcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bashsource ~/.bashrc# Install Node.js 22 LTSnvm install 22nvm alias default 22# Verify installationnode -v # Should show v22.x.xnpm -v # Should show 10.x.x or higher
Platform Installation
Install and verify the inference platform:
npm install -g openclaw@latest# Verify installationopenclaw --version # Should show version like 2026.3.2
Troubleshooting:
- Non-empty directory error:
rm -rf ~/.npm-global/lib/node_modules/openclawnpm cache clean --forcenpm install -g openclaw@latest
- Permission issues: Use
sudo chown -R $USER ~/.npm - Network issues: Configure local mirrors for faster installation
Model Integration Configuration
Interactive Setup
Configure model access through wizard:
openclaw config
Follow these steps:
- Select “Add custom provider”
- Enter provider name (e.g.,
zhipu-glm) - Configure API endpoint (example format):
https://[provider-domain]/api/paas/v4/chat/completions
- Enter valid API key (pre-applied from provider)
Configuration File
Generated config.json structure:
{"providers": {"zhipu-glm": {"api_base": "https://open.bigmodel.cn/api/paas/v4","api_key": "sk-xxxxxxxxxxxxxxxx","model": "glm-4.7-flash","max_tokens": 4096}}}
Model Verification
Test configuration with simple inference:
openclaw test --provider zhipu-glm --prompt "Hello"
Expected response structure:
{"id": "chatcmpl-xxxx","object": "chat.completion","choices": [{"message": {"role": "assistant", "content": "Hello! How can I help you?"}}]}
Secure Access Solutions
SSH Tunneling
Secure web interface access from local machine:
# Windows (PowerShell)ssh -L 3000:localhost:3000 aiadmin@server-ip -N# macOS/Linuxssh -N -L 3000:localhost:3000 aiadmin@server-ip
Access via http://localhost:3000
Nginx Reverse Proxy (Production)
Recommended HTTPS configuration:
server {listen 443 ssl;server_name ai.example.com;ssl_certificate /path/to/cert.pem;ssl_certificate_key /path/to/key.pem;location / {proxy_pass http://localhost:3000;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;}}
Performance Optimization
Resource Allocation
- Single instance: ≤4 concurrent requests
- GPU acceleration required for high-memory models
Caching Configuration
# Enable response cachingopenclaw config --set cache.enabled=trueopenclaw config --set cache.size=1024MB
Log Management
Configure log rotation:
sudo nano /etc/logrotate.d/openclaw
Add configuration:
/var/log/openclaw/*.log {dailyrotate 7compressmissingoknotifempty}
Troubleshooting Guide
| Symptom | Possible Cause | Solution |
|---|---|---|
| 502 Bad Gateway | Service not running | systemctl restart openclaw |
| API timeout | Network restrictions | Check firewall/security group rules |
| 401 Unauthorized | Invalid API key | Regenerate key and update config |
| GPU memory exhausted | Large model size | Reduce max_tokens parameter |
Advanced Features
Multi-Model Routing
Configure intelligent routing:
{"routing": {"default": "zhipu-glm","rules": [{"pattern": "^/tech/","provider": "tech-specialized-model"}]}}
Custom Prompt Templates
Create template files in templates/ directory:
// templates/customer_service.json{"prompt": "As customer service, respond friendly: {query}"}
Invoke with template:
openclaw chat --template customer_service --query "How to return items?"
Maintenance and Upgrades
Regular Updates
npm update -g openclaw
Backup Strategy
# Backup configuration and datatar czvf openclaw_backup_$(date +%Y%m%d).tar.gz /etc/openclaw /var/lib/openclaw
Monitoring Setup
# Install monitoring toolssudo apt install prometheus-node-exporter
This comprehensive guide enables developers to quickly build secure, private AI inference platforms on Ubuntu 24.04. Adjust parameters according to specific business requirements and validate in test environments before production deployment. For enterprise applications, consider containerization and CI/CD pipelines for automated operations.
