How to Install SNMP and Configure the Community String For CentOS

Linux Servers

Install SNMP

  1. Install the SNMPD service by running the following command:
    • yum install net-snmp net-snmp-utils
  2. Once the service is installed, verify that it is set to start at startup by running:
    • CentOS 6:
      • chkconfig snmpd on
    • CentOS 7:
      • systemctl enable snmpd

Configure SNMP

  1. Make a backup of the original configuration file by running:
    • mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
  2. Create a new SNMP configuration file by running:
    • touch /etc/snmp/snmpd.conf
  3. Once you have the new configuration file, generate a random string for the SNMP community string using a tool such as passwordsgenerator.net
  4. Once you have the string, edit /etc/snmp/snmpd.conf and add the following line, replacing [RANDOM_STRING] with the generated string:
    • rocommunity [RANDOM_STRING]
  5. Save the configuration file, and finally start the SNMP service by running:
    • CentOS 6:
      • service snmpd restart
    • CentOS 7:
      • systemctl restart snmpd

Add Feedback