Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Instalasi 9Router Native (NPM + Systemd) di Debian 13 ====== Dokumentasi instalasi **9Router** secara native menggunakan Node.js (NPM) di debian 13. ===== 1. Instalasi Node.js 22 LTS dan Build Tools ===== Instal Node.js v22 LTS dari NodeSource beserta paket ''build-essential'' untuk menghindari error kompilasi modul native (seperti ''better-sqlite3''). <code bash> sudo apt update && sudo apt install -y curl ca-certificates build-essential curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejs </code> **Verifikasi:** <code bash> node -v && npm -v </code> Pastikan versi Node.js yang tampil adalah ''v22.x''. ---- ===== 2. Instalasi 9Router secara Global ===== Instal paket ''9router'' secara global melalui NPM: <code bash> sudo npm install -g 9router </code> **Verifikasi:** <code bash> which 9router </code> Pastikan output mengarah ke path binary (umumnya ''/usr/bin/9router''). ---- ===== 3. Konfigurasi Direktori Data dan Environment File ===== Buat direktori permanen untuk penyimpanan data serta direktori konfigurasi: <code bash> sudo mkdir -p /var/lib/9router /etc/9router sudo chown -R $USER:$USER /var/lib/9router </code> Buat file environment di ''/etc/9router/9router.env'' (ganti ''YourStrongPasswordHere'' dengan password dashboard yang diinginkan): <code bash> sudo tee /etc/9router/9router.env > /dev/null <<EOF NODE_ENV=production PORT=20128 HOSTNAME=0.0.0.0 DATA_DIR=/var/lib/9router INITIAL_PASSWORD=YourStrongPasswordHere JWT_SECRET=$(openssl rand -hex 32) EOF sudo chmod 600 /etc/9router/9router.env </code> ---- ===== 4. Setup Systemd Service ===== Buat unit file ''systemd'' agar 9Router berjalan di background dan otomatis aktif saat server reboot: <code bash> sudo tee /etc/systemd/system/9router.service > /dev/null <<EOF [Unit] Description=9Router AI Gateway Service After=network-online.target Wants=network-online.target [Service] Type=simple User=root WorkingDirectory=/var/lib/9router EnvironmentFile=/etc/9router/9router.env ExecStart=/usr/bin/script -qefc "/usr/bin/9router" /dev/null Restart=always RestartSec=5 [Install] WantedBy=multi-user.target EOF </code> Reload daemon ''systemd'', aktifkan, dan jalankan service: <code bash> sudo systemctl daemon-reload sudo systemctl enable --now 9router </code> ---- ===== 5. Verifikasi Service dan Akses ===== - **Cek status service:** <code bash> sudo systemctl status 9router </code> Pastikan status menunjukkan ''active (running)''. - **Uji endpoint API lokal:** <code bash> curl -I http://localhost:20128/v1/models </code> - **Buka port firewall (jika menggunakan UFW):** <code bash> sudo ufw allow 20128/tcp </code> - **Akses Dashboard:** Buka browser ke ''http://<IP-SERVER-DEBIAN>:20128'' dan login menggunakan ''INITIAL_PASSWORD'' yang sudah diatur. ---- ===== Manajemen Harian ===== ^ Kebutuhan ^ Perintah ^ | Cek log secara real-time | ''journalctl -u 9router -f'' | | Restart service | ''sudo systemctl restart 9router'' | | Update ke versi terbaru | ''sudo npm install -g 9router@latest && sudo systemctl restart 9router'' | | Ubah konfigurasi | Edit ''/etc/9router/9router.env'', lalu jalankan ''sudo systemctl restart 9rou deployment/apps/9router.txt Last modified: 2026/11/25 22:32by ilyasa