hirokofan - Linux雜記 | 2009-02-19 | 人氣:7342





Debian-Based Distributions 安裝

These instructions cover installation for most Debian-Based distributions (Debian, Ubuntu, etc.)

增加 OpenNMS 下載來源 sources.list

修改/etc/apt/sources.lists ,增加下列內容

deb http://debian.opennms.org stable main
deb-src http://debian.opennms.org stable main

(如果想要用最新展版的OpenNMS, 可能有目前穩定版所沒有的新功能,請用unstable 取代 stable.)

deb http://debian.opennms.org unstable main
deb-src http://debian.opennms.org unstable main

增加 OpenNMS PGP Key APT

The official OpenNMS packages are signed with a GPG / PGP key. The fingerprint for the official release key is:

22EE DDA6 8698 B02F B2EC  50B7 062B 8A68 4C4C BBD9

You will need to tell APT about the key:

wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add -

Debian 4.0 (etch) and Ubuntu 7.10 (gutsy) 或更新版本(OB2D在這邊)

As Sun Java has been put under the GPL it's sufficient to type "apt-get install opennms" since Debian 4.0 (etch) or Ubuntu 7.10 (gutsy); the dependencies will be fulfilled automatically.

輸入"apt-get install opennms"就會自動安裝(包含postgresqlJAVA SDK等,另外jrrdrrdtool是建議安裝的套件,需要手動安裝)

在早期的 Debian and Ubuntu(如b2d Jacana、LaPue)

Installing on older Debian or Ubuntu releases involves additional steps to get a Sun Java 5 or Java 6 JDK. Instructions are available online, but if possible, save yourself the trouble and use a newer release that includes Sun Java in the default repositories.

設定 OpenNMS

First, for the purposes of convenience, we are going to set the $OPENNMS_HOME environment variable before running any commands.


export OPENNMS_HOME=/usr/share/opennms

(If you are not using a bourne-compatible shell, you may need to use different syntax.)



OpenNMS 需要以預設使用者"postgres』依靠TCP/IP連線到 PostgreSQL (在安裝opennms時會自動裝起來)

RedHat-based systems
/etc/init.d/postgresql start
/sbin/service postgresql start
pg_hba.conf and postgresql.conf are in /var/lib/pgsql/data

Debian-based systems X.X是版本,如8.1
/etc/init.d/postgresql-X.X start
pg_hba.conf postgresql.conf 兩個檔案 /etc/postgresql/X.X/main

Mac OS X (Fink)
/sw/bin/pgsql.sh start

編輯 pg_hba.conf to Allow postgres to Authenticate

To allow the "postgres" user to connect, you will need to edit your database's pg_hba.conf file, which is usually created on installation or the first startup of PostgreSQL, depending on your distribution: By default, it will have something like this at the bottom:

local all all ident sameuser
host all all ident sameuser
host all all ::1/128 ident sameuser

You will need to change "ident sameuser" to "trust":

local all all trust
host all all trust
host all all ::1/128 trust

編輯 postgresql.conf to Allow TCP/IP Connections

You may also need to change the postgresql.conf to allow TCP/IP connections, if it cannot do so already. On older PostgreSQL versions, this is enabled with the flag:


tcpip_socket = true

On newer PostgreSQL versions, this is enabled with:


# you can use "*" to listen on all addresses
listen_addresses = 'localhost'


Once you've made these changes, you need to restart your database.


/etc/init.d/postgresql-X.X restart

建立 opennms 資料庫

If not done, use "sudo -u postgres createdb -U postgres -E UNICODE opennms" to create the database in postgres.


su postgres

createdb -U postgres -E UNICODE opennms


安裝 IPLIKE Stored Procedure in the Database

If this is your first time installing OpenNMS or iplike, you should make sure that iplike is configured in your database. First you need to install the iplike package from OpenNMS package repositories.

For RPM-based distributions using YUM:

yum install iplike

For DEB-based distributions using APT (use suffix pgsql74, pgsql81, pgsql82, or pgsql83 according to the version of PostgreSQL on your system):

正常來說在apt-get install opennms的時候就會安裝,如果沒有的話請執行

apt-get install iplike-pgsqlXX

如果OpenNMS database 已經設定則可繼續,或是手動執行


告訴 OpenNMS 去哪裡找JAVA

OpenNMS 需要知道去哪裡找JAVA,請執行以下指令(一般而言這樣就夠了,後面部需要)

$OPENNMS_HOME/bin/runjava -s

This will search $JAVA_HOME and other common locations for your JDK. If you wish to use a specific JDK, you can run it with the -S flag instead:


$OPENNMS_HOME/bin/runjava -S /usr/java/jdk1.5.0_12/bin/java

然後將設定JAVA_HOME 寫入 /etc/default/opennms


初始化 OpenNMS Database

Next, you need to run the OpenNMS installer, which will initialize the OpenNMS database, and do some other basic setup. Upon upgrade, you should run this command again to make sure your database schema and other things required at startup are up-to-date.



$OPENNMS_HOME/bin/install -dis

Sometimes you may need to tell OpenNMS where to find libjicmp.so; in that case, you can use the -l option (OpenNMS 1.3.5 and higher):

# i386 example
$OPENNMS_HOME/bin/install -dis -l /usr/lib/jni:/usr/lib
# x86_64 example
$OPENNMS_HOME/bin/install -dis -l /usr/lib64/jni:/usr/lib64

啟動 OpenNMS

You should have a basic OpenNMS installation ready now, so start it up:


sudo /etc/init.d/opennms start

As of OpenNMS 1.3.7, by default, the web UI will come up using the embedded Jetty servlet container, on port 8980. Open your browser and point it at:

依照OpenNMS1.3.7的預設值,web使用介面將會使用 Jetty servlet(以前需要TOMCAT),在port 8980,打開瀏覽器到