Building On FreeBSD6.1
Subscribe

From OpenNMS

Jump to: navigation, search

OpenNMS installation from ports
Download the port for OpenNMS from:
http://www.geeklan.co.uk/files/opennms/opennms-1610-freebsd-port.tgz

(Note: there's a newer version of this port available for OpenNMS 1.8.5. You should always be able to get the latest version from the directory listing at Sevan's site.

extract the file to ports/net-mgmt/
tar -zxvf opennms-1610-freebsd-port.tgz -C /usr/ports/net-mgmt/

install opennms
cd /usr/ports/net-mgmt/opennms
make install

All the dependencies will be downloaded & installed, you may need to fetch some files manually to build a jdk, you will be given exact instructions if that is the case.

Once everything has been built & installed the following message will be shown on your screen:
1st run
${OPENNMSHOME}/bin/runjava -s
Then create
${OPENNMSHOME}/etc/opennms.conf
& add
START_TIMEOUT=0 to it
then run
${OPENNMSHOME}/bin/install -dis
to initialise the DB
edit /etc/rc.conf & add
opennms_enable="YES"
& run
%%PREFIX%%/etc/rc.d/opennms start
you should now be able to login to opennms by pointing your browser to
http://localhost:8980
u: admin
p: admin

Please make sure the hostname that your system is configured with is either resolvable via dns or locally via /etc/hosts
otherwise you will have issues trying to start OpenNMS.


OpenNMS trunk build under FreeBSD 6

Add the git package

  • pkg_add -r git

You can save alot of time by adding mozilla via

pkg_add -r mozilla

pkg_add -r rrdtool

pkg_add -r postgresql81-server

  • Add to /etc/rc.conf postgresql_enable="YES"
  • /usr/local/etc/rc.d/010.pgsql.sh initdb
  • /usr/local/etc/rc.d/010.pgsql.sh start

Add the Native Java5 (This is a Beta Still)

/usr/ports/java/jdk15 >make
 ===>  jdk-1.5.0p3_6 :
 Due to licensing restrictions, certain files must be fetched manually.

 Please open http://www.sun.com/software/java2/download.html
 in a web browser and follow the "Download" link for the
 "JDK 5.0".  You will be required to log in and register,
 but you can create an account on this page.  After registration and
 accepting the Sun Community Source License, download the
 SCSL Source file, jdk-1_5_0-src-scsl.zip and the
 SCSL Binaries file, jdk-1_5_0-bin-scsl.zip .

 In addition, please download the patchset, bsd-jdk15-patches-3.tar.bz2, from
 http://www.eyesbeyond.com/freebsddom/java/jdk15.html.

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

I also had to download the bsd-jdk15-patches-2.tar.bz2 from the same location

You also will need the Java2SDK 1.4.10

I also managed to get some errors, those I worked around by commenting out the strings containing Java HotSpot in

/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java



Verify that it's working

bash-2.05b$ /usr/local/jdk1.5.0/bin/java -version java version "1.5.0-p2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-p2-joed_30_nov_2006_16_04) Java HotSpot(TM) Client VM (build 1.5.0-p2-joed_30_nov_2006_16_04, mixed mode)



Finally onto OpenNMS

Check-Out the source

Edit the top pom.xml file, look for the second commented out entry containing FreeBSD

Replace with this


<!-- FreeBSD -->
    <profile>
      <id>FreeBSD Ports</id>
      <activation>
        <file>
                <exists>/etc/mail/freebsd.cf</exists>
        </file>
      </activation>

      <properties>
        <build.rrd.include.dir>/usr/local/include</build.rrd.include.dir>
        <build.rrd.lib.dir>/usr/local/lib</build.rrd.lib.dir>
        <build.postgresql.compiler.arg>-I/usr/local/include</build.postgresql.compiler.arg>
        <build.postgresql.include.dir>/usr/local/include/postgresql/server</build.postgresql.include.dir>
      </properties>
    </profile>

Follow the build instructions on the Wiki - for a install in /usr/local do this

  • ./build.sh -Dopennms.home=/usr/local/OpenNMS install assembly:attached

You should see something like this :


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 minutes 43 seconds
[INFO] Finished at: Thu Nov 30 20:39:21 GMT 2006
[INFO] Final Memory: 36M/103M
[INFO] ------------------------------------------------------------------------


If you are having troubles with JAVA_HOME not being set, do this


export JAVA_HOME=/usr/local/jdk1.5.0
If you use bash or sh

setenv JAVA_HOME /usr/local/jdk1.5.0 
If you are using csh



  • tomcat

fetch http://apache.archive.sunet.se/dist/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz
I simply untarred this to /usr/local/tomcat (I'm more familiar with the real tomcat than the package)




From here-on you can follow the normal build instructions

mkdir /usr/local/OpenNMS
mv target/opennms-1.3.2-SNAPSHOT.tar.gz /usr/local/OpenNMS/
cd /usr/local/OpenNMS
tar xfvz opennms-1.3.2-SNAPSHOT.tar.gz 
chmod 755 bin/*
cd bin 
./runjava -s
runjava: Looking for an appropriate JRE...
runjava: Checking for an appropriate JRE in JAVA_HOME...
runjava: found: "/usr/local/jdk1.5.0/bin/java" is an appropriate JRE
runjava: value of "/usr/local/jdk1.5.0/bin/java" stored in configuration file

su into pgsql, and do this:

psql postgres
CREATE USER postgres SUPERUSER;
\q

You can now continue with the installer
./install -disU

Then Install the Webapp
./install -y -w /usr/local/tomcat/conf/Catalina/localhost/

Now you actually have OpenNMS installed and ready to run.


Here's a script for /usr/local/etc/rc.d to start/stop/etc (i have everything done verbosely) be sure to change file locations to wherever you've installed nms and to update rc.conf.


#!/bin/sh
#
# PROVIDE: opennms
# REQUIRE: tomcat55
# KEYWORD: shutdown
#
opennms_enable=${opennms_enable-”NO”}
opennms_flags=${opennms_flags-”-v”}
opennms_pidfile=${opennms_pidfile-”/usr/local/OpenNMS/logs/opennms.pid”}
. /etc/rc.subr
name=”opennms”
rcvar=`set_rcvar`
command=”/opt/OpenNMS/bin/opennms”
load_rc_config $name
pidfile=”${opennms_pidfile}”
start_cmd=”echo \”Starting ${name}.\”; ${command} ${opennms_flags} start ${command_args}”
status_cmd=”${command} ${opennms_flags} status”
stop_cmd=”${command} ${opennms_flags} stop”
run_rc_command “$1″


If you've installed tomcat and postgres through ports your rc.conf should look something like

postgresql_enable="YES"
tomcat55_enable="YES"
opennms_enable="YES"


Post install, from the web user interface home page, all the categories stated "Recalculating" despite OpenNMS being up and running for a couple of days. In this state, clicking a category returned a page with a java error message about not being able to find that category.

In order to get it working properly, I had to edit two files:

Edit: /$opennms_home$/webapps/opennms/WEB-INF/web.xml to change the port number from 8080 to 8180

Change this:

<param-name>opennms.rtc-client.http-post.base-url</param-name>
   <param-value>http://localhost:8080/opennms/rtc/post</param-value>

To this: <param-name>opennms.rtc-client.http-post.base-url</param-name>

   <param-value>http://localhost:8180/opennms/rtc/post</param-value>

Edit: /$opennms_home$/etc/service-configuration.xml to change the PORT and HOST values.

Change this:

<name>Port</name> <value type="java.lang.Integer">8180</value>

<name>Host</name> <value type="java.lang.String">127.0.0.1</value>

To this:

<name>Port</name> <value type="java.lang.Integer">8280</value>

<name>Host</name> <value type="java.lang.String">IPADDRESS_OF_YOUR_SERVER</value>