Run LibreNMS application locally for development, without PHP, mariadb-server or redis on the host. Only Docker, git and DDEV are needed.
Tested on Ubuntu 24.04 (WSL2), DDEV 1.25, Docker 29.
This setup binds everything to 127.0.0.1 with fixed ports, so nothing depends on
*.ddev.site DNS. LibreNMS is accessible on htttps://127.0.0.1:8888
Login with: u: admin / p: admin
sudo apt-get update -y && sudo apt-get install -y curl
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://pkg.ddev.com/apt/gpg.key | sudo tee /etc/apt/keyrings/ddev.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/ddev.asc
printf "Types: deb\nURIs: https://pkg.ddev.com/apt/\nSuites: *\nComponents: *\nSigned-By: /etc/apt/keyrings/ddev.asc\n" | sudo tee /etc/apt/sources.list.d/ddev.sources >/dev/null
sudo apt-get update -y && sudo apt-get install -y ddev
mkcert -installSave attached librenms-setup.sh as new file and chmod +x librenms-setup.sh, run it in an empty directory.
Ports are overridable: HTTP_PORT=9000 ./librenms-setup.sh.
Now start it with command ddev start.
Check that it all went well
# web, db, redis all OK
ddev describe
# should reply PONG
ddev redis-cli ping
ddev artisan migrate:status
curl -sk https://librenms.ddev.site/login | grep -o '<title>.*</title>'Start / stop with: ddev start / ddev stop / ddev poweroff
Reset everything: ddev stop --remove-data && ddev start.
Useful commands
# web container logs
ddev logs -f
# open in browser
ddev launch
# db shell (db/db/db, root/root)
ddev mysql
# redis-cli
ddev redis-cli
# laravel cli
ddev artisan tinker
# LibreNMS CLI
ddev exec "php lnms list"
PHP and Blade changes need no rebuild. Frontend:
Tests and lint before a PR:
```bash
ddev artisan test
ddev exec "vendor/bin/phpstan analyse"
ddev exec "vendor/bin/php-cs-fixer fix --dry-run --diff"If SNMP support is needed, uncomment webimage_extra_packages in .ddev/config.yaml and ddev restart.
Simulated devices come from lnms dev:simulate, which serves one of the 1900+
.snmprec recordings in tests/snmpsim/ over a local snmpsim daemon and registers
it as a device. snmpsim is Python, so install it first:
ddev exec "php lnms dev:simulate --setup-venv"
# start sim + add device 'snmpsim'
ddev exec "php lnms dev:simulate ios_c3560e"
ddev exec "php lnms device:discover snmpsim -vv"
ddev exec "php lnms device:poll snmpsim -vv"
ddev exec "snmpget -v2c -c ios_c3560e 127.1.6.1:1161 sysDescr.0"
# remove
ddev exec "php lnms dev:simulate ios_c3560e -r"