.Add OpenNMS repository GPG key
[source, console]
----
curl -fsSL https://debian.opennms.org/OPENNMS-GPG-KEY | sudo gpg --dearmor -o /usr/share/keyrings/opennms.gpg
----

.Add and update apt repository
[source, console]
----
echo "deb [signed-by=/usr/share/keyrings/opennms.gpg] https://debian.opennms.org stable main" | sudo tee /etc/apt/sources.list.d/opennms.list
sudo apt update
----

NOTE: You can safely ignore the message about conflicting distributions (expected stable but got opennms-xx).

.Install OpenNMS {page-component-title} with built-in dependencies (optional)
[source, console]
----
sudo apt -y install opennms
----

TIP: Disable the OpenNMS {page-component-title} repository after installation to prevent unwanted upgrades when upgrading other packages on the server.
     After upgrade, {page-component-title} requires manual steps to upgrade configuration files or migrate database schemas to a new version.
     We recommend that you exclude the {page-component-title} packages from update except when you are planning on performing an upgrade.

[source, console]
----
sudo apt-mark hold libopennms-java \
              libopennmsdeps-java \
              opennms-common \
              opennms-db
----
