2.8 KiB
CLIProxyAPI Installer (Orange Pi / ARM64)
Script này giúp bạn:
- Tự động tải bản mới nhất của CLIProxyAPI
- Giải nén và cài binary
cli-proxy-api - Tạo và quản lý systemd user service
- Tự động chạy khi khởi động
Hỗ trợ:
- Ubuntu / Debian
- Kiến trúc ARM64 (aarch64) — phù hợp Orange Pi
🚀 Cài đặt nhanh
git clone https://git.ttcorp.net/orangepivietnam/CLIProxyAPI-auto-install-on-Orange-Pi cliproxyapi cd cliproxyapi cp config.example.yaml config.yaml chmod +x setup.sh ./setup.sh
📦 Script sẽ làm gì?
1. Tải binary mới nhất
- Gọi GitHub API để lấy release mới nhất
- Lọc file:
linux_aarch64.tar.gz - Tải về thư mục tạm
2. Giải nén & cài đặt
- Extract vào thư mục tạm
- Tìm file
cli-proxy-api - Copy vào thư mục hiện tại
- Set quyền executable
3. Dọn dẹp
- Xóa file
.tar.gz - Xóa thư mục tạm
4. Tạo systemd user service
Nếu chưa tồn tại:
- Tạo file service tại: ~/.config/systemd/user/cliproxyapi.service
- Enable + start service
Nếu đã tồn tại:
- Chỉ restart service
⚙️ Sau khi cài đặt
Kiểm tra trạng thái service
systemctl --user status cliproxyapi
Xem log realtime
journalctl --user -u cliproxyapi -f
Restart service
systemctl --user restart cliproxyapi
Stop service
systemctl --user stop cliproxyapi
Disable auto start
systemctl --user disable cliproxyapi
⚠️ Quan trọng: Auto start khi boot
Nếu bạn chạy trên Orange Pi headless (không login):
👉 BẮT BUỘC chạy:
loginctl enable-linger $(whoami)
Nếu không:
- Service không tự chạy khi reboot
📁 Cấu trúc sau khi cài
Ví dụ:
/home/orangepi/cliproxyapi/ ├── cli-proxy-api
Service sẽ dùng:
- WorkingDirectory = thư mục bạn chạy script
- HOME = $HOME hiện tại
❗ Lỗi thường gặp
1. Không tìm thấy file download
Nguyên nhân:
- GitHub API thay đổi
- Không có file linux_aarch64
Cách xử lý:
- Kiểm tra lại release
2. Permission denied khi chạy binary
chmod +x cli-proxy-api
3. Service không start
systemctl --user status cliproxyapi
Nguyên nhân:
- Sai đường dẫn
- Binary không tồn tại
- Thiếu quyền execute
4. Service không chạy sau reboot
loginctl enable-linger $(whoami)
5. systemctl --user không hoạt động
export XDG_RUNTIME_DIR=/run/user/$(id -u)
6. Port đã bị chiếm
sudo lsof -i :PORT
kill -9
🔄 Cập nhật
./install.sh
📌 Yêu cầu hệ thống
- ARM64 (aarch64)
- Ubuntu / Debian
- Có curl, wget, tar, systemd
🧾 License
Theo repo gốc của CLIProxyAPI