{"id":2236,"date":"2017-12-26T17:37:28","date_gmt":"2017-12-26T14:37:28","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-setup-librenms-monitoring-tools-with-nginx-on-ubuntu-1604-lts\/"},"modified":"2017-12-26T17:37:28","modified_gmt":"2017-12-26T14:37:28","slug":"how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts\/","title":{"rendered":"How to Setup LibreNMS Monitoring Tool with Nginx on Ubuntu 16.04 LTS"},"content":{"rendered":"<p>LibreNMS is an open source monitoring tool based on PHP\/MYSQL\/SNMP. It&#8217;s a featured network monitoring system that provides support for wide range of network hardware and operating systems including, FreeBSD, Cisco, Linux, HP etc.<\/p>\n<p>In this tutorial, I will show you how to install and configure the\u00a0open source monitoring tool &#8216;LibreNMS&#8217; using Nginx as the webserver, MariaDB as the database, and Ubuntu 16.04 server as our main server. We will guide you step-by-step on how to install and configure &#8216;LibreNMS&#8217; on Ubuntu 16.04 Xenial Xerus server.<\/p>\n<p><strong>What we will do<\/strong><\/p>\n<ol>\n<li>Install Packages<\/li>\n<li>Install Nginx Webserver<\/li>\n<li>Install and Configure PHP-FPM<\/li>\n<li>Install and Configure MariaDB<\/li>\n<li>Download and Configure LibreNMS<\/li>\n<li>LibreNMS Web Installer<\/li>\n<li>Final configuration<\/li>\n<\/ol>\n<p><strong>Prerequisites<\/strong><\/p>\n<ul>\n<li>Ubuntu 16.04 Server<\/li>\n<li>Root Privileges<\/li>\n<\/ul>\n<h2 id=\"step-install-packages\">Step 1 &#8211; Install Packages<\/h2>\n<p>The first step we must do for installing LibreNMS Monitoring Tools is to\u00a0install some packages needed on the server. Connect to your server and update the repository.<\/p>\n<p class=\"command\">ssh <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"fb8994948fbb939a909a889ed6979a9988d6889e898d9e89\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a><br \/>sudo apt update<\/p>\n<p>Install all the required packages for LibreNMS from the Ubuntu repository using the following command.<\/p>\n<p class=\"command\">apt install fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd\u00a0 rrdtool git snmp graphviz<\/p>\n<p>After\u00a0the installation is complete, goto the next step.<\/p>\n<h2 id=\"step-install-nginx-webserver\">Step 2 &#8211; Install Nginx Webserver<\/h2>\n<p>In this tutorial, we will be running LibreNMS under the Nginx web server. Nginx is powerful web server\u00a0that&#8217;s\u00a0available in the Ubuntu repositories.<\/p>\n<p>Install nginx using apt command from the repository in the following way.<\/p>\n<p class=\"command\">apt install nginx<\/p>\n<p>When it&#8217;s done, start the service and enable it\u00a0to run automatically every time at system boot.<\/p>\n<p class=\"command\">systemctl start nginx<br \/>systemctl enable nginx<\/p>\n<p>Nginx web server is running under the default port 80. We can check the port using the netstat command, and check Nginx using curl command to get the HTTP status code, as shown below.<\/p>\n<p class=\"command\">netstat -plntu | grep 80<br \/>curl -I localhost<\/p>\n<p><a class=\"fancybox\" id=\"img-1\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts.png\" alt=\"Check ports with netstat\" width=\"500\" height=\"257\" title=\"\"><\/a><\/p>\n<p>Nginx installation has been completed.<\/p>\n<h2 id=\"step-install-and-configure-phpfpm\">Step 3 &#8211; Install and Configure PHP-FPM<\/h2>\n<p>LibreNMS is PHP based web application monitoring tool. It offers support for new PHP version 7.0, and we will be using it for this guide.<\/p>\n<p>Install PHP, PHP-FPM, and all extensions\/modules needed for LibreNMS installation using the apt command below.<\/p>\n<p class=\"command\">apt install php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl php7.0-fpm php7.0-mcrypt php7.0-json php-net-ipv4 php-net-ipv6<\/p>\n<p>Next, we need to add some configuration to php.ini files. We need to define the default timezone in\u00a0php.ini file and make sure the timezone matches with the current\u00a0timezone used by the system.<\/p>\n<p>Check the currently timezone used by the system with the following command.<\/p>\n<p class=\"command\">timedatectl<\/p>\n<p>You should\u00a0get a result similar to the following.<\/p>\n<p><a class=\"fancybox\" id=\"img-2\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-1.png\" alt=\"Check timezone settings\" width=\"500\" height=\"195\" title=\"\"><\/a><\/p>\n<p>You can see\u00a0the server is using the &#8216;<strong>Europe\/Paris<\/strong>&#8216; timezone.<\/p>\n<p>Now go to the PHP configuration directory and edit php.ini files for\u00a0the\u00a0cli and fpm config.<\/p>\n<p class=\"command\">cd \/etc\/php\/7.0\/<br \/>vim fpm\/php.ini<br \/>vim cli\/php.ini<\/p>\n<p>Uncomment the &#8216;<strong>date.time<\/strong>&#8216; line and change the value with our system timezone &#8216;<strong>Europe\/Paris<\/strong>&#8216;.<\/p>\n<pre class=\"system\">date.time = Europe\/Paris<\/pre>\n<p>Uncomment cgi configuration below, change the value to 0.<\/p>\n<pre class=\"system\">cgi.fix_pathinfo = 0<\/pre>\n<p>Save and exit.<\/p>\n<p>All configuration is complete. Now start the service and enable it to launch every time at system boot using the following systemctl commands.<\/p>\n<p class=\"command\">systemctl start php7.0-fpm<br \/>systemctl enable php7.0-fpm<\/p>\n<p>PHP-FPM is now running on ubuntu server &#8211; it&#8217;s running under the sock file. Check it with the netstat command.<\/p>\n<p class=\"command\">netstat -pl | grep php<\/p>\n<p><a class=\"fancybox\" id=\"img-3\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/3.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-2.png\" alt=\"Check PHP-FPM process\" width=\"500\" height=\"162\" title=\"\"><\/a><\/p>\n<h2 id=\"step-install-and-configure-mariadb\">Step 4 &#8211; Install and Configure MariaDB<\/h2>\n<p>In this step, we will install the mariadb-server for the LibreNMS database. We will install, configure and create a new database and a new user for the LibreNMS installation.<\/p>\n<p>Install mariadb-server from ubuntu repository using the apt command below.<\/p>\n<p class=\"command\">apt install mariadb-server mariadb-client mariadb<\/p>\n<p>When it&#8217;s done, start the service, and enable\u00a0it to run automatically at system boot, something you can do\u00a0using the following systemctl commands.<\/p>\n<p class=\"command\">systemctl start mysql<br \/>systemctl enable mysql<\/p>\n<p>The database server mariadb is now running. Next we need to configure the root password for mariadb. We can use the &#8216;mysql_secure_installation&#8217; command below to configure the root password.<\/p>\n<p class=\"command\">mysql_secure_installation<\/p>\n<p>You will be asked about the new root password &#8211; type your password and press &#8216;Enter&#8217; to continue.<\/p>\n<pre class=\"system\">Set root password? [Y\/n] Y<br\/>Remove anonymous users? [Y\/n] Y<br\/>Disallow root login remotely? [Y\/n] Y<br\/>Remove test database and access to it? [Y\/n] Y<br\/>Reload privilege tables now? [Y\/n] Y<\/pre>\n<p>The root password for mariadb has been configured.<\/p>\n<p>Next, we must create a new database and user for LibreNMS. We will create a new database named &#8216;librenms&#8217;, a new user named &#8216;librenms&#8217; with password &#8216;hakase-labs123&#8217;.<\/p>\n<p>Log in to the mariadb shell using the following command.<\/p>\n<p class=\"command\">mysql -u root -p<br \/>Type the ROOT Password:<\/p>\n<p>Run mariadb queries below to create a new database and user, and grant all privileges on the database to the new user.<\/p>\n<p class=\"command\">CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;<br \/>CREATE USER &#8216;librenms&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;hakase-labs123&#8217;;<br \/>GRANT ALL PRIVILEGES ON librenms.* TO &#8216;librenms&#8217;@&#8217;localhost&#8217;;<br \/>FLUSH PRIVILEGES;<\/p>\n<p>A new database and user for LibreNMS has been created.<\/p>\n<p><a class=\"fancybox\" id=\"img-4\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/4.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-3.png\" alt=\"Add a database\" width=\"500\" height=\"305\" title=\"\"><\/a><\/p>\n<p>For the LibreNMS installation, we need to add some configuration to the configuration file. Go to the &#8216;\/etc\/mysql\/&#8217; directory and edit the mariadb configuration file.<\/p>\n<p class=\"system command\">cd \/etc\/mysql\/<br \/>vim mariadb.conf.d\/50-server.cnf<\/p>\n<p>Paste configuration below under the &#8216;<strong>[mysqld]<\/strong>&#8216; section.<\/p>\n<pre class=\"system\">innodb_file_per_table=1<br\/>sql-mode=\"\"<br\/>lower_case_table_names=0<\/pre>\n<p>Save and exit.<\/p>\n<p><a class=\"fancybox\" id=\"img-5\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/5.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-4.png\" alt=\"Change MariaDB settings\" width=\"500\" height=\"220\" title=\"\"><\/a><\/p>\n<p>Now apply the new configuration by restarting the service.<\/p>\n<p class=\"command\">systemctl restart mysql<\/p>\n<p>The mariadb database configuration has been completed.<\/p>\n<h3 id=\"step-download-and-configure-librenms\">Step 5 &#8211; Download and Configure LibreNMS<\/h3>\n<p>In this step, we will configure the system for LibreNMS installation.<\/p>\n<p><strong>&#8211; Add New User and Download LibreNMS<\/strong><\/p>\n<p>Create a new system user named &#8216;librenms&#8217;, define &#8216;\/opt\/librenms&#8217; as the default home directory for the user, and assign the new &#8216;librenms&#8217; user to the www-data group.<\/p>\n<p>Run the following command to do it all.<\/p>\n<p class=\"command\">useradd librenms -d \/opt\/librenms -M -r<br \/>usermod -a -G librenms www-data<\/p>\n<p>Now go to the &#8216;\/opt\/&#8217; directory and download the LibreNMS source code using the git command.<\/p>\n<p class=\"command\">cd \/opt\/<br \/>git clone https:\/\/github.com\/librenms\/librenms.git librenms<\/p>\n<p><a class=\"fancybox\" id=\"img-6\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-5.png\" alt=\"Add librenms user\" width=\"500\" height=\"255\" title=\"\"><\/a><\/p>\n<p>Next, create a new directory for libreNMS log files and rrd files.<\/p>\n<p class=\"command\">mkdir -p \/opt\/librenms\/{logs,rrd}<\/p>\n<p>Change ownership permissions for the &#8216;rrd&#8217; directory to &#8216;775&#8217;, and change the owner of the &#8216;librenms&#8217; directory to the &#8216;librenms&#8217; user and group.<\/p>\n<p class=\"command\">chmod -R 775 \/opt\/librenms\/rrd\/<br \/>chown -R librenms:librenms \/opt\/librenms\/<\/p>\n<p><a class=\"fancybox\" id=\"img-7\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/7.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-6.png\" alt=\"Create a directory\" width=\"500\" height=\"135\" title=\"\"><\/a><\/p>\n<p>A new &#8216;librenms&#8217; has been created, and the LibreNMS source code has been downloaded.<\/p>\n<p><strong>&#8211; Configure LibreNMS Virtualhost<\/strong><\/p>\n<p>Go to the &#8216;nginx&#8217; configuration directory and create a new virtual host file &#8216;librenms&#8217; with\u00a0<a href=\"https:\/\/www.howtoforge.com\/vim-basics\" target=\"_blank\" rel=\"noopener noreferrer\">vim<\/a><\/p>\n<p class=\"command\">cd \/etc\/nginx\/<br \/>vim sites-available\/librenms<\/p>\n<p>Paste the following LibreNMS Virtual host configuration there.<\/p>\n<pre class=\"system\" readability=\"17\">server {<p>\u00a0\u00a0\u00a0 # Add your own domain name<br\/>\u00a0\u00a0\u00a0 listen\u00a0\u00a0\u00a0\u00a0\u00a0 80;<br\/>\u00a0\u00a0\u00a0 server_name librenms.irsyadf.me;<\/p><p>\u00a0\u00a0\u00a0 # LibreNMS Webroot directory<br\/>\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/opt\/librenms\/html;<br\/>\u00a0\u00a0\u00a0 index\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 index.php;<\/p><p>\u00a0\u00a0\u00a0 # LibreNMS logs<br\/>\u00a0\u00a0\u00a0 access_log\u00a0 \/opt\/librenms\/logs\/access_log;<br\/>\u00a0\u00a0\u00a0 error_log\u00a0\u00a0 \/opt\/librenms\/logs\/error_log;<br\/>\u00a0\u00a0\u00a0 <br\/>\u00a0\u00a0\u00a0 # Enabling Gzip compression on Nginx<br\/>\u00a0\u00a0\u00a0 charset utf-8;<br\/>\u00a0\u00a0\u00a0 gzip on;<br\/>\u00a0\u00a0\u00a0 gzip_types text\/css application\/javascript text\/javascript application\/x-javascript image\/svg+xml text\/plain text\/xsd text\/xsl text\/xml image\/x-icon;<br\/>\u00a0\u00a0\u00a0 <br\/>\u00a0\u00a0\u00a0 location \/ {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 try_files $uri $uri\/ \/index.php?$query_string;<br\/>\u00a0\u00a0\u00a0 }<br\/>\u00a0\u00a0\u00a0 <br\/>\u00a0\u00a0\u00a0 location \/api\/v0 {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 try_files $uri $uri\/ \/api_v0.php?$query_string;<br\/>\u00a0\u00a0\u00a0 }<\/p><p>\u00a0\u00a0\u00a0 # PHP-FPM handle all .php files requests<br\/>\u00a0\u00a0\u00a0 location ~ \\.php {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include fastcgi.conf;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_split_path_info ^(.+\\.php)(\/.+)$;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;<br\/>\u00a0\u00a0\u00a0 }<br\/>\u00a0<br\/>\u00a0\u00a0\u00a0 location ~ \/\\.ht {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deny all;<br\/>\u00a0\u00a0\u00a0 }<br\/>}<\/p><\/pre>\n<p>Save and exit. Now, activate the virtualhost.<\/p>\n<p class=\"command\">ln -s \/etc\/nginx\/sites-available\/librenms \/etc\/nginx\/sites-enabled\/<\/p>\n<p>Test the nginx configuration and make sure there is no error. Then restart the service.<\/p>\n<p class=\"command\">nginx -t<br \/>systemctl restart nginx<\/p>\n<p><a class=\"fancybox\" id=\"img-8\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/8.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-7.png\" alt=\"Enable LibreNMS vhost in Nginx\" width=\"500\" height=\"146\" title=\"\"><\/a><\/p>\n<p><strong>&#8211; Configure UFW Firewall<\/strong><\/p>\n<p>Add new ports to the firewall. Add new ssh, http, https and the port used by snmpd 161 udp type to the ufw firewall.<\/p>\n<p>Run the following ufw commands.<\/p>\n<p class=\"command\">ufw allow ssh<br \/>ufw allow http<br \/>ufw allow https<br \/>ufw allow 161\/udp<\/p>\n<p><a class=\"fancybox\" id=\"img-9\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/9.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-8.png\" alt=\"Configure UFW firewall\" width=\"419\" height=\"336\" title=\"\"><\/a><\/p>\n<p>Start the ufw firewall with the ufw enable command as shown below.<\/p>\n<p class=\"command\">ufw enable<\/p>\n<p>Type &#8216;y&#8217; and press &#8216;Enter&#8217; to confirm. Start and enable it to launch every time at system boot.<\/p>\n<p>If you want to see the firewall status, run the &#8216;ufw status&#8217; command.<\/p>\n<p class=\"command\">ufw status<\/p>\n<p>You will get the firewall status &#8211; active or inactive &#8211; and the list of ports and service added to the firewall.<\/p>\n<p><a class=\"fancybox\" id=\"img-10\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/10.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-9.png\" alt=\"List firewall configuration\" width=\"500\" height=\"320\" title=\"\"><\/a><\/p>\n<h2 id=\"step-librenms-web-installer\">Step 6 &#8211; LibreNMS Web Installer<\/h2>\n<p>After\u00a0all the above steps are complete, we need to install LibreNMS through the web browser. Open your web browser, type the LibreNMS domain name &#8216;librenms.hakase-labs.co&#8217; in\u00a0the address bar and press Enter.<\/p>\n<p><strong>&#8211; Checking PHP Modules<\/strong><\/p>\n<p>You will be redirected to the install.php page showing the result of PHP module support checks. Make sure all status is green as shown below.<\/p>\n<p><a class=\"fancybox\" id=\"img-11\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/11.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-10.png\" alt=\"LibreNMS web installer\" width=\"500\" height=\"239\" title=\"\"><\/a><\/p>\n<p>Click &#8216;<strong>Next Stage<\/strong>&#8216; to continue.<\/p>\n<p><strong>&#8211; Database Configuration<\/strong><\/p>\n<p>Fill all the database info with your own db.<\/p>\n<ul>\n<li>DB User: librenms<\/li>\n<li>DB Pass: hakase-labs123<\/li>\n<li>DB Name: librenms<\/li>\n<\/ul>\n<p><a class=\"fancybox\" id=\"img-12\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/12.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-11.png\" alt=\"Set database details\" width=\"500\" height=\"289\" title=\"\"><\/a><\/p>\n<p>And click &#8216;<strong>Next Stage<\/strong>&#8216;.<\/p>\n<p><strong>&#8211; Importing MySQL Database<\/strong><\/p>\n<p>Wait for the installer script to\u00a0import sample of database to our database &#8211; do not close the browser tab during this process.<\/p>\n<p><a class=\"fancybox\" id=\"img-13\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/13.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-12.png\" alt=\"Stage 2 completed\" width=\"500\" height=\"346\" title=\"\"><\/a><\/p>\n<p>After\u00a0all db is imported, click &#8216;<strong>Goto Add User<\/strong>&#8216;.<\/p>\n<p><strong>&#8211; Add Admin User<\/strong><\/p>\n<p>Here, type your admin user, email, and password.<\/p>\n<p><a class=\"fancybox\" id=\"img-14\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/14.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-13.png\" alt=\"Add the admin user\" width=\"500\" height=\"232\" title=\"\"><\/a><\/p>\n<p>Click &#8216;<strong>Add User<\/strong>&#8216;.<\/p>\n<p><strong>&#8211; Generate LibreNMS Config<\/strong><\/p>\n<p><strong><a class=\"fancybox\" id=\"img-15\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/15.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-14.png\" alt=\"Generate LibreNMS config\" width=\"500\" height=\"180\" title=\"\"><\/a><\/strong><\/p>\n<p>Click the &#8216;<strong>Generate Config<\/strong>&#8216; button.<\/p>\n<p>And you will get a\u00a0config file similar to the one shown below.<\/p>\n<p><a class=\"fancybox\" id=\"img-16\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/16.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-15.png\" alt=\"Save config to file\" width=\"500\" height=\"348\" title=\"\"><\/a><\/p>\n<p>Copy the php config script, and come back to your ssh session. Goto the &#8216;\/opt\/librenms&#8217; directory and create the &#8216;config.php&#8217; file manually using vim.<\/p>\n<p class=\"command\">cd \/etc\/librenms\/<br \/>vim config.php<\/p>\n<p>Paste the configuration there, and change the ownership of the file to librenms user and group.<\/p>\n<p class=\"command\">chown librenms:librenms config.php<\/p>\n<p><a class=\"fancybox\" id=\"img-17\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/17.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-16.png\" alt=\"Chown config file to librensm user and group\" width=\"500\" height=\"127\" title=\"\"><\/a><\/p>\n<p>Back to your web browser and click the &#8216;<strong>Finish Install<\/strong>&#8216; button.<\/p>\n<p>Now you get to the last page from the librenms web installer\u00a0&#8211; see below.<\/p>\n<p><a class=\"fancybox\" id=\"img-18\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/18.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-17.png\" alt=\"Installation finished\" width=\"500\" height=\"223\" title=\"\"><\/a><\/p>\n<h2 id=\"step-nbspfinal-configuration\">Step 7 &#8211;\u00a0Final configuration<\/h2>\n<p>After the installation through web browser is complete, we need to do some\u00a0other steps.<\/p>\n<p><strong>&#8211; Configure SNMP<\/strong><\/p>\n<p>Backup default configuration file and copy the sample configuration to the &#8216;\/etc\/snmp\/&#8217; directory.<\/p>\n<p class=\"command\">mv \/etc\/snmp\/snmpd.conf \/etc\/snmp\/snmpd.conf.aseli<br \/>cp \/opt\/librenms\/snmpd.conf.example \/etc\/snmp\/snmpd.conf<\/p>\n<p>Edit the new configuration with vim.<\/p>\n<p class=\"command\">vim \/etc\/snmp\/snmpd.conf<\/p>\n<p>Replace the &#8216;RANDOMSTRINGGOESHERE&#8217; line with your own community name &#8216;hakaselabs&#8217;, as shown below.<\/p>\n<pre class=\"system\">com2sec readonly\u00a0 default\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 hakaselabs<\/pre>\n<p>Save and exit.<\/p>\n<p><a class=\"fancybox\" id=\"img-19\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/19.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-18.png\" alt=\"SNMP config file\" width=\"500\" height=\"209\" title=\"\"><\/a><\/p>\n<p>Next, we need to download the distro detection script. Download it using curl, then make the script executable, then finally, restart the snmp service.<\/p>\n<p class=\"command\">curl -o \/usr\/bin\/distro https:\/\/raw.githubusercontent.com\/librenms\/librenms-agent\/master\/snmp\/distro<br \/>chmod +x \/usr\/bin\/distro<br \/>systemctl restart snmpd<\/p>\n<p><a class=\"fancybox\" id=\"img-20\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/20.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-19.png\" alt=\"Restart smtpd\" width=\"500\" height=\"125\" title=\"\"><\/a><\/p>\n<p><strong>&#8211; Crontab and Logrotate Configuration<\/strong><\/p>\n<p>Goto the librenms directory and copy sample configuration for Crontab and Logrotate.<\/p>\n<p class=\"command\">cd \/opt\/librenms\/<\/p>\n<p>Copy the configuration.<\/p>\n<p class=\"command\">cp librenms.nonroot.cron \/etc\/cron.d\/librenms<br \/>cp misc\/librenms.logrotate \/etc\/logrotate.d\/librenms<\/p>\n<p>Now restart the cron service and reload the logrotate configuration.<\/p>\n<p class=\"command\">systemctl restart cron<br \/>logrotate -f \/etc\/logrotate.conf<\/p>\n<p><a class=\"fancybox\" id=\"img-21\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/21.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-20.png\" alt=\"Crontab configuration\" width=\"500\" height=\"124\" title=\"\"><\/a><\/p>\n<p><strong>&#8211; Validate Configuration<\/strong><\/p>\n<p>Wait for some time until the cron script is running on the system. Once that is done, validate with &#8216;validate.php&#8217; script.<\/p>\n<p>Goto the librenms directory and run the validate script.<\/p>\n<p class=\"command\">cd \/opt\/librenms\/<br \/>.\/validate.php<\/p>\n<p>If your installation is correct, you will get the result as shown below.<\/p>\n<p><a class=\"fancybox\" id=\"img-22\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_setup_librenms_monitoring_tools_with_nginx_on_ubuntu_1604\/big\/22.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2017\/12\/how-to-setup-librenms-monitoring-tool-with-nginx-on-ubuntu-16-04-lts-21.png\" alt=\"Validate LibreNMS setup\" width=\"500\" height=\"355\" title=\"\"><\/a><\/p>\n<p>LibreNMS Installation with Nginx Webserver on Ubuntu 16.04 is complete.<\/p>\n<h2 id=\"reference\">Reference<\/h2>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>LibreNMS is an open source monitoring tool based on PHP\/MYSQL\/SNMP. It&#8217;s a featured network monitoring system that provides support for wide range of network hardware and operating systems including, FreeBSD, Cisco, Linux, HP etc. In this tutorial, I will show you how to install and configure the\u00a0open source monitoring tool &#8216;LibreNMS&#8217; using Nginx as the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2236","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=2236"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2236\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=2236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=2236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=2236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}