帝國反抗君 - PowerOp

關於部落格
2006/11/29 網誌再次搬家,我在樂多網誌 http://blog.roodo.com/ystuan/ 候教
  • 17340

    累積人氣

  • 0

    今日人氣

    0

    訂閱人氣

[筆記]在CentOS 4.2上安裝OpenNMS 1.2.7

這回我是在CentOS 4.2上面安裝OpenNMS 1.2.7,我翻譯的版本是1.2.4,不過差異不大,還可以用。 提醒大家,這篇筆記只是記載一些重點,還是建議妳要參考安裝指南喔。 我這次裝的Java SDK是1.4.2_10(j2sdk-1.4.2_10-fcs),Tomcat4是從OpenNMS FTP站抓回來的tomcat4-4.1.18-full.1jpp.noarch.rpm和tomcat4-webapps-4.1.18-full.1jpp.noarch.rpm。 RRDtool也是抓OpenNMS FTP站的rrdtool-1.0.49-1.1.fc3.fr.i386.rpm curl我直接用yum -y install curl從CentOS那邊抓來裝,metamail已經不用囉。 在檔案/etc/tomcat4/tomcat4.conf裡面設定變數 JAVA_HOME如下: JAVA_HOME="/usr/java/j2sdk1.4.2_10/" 至於postgresql,CentOS 4不叫它做rhdb了,裝postgresql-server就是了。啟動postgresql讓設定檔產生出來,等會要修改
[root@localhost packages]# /etc/init.d/postgresql start
初始化資料庫:                                              [  確定  ]
啟動 postgresql 服務:                                      [  確定  ]
[root@localhost packages]#
修改/var/lib/pgsql/data/postgresql.conf,這邊抱怨一下SourceForge,讓我的文件掉字(英文原版也會掉),這個檔一共要改三行,改成如下:
tcpip_socket = true
max_connections = 256
shared_buffers = 1024
至於pg_hba.conf,我只改了底下這行(把前面的#拿掉即可) host all all 127.0.0.1 255.255.255.255 trust 改完重新啟動postgresql:
[root@localhost data]# /etc/init.d/postgresql restart
停止 postgresql 服務:                                      [  確定  ]
啟動 postgresql 服務:                                      [  確定  ]
[root@localhost data]#
關於用哪個帳號來執行tomcat,這次我選擇不要用root,用tomcat安裝時在/etc/passwd所增加的帳號,也就是"tomcat4"。因此,文件中數個地方所說的tomcat帳號應該是tomcat4帳號,例如我的/etc/group有一行如下:
tomcat4:x:91:tomcat4,root
我用文件中提到的指令稿 runjava -s 搜尋java不成功,所以我就用 -S 參數直接指定: [root@localhost ~]# /opt/OpenNMS/bin/runjava -S /usr/java/j2sdk1.4.2_10/bin/java 接下來把運行安裝程式的結果貼上來給大家參考:
[root@localhost data]# $OPENNMS_HOME/bin/install -disU
==============================================================================
OpenNMS Installer Version $Id: Installer.java,v 1.35.2.1 2005/03/13 03:57:20 djgregor Exp $
==============================================================================

Configures PostgreSQL tables, users, and other miscellaneous settings.

- checking database version... 7.4
  - Full version string: PostgreSQL 7.4.8 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22)
* using 'opennms' as the PostgreSQL user for OpenNMS
* using 'opennms' as the PostgreSQL password for OpenNMS
* using 'opennms' as the PostgreSQL database name for OpenNMS
- using SQL directory... /opt/OpenNMS/etc
- using create.sql... /opt/OpenNMS/etc/create.sql
- using iplike module... /opt/OpenNMS/lib/iplike.so
- checking database for old backup tables... NONE
- checking for rows that violate constraints... NONE
- creating tables...
  - checking table "serverMap"... CREATED
  - checking table "serviceMap"... CREATED
  - checking table "distPoller"... CREATED
  - checking table "node"... CREATED
  - checking table "ipInterface"... CREATED
  - checking table "snmpInterface"... CREATED
  - checking table "service"... CREATED
  - checking table "ifServices"... CREATED
  - checking table "events"... CREATED
  - checking table "outages"... CREATED
  - checking table "vulnerabilities"... CREATED
  - checking table "vulnPlugins"... CREATED
  - checking table "notifications"... CREATED
  - checking table "usersNotified"... CREATED
  - checking table "assets"... CREATED
- creating tables... DONE
- creating sequences...
  - checking "nodeNxtId" minimum value... 1
  - removing sequence "nodeNxtId"... CLEAN
  - creating sequence "nodeNxtId"... OK
  - checking "serviceNxtId" minimum value... 1
  - removing sequence "serviceNxtId"... CLEAN
  - creating sequence "serviceNxtId"... OK
  - checking "eventsNxtId" minimum value... 1
  - removing sequence "eventsNxtId"... CLEAN
  - creating sequence "eventsNxtId"... OK
  - checking "outageNxtId" minimum value... 1
  - removing sequence "outageNxtId"... CLEAN
  - creating sequence "outageNxtId"... OK
  - checking "notifyNxtId" minimum value... 1
  - removing sequence "notifyNxtId"... CLEAN
  - creating sequence "notifyNxtId"... OK
  - checking "vulnNxtId" minimum value... 1
  - removing sequence "vulnNxtId"... CLEAN
  - creating sequence "vulnNxtId"... OK
- creating sequences... DONE
- creating indexes...
  - creating index "server_name_idx"... OK
  - creating index "servicemap_name_idx"... OK
  - creating index "serviceMap_ipaddr_idx"... OK
  - creating index "node_id_type_idx"... OK
  - creating index "node_label_idx"... OK
  - creating index "ipinterface_nodeid_ipaddr_ismanaged_idx"... OK
  - creating index "ipinterface_ipaddr_ismanaged_idx"... OK
  - creating index "ipinterface_ipaddr_idx"... OK
  - creating index "ipinterface_nodeid_ismanaged_idx"... OK
  - creating index "ipinterface_nodeid_idx"... OK
  - creating index "snmpinterface_nodeid_ifindex_idx"... OK
  - creating index "snmpinterface_nodeid_idx"... OK
  - creating index "snmpinterface_ipaddr_idx"... OK
  - creating index "ifservices_nodeid_ipaddr_status"... OK
  - creating index "ifservices_nodeid_status"... OK
  - creating index "ifservices_nodeid_idx"... OK
  - creating index "ifservices_serviceid_idx"... OK
  - creating index "ifservices_nodeid_serviceid_idx"... OK
  - creating index "events_uei_idx"... OK
  - creating index "events_nodeid_idx"... OK
  - creating index "events_ipaddr_idx"... OK
  - creating index "events_serviceid_idx"... OK
  - creating index "events_time_idx"... OK
  - creating index "events_severity_idx"... OK
  - creating index "events_log_idx"... OK
  - creating index "events_display_idx"... OK
  - creating index "events_ackuser_idx"... OK
  - creating index "events_acktime_idx"... OK
  - creating index "outages_svclostid_idx"... OK
  - creating index "outages_svcregainedid_idx"... OK
  - creating index "outages_nodeid_idx"... OK
  - creating index "outages_ipaddr_idx"... OK
  - creating index "outages_serviceid_idx"... OK
  - creating index "outages_regainedservice_idx"... OK
  - creating index "vulnerabilities_nodeid_idx"... OK
  - creating index "vulnerabilities_ipaddr_idx"... OK
  - creating index "vulnerabilities_severity_idx"... OK
  - creating index "vulnerabilities_port_idx"... OK
  - creating index "vulnerabilities_protocol_idx"... OK
  - creating index "vulnplugins_plugin_idx"... OK
  - creating index "notifications_ipaddr_idx"... OK
  - creating index "notifications_serviceid_idx"... OK
  - creating index "notifications_eventid_idx"... OK
  - creating index "notifications_respondtime_idx"... OK
  - creating index "notifications_answeredby_idx"... OK
  - creating index "userid_notifyid_idx"... OK
- creating indexes... DONE
- inserting initial table data for "distPoller"... OK
- checking if database "opennms" is unicode... ALREADY UNICODE
- checking for stale iplike references... CLEAN
- checking for stale eventtime.so references... CLEAN
- adding iplike database function... OK
- adding PL/pgSQL call handler... OK
- adding PL/pgSQL language module... OK
- adding stored procedures...
  - getManagedOutageForIntfInWindow.sql... OK
  - getManagedServiceCountForIntf.sql... OK
  - getOutageTimeInWindow.sql... OK
  - getManagePercentAvailIntfWindow.sql... OK
  - getManagedServiceCountForNode.sql... OK
  - getManagedOutageForNodeInWindow.sql... OK
  - getPercentAvailabilityInWindow.sql... OK
  - getManagePercentAvailNodeWindow.sql... OK

Installer completed successfully!

[root@localhost data]# $OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/webapps -W $CATALINA_HOME/server/lib
==============================================================================
OpenNMS Installer Version $Id: Installer.java,v 1.35.2.1 2005/03/13 03:57:20 djgregor Exp $
==============================================================================

Configures PostgreSQL tables, users, and other miscellaneous settings.

* using 'opennms' as the PostgreSQL user for OpenNMS
* using 'opennms' as the PostgreSQL password for OpenNMS
* using 'opennms' as the PostgreSQL database name for OpenNMS
- using Top-level web application directory... /var/tomcat4/webapps
- using Tomcat server library directory... /var/tomcat4/server/lib
- using OpenNMS webapps directory... /opt/OpenNMS/webapps
- Checking for old opennms webapp directory in /var/tomcat4/webapps/opennms... OK
- Checking for old opennms context in /var/tomcat4/webapps/../conf/server.xml... OK
- Install OpenNMS webapp...
  - creating link to /var/tomcat4/webapps/opennms.xml... DONE
  - creating link to /var/tomcat4/server/lib/log4j.jar... DONE
  - creating link to /var/tomcat4/server/lib/castor-0.9.3.9.jar... DONE
  - creating link to /var/tomcat4/server/lib/castor-0.9.3.9-xml.jar... DONE
  - creating link to /var/tomcat4/server/lib/opennms_core.jar... DONE
  - creating link to /var/tomcat4/server/lib/opennms_services.jar... DONE
  - creating link to /var/tomcat4/server/lib/opennms_web.jar... DONE
- Installing OpenNMS webapp... DONE

Installer completed successfully!
[root@localhost data]#
文件中只有提到用chkconfig讓opennms服務開機時自動啟動,其實tomcat4和postgresql也得這麼做:
[root@localhost ~]# chkconfig --list tomcat4
tomcat4         0:關閉  1:關閉  2:關閉  3:關閉  4:關閉  5:關閉  6:關閉
[root@localhost ~]# /etc/init.d/tomcat4 start
Starting tomcat4:                                          [  確定  ]
[root@localhost ~]# chkconfig tomcat4 on
[root@localhost ~]# chkconfig --list tomcat4
tomcat4         0:關閉  1:關閉  2:開啟  3:開啟  4:開啟  5:開啟  6:關閉
[root@localhost ~]# chkconfig --list postgresql
postgresql      0:關閉  1:關閉  2:關閉  3:關閉  4:關閉  5:關閉  6:關閉
[root@localhost ~]# chkconfig postgresql on
[root@localhost ~]# chkconfig --list postgresql
postgresql      0:關閉  1:關閉  2:開啟  3:開啟  4:開啟  5:開啟  6:關閉
[root@localhost ~]# chkconfig --add opennms
[root@localhost ~]# chkconfig --list opennms
opennms         0:關閉  1:關閉  2:關閉  3:開啟  4:開啟  5:開啟  6:關閉
[root@localhost ~]# 
記得修改 $OPENNMS_HOME/etc/discovery-configuration.xml,設定一下自動發掘哪個範圍的ip位址。
[root@localhost ~]# service opennms start
Starting OpenNMS:                                          [  確定  ]
[root@localhost ~]#
我有遇到tomcat的問題,後來是按照安裝指南的建議:
Tomcat有個"工作"目錄(通常是$CATALINA_HOME/work)用來儲存JSP頁面的Java程式碼,以及JSP的compiled classes。有些使用者一直遇到跟網頁應用程式有關的問題,直到清除工作目錄並重新啟動Tomcat才解決。有鑑於此,如果前述方法都無法讓網頁應用程式正常運作,我們建議妳執行"rm -rf $CATALINA_HOME/work"。
我把這個目錄砍掉,重新啟動tomcat,卻又發現這個目錄沒有自己產生,於是又手動建立。也許只要把目錄底下的東西清光就好了? 登入之後,先來改管理者密碼吧! 點選右上角的Admin,再點左邊的Configure Users and Groups,再點Configure Users,點選管理者帳號admin前面的Modify圖示,再點Reset Password圖示,在對話框輸入兩次密碼按ok,記得還要在前一個畫面左下角點選Finish,才是改好密碼喔! 好啦,大功告成,謝謝收看!
相簿設定
標籤設定
相簿狀態