Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1120247
  • 博文数量: 165
  • 博客积分: 5957
  • 博客等级: 大校
  • 技术积分: 2015
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-24 15:04
文章分类

全部博文(165)

文章存档

2014年(10)

2013年(14)

2012年(9)

2011年(22)

2010年(17)

2009年(17)

2008年(26)

2007年(34)

2006年(16)

我的朋友

分类: LINUX

2007-05-17 19:04:34

官方网站:

Build requirements
------------------
To build NAV, you need at least the following:

 * make
 * autoconf
 * ant
 * Perl >= 5.6.0
 * Python >= 2.3.0
 * Java 2 SDK >= 1.4.0
 * Tomcat >= 4 (or compatible Java Servlet API)
 * JavaSnmp >= 1.4 (A.K.A Drexel SNMP)
 * Cheetah Templates

Runtime requirements
--------------------
To run NAV, these software packages are required:

 * Apache2
 * mod_python
 * mod_php >= 4
 * Cricket
 * PostgreSQL >= 7.4
 * rrdtool
 * Cheetah Templates
 * Tomcat >= 4 (or compatible Java Servlet Container)
 * Java 2 SDK >= 1.4.0
 * Perl >= 5.6.0
 * Python >= 2.3.0


The following PHP extensions are required:

 * php-gd
 * php-pgsql

The following Perl modules are required:

 * DBD::Pg
 * Pg
 * SNMP_Session (with SNMP_util, BER)

The following Java librares are required:

 * PostgreSQL JDBC driver
 * JavaSnmp >= 1.4 (A.K.A Drexel SNMP)

The following python modules are required:

 * pysnmp2
 * egenix-mxdatetime
 * forgethtml
 * forgetsql
 * ipy
 * ldap
 * psycopg
 * rrd

Recommended add-ons
 * Gammu and python-gammu
 * packages

OS : RHEL4.4
软件包准备:(大部分下载来自于:)
===================================================================
mkdir -p /opt/soft
cd /opt/soft
安装apache、php、snmp、httpd、python等略
下载egenix-mx-base-3.0.0.tar.gz:
 ?

baseurl=http%3A%2F%2Fdownloads.egenix.com%2Fpython%2F&product=egenix-mx-

base&version=3.0.0&archive=tar.gz
其他:
wget
wget
wget
wget
wget
wget
wget
wget
wget http://ans.hsh.no/home/roger/nav3/gammu-devel-1.11.0-1.el4.rf.i386.rpm
wget
wget
wget http://ans.hsh.no/home/roger/nav3/rrdtool-devel-1.0.50-3.el4.rf.i386.rpm
wget -

1.2.el4.rf.noarch.rpm
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget -

5.1.2-11.EL4.7.i386.rpm
===================================================================


install_nav_part1.sh
====================================================================
echo "alias net-pf-10 off" >>/etc/modprobe.conf
gpg --import /usr/share/rhn/RPM-GPG-KEY
rpm --import /usr/share/rhn/RPM-GPG-KEY
sed -e 's/pkgSkipList=kernel\*/pkgSkipList=/' -i /etc/sysconfig/rhn/up2date
sed -e 's/^X11Forwarding/#X11Forwarding/' -i /etc/ssh/sshd_config
sed -e '/SYSLOGD_OPTIONS/s/m 0/m 0 -r/' -i /etc/sysconfig/syslog
service syslog restart
====================================================================

然后添加个自己的用户:
useradd -c "Exp" exp
passwd exp

以下root用户操作:
install_nav_part2.sh
====================================================================
## Make source dir
mkdir ~/nav3
cd ~/nav3

rpm -ivh --nodeps /opt/soft/nav-3.2.2-1.noarch.rpm
tar xvzf /opt/soft/nav-3.2.2.tar.gz nav-3.2.2/contrib/patches/

## Install Java Developer Kit
chmod 755 /opt/soft/jdk-1_5_0_12-linux-i586-rpm.bin
/opt/soft/jdk-1_5_0_12-linux-i586-rpm.bin
 yes
vi /etc/profile修改
export JAVA_HOME=/usr/java/jdk1.5.0_12
export JRE_HOME=/usr/java/jdk1.5.0_12/jre

## Install Php
# Install jpegsrc.v6b()
./configure --enable-static --enable-shared && make && make install
# Install libpng(-

1.2.24.tar.bz2)
./configure && make && make install
# Install php

cp php.ini-dist /usr/local/lib/php.ini
# add to apache conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
然后restart apache

## Install Tomcat
cd /home/admin
tar -zxvf /opt/soft/apache-tomcat-5.5.23.tar.gz
cd apache-tomcat-5.5.23
vi conf/server.xml
vi /etc/profile修改
export CATALINA_BASE=/home/admin/apache-tomcat-5.5.23
export CATALINA_HOME=/home/admin/apache-tomcat-5.5.23
export CATALINA_TMPDIR=/home/admin/apache-tomcat-5.5.23/temp
去掉348行左右的注释,使配置如下
directory="logs"  prefix="localhost_access_log." suffix=".txt"
     pattern="common" resolveHosts="false"/>

sed -e 's/port="8080"/port="8080" address="127.0.0.1"/' -i

/home/admin/apache-tomcat-5.5.23/conf/server.xml
ln -s /usr/local/nav/apache/webapps/*.war /home/admin/apache-tomcat-

5.5.23/webapps

启动tomcat:
/home/admin/apache-tomcat-5.5.23/bin/startup.sh
lsof -i:8080看下是否启动成功就ok

## install pgsql
下载postgresql-8.2.6
useradd pg
./configure --prefix=/home/pg
gmake
su
gmake install
mkdir -p /home/pg/data
chown pg /home/pg/data
su - pg
bin/initdb -D data
bin/postgres -D data >logfile 2>&1 &
bin/createdb test
bin/psql test

修改系统path:
修改/root/.bash_profile PATH中加入/home/pg/bin
source /root/.bash_profile

pgsql的起停方法:
使用pg用户
bin/pg_ctl stop -D data
bin/pg_ctl start -D data

最好的不通过SIGKILL的来停pgsql的方法是:
kill -INT `head -1 /home/pg/data/postmaster.pid`
缺省端口:5432

配置pgsql:
【如果是老版本(8.2.5以前的版本),需要:
修改/home/pg/data/postgresql.conf的tcp/ip选项,使的accept tcp/ip connections

修改/usr/local/pgsql/data/pg_hba.conf,如下:
    # "local" is for Unix domain socket connections only
    local   all         all              md5
    # IPv4 local connections:
    host    all         all         127.0.0.1/32   md5
    # IPv6 local connections:
    host    all         all         ::1/128        md5
即让所有连接都需要md5认证
重启postgresql:bin/pg_ctl restart -D data

vi /etc/profile
添加
export POSTGRES_HOME=/home/pg
export POSTGRES_INCLUDE=/home/pg/include
export POSTGRES_LIB=/home/pg/lib

## Install DBI
perl -MCPAN -e 'install DBI'

## Install DBD::Pg
tar -zxvf /opt/soft/DBD-Pg-2.0.0_5.tar.gz
cd DBD-Pg-2.0.0_5
perl Makefile.PL
make
make install
cd ..

## Install mod_python
tar -zxvf /opt/soft/mod_python-3.3.1
./configure --with-apxs=/opt/apache/bin/apxs
make
su
make install
cd ..
再修改httpd.conf配置,加入:
DocumentRoot "/usr/local/nav/apache/webroot"
LoadModule python_module modules/mod_python.so
AddHandler cgi-script .cgi
#Alias /nav /usr/local/nav/apache/webroot

    Options Indexes FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all


    # Let NAV authorize all access to this location
    PythonHeaderParserHandler nav.web
    PythonDebug on

LogLevel warn

    AccessFileName .htaccess
    DirectoryIndex index.html index.html index.php index.cgi index.py

然后重启httpd

## Install Java SNMP Package
mkdir JavaSNMP
cd JavaSNMP
unzip /opt/soft/source_1.4.2.zip
export PATH=$PATH:/usr/java/jdk1.5.0_12/bin
make SNMPPackage
cp snmp.jar /usr/local/nav/lib/java
cd ..

## Use GPG-key for installing RPMs from Dag Wieers
gpg --import /opt/soft/RPM-GPG-KEY.dag.txt
rpm --import /opt/soft/RPM-GPG-KEY.dag.txt

## Install gammu
rpm -ivh /opt/soft/gammu-1.11.0-1.el4.rf.i386.rpm
rpm -ivh /opt/soft/gammu-devel-1.11.0-1.el4.rf.i386.rpm

## Install rrdtool version 1.0
rpm -ivh /opt/soft/rrdtool-1.0.50-3.el4.rf.i386.rpm
rpm -ivh /opt/soft/perl-rrdtool-1.0.50-3.el4.rf.i386.rpm
rpm -ivh /opt/soft/rrdtool-devel-1.0.50-3.el4.rf.i386.rpm

## Perl module installations
# Checked out, cricket/compile needs it
rpm -ivh /opt/soft/perl-TimeDate-1.16-1.2.el4.rf.noarch.rpm

# Checked out, cricket/compile needs it
tar xvzf /opt/soft/SNMP_Session-1.10.tar.gz
cd SNMP_Session-1.10
perl Makefile.PL
make
make install
cd ..

# MD5 CPAN Perl module
tar xvzf /opt/soft/MD5-2.03.tar.gz
cd MD5-2.03
perl Makefile.PL
make
make install
cd ..

# install perl-libwww-perl
perl -MCPAN -e 'install Bundle::Link_Controller'

# Checked out, cricket/compile needs it
tar xvzf /opt/soft/DB_File-1.815.tar.gz
cd DB_File-1.815
perl Makefile.PL
make
make install
cd ..

# CGI CPAN Perl module
tar xvzf /opt/soft/CGI.pm-3.29.tar.gz
cd CGI.pm-3.29
perl Makefile.PL
make
make install
cd ..

# Checked out, bin/makecricketconfig.pl needs it
tar xvzf /opt/soft/pgsql_perl5-1.9.0.tar.gz
cd pgsql_perl5-1.9.0
export POSTGRES_INCLUDE=/home/pg/include POSTGRES_LIB=/home/pg/lib
perl Makefile.PL
make
make install
unset POSTGRES_INCLUDE POSTGRES_LIB
cd ..

## Install python-egenix-mx
tar -zxvf /opt/soft/egenix-mx-base-3.0.0.tar.gz
cd egenix-mx-base-3.0.0
python setup.py install
cd ..

 

## Python module installations

# Install psycopy
tar xvzf /opt/soft/psycopg-1.1.21.tar.gz
cd psycopg-1.1.21
./configure \
 --with-postgres-includes=/home/pg/include/postgresql/server \
 --with-postgres-libraries=/home/pg/lib \
 --with-postgres-includes=/home/pg/include \
 --with-mxdatetime-includes=/usr/lib/python2.3/site-

packages/mx/DateTime/mxDateTime
make
make install
cd ..

# Checked out, machinetracker.py needs it
tar xvzf /opt/soft/IPy-0.54.tar.gz
cd IPy-0.54
python setup.py install
cd ..

# Checked out, servicemon needs it
tar xvzf /opt/soft/py-rrdtool-0.2.1.tar.gz
cd py-rrdtool-0.2.1
python setup.py install
cd ..

# Needs version 2 of pysnmp
tar xvzf /opt/soft/pysnmp-2.0.9.tar.gz
cd pysnmp-2.0.9
python setup.py install
cd ..

# Checked out
tar xvzf /opt/soft/Cheetah-1.0.tar.gz
cd Cheetah-1.0
python setup.py install
cd ..

#
tar xvzf /opt/soft/forgethtml-cvs-2004-10-21.tar.gz
cd forgethtml
python setup.py install
cd ..

# thresholdMon.py
tar xvzf /opt/soft/forgetSQL-0.5.1.tar.gz
# Patch it with patch from NAV source
cp nav-3.2.2/contrib/patches/forgetSQL-0.5.1.patch forgetSQL-0.5.1/lib
cd forgetSQL-0.5.1/lib
patch cd ..
python setup.py install
cd ..

# Install Python bindings for gammu
tar xvzf /opt/soft/python-gammu-0.20.tar.gz
cd python-gammu-0.20
python setup.py install
cd ..

### Nav configuration
## NAV setup
然后修改/usr/local/nav/etc/nav.conf中的ADMIN_MAIL和DOMAIN_SUFFIX还有JAVA_HOME
JAVA_HOME = /usr/java/jdk1.5.0_12
# Arnold needs its log file existing
touch /usr/local/nav/var/log/arnold/arnold.log

## Profile setup
##
cat << EOF > /etc/profile.d/nav_environ.sh
JAVA_HOME=/usr/java/jdk1.5.0_12
PATH=$PATH:$JAVA_HOME/jre/bin
export JAVA_HOME
CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server -

Djava.ext.dirs=/usr/local/nav/lib/java"
export CATALINA_OPTS
EOF

chmod 755 /etc/profile.d/nav_environ.sh

## Link in the JDBC driver
cp /opt/soft/pg74.215.jdbc3.jar /usr/share/java/
ln -s /usr/share/java/pg74.215.jdbc3.jar /usr/local/nav/lib/java

## Link in some NAV Perl scripts into the Perl library
ln -s /usr/local/nav/lib/perl/NAV.pm /usr/lib/perl5/site_perl/5.8.5
ln -s /usr/local/nav/lib/perl/NAV /usr/lib/perl5/site_perl/5.8.5
ln -s /usr/local/nav/lib/perl/NetAddr /usr/lib/perl5/site_perl/5.8.5

## Append to Python the path to NAV python scripts
cat << EOF > /usr/lib/python2.3/site-packages/sitecustomize.py
import sys
sys.path.append('/usr/local/nav/lib/python')
EOF

## Configure gammu
cat << EOF > /etc/gammurc
[gammu]
port = /dev/ttyS0
connection = dlr3
EOF

# You can test that the gammu program works by doing this test as root:
gammu nothing --identify
# and when that test gives correct data send yourself a test SMS like this:
echo Test | gammu nothing --sendsms TEXT YourMobileNumber

usermod -G uucp navcron
# Now you can test the smsd.py module to see that it will send SMS'es:
/usr/local/nav/bin/smsd.py -t YourMobileNumber

配置pgsql
su - pg
createuser --no-createdb --no-adduser --pwprompt nav
# Set up the NAV databases
createdb --owner nav --encoding UTF-8 manage
createdb --owner nav --encoding UTF-8 navprofiles
createdb --owner nav --encoding UTF-8 logger
createdb --owner nav --encoding UTF-8 arnold
createlang plpgsql manage
createlang plpgsql navprofiles
cd /usr/local/nav/doc/sql
# Use the nav user password you just made here
export PGPASSWORD=******
psql -f manage.sql manage nav
psql -f types.sql manage nav
psql -f snmpoid.sql manage nav
psql -f navprofiles.sql navprofiles nav
psql -f logger.sql logger nav
psql -f arnold.sql arnold nav
exit

sed -e 's/userpw_nav=/userpw_nav=*******/' -i /usr/local/nav/etc/db.conf

## Install and configure cricket
chgrp nav /usr/local/nav
chmod g+sw /usr/local/nav
su navcron
mkdir ~/cricket
cd ~/cricket
wget
tar xvzf cricket-1.0.5.tar.gz
ln -s cricket-1.0.5 cricket
cd cricket
sh configure
cp cricket-conf.pl.sample cricket-conf.pl
sed \
 -e '/^$gCricketHome/s/\/home\/cricket/\/usr\/local\/nav\/cricket/' \
 -e 's/^#$gConfigRoot/$gConfigRoot/' \
 -e 's/^#$gDbAccess = "slurp"/$gDbAccess = "slurp"/' \
 -i cricket-conf.pl
cd ~/cricket
mkdir public_html
cd public_html/
ln -s ../cricket/images
ln -s ../cricket/grapher.cgi
ln -s ../cricket/lib
ln -s ../cricket/mini-graph.cgi
ln -s ../cricket/VERSION
ln -s ../cricket/grapher.cgi index.cgi
cp /usr/local/nav/doc/cricket/public_html/cricket.css .
mkdir ../cricket-data
ln -s ../cricket-data
cp -r /usr/local/nav/doc/cricket/cricket-config ..
ln -s ../cricket-config
cd ~/cricket/cricket
cp /usr/local/nav/doc/cricket/cricket/* .
cd ~
mkdir cricket/cricket-logs
touch /usr/local/nav/cricket/cricket-logs/changelog
cricket/cricket/compile
bin/makecricketconfig.pl ---------------------到这一步
【注:如果这一步报如下错误:
bin/makecricketconfig.pl
Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-

multi/auto/Pg/Pg.so' for module Pg: libpq.so.5: cannot open shared object

file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-

multi/DynaLoader.pm line 230.
则将cp /home/pg/lib/libpq.* /usr/lib/即可

exit
cd /usr/local/nav/apache/webroot
ln -s ~navcron/cricket/public_html cricket
cd cricket
echo "SetHandler none" > .htaccess

/etc/rc.local里面加入如下行
. /etc/profile.d/nav_environ.sh
/home/admin/apache-tomcat-5.5.23/bin/startup.sh
/usr/local/nav/bin/nav start

至此配置全部完成
## Start NAV
/usr/local/nav/bin/nav start
# Check the startup by using this command:
/usr/local/nav/bin/nav status

页面登录默认用户名admin,默认密码admin

记得安装snmp utils包
rpm -ivh /opt/soft/net-snmp-utils-5.1.2-11.EL4.7.i386.rpm

阅读(5241) | 评论(0) | 转发(0) |
0

上一篇:a life

下一篇:RRDtool中英文翻译使用手册

给主人留下些什么吧!~~