前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu编译文件安装SNMP服务

Ubuntu编译文件安装SNMP服务

原创
作者头像
何宇
发布2024-03-27 16:07:47
1090
发布2024-03-27 16:07:47
举报

net-snmp源码下载

http://www.net-snmp.org/download.html

编译步骤

指定参数编译

代码语言:bash
复制
./configure --prefix=/root/snmpd --with-default-snmp-version="2" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" --with-sys-contact="contact" --with-sys-location="location"
代码语言:bash
复制
make 

make install

编译环境

代码语言:bash
复制
apt-get install make

apt-get install gcc

apt-get install cmake

apt-get install perl-ExtUtils-Embed

apt-get install libperl-dev 
代码语言:bash
复制
---------------------------------------------------------

            Net-SNMP configuration summary:

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



  SNMP Versions Supported:    1 2c 3

  Building for:               linux

  Net-SNMP Version:           5.9.4.pre2

  Network transport support:  Callback Unix Alias TCP UDP TCPIPv6 UDPIPv6 IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase IPBase IPv6Base

  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:      disabled

  SNMP Perl modules:          building -- not embeddable

  SNMP Python modules:        disabled

  Crypto support from:        internal

  Authentication support:     MD5 SHA1

  Encryption support:         DES AES AES128

  Local DNSSEC validation:    disabled



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

编译完成

代码语言:bash
复制
gcc -E -I./include -I. -DDONT\_INC\_STRUCTS -DBINDIR=/root/snmpd/bin -x c -I. -Iinclude ./sedscript.in | /bin/grep -E '^s[/#]' | sed 's/REMOVEME//g;s# \*/#/#g;s/ \*#/#/g;s#/ \*#/#g;s/# g/#g/;' > sedscript

echo 's/VERSIONINFO/5.9.4.pre2/g' >> sedscript

echo 's#DATADIR#/root/snmpd/share#g' >> sedscript

echo 's#LIBDIR#/root/snmpd/lib#g' >> sedscript

echo 's#BINDIR#/root/snmpd/bin#g' >> sedscript

echo 's#PERSISTENT\_DIRECTORY#/var/net-snmp#g' >> sedscript

echo 's#SYSCONFDIR#/root/snmpd/etc#g' >> sedscript

/bin/sed -f sedscript ./EXAMPLE.conf.def > EXAMPLE.conf

making all in /root/net-snmp-5.9.4/snmplib

make[1]: Entering directory '/root/net-snmp-5.9.4/snmplib'

编译报错

代码语言:bash
复制
# 编译报错



collect2: error: ld returned 1 exit status

Makefile:1008: recipe for target 'libnetsnmpagent.la' failed

make[1]: \*\*\* [libnetsnmpagent.la] Error 1

make[1]: Leaving directory '/root/net-snmp-5.9.4/agent'

Makefile:671: recipe for target 'subdirs' failed

make: \*\*\* [subdirs] Error 1

编译的时候出现找不到perl库的问题,这个问题其实也好解决,编译一个就是嘛。但是呢,没有这个必要,麻烦。解决办法 其实很简单,将之前configure配置的时候加上一个参数--disable-embedded-perl,然后再次make就可以了。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • net-snmp源码下载
  • 编译步骤
  • 编译环境
  • 编译完成
  • 编译报错
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档