Net-Snmp on Ubuntu

From Net-SNMP Wiki
Revision as of 07:30, 16 January 2011 by Abrahamvarricatt (Talk | contribs)

Jump to: navigation, search

I'm actually working/customizing net-snmp to work on a MIPS board. I've found that Ubuntu (running in VirutalBox) provides a good prototyping area. To share what I've learned, I'm creating these pages.

Getting the sources

You can download the latest sources of net-snmp from here,

Main net-snmp Download Page

Setting the Environment

I advise you to start off with a fresh install of the Ubuntu Desktop edition. Don't worry - we won't really need the GUI, but if you are a beginner, it will be useful. Now, open up a terminal window and create a projects directory,

>pwd
/home/abru/
>mkdir projects
>cd projects
>pwd
/home/abru/projects

The purpose of the "projects" directory is an organizational measure. I like keeping all the code I work with separate from my "Download" or "Document" or "Home" folders (just messy, doing that). And "abru" is my username (short for Abraham).

Now we need to move the source tarball into the projects folder. If you haven't downloaded it yet, you can download the sources with the "wget" command (At the time of this writing, 5.6.1 is the latest),

>pwd
/home/abru/projects
>wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.1/net-snmp-5.6.1.tar.gz
...
...
>ls
net-snmp-5.6.1.tar.gz
>

Now lets get about extracting the sources,

>tar -xvzf net-snmp-5.6.1.tar.gz
...
...
...
>ls
net-snmp-5.6.1  net-snmp-5.6.1.tar.gz
> mv net-snmp-5.6.1 net-snmp
> ls
net-snmp  net-snmp-5.6.1.tar.gz
> 

It's not really a must, to the "mv" step above. But doing it here will help keep this tutorial updated (fewer changes with future releases).

Ubuntu Dependencies

If you've installed the desktop version of Ubuntu, then there's only 1 package missing from your install. Get it from the Ubuntu repositories with this,

> sudo apt-get install libperl-dev

If instead, you went and installed the server version of ubuntu, then you'll probably need to get gcc and build-essentails as well - I don't remember if there were more.

Anyway, with all that out of the way, lets configure the package! Follow these steps,

> cd net-snmp
> ./configure

The configure script will scan your system and prepare the "Makefile" from which we will perform our actual install. configure will ask you a few questions - I just press "enter" and go with the defaults. After a while you should see something like this,

---------------------------------------------------------
            Net-SNMP configuration summary:
---------------------------------------------------------

  SNMP Versions Supported:    1 2c 3
  Building for:               linux
  Net-SNMP Version:           5.6.1
  Network transport support:  Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase
  SNMPv3 Security Modules:     usm
  Agent MIB code:             default_modules =>  snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host
  MYSQL Trap Logging:         unavailable
  Embedded Perl support:      enabled
  SNMP Perl modules:          building -- embeddable
  SNMP Python modules:        disabled
  Crypto support from:        internal
  Authentication support:     MD5 SHA1
  Encryption support:         DES AES

---------------------------------------------------------

> 

The above means that "configure" has finished running and we can start compiling!