Ubuntu Server 安装SNMP组件 ,首先要安装软件包
root@Ouc:~# apt-get install snmpd
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libperl5.14 libsensors4 libsnmp-base libsnmp15
Suggested packages:
lm-sensors snmp-mibs-downloader
The following NEW packages will be installed:
libperl5.14 libsensors4 libsnmp-base libsnmp15 snmpd
0 upgraded, 5 newly installed, 0 to remove and 167 not upgraded.
Need to get 1655 kB of archives.
After this operation, 4239 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main libsensors4 amd64 1:3.3.1-2ubuntu1 [31.9 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libperl5.14 amd64 5.14.2-6ubuntu2.3 [1254 B]
Get:3 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libsnmp-base all 5.4.3~dfsg-2.4ubuntu1.1 [213 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libsnmp15 amd64 5.4.3~dfsg-2.4ubuntu1.1 [1333 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main snmpd amd64 5.4.3~dfsg-2.4ubuntu1.1 [76.1 kB]
Fetched 1655 kB in 2s (697 kB/s)
Preconfiguring packages …
Selecting previously unselected package libsensors4.
(Reading database … 50330 files and directories currently installed.)
Unpacking libsensors4 (from …/libsensors4_1:3.3.1-2ubuntu1_amd64.deb) …
Selecting previously unselected package libperl5.14.
Unpacking libperl5.14 (from …/libperl5.14_5.14.2-6ubuntu2.3_amd64.deb) …
Selecting previously unselected package libsnmp-base.
Unpacking libsnmp-base (from …/libsnmp-base_5.4.3~dfsg-2.4ubuntu1.1_all.deb) …
Selecting previously unselected package libsnmp15.
Unpacking libsnmp15 (from …/libsnmp15_5.4.3~dfsg-2.4ubuntu1.1_amd64.deb) …
Selecting previously unselected package snmpd.
Unpacking snmpd (from …/snmpd_5.4.3~dfsg-2.4ubuntu1.1_amd64.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
Setting up libsensors4 (1:3.3.1-2ubuntu1) …
Setting up libperl5.14 (5.14.2-6ubuntu2.3) …
Setting up libsnmp-base (5.4.3~dfsg-2.4ubuntu1.1) …
Setting up libsnmp15 (5.4.3~dfsg-2.4ubuntu1.1) …
Setting up snmpd (5.4.3~dfsg-2.4ubuntu1.1) …
update-rc.d: warning: snmpd stop runlevel arguments (1) do not match LSB Default-Stop values (0 1 6)
* Starting network management services: Processing triggers for libc-bin …
ldconfig deferred processing now taking place
2.编辑配置文件,只需修改三个地方即可
root@Ouc:~# nano /etc/snmp/snmpd.conf
#########################################################
#
# ACCESS CONTROL
## system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
view systemonly included .1 80 #新增此项
#view systemonly included .101.4.15.208 80 #rocommunity public localhost
# Default access to basic system info
rocommunity public default -V systemonly
root@Ouc:~# /etc/init.d/snmpd restart
* Restarting network management services:
root@Ouc:~# service snmpd status
* snmpd is running
评论区