{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreia4ohxnsgn34uxhuadmpmwagahssbe53jesg4qiddujrg4cld3av4",
    "uri": "at://did:plc:om3y3n35sj2qfdrmdvrzmusa/app.bsky.feed.post/3mlcagaxfmrs2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreigkucm5o55e7x4ul2m7o5fspdde3iya6exfcjwmrbwwjzgrarqjny"
    },
    "mimeType": "image/webp",
    "size": 18398
  },
  "path": "/2026/05/07/monitor-your-services-with-librenms-on-freebsd/",
  "publishedAt": "2026-05-07T10:45:00.000Z",
  "site": "https://it-notes.dragas.net",
  "tags": [
    "freebsd",
    "monitoring",
    "server",
    "networking",
    "hosting",
    "tutorial",
    "security",
    "jail",
    "ownyourdata",
    "LibreNMS",
    "Uptime-Kuma",
    "official LibreNMS documentation"
  ],
  "textContent": "LibreNMS has been a faithful companion for years now. It quietly handles the monitoring of my servers, devices, and services without demanding much in return - exactly what you want from a tool whose job is to watch over everything else. It's a solid alternative to heavier solutions like Zabbix, and it gives you alerts, data, and graphs on virtually anything reachable over SNMP.\n\nI usually install it on a host that is _not_ reachable from the outside, then let it poll all the devices through a VPN: a single observation point, clean perimeter. The ability to create multiple dashboards - and to filter them by user - has also let me give clients a transparent window onto their own servers. Transparency, in my experience, is always the better long-term bet.\n\nTogether with Uptime-Kuma (and the good old Nagios/Munin pair), LibreNMS lives in a FreeBSD jail on my monitoring servers and just does its job.\n\nThis post walks through a plain installation of LibreNMS on FreeBSD: package-based, no reverse proxy, no HTTPS, no fancy hardening. The goal is to get to a working setup you can build on top of.\n\n## Assumptions\n\n  * FreeBSD 15.0-RELEASE, in a jail or on a dedicated VM/host\n  * nginx + php-fpm + MySQL 8.4\n  * LibreNMS installed from the official package — not via `git clone`\n\n\n\nOne note before we start: in this guide I use plain HTTP just to reach the first-time setup. If your LibreNMS instance won't stay confined to a private network or behind a VPN, configuring HTTPS is mandatory, not optional.\n\n## Installation\n\n\n    pkg install librenms mysql84-server python3 nginx\n\n\nLibreNMS currently depends on PHP 8.4. If you want to speed PHP up, install OPcache too:\n\n\n    pkg install php84-opcache\n\n\n## MySQL\n\nTwo settings need to be in place _before_ MySQL starts for the first time. After the first start they cannot be changed without reinitializing the data directory, so it's worth getting them right now.\n\n\n    cd /usr/local/etc/mysql\n    cp my.cnf.sample my.cnf\n\n\nIn the `[mysqld]` section, add:\n\n\n    innodb_file_per_table=1\n    lower_case_table_names=0\n\n\nNow start MySQL:\n\n\n    service mysql-server enable\n    service mysql-server start\n\n\nOn a fresh FreeBSD install, the local `root` user can connect to MySQL without a password from the command line. Connect and create the database and user. I'm using `password` here as a placeholder - don't.\n\n\n    mysql\n\n\n\n    CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n    CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';\n    GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';\n    exit\n\n\n## php-fpm\n\nEdit `/usr/local/etc/php-fpm.d/www.conf` and adjust the listen directives:\n\n\n    listen = /var/run/php-fpm-librenms.sock\n    listen.owner = www\n    listen.group = www\n    listen.mode = 0660\n\n\nThen create `php.ini` from the production sample:\n\n\n    cd /usr/local/etc\n    cp php.ini-production php.ini\n\n\nAnd set the timezone in `php.ini`:\n\n\n    date.timezone = Europe/Rome\n\n\n## nginx\n\nSince this jail (or host) is dedicated to LibreNMS, we can rewrite the `server` block in `/usr/local/etc/nginx/nginx.conf` directly:\n\n\n    server {\n        listen      80;\n        #server_name yourServerName\n        root        /usr/local/www/librenms/html;\n        index       index.php;\n\n        charset utf-8;\n        gzip on;\n        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;\n\n        location / {\n            try_files $uri $uri/ /index.php?$query_string;\n        }\n\n        location /api/v0 {\n            try_files $uri $uri/ /api_v0.php?$query_string;\n        }\n\n        location ~ \\.php$ {\n            fastcgi_split_path_info ^(.+\\.php)(/.*)$;\n            set $path_info $fastcgi_path_info;\n            try_files $fastcgi_script_name =404;\n            include fastcgi_params;\n            fastcgi_param SERVER_SOFTWARE \"\";\n            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n            fastcgi_param PATH_INFO $path_info;\n            fastcgi_index index.php;\n            fastcgi_pass unix:/var/run/php-fpm-librenms.sock;\n            fastcgi_buffers 256 4k;\n            fastcgi_intercept_errors on;\n            fastcgi_read_timeout 14400;\n        }\n\n        location ~ /\\.(?!well-known).* {\n            deny all;\n        }\n    }\n\n\nNow start nginx and php-fpm:\n\n\n    service nginx enable\n    service nginx start\n\n    service php_fpm enable\n    service php_fpm start\n\n\n## LibreNMS configuration\n\nCopy the default config:\n\n\n    cp /usr/local/www/librenms/config.php.default /usr/local/www/librenms/config.php\n\n\nBecause we installed from the package, this file already has the right commands and paths for FreeBSD - no need to hunt down `mtr`, `fping`, `snmpwalk` and friends one by one.\n\nCreate the directory for RRD graphs and set ownership:\n\n\n    mkdir -p /var/db/librenms/rrd\n    chown -R www:www /var/db/librenms\n    chmod 775 /var/db/librenms/rrd\n\n\nThen the `.env` file:\n\n\n    cd /usr/local/www/librenms\n    cp .env.example .env\n    chown www .env\n\n\nEdit `.env` and set at least:\n\n  * `DB_DATABASE` - `librenms`\n  * `DB_USERNAME` - `librenms`\n  * `DB_PASSWORD` - the one you actually used (not `password`, please)\n\n\n\nThen add this line, which tells LibreNMS we still need to run the web installer:\n\n\n    INSTALL=true\n\n\nA note on permissions. The official LibreNMS documentation suggests `chown -R www:www` over the entire application tree, but on FreeBSD the package already lays down sane ownership, with `storage/` and `bootstrap/cache/` writable by `www`. There's no reason to widen the rest of the codebase. If `validate.php` complains later about something write-related, the first place to check is:\n\n\n    ls -la /usr/local/www/librenms/storage /usr/local/www/librenms/bootstrap/cache\n\n\nNow generate the app key as `www`, since the file is owned by `www`:\n\n\n    su -m www -c \"php artisan key:generate\"\n\n\nAnd tighten `.env`:\n\n\n    chmod 600 .env\n\n\nRefresh the configuration cache:\n\n\n    su -m www -c \"lnms config:clear\"\n    su -m www -c \"lnms config:cache\"\n\n\n## Web installer\n\nOpen `http://host/install` and follow the steps. The validation process may fail. Refreshing the cache picks up the values written to `config.php` during the install:\n\n\n    su -m www -c \"lnms config:clear\"\n    su -m www -c \"lnms config:cache\"\n\n\nWhen the web installer is done, edit .env again and remove the INSTALL=true line if it's still there. Leaving it in place re-exposes the installer to anyone who can reach the URL.\n\n## Polling service\n\nLibreNMS needs something to actually run the polls. On FreeBSD, the package ships an rc service that runs the LibreNMS dispatcher, so there's no need to manage cron entries by hand the way most Linux guides assume.\n\n\n    service librenms enable\n    service librenms start\n\n\n## Validate\n\n\n    cd /usr/local/www/librenms\n    su -m www -c './validate.php'\n\n\nYou may see a couple of complaints right after starting the service - usually scheduler-related and self-resolving within a few minutes. Re-run `validate.php` once the dispatcher has had time to settle. Anything still red after that is worth investigating.\n\n## Next steps\n\nAt this point you can log into the web interface and start adding devices, configuring SNMP, and building dashboards. For that, the official LibreNMS documentation is excellent, and there's no point in me paraphrasing it here.",
  "title": "Monitor your devices with LibreNMS on FreeBSD"
}