Install OpenNMS on FreeBSD   June 21st, 2009

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

Thanks to alamster

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 03/12/2009

This guide explains how to set up an NFS server and an NFS client on Debian Lenny. NFS stands for Network File System; through NFS, a client can access (read, write) a remote share on an NFS server as if it was on the local hard disk.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I’m using two Debian systems here:

  • NFS Server: server.example.com, IP address: 192.168.0.100
  • NFS Client: client.example.com, IP address: 192.168.0.101

2 Installing NFS

server:

On the NFS server we run:

apt-get install nfs-kernel-server nfs-common portmap

client:

On the client we can install NFS as follows:

apt-get install nfs-common portmap

3 Exporting Directories On The Server

server:

I’d like to make the directories /home and /var/nfs accessible to the client; therefore we must “export” them on the server.

When a client accesses an NFS share, this normally happens as the user nobody. Usually the /home directory isn’t owned by nobody (and I don’t recommend to change its ownership to nobody!), and because we want to read and write on /home, we tell NFS that accesses should be made as root (if our /home share was read-only, this wouldn’t be necessary). The /var/nfs directory doesn’t exist, so we can create it and change its ownership to nobody and nogroup:

mkdir /var/nfs
chown nobody:nogroup /var/nfs

Now we must modify /etc/exports where we “export” our NFS shares. We specify /home and /var/nfs as NFS shares and tell NFS to make accesses to /home as root (to learn more about /etc/exports, its format and available options, take a look at

man 5 exports

)

vi /etc/exports

# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home           192.168.0.101(rw,sync,no_root_squash,no_subtree_check)
/var/nfs        192.168.0.101(rw,sync,no_subtree_check)

(The no_root_squash option makes that /home will be accessed as root.)

Whenever we modify /etc/exports, we must run

exportfs -a

afterwards to make the changes effective.

4 Mounting The NFS Shares On The Client

client:

First we create the directories where we want to mount the NFS shares, e.g.:

mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfs

Afterwards, we can mount them as follows:

mount 192.168.0.100:/home /mnt/nfs/home
mount 192.168.0.100:/var/nfs /mnt/nfs/var/nfs

You should now see the two NFS shares in the outputs of

df -h

client:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root   19G  676M   17G   4% /
tmpfs                 253M     0  253M   0% /lib/init/rw
udev                   10M   80K   10M   1% /dev
tmpfs                 253M     0  253M   0% /dev/shm
/dev/sda1             471M   20M  427M   5% /boot
192.168.0.100:/home    29G  684M   27G   3% /mnt/nfs/home
192.168.0.100:/var/nfs
29G  684M   27G   3% /mnt/nfs/var/nfs
client:~#

document.write(”);createAndAttachAd(“idgt-1228731_1245091259″, “http://ad.doubleclick.net/adj/idgt.howtoforge.en/rec_b;net=idgt;u=idgt-1228731_1245091259,111fde07a182f28,apple,;;tile=1;ord1=728801;sz=300×250;contx=apple;btg=;ord=%5Btimestamp%5D?”,”300″,”250″); Click Here! <a href=”http://ad.amgdgt.com/ads/?t=c&c=0EQvWD” target=”_blank”><img src=”http://ad.amgdgt.com/ads/?t=i&f=h&p=2388&pl=f88d4ba9&c=0EQvWD&rnd=[cache_buster]” width=”300″ height=”250″ border=”0″ /></a> <a href=”http://a.collective-media.net/jump/idgt.howtoforge.en/rec_b;tile=1;sz=300×250;ord=[timestamp]?” target=”_blank”><img src=”http://a.collective-media.net/ad/idgt.howtoforge.en/rec_b;tile=1;sz=300×250;ord=[timestamp]?” width=”300″ height=”250″ border=”0″ alt=”"></a>