OpenNMS Installation Under Linux

来源:互联网 发布:北大青鸟编程多长时间 编辑:程序博客网 时间:2024/05/18 13:09

OpenNMS Installation Under Linux

This document is OpenNMS installation guide under Redhat Linux Enterprise Server 5.0. Start OpenNMS installation, you need to prepare following packages:

jdk-1_5_0_15-linux-i586.bin

jakarta-tomcat-4.1.31.tar.gz

postgresql-7.3.21.tar.gz

rrdtool-1.0.50.tar.gz

opennms-1.2.9-0_rhel5.i386.rpm

opennms-webapp-1.2.9-0_rhel5.i386.rpm

(Note: Assume all packages copy to directory /home/jacky)

1.   JDK Installation

Unpack jdk with following command. vi ~/.bash_profile

[root@localhost jacky]# chmod +x jdk-1_5_0_15-linux-i586.bin

[root@localhost jacky]# ./jdk-1_5_0_15-linux-i586.bin

Reading Binary Code License Agreement and input “yes” to agree to license terms. After unpacking, rename directory jdk1.5.0_15 to java directory and move it to /opt.

[root@localhost jacky]# mv jdk1.5.0_15  java

[root@localhost jacky]# mv java /opt

Setup Environment variable for java home.Insert the following entries in /etc/profile.

[root@localhost jacky]# vi /etc/profile

 

JAVA_HOME=/opt/java

export JAVA_HOME

Save the file then exit and run the command to read /etc/profile.

[root@localhost jacky]# source /etc/profile

Input java -version check jdk install.

[root@localhost jacky]# java -version

java version "1.5.0_15"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)

Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)

 

Notes: If you system had installed jdk, be likely to return following statement when input java -version, please input following command solve out this problem.

[root@localhost jacky]# java -version

-bash: /usr/bin/java: Permission denied

[root@localhost jacky]# cd /usr/bin

[root@localhost bin]# chmod +x java

[root@localhost bin]# java -version

Error: could not find libjava.so

Error: could not find Java 2 Runtime Environment.

[root@localhost /]# ln -s /opt/java/bin/java /usr/bin/java

ln: creating symbolic link `/usr/bin/java' to `/opt/java/bin/java': File exists

[root@localhost /]# mv /usr/bin/java /usr/bin/java.bak

mv: overwrite `/usr/bin/java.bak'? yes

[root@localhost /]# ln -s /opt/java/bin/java /usr/bin/java

[root@localhost /]# java -version

java version "1.5.0_15"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)

Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)

2. Tomcat Installation

Add tomcat group and tomcat user under group, modfiy password to tomcat.

[root@localhost /]# groupadd tomcat

[root@localhost /]# useradd -g tomcat -d /opt/tomcat tomcat

[root@localhost /]# passwd tomcat

Changing password for user tomcat.

New UNIX password:

BAD PASSWORD: it is based on a dictionary word

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

Decompressing tomcat tar.gz file, rename apache-tomcat-4.1.37 to tomcat and then move it to /opt folder.

[root@localhost jacky]# tar -zxvf apache-tomcat-4.1.37.tar.gz

 

[root@localhost jacky]# mv apache-tomcat-4.1.37 tomcat

[root@localhost jacky]# mv tomcat/* /opt/tomcat/

[root@localhost jacky]# chown -R tomcat.tomcat /opt/tomcat

[root@localhost jacky]# chown -R tomcat.tomcat /opt/tomcat/logs

[root@localhost jacky]# su - tomcat

Setup Environment variable for tomcat home. Insert the following entries in /etc/profile.

[tomcat@localhost ~]$ vi /etc/profile

 

CATALINA_HOME=/opt/tomcat

export CATALINA_HOME

Save the file then exit and run the command to read /etc/profile.

[tomcat@localhost ~]$ source /etc/profile

Start tomcat

[tomcat@localhost ~]$ /opt/tomcat/bin/startup.sh

Stop tomcat

[tomcat@localhost ~]$ /opt/tomcat/bin/shutdown.sh

3. RRDTool Installation

Untar tar.gz file, and run the following commands to make and install rrdtool.

[root@localhost jacky]# tar -zxvf rrdtool-1.0.50.tar.gz

[root@localhost jacky]# cd rrdtool-1.0.50

[root@localhost rrdtool-1.0.50]# ./configure --prefix=/opt/rrdtool;make;make install

When you run configure script, it may ask to install cgilib, if you don't have cgilib on your system, download cgilib from sourceforge.net and install it.

Then run the above commands again to install rrdtool.

Setup Environment variable for rrdtool home. Insert the following entries in /etc/profile.

[root@localhost jacky]# vi /etc/profile

 

RRDTOOL_HOME=/opt/rrdtool

export RRDTOOL_HOME

Save the file then exit and run the command to read /etc/profile.

[root@localhost rrdtool-1.0.50]#source /etc/profile

4. PostgreSQL Installation

Add tomcat group and tomcat user under group, modfiy password to tomcat.

[root@localhost ~]# groupadd postgres

[root@localhost ~]# useradd -g postgres -d /opt/pgsql postgres

[root@localhost ~]# passwd postgres

Changing password for user postgres.

New UNIX password:

BAD PASSWORD: it is based on a dictionary word

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@localhost ~]# chown -R postgres.postgres /opt/pgsql

Untar tar.gz file, and run the following commands to make and install postgresql.

[root@localhost jacky]# tar -zxvf postgresql-7.3.21.tar.gz

[root@localhost jacky]# cd postgresql-7.3.21

[root@localhost postgresql-7.3.21]# ./configure --prefix=/opt/pgsql

[root@localhost postgresql-7.3.21]# make && make install

After this process, add a user to manage postgresql and define home directory /opt/pqsql/ for this user.

[root@localhost ~]# cd /opt/pgsql/

[root@localhost pgsql]# mkdir /opt/pgsql/data

[root@localhost pgsql]# chown postgres /opt/pgsql/data

[root@localhost pgsql]# su - postgres

[postgres@localhost ~]$ cd /opt/pgsql/

[postgres@localhost pgsql]$ bin/initdb -D data/

Modfy postgresql connection parameters

[postgres@localhost pgsql]$ vi /opt/pgsql/data/postgresql.conf

 

tcpip_socket = true

max_connections = 256

shared_buffers = 1024

 

Copy postgresql src/include *.h file to /opt/pgsql/include, but don’t overwrite exists file.

[root@localhost /]# cd /home/jacky/postgresql-7.3.21/

[root@localhost postgresql-7.3.21]# cp -rf src/include /opt/pgsql/

cp: overwrite `/opt/pgsql/include/postgres_ext.h'? no

cp: overwrite `/opt/pgsql/include/libpq/libpq-fs.h'? no

cp: overwrite `/opt/pgsql/include/pg_config.h'? no

cp: overwrite `/opt/pgsql/include/pg_config_os.h'? no

 

Setup Environment variable for postgres home. Insert the following entries in /etc/profile.

[root@localhost ~]# vi /etc/profile

 

POSTGRES_HOME="/opt/pgsql"

export POSTGRES_HOME

Save the file then exit and run the command to read /etc/profile.

[root@localhost ~]# source /etc/profile

 

Start database use postgres user

su - postgres  postmaster -i -D ~/data &

or

su - postgres -c "/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start"

5. OpenNMS Installation

Install core and webapp OpenNMS of no dependencies with rpm package. Then OpenNMS default setup to directory /opt/opennms.

[root@localhost jacky]# rpm -ivh --nodeps opennms-1.2.9-0_rhel5.i386.rpm

Preparing...                ########################################### [100%]

1:opennms                ########################################### [100%]

- moving *.sql.rpmnew files (if any)... done

- checking for old update files... done

 

 *** Installation complete.  You must still run the installer and

 *** make a few other changes before you start OpenNMS.  See the

 *** install guide and release notes for details.

 

[root@Jacky-vm fang]# rpm -ivh --nodeps opennms-webapp-1.2.9-0_rhel5.i386.rpm

Preparing...                ########################################### [100%]

1:opennms-webapp         ########################################### [100%]

 

Now you can run following command to install opennms

[root@localhost source]# sh build.sh install

It will take time to complete installation process.

Setup Environment variable for OpenNMS home. Insert the following entries in /etc/profile.

[root@localhost jacky]# vi /etc/profile

 

OPENNMS_HOME=/opt/opennms

export OPENNMS_HOME

Save the file then exit and run the command to read /etc/profile.

[root@localhost ~]# source /etc/profile

 

6. OpenNMS Configuration

Before config OpenNMS, MUST start Postgresql.

Run the following commands to configure OpenNMS.

[root@localhost /]# /opt/opennms/bin/runjava -s

runjava: Looking for an appropriate JRE...

runjava: Checking for an appropriate JRE in JAVA_HOME...

runjava: found: "/opt/java/bin/java" is an appropriate JRE

runjava: value of "/opt/java/bin/java" stored in configuration file

[root@localhost /]# /opt/opennms/bin/runjava -S /opt/java/jre/bin/java

runjava: checking specified JRE: "/opt/java/jre/bin/java"...

runjava: specified JRE is good.

runjava: value of "/opt/java/jre/bin/java" stored in configuration file

Now run following command to create OpenNMS database and make sure postgres service is running.

[root@localhost /]# su - postgres -c "/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop"

[root@localhost /]# su - postgres -c "/opt/pgsql/bin/postmaster -i -D /opt/pgsql/data &"

 

[root@localhost /]# /opt/opennms/bin/install -disU

 

Set opennms web application environment

[root@localhost /]# /opt/opennms/bin/install -y -w /opt/tomcat/webapps/ -W /opt/tomcat/server/lib

 

Configure auto discovery

Go into following directory, open the discovery-configuration.xml with vi and add your ip range in begin and end tags.

[root@localhost /]# cd /opt/opennms/etc/
[root@localhost /etc]# vi discovery-configuration.xml

 

<discovery-configuration threads="1" packets-per-second="1"

initial-sleep-time="300000" restart-sleep-time="86400000"

retries="3" timeout="800">

<include-range retries="2" timeout="3000">

<begin>192.168.6.1</begin>

<end>192.168.6.254</end>

</include-range>

<include-url>file:/opt/OpenNMS/etc/include</include-url>

</discovery-configuration>

7. OpenNMS Start up

Run the following commands to start services.

[root@localhost /]# su - postgres -c "/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile restart"

[root@localhost /]# su - tomcat -c "/opt/tomcat/bin/startup.sh"

[root@localhost /]# /opt/opennms/bin/install -disU

[root@localhost /]# /opt/opennms/bin/install -y -w /opt/tomcat/webapps/ -W /opt/tomcat/server/lib

[root@localhost /]# /opt/opennms/bin/opennms.sh start

 

Now you can login to main page of OpenNMS in your browser.

http://localhost:8080/opennms

Use user name "admin" and password "admin" to logging to main page.

 

原创粉丝点击