> For the complete documentation index, see [llms.txt](https://documentation.ocsinventory-ng.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ocsinventory-ng.org/administrator-docs/agent-setup/installation-methods/using-official-repositories-linux.md).

# Linux installation

OCS Inventory provides official package repositories for common Linux distributions. This is the recommended installation method when available: it installs prebuilt binaries (no Dart SDK required) and lets you upgrade/uninstall using the system package manager.

### Supported platforms

* Linux distributions using APT (Debian based) or RPM (RHEL based)
* Architecture: `amd64` / `x86_64` only

### Installation

{% tabs %}
{% tab title="Using Debian repositories" %}
{% stepper %}
{% step %}

#### **Add the OCS Inventory repository**

Add the OCS Inventory repository. This imports the GPG key used to sign OCS Inventory packages and registers the APT repository.

Replace `<distribution_codename>` with your system’s codename.

Supported codenames:

* Debian: `bookworm`, `trixie`
* Ubuntu: `jammy`, `noble`, `plucky`

```bash
curl -fsSL https://deb-v3.ocsinventory-ng.org/repo-signing-key.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/ocs-archive-keyring.gpg
echo "deb https://deb-v3.ocsinventory-ng.org/ <distribution_codename> main" | sudo tee /etc/apt/sources.list.d/ocsinventory.list
sudo apt update
```

This installs:

* `/etc/apt/trusted.gpg.d/ocs-archive-keyring.gpg` - the public GPG key used to verify package signatures
* `/etc/apt/sources.list.d/ocsinventory.list` - the repository definition
  {% endstep %}

{% step %}

#### Install the packages <a href="#install-the-packages" id="install-the-packages"></a>

```bash
sudo apt install ocsinventory-agent
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Using RPM repositories" %}
{% stepper %}
{% step %}

#### **Add the OCS Inventory repository**

The `ocsinventory-release` package configures the YUM/DNF repository and imports the GPG key used to sign OCS Inventory packages.

```bash
sudo dnf install -y https://rpm-v3.ocsinventory-ng.org/rpm/ocsinventory-release-latest.[elX|fcXX].noarch.rpm
```

> Replace `elX` or `fcXX` with the version matching your operating system, from those supported by OCS Inventory:
>
> * **Enterprise Linux** (RHEL, Rocky, AlmaLinux): `el9`, `el10`
> * **Fedora**: `fc42`, `fc43`, `fc44`

This installs:

* `/etc/yum.repos.d/ocsinventory.repo` - the repository definition
* `/etc/pki/rpm-gpg/RPM-GPG-KEY-ocsinventory` - the public GPG key, imported automatically on install

The key is **not** imported at this point. DNF imports it automatically the first time a package is actually installed from the `ocsinventory` repository (see step 2), prompting you to confirm the key fingerprint unless `assumeyes` is set.
{% endstep %}

{% step %}

#### Install the packages <a href="#install-the-packages-1" id="install-the-packages-1"></a>

```bash
sudo dnf install -y ocsinventory-agent
```

On this first install from the `ocsinventory` repository, DNF prompts you to confirm and import the GPG key. Once accepted, you can verify it was imported with:

```bash
rpm -qa gpg-pubkey* --qf '%{name}-%{version}-%{release} --> %{summary}\n' | grep -i ocsinventory
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

### Silent installation

The agent can be installed and configured without any prompt, for mass deployment.

`DEBIAN_FRONTEND=noninteractive` is what makes the installation silent: on a fresh install, the package runs the interactive setup wizard whenever it detects a terminal. Without the wizard, the package configures the agent in local mode (`mode: 4`) with an empty server URL, so a second command is needed to point it at your server:

```bash
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ocsinventory-agent

sudo ocsinventory-cli --overwrite_config true \
  --url http://server_ip:port \
  --username username \
  --password password \
  --mode 1 \
  --log_level 3
```

The second command writes those values to `/etc/ocsinventory-agent/config.json` and runs a first inventory, so a zero exit code means the agent is configured and reached the server. Only the options you pass are written, so pass at least `--url`, `--username`, `--password` and `--mode`.

The package installs the systemd unit but leaves it stopped. Enable it to get periodic inventories:

```bash
sudo systemctl enable --now ocsinventory-agent.service
```

{% hint style="warning" %}
Silent mode prints nothing on stdout, the full log is written to `install.log` next to the script. A silent run on a host where the agent already exists removes the existing configuration, logs and data before reinstalling, so use the `--overwrite_config` command above to reconfigure an already-installed agent.
{% endhint %}

### Post-Install Configuration

There are three ways to configure the agent after installation:

* **Run the interactive setup**, which walks you through the configuration step by step:

```bash
  sudo /usr/share/ocsinventory-agent/install.sh
```

* **Edit the configuration file directly**:

```bash
  sudo nano /etc/ocsinventory-agent/config.json
```

* **Persist settings via the CLI**, using `--overwrite_config true`:

```bash
  sudo ocsinventory-cli --overwrite_config true \
    --mode 2 \
    --url http://server_ip:port \
    --username username \
    --password password
```

### Verification

* Package name: `ocsinventory-agent`
* Command to run the agent: `ocsinventory-cli`
* Files:
  * `/usr/local/bin/ocsinventory-cli` (installed binary)
  * `/usr/bin/ocsinventory-cli` (symlink)
  * `/etc/ocsinventory-agent/config.json` (main config)
  * `/usr/share/ocsinventory-agent/` (install/uninstall helper scripts + service file)

Run the agent with:

```
sudo ocsinventory-cli
```

* Local modes (`3`/`4`): check for a new inventory file in your `data_directory`.
* Remote modes (`1`/`2`): confirm the asset appears/updates on the server.

{% hint style="info" %}
For configuration details, see [Configuration](/administrator-docs/agent-setup/configuration.md).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.ocsinventory-ng.org/administrator-docs/agent-setup/installation-methods/using-official-repositories-linux.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
