Install OpenNMS on FreeBSD

Download

# cd /usr/ports/net-mgmt
# wget -c http://www.geeklan.co.uk/files/opennms/opennms-164-freebsd-port.tgz

–2009-05-15 03:17:40–  http://www.geeklan.co.uk/files/opennms/opennms-164-freebsd-port.tgz
Resolving www.geeklan.co.uk… 93.97.185.103
Connecting to www.geeklan.co.uk|93.97.185.103|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 15093 (15K) [application/x-tar]
Saving to: `opennms-164-freebsd-port.tgz’

100%[=====================================================================================================>] 15,093      5.23K/s   in 2.8s

2009-05-15 03:17:45 (5.23 KB/s) – `opennms-164-freebsd-port.tgz’ saved [15093/15093]

Extract and delete

# tar xvzf opennms-164-freebsd-port.tgz && rm opennms-164-freebsd-port.tgz

x opennms/
x opennms/files/
x opennms/distinfo
x opennms/pkg-descr
x opennms/pkg-message
x opennms/pkg-plist
x opennms/Makefile
x opennms/files/opennms.in
x opennms/files/patch-maven-conf_settings.xml
x opennms/files/patch-pom.xml

Install

# cd opennms && make install

make sure to download manually :

http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd7-i386-1.6.0_07-b02.tar.bz2

Plus

Please open

http://java.sun.com/javase/downloads/

in a web browser and follow the “Download” link for “Java
Cryptography Extension (JCE) Unlimited Strength Jurisdiction
Policy Files 6″ to obtain the JCE policy file, jce_policy-6.zip.

Please open http://java.sun.com/javase/downloads/index.jsp
in a web browser and follow the “Download” link for
“JDK US DST Timezone Update Tool – 1_3_12″ to obtain the
time zone update file, tzupdater-1_3_12-2009a.zip.

Please place the downloaded file(s) in /usr/ports/distfiles.

if you choose  :

Unlimited Strength Jurisdiction
Policy and DST Timezone Update Tool

After install process succesfully accomplish.

# /usr/local/opennms/bin/runjava -s

runjava: Looking for an appropriate JRE…
runjava: Checking for an appropriate JRE in JAVA_HOME…
runjava: skipping… JAVA_HOME not set
runjava: Checking JRE in user’s path: “/usr/local/bin/java”…
runjava: found an appropriate JRE in user’s path: “/usr/local/bin/java”
runjava: value of “/usr/local/bin/java” stored in configuration file

# /usr/local/opennms/bin/install -dis

==============================================================================
OpenNMS Installer Version $Id: Installer.java 11800 2009-01-11 23:04:48Z dhustace $
==============================================================================

Configures PostgreSQL tables, users, and other miscellaneous settings.

- searching for jicmp:
- trying to load /usr/local/lib/libjicmp.so: OK
- searching for jrrd:
- trying to load /usr/local/lib/libjrrd.so: OK
- checking database version… Exception in thread “main” java.sql.SQLException: Could not get an administrative connection to the database.  Is the database running, listening for TCP connections, and allowing us to connect and authenticate from localhost?  Tried connecting to database specified by data source SimpleDataSource[URL='jdbc:postgresql://localhost:5432/template1', driver class='org.postgresql.Driver', properties: user='pgsql', password=''].  Original error: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.opennms.netmgt.dao.db.InstallerDb.rethrowDatabaseConnectionException(InstallerDb.java:2214)
at org.opennms.netmgt.dao.db.InstallerDb.initializeAdminConnection(InstallerDb.java:2191)
at org.opennms.netmgt.dao.db.InstallerDb.getAdminConnection(InstallerDb.java:2180)
at org.opennms.netmgt.dao.db.InstallerDb.databaseCheckVersion(InstallerDb.java:1526)
at org.opennms.install.Installer.install(Installer.java:194)
at org.opennms.install.Installer.main(Installer.java:778)
Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:369)
at org.postgresql.Driver.connect(Driver.java:245)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.opennms.netmgt.dao.db.SimpleDataSource.getConnection(SimpleDataSource.java:79)
at org.opennms.netmgt.dao.db.InstallerDb.initializeAdminConnection(InstallerDb.java:2189)
… 4 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at org.postgresql.core.PGStream.<init>(PGStream.java:60)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
… 14 more

#cd /usr/ports/databases/postgresql82-server && make install

# su -l pgsql /usr/local/bin/initdb -D /usr/local/pgsql/data

The files belonging to this database system will be owned by user “pgsql”.
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory /usr/local/pgsql/data… ok
creating directory /usr/local/pgsql/data/base… ok
creating directory /usr/local/pgsql/data/global… ok
creating directory /usr/local/pgsql/data/pg_xlog… ok
creating directory /usr/local/pgsql/data/pg_clog… ok
selecting default max_connections… 100
selecting default shared_buffers… 1000
creating configuration files… ok
creating template1 database in /usr/local/pgsql/data/base/1… ok
initializing pg_shadow… ok
enabling unlimited row size for system tables… ok
initializing pg_depend… ok
creating system views… ok
loading pg_description… ok
creating conversions… ok
setting privileges on built-in objects… ok
creating information schema… ok
vacuuming database template1… ok
copying template1 to template0… ok

Success. You can now start the database server using:

/usr/local/bin/postmaster -D /usr/local/pgsql/data
or
/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

# echo ‘postgresql_enable=”YES”‘ >> /etc/rc.conf

# echo ‘opennms_enable=”YES”‘ >> /etc/rc.conf

# /usr/local/etc/rc.d/postgresql start

# /usr/local/etc/rc.d/opennms start