1、源代码安装
#wget http://nchc.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.4.2.1.tar.gz
#tar zxvf net-snmp-5.4.2.1.tar.gz
#cd net-snmp-5.4.2.1
#./configure -enable-mfd-rewrites -with-default-snmp-version="2" -with-sys-contact="admin" -with-sys-location="China" -with-logfile="/var/log/snmpd.log" -with-persistent-directory="/var/net-snmp"
#make
#make install
2、通过网络yum安装net-snmp
# yum -y install net-snmp
3、或者找到光盘或者网上下载rpm包进行安装即可
安装命令为
# rpm -ivh net-snmp-5.3.1-14.el5.i386.rpm
其他相关的snmp包也建议一并安装
net-snmp-utils-5.3.1-14.el5.i386.rpm
net-snmp-libs-5.3.1-14.el5.i386.rpm
net-snmp-devel-5.3.1-14.el5.i386.rpm
配置snmp
# cp /etc/snmpd.conf /etc/snmpd.conf.bak
# vi /etc/snmpd.conf
输入如下信息,其中localhost 表示允许访问该snmp的主机地址,public为团体名称
com2sec roUser localhost public
#如果需要更多团体和允许访问的主机,增加如下行即可
com2sec roUser 0.0.0.0/0 abcdefg
group roGroup v1 roUser
group roGroup v2c roUser
view all included .1
includeAllDisks for all partitions and disks
access roGroup "" any noauth exact all none none
4.重启snmpd
# service snmpd restart
5.设置系统启动自动启动
# chkconfig --level 345 snmpd on
6.注意确认udp 161端口被防火墙允许。
转载于:https://www.cnblogs.com/blog-java/p/4512129.html