Installing OpenNMS

Last Updated : Sep 07, 2021 |
Prolog information
OpenNMS can be installed on Windows or Linux platform types. Refer to the installation documentation on the OpenNMS website for more details: https://docs.opennms.org/opennms/releases/latest/guide-install/guide-install.html.
Before you begin
The following are the prerequisites for installing OpenNMS:
  • Oracle Java SE Development Kit 8. OpenJDK is not recommended for production.
  • PostgresSQL 9.1 or later.
  • Configured yum package manager.
Installing OpenNMS with the yum package manager will ensure that all the pre-requisites are installed.
  1. Download the OpenNMS repository file and install the packages as follows:
    ADDITIONAL INFORMATION:
    You must run the installation as the root user.
    # rpm -Uvh http://yum.opennms.org/repofiles/opennms-repo-stable-rhel6.noarch.rpm 
    # yum install opennms
    . . .
    . . .
    Installed:
      opennms.noarch 0:18.0.2-1                                                                                                        

    Dependency Installed:
      jdk1.8.0_60.x86_64 2000:1.8.0_60-fcs
      jicmp.x86_64 0:1.4.5-2
      jicmp6.x86_64 0:1.2.4-1
      opennms-core.noarch 0:18.0.2-1
      opennms-webapp-jetty.noarch 0:18.0.2-1   

    Complete!
    Note:
    In this example, the Postgres database is already installed.
  2. Use the following commands to prepare the database.
    ADDITIONAL INFORMATION: # service postgresql-9.1 initdb            # initialize the DB
    # chkconfig postgresql-9.1 on              # enable DB server on system startup
    # service postgresql-9.1 start             # start the DB server
  3. Enter the following postgres command to create a database user for OpenNMS to use.
    ADDITIONAL INFORMATION: # su - postgres
    -bash-4.1$ createuser -P opennms
    Enter password for new role:  opennms
    Enter it again: opennms
    Shall the new role be a superuser? (y/n) n
    Shall the new role be allowed to create databases? (y/n) n
    Shall the new role be allowed to create more new roles? (y/n) n
    -bash-4.1$ createdb -O opennms opennms
    -bash-4.1$ exit
  4. Modify the password for the Postgres super user account.
    ADDITIONAL INFORMATION: # su - postgres
    -bash-4.1$ psql -c "ALTER USER postgres WITH PASSWORD 'opennms18';"
    ALTER ROLE
    -bash-4.1$ exit
  5. Modify the postgres configuration for OpenNMS access over the local network.
    1. Navigate to /var/lib/pgsql/9.1/data/.
    2. Update the pg_hba.conf file as follows:
      ADDITIONAL INFORMATION:
      From:
      #host    replication     postgres        198.51.100.9/32            ident
      #host    replication     postgres        ::1/128                 ident
      To:
      host    all             all             198.51.100.9/32            md5
      host    all             all             ::1/128                 md5
  6. Restart the postgres server.
    ADDITIONAL INFORMATION: # service postgresql-9.1 restart
    Stopping postgresql-9.1 service:                           [  OK  ]
    Starting postgresql-9.1 service:                           [  OK  ]
  7. Modify the OpenNMS database access configuration file using the passwords created earlier.
    ADDITIONAL INFORMATION: # vi /opt/opennms/etc/opennms-datasources.xml
    <jdbc-data-source name="opennms" 
                        database-name="opennms" 
                        class-name="org.postgresql.Driver" 
                        url="jdbc:postgresql://localhost:5432/opennms"
                        user-name="opennms"
                        password="opennms"/>
    <jdbc-data-source name="opennms-admin" 
                        database-name="template1" 
                        class-name="org.postgresql.Driver" 
                        url="jdbc:postgresql://localhost:5432/template1"
                        user-name="postgres"
                        password="opennms18"/>