Install LibreNMS Ubuntu 22.04
Install LibreNMS Ubuntu. LibreNMS a fully featured network monitoring system that provides a wealth of features and device support. LibreNMS merupakan tools monitoring perangkat jaringan yang OpenSource. LibreNMS ini memungkinkan untuk memantuak perangkat seperti Linux, Mikrotik, Juniper, FreeBSD dan banyak lagi. Protokol yang digunakan seperti SNMP, ARP, CDP, FDP, LLDP, OSPF dan BGP.
Feature LibreNMS
Here’s a brief list of supported features, some might be missing. If you think something is missing, feel free to ask us.
- Auto discovery
- Alerting
- Multiple environment sensors support
- Multiple protocols data collection (STP, OSPF, BGP etc)
- VLAN, ARP and FDB table collection
- Customizable Dashboards
- Device Backup integration (Oxidized, RANCID)
- Distributed Polling
- Multiple Authentication Methods (MySQL, LDAP, Active Directory, HTTP)
- NetFlow, sFlow, IPFIX (NfSen)
- Service monitoring (Nagios Plugins)
- Syslog (Integrated, Graylog)
- Traffic Billing (Quota, 95th Percentile)
- Two Factor Authentication
- API
- Auto Updating
Persiapan
Siapkan sebuah server Linux yang sudah di install. Disini kami menggunakan OS Ubuntu 22.04. LibreNMS ini Support untuk beberapa OS seperti Ubuntu 22.04, Ubuntu 20.04, Centos 8, Debian 11.
Langkah — Langkah
Pertama, rekomendasi dari kami harap Anda untuk melakukan Update pada System Linux terlebih dahulu, agar semua paket yang akan di install juga terbaru/latest. Untuk update System gunakan perintah berikut ini
apt update && apt upgrade
Setelah proses update selesai, Install beberapa depedencies yang diperlukan untuk instal LibreNMS Ubuntu 22.04, Gunakan perintah berikut ini
apt-get install rrdtool whois fping imagemagick graphviz mtr-tiny nmap python3-mysqldb snmp snmpd python3-pip python3-memcache mtr-tiny acl unzip git curl wget -y
Install WebServer, PHP and Database
Selanjutnya untuk kebutuhan LibreNMS, Anda perlu menginstall Nginx Server, Php, and Database, yaitu MariaDB. Ikuti proses Install dengan menggunakan perintah berikut ini
apt-get install nginx mariadb-server php php-pear php-cgi php-common php-curl php-mbstring php-gd php-mysql php-bcmath php-imap php-json php-xml php-snmp php-fpm php-zip -y
Jika proses Installasi sudah selesai, Anda harus mengganti Timezone lokasi dimana Anda berada, agar untuk Log Devide nantinnya sesuai dengan waktu dimana Anda berada.
Untuk mengganti TimeZone cukup dengan mengganti pada file php.ini.
nano /etc/php/8.1/fpm/php.ini
nano /etc/php/8.1/cli/php.ini
Ganti seperti berikut, jika menggunakan Editor nano, dapat menggunakan CTRL + W untuk mencari timezone, lalu ganti seperti berikut
date.timezone = "Asia/Jakarta"
Save and Clode, lalu restart service PHP-FPM yang barusan kita ganti timezone nya
systemctl restart php8.1-fpm
Lalu ganti Timezone server dengan menggunakan perintah berikut ini
timedatectl set-timezone Asia/Jakarta
Create Database Install LibreNMS Ubuntu
Jika Installasi PHP dan Konfigurasinya sudah selesai, selanjutnya kita perlu menambahkan Database untuk LibreNMS. Ikutin perintah berikut ini
Pertama, kita perlu masuk ke Database MariaDB, dengan menggunakan perintah berikut ini
mysql
Buat Sebuah User, Password dan Database. Mengunakan Perintah berikut ini
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
Untuk memastikan Database sudah dibuat, gunakan perintah berikut
show databases;
OUTPUT
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| librenms |
+--------------------+
2 rows in set (0.002 sec)
Lalu Exit
exit;
Lalu edit konfigurasi Database MariaDB Install LibreNMS Ubuntu. Buka file berikut
nano /etc/mysql/mariadb.conf.d/50-server.cnf
Tambahkan konfigurasi berikut pada diantara line [mysqld] :
innodb_file_per_table=1
sql-mode=""
lower_case_table_names=0
OUTPUT
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
innodb_file_per_table=1
sql-mode=""
lower_case_table_names=0
Simpan dan Close file tersebut, untuk menyetujui perubahan, Restart Service MariaDB
systemctl restart mariadb
Install LibreNMS Ubuntu and Configuration
Pertama untuk mulai Install LibreNMS ubuntu, kita perlu menambahkan user untuk LibreNMS.
useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
Lalu tambahkan user librenms tersebut ke Group www-data. ikuti perintah berikut ini
lalu pindah ke Directory /opt, dan download Package LibreNMS yang terbaru
cd /opt
git clone https://github.com/librenms/librenms.git
SET PERMISSIONS user yang telah kita buat tadi
chown -R librenms:librenms /opt/librenms
chmod 771 /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/
Lalu install dependecies
su - librenms
./scripts/composer_wrapper.php install --no-dev
OUTPUT
> LibreNMS\ComposerHelper::preInstall
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 114 installs, 0 updates, 0 removals
- Downloading amenadiel/jpgraph (v4.1.1)
- Downloading clue/socket-raw (v1.6.0)
- Downloading dapphp/radius (2.5.8)
- Downloading doctrine/deprecations (v1.0.0)
- Downloading doctrine/event-manager (1.2.0)
- Downloading doctrine/cache (2.2.0)
- Downloading doctrine/dbal (2.13.9)
- Downloading doctrine/inflector (2.0.6)
- Downloading doctrine/lexer (1.2.3)
- Downloading symfony/polyfill-ctype (v1.27.0)
- Downloading webmozart/assert (1.11.0)
- Downloading dragonmantank/cron-expression (v3.3.2)
- Downloading easybook/geshi (v1.0.8.19)
- Downloading symfony/polyfill-php80 (v1.27.0)
- Downloading symfony/polyfill-mbstring (v1.27.0)
Lalu exit dari user librenms
exit
Konfigurasikan PHP-FPM Install LibreNMS
Selanjutnya kita akan mengkonfigurasi PHP-FPM yaitu mengganti user untuk PHP ke librenms. ikut perintah berikut ini
cp /etc/php/8.1/fpm/pool.d/www.conf /etc/php/8.1/fpm/pool.d/librenms.conf
nano /etc/php/8.1/fpm/pool.d/librenms.conf
Ganti [www] to [librenms]
[librenms]
dan juga untuk user dan group ganti juga ke librenms
user = librenms
group = librenms
pada bagian listen pastikan sesuai dengan konfigurasi web server kita
(fastcgi_pass untuk NGINX) dan SetHandler untuk APACHE
listen = /run/php-fpm-librenms.sock
Konfigurasi Web Server (Install LibreNMS Ubuntu)
Selanjutnya kita akan mengkonfigurasi We Server NGINX, agar dapat diakase menggunakan Browser. masuk ke file config librenms
nano /etc/nginx/conf.d/librenms.conf
Tambahkan script berikut ini, untuk server_name dapat disesuikan dengna Domain atau IP Address yang Anda gunakan
server {
listen 80;
server_name librenms.dixmata.com;
root /opt/librenms/html;
index index.php;
charset utf-8;
gzip on;
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;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm-librenms.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
Hapus file config default dari Nginx agar tidak bentrok dengan konfigurasi LibreNMS yang akan kita buat.
rm /etc/nginx/sites-enabled/default
Save and Close, Uji coba konfigurasi Nginx yang telah kita tambahkan, apakah terjadi error. Gunakan perintah berikut ini.
nginx -t
OUTPUT
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Jika OK, maka lakukan Restart pada Service NGINX Web Server.
systemctl restart nginx
Check Status nginx, dengan perintah berikut ini
systemctl status nginx
OUTPUT
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-03-05 15:43:01 UTC; 5min ago
Docs: man:nginx(8)
Process: 40708 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 40709 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 40710 (nginx)
Tasks: 5 (limit: 4571)
Memory: 5.5M
CPU: 77ms
CGroup: /system.slice/nginx.service
├─40710 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─40711 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─40712 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─40713 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─40714 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Mar 05 15:43:01 libre systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 05 15:43:01 libre systemd[1]: Started A high performance web server and a reverse proxy server.
Lalu juga Restart pada PHP-FPM
systemctl restart php8.1-fpm
Dan juga check status
systemctl status php8.1-fpm
OUTPUT
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-03-05 15:42:52 UTC; 7min ago
Docs: man:php-fpm8.1(8)
Process: 40701 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS)
Main PID: 40694 (php-fpm8.1)
Status: "Processes active: 0, idle: 4, Requests: 4, slow: 0, Traffic: 0req/sec"
Tasks: 5 (limit: 4571)
Memory: 38.8M
CPU: 929ms
CGroup: /system.slice/php8.1-fpm.service
├─40694 "php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─40697 "php-fpm: pool librenms" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
├─40698 "php-fpm: pool librenms" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
├─40699 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
└─40700 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
Mar 05 15:42:51 libre systemd[1]: Starting The PHP 8.1 FastCGI Process Manager...
Mar 05 15:42:52 libre systemd[1]: Started The PHP 8.1 FastCGI Process Manager.
Terakhir restart serive MariaDB.
systemctl restart mariadb
Check status
systemctl status mariadb
OUTPUT
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-03-05 23:14:05 WIB; 2min 57s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 41085 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 41086 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 41088 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_P>
Process: 41142 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 41144 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 41126 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 8 (limit: 4571)
Memory: 61.3M
CPU: 785ms
CGroup: /system.slice/mariadb.service
└─41126 /usr/sbin/mariadbd
Acces LibreNMS With Web Interface
Sekarang kita sudah dapat membuka LibreNMS menggunakan Browser, buka Browser kesayangan Anda, lalu akses http://IP-Address-Server atau http://domain-anda.com. Maka kita akan masuk Pre Install dari LibreNMS.
Jika Pre-Install Check sudah OK, lanjut klik Icon Database, pastikan semua config ke Database sesuai dengan Database yang telah kita Installa dan Konfigurasi sebelumnya seperti Host, Port, User, Password , dan Nama Database. Klik > Check Credential
Jika pada Check Credential OK, maka akan tampil Build Database. klik > Build Database
Jika Sudah Oke untuk Database Credential dan Bulid Database, lanjutkan dengan Icon Kunci, yaitu membuat Admin untuk masuk ke LibreNMS Web Interface. Disana Anda akan diminta untuk membuat Username, Password dan Email. klik > Add User
Jika Berhasil makan terakhir Klik icon Ceklis, untuk menyelesaikan Pre-Install LibreNMS.
Anda akan diminta untuk memilih Additional Settings. Pilih sesuai dengan kebutuhan Anda. Klik > Finish
Klik > Valiadte Install
BACA JUGA : Install LibreNMS Ubuntu 22.04 | Dixmata Studio