LibreNMS Install On Debian

Install the required programs

sudo bash
apt install software-properties-common -y
apt update

apt install curl apache2 composer fping git graphviz imagemagick libapache2-mod-php7.3 mariadb-client mariadb-server mtr-tiny nmap php7.3-cli php7.3-curl php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-snmp php7.3-xml php7.3-zip python-memcache python-mysqldb rrdtool snmp snmpd whois -y

Add the librenms user

/usr/sbin/useradd librenms -d /opt/librenms -M -r
/usr/sbin/usermod -a -G librenms www-data

Install LibreNMS

cd /opt
git clone https://github.com/librenms/librenms.git
apt-get install acl
chown -R librenms:librenms /opt/librenms
chmod 770 /opt/librenms

setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
apt install python3-pip -y

su - librenms
./scripts/composer_wrapper.php install --no-dev
exit

Set up MySQL

systemctl restart mysql
mysql -uroot -p            # password1
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password2';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit

vi /etc/mysql/mariadb.conf.d/50-server.cnf

# in [mysqld] section:
innodb_file_per_table=1
lower_case_table_names=0

systemctl restart mysql

Sort out Apache

vi /etc/php/7.3/apache2/php.ini
vi /etc/php/7.3/cli/php.ini

Add    date.timezone = Australia/Brisbane

/usr/sbin/a2enmod php7.3
/usr/sbin/a2dismod mpm_event
/usr/sbin/a2enmod mpm_prefork

vi /etc/apache2/sites-available/librenms.conf

<VirtualHost *:80>
 DocumentRoot /opt/librenms/html/
 ServerName  librenms.domain.com

 AllowEncodedSlashes NoDecode
 <Directory "/opt/librenms/html/">
  Require all granted     
  AllowOverride All     
  Options FollowSymLinks MultiViews   
 </Directory>
</VirtualHost>

/usr/sbin/a2dissite 000-default
/usr/sbin/a2ensite librenms.conf
/usr/sbin/a2enmod rewrite
systemctl restart apache2

Sort out SNMP

cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
vi /etc/snmp/snmpd.conf        # Change public string

curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /usr/bin/distro
systemctl restart snmpd

cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms

Web setup

chown -R librenms:librenms /opt/librenms 
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
 /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/


db pass = password2 (from earlier in the setup)

username=admin
password=password
email=admin@localhost