:::

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

這篇文章是從opennms官網隨便翻譯過來的,原網址

http://www.opennms.org/index.php/Installation:Debian

需要修改的地方或指令我加粗體,另外使用etch以後的版本會比較簡單而且簡單很多。

另外可以裝phppgadmin來處理資料庫,不過他依附的是php4,如果使用OB2D要把php5移掉

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 -
(如果是root身份,上面那行要去掉sudo
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.

在執行命令前先設定$OPENNMS_HOME

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 127.0.0.1/32 ident sameuser
host all all ::1/128 ident sameuser

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

將最後一欄改成trust
local all all trust
host all all 127.0.0.1/32 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:

7.x版需要將以下功能打開(不適用於較新的8.x版)

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.

如果是root身份則改成

su postgres

createdb -U postgres -E UNICODE opennms

exit

安裝 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 已經設定則可繼續,或是手動執行

install_iplike.sh

告訴 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:

如果是自行設置的JDK則需要指定位置如

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

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

JAVA_HOME=/usr

初始化 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的安裝程式,這將會初始化OpenNMS資料庫並進行基本設定,(升級可再次執行確認資料庫結構和其他必要的升級。)

大部分的狀況只要執行下面指令即可

$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:

現在應該已經有了基礎的OpenNMS,啟動他

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,打開瀏覽器到

http://yourhost:8980/opennms/

帳號密碼都使用admin登入

port設定可以到/etc/opennms/opennms.properties裡面修改,如將8980改成8180。)