3.3 Installing MRTG

MRTG is available at http://www.mrtg.org/. It relies on a few pieces of software not included in the distribution. In particular, it requires:

  • Perl 5.005 or greater

  • The GD library

  • The PNG library

  • The zlib library

You will not need external SNMP software because MRTG comes with its own SNMP implementation. Begin by unpacking the source in a convenient location:

 
 Linux% gunzip -c mrtg-2.9.25.tar.gz  tar xvf -   Linux% cd mrtg-2.9.25 

Install documentation is available from the doc/ directory in the distribution, but on a modern Linux system, MRTG will build without any special instructions:

 
 Linux% ./configure   Linux% make 

Then as root you may log in and execute the following command:

 
 Linux# make install 

if you would like to install MRTG in the default location, /usr/local/mrtg-2/ . If you are building MRTG for other platforms, you may find that a couple of necessary components are not already installed on your system. On Solaris, for example, you will first have to build the PNG and GD libraries before you can successfully build MRTG.

3.3.1 Building the PNG Library

The source for PNG is available at http://www.libpng.org/pub/png/libpng.html. Download the latest version and unpack it:

 
 Solaris% gunzip -c libpng-1.2.5.tar.gz  tar xvf -   Solaris% cd libpng-1.2.5 

Then examine the INSTALL file. It contains a list of makefiles designed for use with different systems. For example:

 
 makefile.linux   => Linux/ELF makefile (gcc, creates \      libpng12.so.0.1.2.5)   makefile.hpux    => HPUX (10.20 and 11.00) makefile   makefile.macosx  => MACOS X Makefile 

Find the one that is the closest match to your system and make a note of the name . In this example, we use makefile.solaris . Copy the makefile file you wish to use to the current directory and try building the package:

 
 Solaris% cp scripts/makefile.solaris makefile   Solaris% make 

If all goes well, there will be a file called libpng.a when you are finished. If the build complains about not being able to find the zlib library, you will need to retrieve it from http://www.gzip.org/zlib/ and build it before continuing. Once you have libpng.a , install it on your system from a root account with:

 
 Solaris# make install 

3.3.2 Building the GD Library

The GD library is available at http://www.boutell.com/gd/. As above, download the latest version and unpack it:

 
 Solaris% gunzip -c gd-2.0.9.tar.gz  tar xvf -   Solaris% cd gd-2.0.9 

Before running the configure script, you must indicate where GD should find the PNG library by setting the CFLAGS and LDFLAGS environment variables . Assuming you installed PNG in the default location, /usr/local/ , you will want:

 
 Solaris$ CFLAGS=-I/usr/local/include export CFLAGS   Solaris$ LDFLAGS="-L/usr/local/lib -R/usr/local/lib" export \    LDFLAGS 

if you use the bash, Korn or Bourne [2] shell, but:

[2] The Bourne shell is /bin/sh .

 
 Solaris% setenv CFLAGS -I/usr/local/include   Solaris% setenv LDFLAGS "-L/usr/local/lib -R/usr/local/lib" 

if you use the csh or tcsh shell.

Now install GD on your system with make install from a root account.

3.3.3 Building MRTG

Once the GD library is built with PNG, you can go on to build MRTG. Change back to the MRTG source directory and now run the configure script with CFLAGS and LDFLAGS still pointed at /usr/local :

 
 Solaris$ CFLAGS=-I/usr/local/include export CFLAGS   Solaris$ LDFLAGS="-L/usr/local/lib -R/usr/local/lib" export \      LDFLAGS   Solaris$ ./configure   Solaris$ make 

And as root:

 
 Solaris# make install 

This will install all of the MRTG software in /usr/local/mrtg-2 . You can specify an alternate location by running the configure script with the --prefix option:

 
 Solaris$ ./configure --prefix=/var/tmp/my-mrtg 

For the rest of this chapter, it is assumed that MRTG is installed in the default location.



Open Source Network Administration
Linux Kernel in a Nutshell (In a Nutshell (OReilly))
ISBN: 130462101
EAN: 2147483647
Year: 2002
Pages: 85

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net