{"id":1659,"date":"2017-10-12T00:10:02","date_gmt":"2017-10-12T00:10:02","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1659"},"modified":"2017-10-12T00:49:31","modified_gmt":"2017-10-12T00:49:31","slug":"install-librenms-on-ubuntu-with-https","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/install-librenms-on-ubuntu-with-https\/","title":{"rendered":"Install LibreNMS on Ubuntu with HTTPS"},"content":{"rendered":"<p>The goal of this guide is to install LibreNMS on an Ubuntu Server with a self signed certificate.\u00a0 Most of the steps are copied out of the LibreNMS Documentation found <a href=\"https:\/\/docs.librenms.org\/#Installation\/Installation-Ubuntu-1604-Apache\/\">here<\/a>.<\/p>\n<p><strong>Install required packages<\/strong><\/p>\n<pre>sudo apt 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<\/pre>\n<p><strong>Create LibreNMS user<\/strong><\/p>\n<pre>sudo useradd librenms -d \/opt\/librenms -M -r\r\nsudo usermod -a -G librenms www-data<\/pre>\n<p><strong>Install LibreNMS<\/strong><\/p>\n<pre>cd \/opt\r\nsudo git clone https:\/\/github.com\/librenms\/librenms.git librenms<\/pre>\n<p><strong>Configure MySQL<\/strong><\/p>\n<pre>sudo systemctl restart mysql\r\nsudo mysql -uroot -p<\/pre>\n<p>Run the following MySQL commands to create the LibreNMS user. Change password to your own password.<\/p>\n<pre>CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;\r\nCREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';\r\nGRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';\r\nFLUSH PRIVILEGES;\r\nexit<\/pre>\n<p>Edit following file<\/p>\n<pre>sudo vi \/etc\/mysql\/mariadb.conf.d\/50-server.cnf<\/pre>\n<p>Add the following inside the [mysqld] section<\/p>\n<pre>innodb_file_per_table=1\r\nsql-mode=\"\"\r\nlower_case_table_names=0<\/pre>\n<p>Restart MySQL<\/p>\n<pre>sudo systemctl restart mysql<\/pre>\n<p><strong>Configure PHP<\/strong><\/p>\n<p>Edit the two files and set the time zone, date.timezone.\u00a0 Example &#8220;America\/New_York&#8221;<\/p>\n<pre>sudo vi \/etc\/php\/7.0\/apache2\/php.ini\r\nsudo vi \/etc\/php\/7.0\/cli\/php.ini<\/pre>\n<p>Then run these commands<\/p>\n<pre>sudo a2enmod php7.0\r\nsudo a2dismod mpm_event\r\nsudo a2enmod mpm_prefork\r\nsudo phpenmod mcrypt<\/pre>\n<p><strong>Generate Self signed certificate<\/strong><\/p>\n<p>Enable ssl in apache<\/p>\n<pre class=\"code-pre \"><code>sudo a2enmod ssl<\/code><\/pre>\n<p>Generate Cert<\/p>\n<pre>sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout <span class=\"hljs-tag\">\/etc\/ssl\/private\/localhost.key<\/span> -out <span class=\"hljs-tag\">\/etc\/ssl\/certs\/localhost.crt<\/span><\/pre>\n<p><strong>Configure Apache<\/strong><\/p>\n<p>Edit the following config file<\/p>\n<pre>sudo vi \/etc\/apache2\/sites-available\/librenms.conf<\/pre>\n<p>Add the following<\/p>\n<pre><span class=\"hljs-tag\">&lt;VirtualHost *:443&gt;\r\n DocumentRoot \/opt\/librenms\/html\/\r\n ServerName librenms.example.com\r\n SSLEngine on\r\n SSLCertificateFile \/etc\/ssl\/certs\/localhost.crt\r\n SSLCertificateKeyFile \/etc\/ssl\/private\/localhost.key\r\n CustomLog \/opt\/librenms\/logs\/access_log combined\r\n ErrorLog \/opt\/librenms\/logs\/error_log\r\n AllowEncodedSlashes NoDecode\r\n &lt;Directory \"\/opt\/librenms\/html\/\"&gt;\r\n Require all granted\r\n AllowOverride All\r\n Options FollowSymLinks MultiViews\r\n &lt;\/Directory&gt;\r\n&lt;\/VirtualHost&gt;<\/span><\/pre>\n<p>Run the following commands<\/p>\n<pre>sudo a2ensite librenms.conf\r\nsudo a2enmod rewrite\r\nsudo systemctl restart apache2<\/pre>\n<p>Configure snmpd<\/p>\n<pre>sudo cp \/opt\/librenms\/snmpd.conf.example \/etc\/snmp\/snmpd.conf<\/pre>\n<p>Set the SNMP community string in the following file<\/p>\n<pre>sudo vi \/etc\/snmp\/snmpd.conf<\/pre>\n<p>Then run these commands<\/p>\n<pre>sudo curl -o \/usr\/bin\/distro https:\/\/raw.githubusercontent.com\/librenms\/librenms-agent\/master\/snmp\/distro\r\nsudo chmod +x \/usr\/bin\/distro\r\nsudo systemctl restart snmpd<\/pre>\n<p><strong>Setup Crontab<\/strong><\/p>\n<pre>sudo cp \/opt\/librenms\/librenms.nonroot.cron \/etc\/cron.d\/librenms<\/pre>\n<p><strong>Copy logrotate config<\/strong><\/p>\n<pre>sudo cp \/opt\/librenms\/misc\/librenms.logrotate \/etc\/logrotate.d\/librenms<\/pre>\n<p><strong>Set permissions<\/strong><\/p>\n<pre>mkdir -p \/opt\/librenms\/rrd \/opt\/librenms\/logs\r\nsudo chown -R librenms:librenms \/opt\/librenms\r\nsudo setfacl -d -m g::rwx \/opt\/librenms\/rrd \/opt\/librenms\/logs\r\nsudo setfacl -R -m g::rwx \/opt\/librenms\/rrd \/opt\/librenms\/logs<\/pre>\n<p><strong>Web Installer<\/strong><\/p>\n<p>Restart apache<\/p>\n<pre>sudo systemctl restart apache2<\/pre>\n<p>Finish the install by going to<\/p>\n<pre>https:\/\/your-server\/install.php<\/pre>\n<p>Change &#8220;your-server&#8221; to your server&#8217;s ip address, or hostname.\u00a0 Since we created a self signed certificate, you&#8217;ll need to accept the https error.<\/p>\n<p><strong>Validate<\/strong><\/p>\n<p>Back on the command line run the php validation script<\/p>\n<pre>sudo \/opt\/librenms\/validate.php<\/pre>\n<p>Finally log into your new LibreNMS instance by going to <\/p>\n<pre>https:\/\/your-server<\/pre>\n<p>Change &#8220;your-server&#8221; to your server&#8217;s IP address or hostname.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The goal of this guide is to install LibreNMS on an Ubuntu Server with a self signed certificate.\u00a0 Most of the steps are copied out of the LibreNMS Documentation found here. Install required packages sudo apt install apache2 composer fping &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/install-librenms-on-ubuntu-with-https\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[352,3,28],"tags":[357,353,7,134,356,49],"class_list":["post-1659","post","type-post","status-publish","format-standard","hentry","category-librenms","category-linux","category-ubuntu","tag-https","tag-librenms","tag-linux-2","tag-monitoring","tag-ssl","tag-ubuntu-2"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1659"}],"version-history":[{"count":11,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1659\/revisions"}],"predecessor-version":[{"id":1671,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1659\/revisions\/1671"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}