# Single-Instance Installation

- Link: https://ubient.dscloud.biz/docs/ubient-software/rtmn/single-instance-installation/
- Published: 2026-10-13T01:22:09+09:00
- Author: Ubient

Use the built-in `install` command when one server needs one `rtmn` gateway.

## Install Command

Do not type the bot token directly into the command line. The following command 
reads the token as hidden input inside a root shell and passes it only through the
environment.

Replace `<CHAT_ID_1>,<CHAT_ID_2>` and `<LINUX_USER>` with real values.

    ```ubient-docs-code
    Bashsudo bash -c '
    read -r -s -p "Telegram bot token: " RTMN_TELEGRAM_TOKEN
    echo
    export RTMN_TELEGRAM_TOKEN
    exec "$1" install -chat-ids "$2" -user "$3"
    ' _ "$(pwd)/rtmn" "<CHAT_ID_1>,<CHAT_ID_2>" "<LINUX_USER>"
    ```

If `-user` is omitted, the installer uses `$SUDO_USER` when available.

## What the Installer Does

The built-in installer performs these tasks:

 * Verifies systemd availability.
 * Validates the bot token through Telegram `getMe`.
 * Validates chat ID syntax.
 * Copies the binary to `/usr/local/bin/rtmn`.
 * Writes the root-owned environment file `/etc/rtmn/env`.
 * Creates the audit log path.
 * Registers and starts `rtmn.service`.
 * Enables automatic start on boot.

## Installation Flags

| Flag | Description | Default | 
| `-chat-ids` | Allowed chat IDs, comma-separated | Required | 
| `-user` | Linux account that runs the shell | `$SUDO_USER` | 
| `-shell` | Shell path | `/bin/bash` | 
| `-shell-args` | Shell arguments | Empty | 
| `-audit-log` | Audit log path | `/var/log/rtmn/audit.log` | 
| `-prefix` | Binary installation directory | `/usr/local/bin` | 
| `-env-file` | systemd environment file path | `/etc/rtmn/env` | 
| `-force` | Bypass safety checks such as an oversized allowlist | `false` |

## Example with Explicit Paths

    ```ubient-docs-code
    Bashsudo bash -c '
    read -r -s -p "Telegram bot token: " RTMN_TELEGRAM_TOKEN
    echo
    export RTMN_TELEGRAM_TOKEN
    exec "$1" install \
      -chat-ids "$2" \
      -user "$3" \
      -prefix /usr/local/bin \
      -env-file /etc/rtmn/env \
      -audit-log /var/log/rtmn/audit.log
    ' _ "$(pwd)/rtmn" "<CHAT_ID_1>,<CHAT_ID_2>" "<LINUX_USER>"
    ```

## Verify Installation

    ```ubient-docs-code
    Bashsudo systemctl status rtmn --no-pager
    sudo journalctl -u rtmn -n 100 --no-pager
    ```

A successful start sends a startup notification to every allowed Telegram chat.
