> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nagare.smtdfc.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Cài đặt

> Cài đặt Nagare trên Linux, macOS và Windows bằng script cài đặt chính thức.

## Yêu cầu

* Hệ điều hành: Linux, macOS hoặc Windows.
* Kiến trúc CPU: `amd64` hoặc `arm64`.
* Một API key của nhà cung cấp mô hình tương thích OpenAI hoặc Google.
* Keyring của hệ điều hành hoạt động được (Nagare lưu khóa RSA vào đó).

## Cài bằng script

> [tab] Linux / macOS
>
> ```bash theme={null}
> curl -fsSL https://raw.githubusercontent.com/smtdfc/nagare/main/installers/linux/install.sh | sudo bash
> ```

> [tab] Windows (PowerShell)
>
> ```powershell theme={null}
> irm https://raw.githubusercontent.com/smtdfc/nagare/main/installers/window/install.ps1 | iex
> ```

Script cài đặt sẽ:

1. Tải bản phát hành mới nhất `nagare-<OS>-<ARCH>.tar.gz` từ [GitHub Releases](https://github.com/smtdfc/nagare/releases). Nếu thư mục hiện tại có `./dist/nagare`, script cài trực tiếp từ thư mục `dist` thay vì tải về.
2. Cài ba tệp thực thi vào `$HOME/.local/bin`:
   * `nagare`: CLI.
   * `nagare-gateway`: tiến trình gateway.
   * `nagare-desktop`: ứng dụng desktop.
3. Chép tài nguyên vào `~/.nagare/assets/` (plugin tích hợp sẵn, plugin lõi và giao diện web).
4. Cài module `nagare_vector` vào `~/.nagare/modules`.

## Thêm vào PATH

Nếu lệnh `nagare` không được tìm thấy, thêm `$HOME/.local/bin` vào `PATH`:

```bash theme={null}
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

Thay `~/.bashrc` bằng `~/.zshrc` nếu bạn dùng zsh.

## Kiểm tra cài đặt

```bash theme={null}
nagare --version
nagare doctor
```

`nagare doctor` báo lỗi gateway khi gateway chưa chạy. Đây là bình thường trước khi bạn chạy `nagare gateway start`.

## Ứng dụng desktop

`nagare-desktop` mở cửa sổ "Nagare Desktop" dùng chung giao diện với bản web. Ứng dụng đọc hai biến môi trường để tự đăng nhập:

| Biến | Ý nghĩa |
| - | - |
| `NAGARE_GATEWAY_URL` | Địa chỉ gateway, ví dụ `http://localhost:9832`. |
| `NAGARE_AUTH_TOKEN` | Token tạo bằng `nagare auth token`. |

```bash theme={null}
nagare auth token
# Your token is: <TOKEN>

NAGARE_GATEWAY_URL=http://localhost:9832 \
NAGARE_AUTH_TOKEN="<TOKEN>" \
nagare-desktop
```

Nếu không đặt các biến này, bạn có thể dán token trực tiếp trong màn hình đăng nhập.

## Thư mục dữ liệu

Mọi dữ liệu nằm trong `~/.nagare`. Xem [Cấu hình](https://docs.nagare.smtdfc.net/reference/configuration.md#thu-muc-du-lieu) để biết chi tiết. Để gỡ cài đặt hoàn toàn, dừng gateway, xóa các tệp thực thi trong `$HOME/.local/bin` và xóa thư mục `~/.nagare`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.