Changes between Initial Version and Version 1 of netmon2017librenms


Ignore:
Timestamp:
Nov 14, 2017, 5:50:48 PM (7 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • netmon2017librenms

    v1 v1  
     1= LibreNMS =
     2
     3NOTE: These instructions assume you are the root user. If you are not, prepend sudo to the shell commands
     4
     5== Installation ==
     6
     7=== Install LibreNMS ===
     8First install required packages.
     9{{{
     10apt-get install apache2 composer fping git graphviz imagemagick libapache2-mod-php7.0 mariadb-client mariadb-server mtr-tiny nmap php7.0-cli php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois
     11}}}
     12give <class password> as databse root password.
     13
     14Add librenms user and user's home directory
     15{{{
     16useradd librenms -d /opt/librenms -M -r
     17usermod -a -G librenms www-data
     18}}}
     19
     20Install LibreNMS
     21{{{
     22cd /opt
     23git clone https://github.com/librenms/librenms.git librenms
     24}}}
     25
     26=== Database Configuration ===
     27
     28Configure MySQL
     29{{{
     30systemctl restart mysql
     31mysql -uroot -p
     32}}}
     33
     34Create '''librenms''' database and '''librenms''' database user. grant all privileges to the created user.
     35{{{
     36CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
     37CREATE USER 'librenms'@'localhost' IDENTIFIED BY '<class password>';
     38GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
     39FLUSH PRIVILEGES;
     40}}}
     41
     42exit mysql
     43{{{
     44exit
     45}}}
     46
     47We need to change some mysql server settings. To do that edit '''50-server.cnf''' file
     48{{{
     49vi /etc/mysql/mariadb.conf.d/50-server.cnf
     50}}}
     51
     52Add the following llines within the '''[mysqld]''' section
     53{{{
     54innodb_file_per_table=1
     55sql-mode=""
     56lower_case_table_names=0
     57}}}
     58
     59Restart the mysql server
     60{{{
     61systemctl restart mysql
     62}}}
     63
     64=== Web server Configuration ===
     65
     66==== Configure PHP ====
     67
     68To set the correct time zone edit '''php.ini'''
     69{{{
     70vi /etc/php/7.0/apache2/php.ini
     71}}}
     72
     73Find the line ''';date.timezone''' and change the line as follows
     74{{{
     75date.timezone = Asia/Colombo
     76}}}
     77
     78Do the same to the '''vi /etc/php/7.0/cli/php.ini'''
     79
     80Enable php modules in apache
     81{{{
     82a2enmod php7.0
     83a2dismod mpm_event
     84a2enmod mpm_prefork
     85phpenmod mcrypt
     86}}}
     87
     88==== Configure Apache ====
     89
     90Create '''librenms.conf''' to enable the site
     91{{{
     92vi /etc/apache2/sites-available/librenms.conf
     93}}}
     94
     95Add the following lines:
     96{{{
     97<VirtualHost *:80>
     98  DocumentRoot /opt/librenms/html/
     99  CustomLog /opt/librenms/logs/access_log combined
     100  ErrorLog /opt/librenms/logs/error_log
     101  AllowEncodedSlashes NoDecode
     102  <Directory "/opt/librenms/html/">
     103    Require all granted
     104    AllowOverride All
     105    Options FollowSymLinks MultiViews
     106  </Directory>
     107</VirtualHost>
     108}}}
     109
     110Enable the librenms site and restart apache server
     111{{{
     112a2ensite librenms.conf
     113a2enmod rewrite
     114systemctl restart apache2
     115}}}
     116
     117=== Configure snmpd ===
     118
     119Create the snmpd configuration file
     120{{{
     121cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
     122vi /etc/snmp/snmpd.conf
     123}}}
     124
     125Edit the text which says '''RANDOMSTRINGGOESHERE''' and set your own community string.
     126
     127Install the libreNMS agent and restart snmpd
     128{{{
     129curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
     130chmod +x /usr/bin/distro
     131systemctl restart snmpd
     132}}}
     133
     134=== Cron job ===
     135{{{
     136cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
     137}}}
     138
     139Copy logrotate config
     140
     141LibreNMS keeps logs in /opt/librenms/logs. Over time these can become large and be rotated out. To rotate out the old logs you can use the provided logrotate config file:
     142{{{
     143cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
     144}}}
     145
     146=== Set permissions ===
     147{{{
     148chown -R librenms:librenms /opt/librenms
     149setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
     150setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs
     151}}}