# Running LibreNMS in Docker on Ubuntu Server

## What is LibreNMS

> LibreNMS is an autodiscovering PHP/MySQL/SNMP based network monitoring which includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, Brocade, Foundry, HP and many more. -https://github.com/librenms/librenms

## Installing Docker

1. Log into the Linux based device
2. Run the following commands in the terminal
   # install prerequisites
   sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
   # add docker gpg key
   curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
   # add docker software repository
   sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
   # install docker
   sudo apt install docker-ce docker-compose containerd.io -y
   # enable and start docker service
   sudo systemctl enable docker && sudo systemctl start docker
   # add the current user to the docker group
   sudo usermod -aG docker $USER
   # reauthenticate for the new group membership to take effect
   su - $USER

## Running LibreNMS

1. Now that Docker is installed, run the following commands to setup the LibreNMS Docker container and run it
   # create working directories
   mkdir /home/$USER/docker/librenms -p && mkdir /home/$USER/docker/mariadb -p
   # run the mariadb docker container
   docker run --name mariadb -e MYSQL_ROOT_PASSWORD=p@$$word -e MYSQL_USER=librenms_rw -e MYSQL_PASSWORD=librenms -e MYSQL_DATABASE=librenms -v /home/$USER/docker/mariadb:/var/lib/mysql -p 3306:3306 -d mariadb
   # run the librenms docker container, replace 10.10.27.11 with your docker host IP address
   docker run -d --name librenms -v /home/$USER/docker/librenms:/data -e TZ=America/New_York -e DB_HOST=10.10.27.11 -e DB_NAME=librenms -e DB_USER=librenms_rw -e DB_PASSWORD=librenms --network host librenms/librenms:latest
2. Open a web browser and navigate to http://DNSorIP:8000
3. Login to LibreNMS with username librenms and password librenms
4. Welcome to LibreNMS running in a Docker container
5. Hover over librenms in the top right > My Settings
6. Enter the current password (librenms) and enter and confirm a new password > Click the Change Password button

Documentation: https://hub.docker.com/r/librenms/librenms/