Before we start, you will need a Debian 10 VPS (you can get one on digitalocean for example), if you prefer to use your own self hosted server, make sure that port 80 and 443 are correctly port forwarded so that the public ip points to the server and not the router. Once that's done, go and ssh into your debian 10 server.
First we get every package we need:
apt-get -y install apt-transport-https lsb-release ca-certificates curl gnupg -y
apt-get update -y
apt install acl curl socat composer fping git graphviz imagemagick mariadb-server mtr-tiny nginx-full nmap php7.3-cli php7.3-mysqlnd php7.3-curl php7.3-fpm php7.3-gd php7.3-json php7.3-mbstring php7.3-pgsql php7.3-snmp php7.3-xml php7.3-zip python-memcache python-mysqldb rrdtool snmp snmpd whois python3-pymysql python3-dotenv python3-redis python3-setuptools -y
Then we add the librenms user
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms www-data
Next we install LibreNMS:
cd /opt
git clone https://github.com/librenms/librenms.git
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/
Next we'll install the php dependencies:
su - librenms
bash
./scripts/composer_wrapper.php install --no-dev
exit
exit
From here, we need to install MySQL:
service mysql restart
mysql -u root -p
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'P@SSW0RD';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
Take note here that we are using the password 'P@SSW0RD'
Now we'll edit mariadb's configuration:
echo 'innodb_file_per_table=1' >> /etc/mysql/mariadb.conf.d/50-server.cnf
echo 'lower_case_table_names=0' >> /etc/mysql/mariadb.conf.d/50-server.cnf
service mysql restart
Next we edit php.ini:
cd /etc/php/7.3/
echo 'date.timezone = Europe/Paris' >> fpm/php.ini
echo 'date.timezone = Europe/Paris' >> cli/php.ini
service php7.3-fpm restart
Before we configure NGINX, we need to get a domain name, so if you don't have it, go and get one make sure it points to your server's public ip address, if you don't want to pay for a domain name just go on DuckDNS.
Now we will configure NGINX:
First of all, we'll get the free SSL certificate:
wget -O - https://get.acme.sh | sh
source ~/.bashrc
Here you verify your ip domain name is correctly setup like so:
Once there we can use acme.sh to get the free SSL certificate:
systemctl stop nginx
acme.sh --issue --standalone -d ech2.duckdns.org -k 4096
systemctl start nginx
From here we need to make sure the nginx configuration is correct:
rm /etc/nginx/sites-enabled/default
wget https://ech1.netlify.app/servers/librenms/librenms.vhost -O /etc/nginx/sites-available/librenms.vhost
nano /etc/nginx/sites-available/librenms.vhost
Make sure you change the librenms.vhost server_name line to your domain name:
Once you're done, do the following:
ln -s /etc/nginx/sites-available/librenms.vhost /etc/nginx/sites-enabled/librenms.vhost
nginx -t
service nginx reload
If nginx doesn't accept your configuration, you most probably made a mistake changing the domain name, so double check and correct it until nginx successfully reloads the configuration.
Next we'll configure SNMPD
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
chmod 600 /etc/snmp/snmpd.conf
nano /etc/snmp/snmpd.conf
in snmpd.conf make sure you change the text "RANDOMSTRINGGOESHERE" and change it to your community string
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /usr/bin/distro
service snmpd restart
Now we'll setup Cronjob:
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
copy logrotate config:
cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
And we should be done!
Now that's done, just go to the URL of your website : http://ech2.duckdns.org/
after that, head over to the database installation tab and just put in the password you put earlier (here it's P@SSW0RD)
Here just hit "build database"
Create the admin user:
Here for some reason it failed to write to the .env file so we manually edit it:
nano /opt/librenms/.env
just delete every line (ctrl+k) and then paste in the contents of the file shown on the webpage (CTRL+SHIFT+V), then hit CTRL+S to save and CTRL+X to exit
And that's it! All that's left is for you to login and setup the rest of librenms
Take note here that the ech2 community input field is the community "randomstringgoeshere" we put in the snmpd.conf earlier
Some Address 67120,
Duttlenheim, France.
This cute theme was created to showcase your work in a simple way. Use it wisely.