{"id":1800,"date":"2018-01-27T20:55:56","date_gmt":"2018-01-27T20:55:56","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1800"},"modified":"2018-01-27T21:01:16","modified_gmt":"2018-01-27T21:01:16","slug":"install-librenms-on-centos","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/install-librenms-on-centos\/","title":{"rendered":"Install LibreNMS on CentOS"},"content":{"rendered":"<h1>Install prerequisites<\/h1>\n<pre><code>yum install -y epel-release \r\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm\r\nyum install -y policycoreutils-python cronie fping git httpd ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nmap php71w php71w-cli php71w-common php71w-curl php71w-gd php71w-mcrypt php71w-mysql php71w-process php71w-snmp php71w-xml php71w-zip python-memcached rrdtool<\/code><\/pre>\n<h1>Setup LibreNMS user<\/h1>\n<pre><code>useradd librenms -d \/opt\/librenms -M -r\r\nusermod -a -G librenms apache<\/code><\/pre>\n<h1>Install LibreNMS<\/h1>\n<pre><code>cd \/opt\r\ngit clone https:\/\/github.com\/librenms\/librenms.git librenms<\/code><\/pre>\n<h1>Configure MySQL<\/h1>\n<p>Start MySQL<\/p>\n<pre>systemctl start mariadb\r\nmysql -u root<\/pre>\n<p>Create the Database and database user. Change password to a different password<\/p>\n<pre><code class=\"sql\">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<\/code><\/pre>\n<p>Disable MySQL strict mode<\/p>\n<pre><code>vi \/etc\/my.cnf<\/code><\/pre>\n<p>Add the following in the [mysqld] section<\/p>\n<pre>innodb_file_per_table=1\r\nsql-mode=\"\"\r\nlower_case_table_names=0<\/pre>\n<p>Enable and restart mariadb i.e.(MySQL)<\/p>\n<pre><code>systemctl enable mariadb\r\nsystemctl restart mariadb<\/code><\/pre>\n<p>Configure PHP.\u00a0 Set Timezone<\/p>\n<p>You can go <a href=\"https:\/\/secure.php.net\/manual\/en\/timezones.php\">here<\/a> to figure out which time zone you need.<\/p>\n<pre><code>vi  \/etc\/php.ini<\/code><\/pre>\n<p>Find the [Date] Section and change the timezone<\/p>\n<p>Example:<\/p>\n<pre>date.timezone = America\/New_York<\/pre>\n<h1>Configure Apache<\/h1>\n<pre><code>vi \/etc\/httpd\/conf.d\/librenms.conf<\/code><\/pre>\n<p>Add the following, change the server name.<\/p>\n<pre><code class=\"apache\">&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/opt\/librenms\/html\/\r\n  ServerName  librenms.example.com\r\n\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;<\/code><\/pre>\n<p>Enable and restart apache<\/p>\n<pre><code>systemctl enable httpd\r\nsystemctl restart httpd<\/code><\/pre>\n<h1>Allow fping<\/h1>\n<pre>cd \/opt\/librenms\r\nvi http_fping.tt<\/pre>\n<p>Add the following<\/p>\n<pre><code>module http_fping 1.0;\r\n\r\nrequire {\r\ntype httpd_t;\r\nclass capability net_raw;\r\nclass rawip_socket { getopt create setopt write read };\r\n}\r\n\r\n#============= httpd_t ==============\r\nallow httpd_t self:capability net_raw;\r\nallow httpd_t self:rawip_socket { getopt create setopt write read };<\/code><\/pre>\n<h1>Configure SELinux<\/h1>\n<p>You can disable SELinux completely in the \/etc\/selinux\/config file or run these commands to make LibreNMS and SELinux play together.<\/p>\n<pre><code>semanage fcontext -a -t httpd_sys_content_t '\/opt\/librenms\/logs(\/.*)?'\r\nsemanage fcontext -a -t httpd_sys_rw_content_t '\/opt\/librenms\/logs(\/.*)?'\r\nrestorecon -RFvv \/opt\/librenms\/logs\/\r\nsemanage fcontext -a -t httpd_sys_content_t '\/opt\/librenms\/rrd(\/.*)?'\r\nsemanage fcontext -a -t httpd_sys_rw_content_t '\/opt\/librenms\/rrd(\/.*)?'\r\nrestorecon -RFvv \/opt\/librenms\/rrd\/\r\nsetsebool -P httpd_can_sendmail=1\r\ncheckmodule -M -m -o http_fping.mod http_fping.tt\r\nsemodule_package -o http_fping.pp -m http_fping.mod\r\nsemodule -i http_fping.pp\r\n<\/code><\/pre>\n<h1>Configure Firewall<\/h1>\n<pre><code>firewall-cmd --zone public --add-service http\r\nfirewall-cmd --permanent --zone public --add-service http\r\nfirewall-cmd --zone public --add-service https\r\nfirewall-cmd --permanent --zone public --add-service https<\/code><\/pre>\n<h1>Configure snmpd<\/h1>\n<pre><code>cp \/opt\/librenms\/snmpd.conf.example \/etc\/snmp\/snmpd.conf<\/code><\/pre>\n<p>Edit the snmpd file and change RANDOMSTRINGGOESHERE to your community string<\/p>\n<pre>vi \/etc\/snmp\/snmpd.conf<\/pre>\n<p>Enable and restart snmpd<\/p>\n<pre><code>curl -o \/usr\/bin\/distro https:\/\/raw.githubusercontent.com\/librenms\/librenms-agent\/master\/snmp\/distro\r\nchmod +x \/usr\/bin\/distro\r\nsystemctl enable snmpd\r\nsystemctl restart snmpd<\/code><\/pre>\n<h1>Setup Cron Job and Cycle logs<\/h1>\n<pre><code>cp \/opt\/librenms\/librenms.nonroot.cron \/etc\/cron.d\/librenms<\/code><\/pre>\n<pre><code>cp \/opt\/librenms\/misc\/librenms.logrotate \/etc\/logrotate.d\/librenms<\/code><\/pre>\n<h1>Set Permisions<\/h1>\n<pre><code>chown -R librenms:librenms \/opt\/librenms\r\nsetfacl -d -m g::rwx \/opt\/librenms\/rrd \/opt\/librenms\/logs\r\nsetfacl -R -m g::rwx \/opt\/librenms\/rrd \/opt\/librenms\/logs<\/code><\/pre>\n<h1>Finish Install<\/h1>\n<p>Finish the install by<\/p>\n<pre>http:\/\/your-server-ip\/install.php<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Install prerequisites yum install -y epel-release rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm yum install -y policycoreutils-python cronie fping git httpd ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nmap php71w php71w-cli php71w-common php71w-curl php71w-gd php71w-mcrypt php71w-mysql php71w-process php71w-snmp php71w-xml php71w-zip python-memcached rrdtool Setup &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/install-librenms-on-centos\/\">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":[23,24,352,3,22],"tags":[353,7,134],"class_list":["post-1800","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-fedora-2","category-librenms","category-linux","category-redhat-linux","tag-librenms","tag-linux-2","tag-monitoring"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1800","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=1800"}],"version-history":[{"count":9,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1800\/revisions"}],"predecessor-version":[{"id":1812,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1800\/revisions\/1812"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}