instalación del aplicativo librenms
Post on 27-Jun-2022
9 Views
Preview:
TRANSCRIPT
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 1 de 34
Instalación del Aplicativo LibreNMS
CONSIDERACIONES DE LA GUÍA. ............................................................................................................................................. 1
a. Objetivo principal: .............................................................................................................................................................. 1 b. Software necesario ............................................................................................................................................................. 1
FASE I – CONFIGURACIÓN DE RED PARA LIBRENMS ............................................................................................................................... 4 Paso 1 – Descarga del aplicativo Web LibreNMS ................................................................................................................... 4 Paso 2 – Asignación de contraseñas a las cuentas de usuario root y librenms ...................................................................... 5 Paso 3 – Configuración volátil IPv4 de interfaz de red ........................................................................................................... 5 Paso 4 – Instalación de herramientas .................................................................................................................................... 8 Paso 5 – Configuración permanente IPV4 de la interfaz de red ............................................................................................. 9
FASE II – PREPARACIÓN DE LAS BIBLIOTECAS Y DEPENDENCIAS DEL APLICATIVO LIBRENMS .......................................................................... 11 Paso 1 – Ingresar como el usuario librenms ......................................................................................................................... 11 Paso 2 – Actualizar repositorios de Ubuntu ......................................................................................................................... 11 Paso 3 – Actualización de LibreNMS .................................................................................................................................... 11 Paso 4 - Configuración de MySQL ........................................................................................................................................ 12 Paso 5 – Instalación de Python ............................................................................................................................................ 15 Paso 6 – Configuración de la hora del sistema .................................................................................................................... 18 Paso 7 – Modificación de la base de datos para el formato de fecha en EL Salvador ......................................................... 21 Paso 8 – Actualizar permisos en directorios del aplicativo .................................................................................................. 23 Paso 9 – Instalación de PHP 7.4 ........................................................................................................................................... 24
FASE III – ACCESO DEL APLICATIVO LIBRENMS ................................................................................................................................... 29 Paso 1 – Ingresar al aplicativo LibreNMS ............................................................................................................................. 29 Paso 2 - Cambie la contraseña del usuario: librenms a 123456 ........................................................................................... 29 Paso 3 – Verificar el asistente de configuración gráfico ...................................................................................................... 31
INFORMACIÓN ADICIONAL ................................................................................................................................................... 32
Lista de servicios usados en esta guía .................................................................................................................................. 32 RESUMEN DE COMANDOS ............................................................................................................................................................... 33
Consideraciones de la guía.
a. Objetivo principal: Actualizar y configurar la máquina virtual proporcionada por LibreNMS para operar en un entorno de producción empresarial como gestor NMS.
b. Software necesario Para esta práctica se utilizará el siguiente software.
• Archivo en formato OVA con la versión más actualizada de LibreNMS
• Herramienta de consola SSH con editor de archivos gráficos y SCP (MobaXterm)
• Conexión a Internet. Agradecimiento a Melvín Gómez por la ayuda en la solución del error relacionado con Laravel Derechos de autor: La información presentada aquí es propiedad de Víctor Cuchillac (padre) y para su uso se debe citar al autor.
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 2 de 34
¿Qué es LibreNMS? Tomado de https://github.com/librenms/librenms LibreNMS es un sistema de supervisión de red basado en PHP / MySQL / SNMP de detección automática que incluye soporte para una amplia gama de hardware de red y sistemas operativos, incluidos Cisco, Linux, FreeBSD, Juniper, Brocade, Foundry, HP y muchos más. LibreNMS es una bifurcación (fork) de Observium. Según el sitio de LibreNMS (https://docs.librenms.org/General/Welcome-to-Observium-users/) se lee
“El motivo de la bifurcación no tiene nada que ver con el cambio de Observium a la comunidad frente a las versiones de pago. Es simplemente que tenemos diferentes prioridades y valores para el equipo de desarrollo de Observium. Decidimos bifurcarnos (a regañadientes) porque nos gusta usar Observium, pero queremos colaborar en un proyecto comunitario con profesionales de TI de ideas afines…”
LibreNMS utiliza una licencia GNU General Public License v3.0, por lo que es software libre. En qué se diferenciará LibreNMS de Observium: Tomado de (https://docs.librenms.org/General/Welcome-to-Observium-users/)
i. Tendremos una comunidad inclusiva, donde está bien hacer preguntas estúpidas y está bien pedir cosas que no están en la hoja de ruta. Si desea ver algo agregado, agregue o comente sobre el tema relevante en nuestro foro de la Comunidad.
ii. Las decisiones de desarrollo serán impulsadas por la comunidad. Queremos hacer un software que satisfaga las necesidades de sus usuarios.
iii. No hay planes para una versión paga y no anticipamos que esto cambie nunca. iv. No hay planes actuales para el soporte pagado, pero esto se puede agregar más adelante si hay
suficiente demanda. v. Usamos git para el control de versiones y GitHub para el alojamiento para que sea lo más fácil y
sencillo posible crear versiones bifurcadas o privadas. Entre sus principales ventajas encontramos: Información tomada y modificada de: https://www.ochobitshacenunbyte.com/2019/02/05/librenms-una-plataforma-para-el-monitoreo-de-red/
1. Descubrimiento automático de equipos: Descubre de manera automática toda nuestra red, utilizando CDP, FDP, LLDP, OSPF, BGP, SNMP y ARP
2. Alertas personalizables: Sistema de alerta altamente flexible, incluyendo la notificación por correo electrónico o IRC, entre otros.
3. Acceso API: Una API completa para administrar, graficar y recuperar datos de la instalación. 4. Sistema de cobro: Permite generar facturas de ancho de banda utilizado, para puertos en nuestra
red según el uso o la transferencia. 5. Actualizaciones automáticas: Podemos tener el producto actualizado en todo momento,
incluyendo corrección de errores, nuevas funcionalidades y mucho más. 6. Escalamiento distribuido: Escalamiento horizontal para crear con nuestra red. 7. Aplicación para iPhone y para Android: Las aplicaciones nativas para estos sistemas operativos
de dispositivos móviles están disponibles, lo que proporciona una funcionalidad básica.
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 3 de 34
Tipos de autenticación disponible: 1. MySQL 2. HTTP
3. LDAP 4. Radius
5. Active Directory
Características según el sitio we de LibreNMS
• Auto discovery
• Alerting
• Multiple environnement 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
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 4 de 34
Fase I – Configuración de red para LibreNMS
Paso 1 – Descarga del aplicativo Web LibreNMS
1.1 Ingresar al sitio web de descarga del appliance LibreNMS https://www.librenms.org/
1.2 Clic en Downloads
1.3 Seleccionar la versión OVA Dar clic en OVA images
Nota: Se sugiere Ubuntu 18.04 (versión de la guía para LibreNMS 1.63)
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 5 de 34
Paso 2 – Asignación de contraseñas a las cuentas de usuario root y librenms Para ejecutar la MV, en Oracle VirtualBox usar importar, la OVA fue creada en VirtualBox. Para VMware Workstarion hay dos opciones: a. importar la OVA, b. desempaquetar la OVA, crear una MV y usar el disco duro.
Nota: Se sugiere utilizar 1GB de memoria RAM y configurar la red virtual (NAT o bridge según el caso)
La información de los accesos para la máquina virtual en formato OVA se encuentra en: https://docs.librenms.org/Installation/Images/
2.1 Ingresar como usuario LibreNMS Accesos creados en la máquina virtual:
• Consola CLI: librenms / CDne3fwdfds (en versiones previas: CIne3fwdfds)
• Cliente SSH: librenms / CDne3fwdfds
• Aplicativo WebUI: librenms / D32fwefwef
• Cuenta de MySQL/MariaDB: librenms / D42nf23rewD
2.2 Asignar contraseña a usuario root librenms@librenms:~$ sudo passwd root
[sudo] password for librenms: CDne3fwdfds
Enter new UNIX password: 123456
Retype new UNIX password: 123456
passwd: password updated successfully
2.3 Verificar la contraseña creada librenms@librenms:~$ su root -l Password: 123456
2.4 Asignar contraseña a usuario librenms root@librenms:~# passwd librenms Enter new UNIX password: 123456
Retype new UNIX password: 123456
passwd: password updated successfully
Paso 3 – Configuración volátil IPv4 de interfaz de red
3.1 Visualizar el identificador de las interfaces de red root@librenms:~# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 ens32 ether off unmanaged
2 links listed.
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 6 de 34
3.2 Verificar los parámetros de red de las interfaces existentes root@librenms:~# ip addr show ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state DOWN
group default qlen 1000
link/ether 00:0c:29:8c:5d:e3 brd ff:ff:ff:ff:ff:ff
3.3 Activar la interfaz si estuviera desactivada a. Digitar el siguiente comando root@librenms:~# ip link set dev ens32 up
b. Verificar que se haya activado root@librenms:~# ip addr show ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group
default qlen 1000
link/ether 00:0c:29:da:d1:02 brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:feda:d102/64 scope link
valid_lft forever preferred_lft forever
3.4 Asignar dirección IPv4 a. Digitar el siguiente comando root@librenms:~# ip addr add 192.168.50.10/24 dev ens32
b. Verificar que se haya asignado la IPv4 root@librenms:~# ip a s ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group
default qlen 1000
link/ether 00:0c:29:8c:5d:e3 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.10/24 brd 192.168.50.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe8c:5de3/64 scope link
valid_lft forever preferred_lft forever
3.5 Asignar el Gateway por default a. Digitar el siguiente comando root@librenms:~# ip route add default via 192.168.50.254
b. Verificar que se haya asignado la IPv4 root@librenms:~# ip route show
default via 192.168.50.254 dev ens32 proto static
192.168.50.0/24 dev ens32 proto kernel scope link src 192.168.50.10
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 7 de 34
3.6 Definir el servidor DNS a. Verificar el contenido del archivo root@librenms:~# cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
b. Agregar la dirección del DNS
Nota: Para facilitar la edición se agregará una línea al archivo resolv.conf
root@librenms:~# echo "nameserver 192.168.50.254" >> /etc/resolv.conf
c. Verificar el cambio realizado root@librenms:~# cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
. . .
. . .
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
nameserver 192.168.50.254
d. Verificar que funcione el servicio DNS root@librenms:~# nslookup www.cuchillac.net
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
www.cuchillac.net canonical name = cuchillac.net.
Name: cuchillac.net
Address: 50.87.152.212
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 8 de 34
Paso 4 – Instalación de herramientas
4.1 Actualizar los repositorios root@librenms:~# apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease
is not valid yet (invalid for another 4h 11min 56s). Updates for this repository will
not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-
updates/InRelease is not valid yet (invalid for another 4h 12min 42s). Updates for
this repository will not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-
backports/InRelease is not valid yet (invalid for another 4h 13min 37s). Updates for
this repository will not be applied.
4.2 Instalar el manejador de archivo mc root@librenms:~# apt-get install mc -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
mc-data
Suggested packages:
arj catdvi | texlive-binaries dbview djvulibre-bin genisoimage gv links | w3m |
lynx odt2txt poppler-utils python-boto
python-tz xpdf | pdf-viewer
The following NEW packages will be installed
mc mc-data
0 to upgrade, 2 to newly install, 0 to remove and 8 not to upgrade.
Need to get 1,664 kB of archives.
After this operation, 7,009 kB of additional disk space will be used.
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 mc-data all 3:4.8.15-
2 [1,202 kB]
. . .
. . .
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up mc-data (3:4.8.15-2) ...
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 9 de 34
Paso 5 – Configuración permanente IPV4 de la interfaz de red
Nota: Se sugiere utilizar un cliente SSH como MobaXterm
• Verificar que el servidor SSH se esté ejecutando root@librenms:~# systemctl status ssh
5.1 Editar el archivo /etc/netplan/01-netcfg.yaml root@librenms:~# mcedit /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens32:
dhcp4: no
addresses: [192.168.50.10/24]
gateway4: 192.168.50.254
nameservers:
addresses: [192.168.50.254]
5.2 Comprobación de la configuración de red permanente root@librenms:~# netplan try
Do you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 112 seconds
Configuration accepted.
Nota: Otros comandos de apoyo, en el anexo hay varios comandos de apoyo para el manejo de
servicios
• Para aplicar la configuración root@librenms:~# netplan apply
• Si hay problemas y se desea ver la ayuda root@librenms:~# netplan –d apply
• Para reiniciar el servicio de red Si es Ubuntu Desktop root librenms:~# systemctl restart network-manager
Si es Ubuntu Server root@librenms:~# systemctl restart systemd-networkd
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 10 de 34
5.3 Reiniciar el servicio de red En Linux existen dos modelos muy utilizados para administrar los servicios del sistema, System V y Systemd. Aunque hay otros:
system V (sysV) Antiguo administrador de sistema
Systemd Nuevo sistema administrador de sistema
Ver servicios que se ejecutan en system V service --status-all
Para filtrar los que están en ejecución
service --status-all | grep +
Ver servicios que se ejecutan en systemd systemctl list-unit-files
systemctl list-unit-files --all
systemctl list-units
Para filtrar los que están en ejecución systemctl list-unit-files | grep enabled
systemctl list-unit-files --state=enabled
Ejecutar servicios chkconfig --level 14 nscd on
chkconfig --level 357 nscd off
chkconfig --list nscd
service sshd stop
service sshd start
service sshd status
/etc/init.d/apache stop
/etc/init.d/apache start
/etc/init.d/apache status
Ejecutar servicios systemctl enable servicio
systemctl disable servicio
systemctl start servicio
systemctl status servicio
systemctl stop servicio
systemctl restart servicio
systemctl reload servicio
Para identificar el tipo sistema de administrador de tareas se puede digitar alguno de estos comandos
• ps -p1 | grep "init\|upstart\|systemd"
• pstree
a. Identificar el nombre del servicio de red root@librenms:~# systemctl list-unit-files | grep enabled | grep network
networkd-dispatcher.service enabled
systemd-networkd-wait-online.service enabled-runtime
systemd-networkd.service enabled-runtime
b. Reiniciar el servicio de red root@librenms:~# systemctl restart systemd-networkd.service
5.4 Reiniciar el equipo para verificar los cambios Probar la conexión a Internet
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 11 de 34
Fase II – Preparación de las bibliotecas y dependencias del aplicativo
LibreNMS
Paso 1 – Ingresar como el usuario librenms librenms@/ # cd /opt/librenms
Paso 2 – Actualizar repositorios de Ubuntu librenms@librenms:~$ sudo apt clean
librenms@librenms:~$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
. . .
. . .
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-
backports/InRelease is not valid yet (invalid for another 5h 20min 25s). Updates for
this repository will not be applied.
Paso 3 – Actualización de LibreNMS Digitar los siguientes comandos librenms@librenms:~$ git pull
remote: Enumerating objects: 10531, done.
remote: Counting objects: 100% (10531/10531), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 16202 (delta 10520), reused 10522 (delta 10518), pack-reused 5671
Receiving objects: 100% (16202/16202), 10.57 MiB | 718.00 KiB/s, done.
Resolving deltas: 100% (13372/13372), completed with 4062 local objects.
From https://github.com/librenms/librenms
* [new branch] 1_65 -> origin/1_65
* [new branch] Jellyfrog-patch-1 -> origin/Jellyfrog-patch-1
+ d99b0ab74...68859d9b2 PipoCanaja-patch-1 -> origin/PipoCanaja-patch-1 (forced
. . .
. . .
librenms@librenms:~$ ./daily.sh
Updating to latest release OK
Python 3 dependencies missing, switched to php71-python2 branch. OK
Updating Composer packages OK
Updated from 1.63 to 1.68 OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 12 de 34
Si al ejecutar el comando aparece un mensaje indicando que en la línea 122 del manifiesto existe un error, realice el siguiente procedimiento Gracias a Ing. Melvín Gómez por compartir la solución
https://stackoverflow.com/questions/61177995/laravel-packagemanifest-php-undefined-index-name
I. Utilizar el editor de texto mcedit o el editor que trae incorporado MobaXterm librenms@librenms:~$ mcedit /opt/librenms/vendor/laravel/framework/src/
Illuminate/Foundation/PackageManifest.php
II. Buscar json_decode
III. Comentar la línea //cuc $packages = json_decode($this->files->get($path), true);
IV. Agregar las siguientes líneas $installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
V. Ejecutar el comando librenms@librenms:~$ ./validate.php
Paso 4 - Configuración de MySQL
4.1 Verificación del asistente de configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.68
DB Schema | 2020_09_22_172321_add_alert_log_index (174)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Database: extra index (devices/sysName)
[FAIL] Database: missing index (entityState/entitystate_device_id_index)
[FAIL] Database: extra index (entityState/entityState_device_id_index)
[FAIL] Database: extra index (mefinfo/mefID)
[FAIL] Database: extra index (munin_plugins/UNIQUE)
[FAIL] Database: extra index (ports/device_ifIndex)
[FAIL] Database: extra index (ports_vlans/unique)
[FAIL] Database: extra index (syslog/device_id-timestamp)
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 13 de 34
[FAIL] Database: extra index (tnmsneinfo/neID)
[FAIL] Database: extra index (vminfo/vmwVmVMID)
[FAIL] We have detected that your database schema may be wrong, please report the
following to us on Discord (https://t.libren.ms/discord) or the community site
(https://t.libren.ms/5gscd):
[FIX]:
Run the following SQL statements to fix.
SQL Statements:
ALTER TABLE `devices` DROP INDEX `sysName`;
ALTER TABLE `entityState` DROP INDEX `entityState_device_id_index`;
ALTER TABLE `entityState` ADD INDEX `entitystate_device_id_index`
(`device_id`);
ALTER TABLE `mefinfo` DROP INDEX `mefID`;
ALTER TABLE `munin_plugins` DROP INDEX `UNIQUE`;
ALTER TABLE `ports` DROP INDEX `device_ifIndex`;
ALTER TABLE `ports_vlans` DROP INDEX `unique`;
ALTER TABLE `syslog` DROP INDEX `device_id-timestamp`;
ALTER TABLE `tnmsneinfo` DROP INDEX `neID`;
ALTER TABLE `vminfo` DROP INDEX `vmwVmVMID`;
[WARN] PHP version 7.3 is the minimum supported version as of November, 2020. We
recommend you update PHP to a supported version (7.4 suggested) to continue to
receive updates. If you do not update PHP, LibreNMS will continue to function but
stop receiving bug fixes and updates.
4.2 Abrir la conexión a la base de datos de MariaDB librenms@librenms:~$ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 243
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
4.3 Seleccionar la base de datos de LibreNMS MariaDB [(none)]> use librenms;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
4.4 Ejecutar los comandos propuestos por el asistente a. Digitar los comandos que indica el asistente de configuración MariaDB [librenms]> ALTER TABLE `devices` DROP INDEX `sysName`;
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `entityState` DROP INDEX
`entityState_device_id_index`;
Query OK, 0 rows affected (0.18 sec)
Records: 0 Duplicates: 0 Warnings: 0
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 14 de 34
MariaDB [librenms]> ALTER TABLE `entityState` ADD INDEX
`entitystate_device_id_index` (`device_id`);
Query OK, 0 rows affected (0.18 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `mefinfo` DROP INDEX `mefID`;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `munin_plugins` DROP INDEX `UNIQUE`;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `ports` DROP INDEX `device_ifIndex`;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `ports_vlans` DROP INDEX `unique`;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `syslog` DROP INDEX `device_id-timestamp`;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `tnmsneinfo` DROP INDEX `neID`;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `vminfo` DROP INDEX `vmwVmVMID`;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
b. Salir de la consola de MariaDB
MariaDB [librenms]> exit
Bye
4.5 Reiniciar la base de datos o el equipo
4.6 Verificar la configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.68
DB Schema | 2020_09_22_172321_add_alert_log_index (174)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 15 de 34
[OK] Database connection successful
[OK] Database schema correct
[WARN] PHP version 7.3 is the minimum supported version as of November, 2020. We
recommend you update PHP to a supported version (7.4 suggested) to continue to
receive updates. If you do not update PHP, LibreNMS will continue to function but
stop receiving bug fixes and updates.
Hasta aquí bien, pero la hora no está definida para el formato de El Salvador y la versión de PHP 7.2 no recibiría actualizaciones después de noviembre 2020
Paso 5 – Instalación de Python
5.1 Ejecutar el script de validación librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.63-57-g0040f38d1
DB Schema | 2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
sh: 1: pip3: not found
[FAIL] python3 (3.6) and pip3 () versions do not match. This likely will cause
dependencies to be installed for the wrong python version.
[FAIL] Python3 module issue found: 'The 'PyMySQL' distribution was not found and is
required by the application
'
[FIX]:
pip3 install -r /opt/librenms/requirements.txt
5.2 Instalar Python-pip a. problema de versión en Python y pip [FAIL] python3 (3.6) and pip3 () versions do not match.
b. Búsqueda de paquete a instalar librenms@librenms:~$ apt-cache search python3 |grep pip
python-apipkg - namespace control and lazy-import mechanism for Python
python-cpl - Control pipeline recipes from the European Southern Observatory
python3-apipkg - namespace control and lazy-import mechanism for Python 3
python3-cpl - Control pipeline recipes from the ESO (Python3)
python3-django-pipeline - Asset packaging library for Django (Python3 version)
python3-joblib - tools to provide lightweight pipelining in Python
python3-pip - Python package installer
python3-ruffus - Python3 computation pipeline library widely used in bioinformatics
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 16 de 34
c. Instalación de paquete librenms@librenms:~$ sudo apt install python3-pip -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
. . .
. . .
. . .
Get:8 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 python3-keyrings.alt all 3.0-1
[16.6 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-pip all 9.0.1-2 [114
kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 python3-setuptools all 39.0.1-2
. . .
. . .
Setting up python3-keyring (10.6.0-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
d. verificar que el problema se haya resuelto la dependencia librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.63-57-g0040f38d1
DB Schema | 2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Python3 module issue found: 'The 'PyMySQL' distribution was not found and is
required by the application
'
[FIX]:
pip3 install -r /opt/librenms/requirements.txt
4.3 Instalar PyMySQL [FAIL] Python3 module issue found: 'The 'PyMySQL' distribution was not found and is
required by the application
a. Digitar el siguiente comando librenms@librenms:~$ pip3 install -r /opt/librenms/requirements.txt
Collecting PyMySQL (from -r /opt/librenms/requirements.txt (line 1))
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 17 de 34
Downloading
https://files.pythonhosted.org/packages/1a/ea/dd9c81e2d85efd03cfbf808736dd055bd9ea1a7
8aea9968888b1055c3263/PyMySQL-0.10.1-py2.py3-none-any.whl (47kB)
100% |████████████████████████████████| 51kB 484kB/s
Collecting python-dotenv (from -r /opt/librenms/requirements.txt (line 2))
Downloading
https://files.pythonhosted.org/packages/f2/16/28d434b28c5be29a6af8fd0e3a2bda3bd30500e
f0cd17bc79f7a6793a8d4/python_dotenv-0.14.0-py2.py3-none-any.whl
Collecting redis>=3.0 (from -r /opt/librenms/requirements.txt (line 3))
Downloading
https://files.pythonhosted.org/packages/a7/7c/24fb0511df653cf1a5d938d8f5d19802a88cef2
55706fdda242ff97e91b7/redis-3.5.3-py2.py3-none-any.whl (72kB)
100% |████████████████████████████████| 81kB 797kB/s
Installing collected packages: PyMySQL, python-dotenv, redis
Successfully installed PyMySQL-0.10.1 python-dotenv-0.14.0 redis-3.5.3
b. Comprobar la configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.63-57-g0040f38d1
DB Schema | 2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
5.6 Actualizar dependencias librenms@librenms:~$ ./scripts/composer_wrapper.php install --no-dev
> LibreNMS\ComposerHelper::preInstall
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
> LibreNMS\ComposerHelper::postInstall
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.
Nota: Por si hay errores se estos comandos dan ayuda librenms@librenms:~$ ./scripts/check_requirements.py -v
Instalar de nuevo las librerías
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 18 de 34
librenms@librenms:~$ sudo sudo apt install python3-dotenv python3-pymysql
python3-redis
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-click python3-colorama
librenms@librenms:~$ apt install python3-pip -y
Paso 6 – Configuración de la hora del sistema En los sistemas operativos GNU/Linux hay tres horas a considerar
1. La hora local o del sistema (local time) 2. La hora UTC (Tiempo universal de referencia) 3. La hora de la BIOS
La diferencia entre la hora local y la hora UTC está definida por la zona de tiempo, en El Salvador el huso horario es UTC – 6:00
6.1 Verificar las horas del sistema y huso horario librenms@librenms:~$ timedatectl
Local time: Thu 2020-10-22 08:53:20 UTC
Universal time: Thu 2020-10-22 08:53:20 UTC
RTC time: Thu 2020-10-22 08:53:21
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: no
systemd-timesyncd.service active: yes
RTC in local TZ: no
6.2 Definir zona horaria en el sistema operativo a. Digitar el siguiente comando librenms@librenms:~$ sudo timedatectl set-timezone America/El_Salvador
b. Verificar que se haya cambiado la zona horaria librenms@librenms:~$ timedatectl
Local time: Thu 2020-10-22 08:53:20 UTC
Universal time: Thu 2020-10-22 08:53:20 UTC
RTC time: Thu 2020-10-22 08:53:21
Time zone: America/El_Salvador (CST, -0600)
System clock synchronized: no
systemd-timesyncd.service active: yes
RTC in local TZ: no
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 19 de 34
c. Actualizar la hora del sistema usando la zona horaria librenms@librenms:~$ cd /usr/share/zoneinfo/
librenms@librenms:/usr/share/zoneinfo$ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Asia
5) Atlantic Ocean
6) Australia
7) Europe
8) Indian Ocean
9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the time zone using the Posix TZ format.
#? 2
Please select a country whose clocks agree with yours.
1) Anguilla 19) Dominican Republic 37) Peru
2) Antigua & Barbuda 20) Ecuador 38) Puerto Rico
3) Argentina 21) El Salvador 39) St Barthelemy
4) Aruba 22) French Guiana 40) St Kitts & Nevis
5) Bahamas 23) Greenland 41) St Lucia
6) Barbados 24) Grenada 42) St Maarten (Dutch)
7) Belize 25) Guadeloupe 43) St Martin (French)
8) Bolivia 26) Guatemala 44) St Pierre & Miquelon
9) Brazil 27) Guyana 45) St Vincent
10) Canada 28) Haiti 46) Suriname
11) Caribbean NL 29) Honduras 47) Trinidad & Tobago
12) Cayman Islands 30) Jamaica 48) Turks & Caicos Is
13) Chile 31) Martinique 49) United States
14) Colombia 32) Mexico 50) Uruguay
15) Costa Rica 33) Montserrat 51) Venezuela
16) Cuba 34) Nicaragua 52) Virgin Islands (UK)
17) Curaçao 35) Panama 53) Virgin Islands (US)
18) Dominica 36) Paraguay
#? 21
The following information has been given:
El Salvador
Therefore TZ='America/El_Salvador' will be used.
Selected time is now: Wed Oct 21 19:22:22 CST 2020.
Universal Time is now: Thu Oct 22 01:22:22 UTC 2020.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='America/El_Salvador'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 20 de 34
America/El_Salvador
6.3 Sincronizar la hora del sistema operativo desde un servidor NTP a. Ejecutar la sincronización de tiempo librenms@librenms:~$ sudo timedatectl set-ntp true
b. Verificar el estado del servicio NTP librenms@librenms:~$ sudo systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor
preset: enabled)
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
c. Reiniciar el servicio del cliente NTP librenms@librenms:/usr/share/zoneinfo$ sudo systemctl restart systemd-
timesyncd.service
librenms@librenms:/usr/share/zoneinfo$ timedatectl
Local time: Thu 2020-10-22 16:21:53 CST
Universal time: Thu 2020-10-22 22:21:53 UTC
RTC time: Thu 2020-10-22 22:21:53
Time zone: America/El_Salvador (CST, -0600)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
d. Regresar al directorio home librenms@librenms:/usr/share/zoneinfo$ cd ~
librenms@librenms:~$ pwd
/opt/librenms
Otros Comandos de ayuda para la fecha y hora
• Definir la hora del sistema manualmente
librenms@librenms:/usr/share/zoneinfo$ sudo date --set "2020-10-22 09:13"
Thu Oct 22 09:13:00 CST 2020
• Utilizar la herramienta de texto de Ubuntu Server para sincronizar la hora del sistema
librenms@librenms:~$ sudo dpkg-reconfigure tzdata
• Sincronizar los segundos de diferencia con la hora del BIOS
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 21 de 34
Pero los sistemas modernos no recomiendan actualizar la hora del sistema desde la hora del BIOS porque el BIOS no se actualiza y puede retrasarse librenms@librenms:/usr/share/zoneinfo$ sudo timedatectl set-local-rtc 1
Para quitar la sincronización desde el BIOS librenms@librenms:/usr/share/zoneinfo$ sudo timedatectl set-local-rtc 0
6.5 Definir el tipo de zona horaria en PHP a. Editar el archivo php.ini y buscar la sección date.timezone root@librenms:/opt/librenms# sudo mcedit /etc/php/7.2/cli/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = Etc/UTC
date.timezone = "America/El_Salvador"
Para búsqueda de texto utilice F7 Para guardar presione “F2” y para salir “F10” Nota: Si el asistente de configuración Web indica que no existe el mismo formato entre MySQL y PHP, debe editar o agregar el siguiente texto al archivo root@librenms:/opt/librenms# sudo mcedit /etc/php/7.2/fpm/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = Etc/UTC
date.timezone = "America/El_Salvador"
Para búsqueda de texto utilice F7 (date.time) Para guardar presione “F2” y para salir “F10”
Paso 7 – Modificación de la base de datos para el formato de fecha en EL Salvador
7.1 Ejecutar asistente de configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.68
DB Schema | 2020_09_22_172321_add_alert_log_index (174)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 22 de 34
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Database: incorrect column (notifications/datetime)
[FAIL] Database: incorrect column (users/created_at)
[FAIL] We have detected that your database schema may be wrong, please report the
following to us on Discord (https://t.libren.ms/discord) or the community site
(https://t.libren.ms/5gscd):
[FIX]:
Run the following SQL statements to fix.
SQL Statements:
ALTER TABLE `notifications` CHANGE `datetime` `datetime` timestamp NOT NULL
DEFAULT '1970-01-02 00:00:00' ;
ALTER TABLE `users` CHANGE `created_at` `created_at` timestamp NOT NULL
DEFAULT '1970-01-02 00:00:01' ;
[WARN] PHP version 7.3 is the minimum supported version as of November, 2020. We
recommend you update PHP to a supported version (7.4 suggested) to continue to
receive updates. If you do not update PHP, LibreNMS will continue to function but
stop receiving bug fixes and updates.
[FAIL] We have found some files that are owned by a different user than librenms,
this will stop you updating automatically and / or rrd files being updated causing
graphs to fail.
[FIX]:
sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Files:
/opt/librenms/.local/share/mc
/opt/librenms/.config/mc
/opt/librenms/.cache/mc
7.2 Abrir conexión a la base de datos librenms@librenms:~$ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 57
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
7.3 Seleccionar la base de datos de LibreNMS MariaDB [(none)]> use librenms;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
7.4 Ejecutar los comandos que indica el asistente MariaDB [librenms]> ALTER TABLE `notifications` CHANGE `datetime` `datetime`
timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' ;
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 23 de 34
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [librenms]> ALTER TABLE `users` CHANGE `created_at` `created_at`
timestamp NOT NULL DEFAULT '1970-01-02 00:00:01' ;
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
7.5 Salir de la consola del motor de MariaDB MariaDB [librenms]> exit
Bye
Paso 8 – Actualizar permisos en directorios del aplicativo
8.1 Ejecutar asistente de configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.63-57-g0040f38d1
DB Schema | 2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] We have found some files that are owned by a different user than librenms,
this will stop you updating automatically and / or rrd files being updated causing
graphs to fail.
[FIX]:
sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Files:
/opt/librenms/.local/share/mc
/opt/librenms/.config/mc
/opt/librenms/.cache/mc
8.2 Ejecutar los comandos para dar permisos a los directorios librenms@librenms:~$ sudo chown -R librenms:librenms /opt/librenms
librenms@librenms:~$ sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 24 de 34
librenms@librenms:~$ sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Paso 9 – Instalación de PHP 7.4
1. Ver asistente de configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.68
DB Schema | 2020_09_22_172321_add_alert_log_index (174)
PHP | 7.2.24-0ubuntu0.18.04.4
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] PHP version 7.3 is the minimum supported version as of November, 2020. We
recommend you update PHP to a supported version (7.4 suggested) to continue to
receive updates. If you do not update PHP, LibreNMS will continue to function but
stop receiving bug fixes and updates.
9.2. Actualizar bibliotecas
librenms@librenms:~$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
. . .
. . .
librenms@librenms:~$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
9.3 Verificar la versión de PHP librenms@librenms:~$ php --version
PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr 8 2020 15:45:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend
Technologies
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 25 de 34
9.4 Instalar el repositorio para PHP 7.4 Digitar los siguientes comandos librenms@librenms:~$ sudo apt install software-properties-common -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-software-properties unattended-upgrades
Suggested packages:
bsd-mailx default-mta | mail-transport-agent needrestart
The following NEW packages will be installed:
python3-software-properties software-properties-common unattended-upgrades
. . .
. . .
librenms@librenms:~$ sudo add-apt-repository ppa:ondrej/php -y
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are
included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for
Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask
for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well:
https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
. . .
. . .
librenms@librenms:~$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
. . .
9.5 Instalar PHP 7.4 para Nginx a. Digitar el siguiente comando para instalar php para Nginx
librenms@librenms:~$ sudo apt install php7.4-fpm -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libargon2-1
liblua5.2-0 libpcre2-8-0 php-common php7.4-cli php7.4-common php7.4-json php7.4-
opcache php7.4-readline ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
openssl-blacklist
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libargon2-1
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 26 de 34
liblua5.2-0 libpcre2-8-0 php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache
php7.4-readline ssl-cert
The following packages will be upgraded:
php-common
. . .
. . .
b. Verificar la versión que se ha instalado de PHP librenms@librenms:~$ php -v
PHP 7.4.11 (cli) (built: Oct 18 2020 19:39:25) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
9.6 Instalar extensiones necesarias para el aplicativo LibreNMS a. Digitar el siguiente comando librenms@librenms:~$ sudo apt install php7.4-common php7.4-mysql php7.4-xml
php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev
php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl
-y
Reading package lists... Done
Building dependency tree
Reading state information... Done
php7.4-cli is already the newest version (7.4.11-6+ubuntu18.04.1+deb.sury.org+1).
php7.4-cli set to manually installed.
php7.4-common is already the newest version (7.4.11-6+ubuntu18.04.1+deb.sury.org+1).
php7.4-common set to manually installed.
php7.4-opcache is already the newest version (7.4.11-6+ubuntu18.04.1+deb.sury.org+1).
php7.4-opcache set to manually installed.
. . .
. . .
. . .
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 27 de 34
b. comprobar los módulos instalados librenms@librenms:~$ php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
imap
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
9.7 Configurar el archivo de Nginx Se debe indicar al servidor Ngnix la nueva versión de PHP a. Editar el archivo /etc/nginx/conf.d/librenms.conf librenms@librenms:~$ sudo mcedit /etc/nginx/conf.d/librenms.conf
b. Modificar la versión antes . . .
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
. . .
debe quedar . . .
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
. . .
9.8 Definir el formato de fecha para El Salvador en PHP a. Editar los siguientes archivos librenms@librenms:~$ sudo mcedit /etc/php/7.4/cli/php.ini
librenms@librenms:~$ sudo mcedit /etc/php/7.4/fpm/php.ini
b. Definir la zona horaria para El Salvador [Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = Etc/UTC
date.timezone = "America/El_Salvador"
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 28 de 34
Para búsqueda de texto utilice F7 Para guardar presione “F2” y para salir “F10”
9.9 Validar el asistente de configuración librenms@librenms:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.68
DB Schema | 2020_09_22_172321_add_alert_log_index (174)
PHP | 7.4.11
Python | 3.6.9
MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.10.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
9.10 Reinicie el servidor Nginx Ejecute los siguientes comandos librenms@librenms:~$ sudo php-fpm7.4 -t
[23-Oct-2020 04:56:09] NOTICE: configuration file /etc/php/7.4/fpm/php-fpm.conf test
is successful
librenms@librenms:~$ sudo service php7.4-fpm restart
librenms@librenms:~$ sudo service php7.4-fpm status
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset:
enabled)
Active: active (running) since Fri 2020-10-23 04:56:21 CST; 9s ago
Docs: man:php-fpm7.4(8)
Process: 5112 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-
fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCC
Process: 5119 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install
/run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SU
Main PID: 5114 (php-fpm7.4)
Status: "Ready to handle connections"
Tasks: 3 (limit: 1127)
CGroup: /system.slice/php7.4-fpm.service
├─5114 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─5117 php-fpm: pool www
└─5118 php-fpm: pool www
Oct 23 04:56:21 librenms systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Oct 23 04:56:21 librenms systemd[1]: Started The PHP 7.4 FastCGI Process Manager.
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 29 de 34
Fase III – Acceso del aplicativo LibreNMS Nota para probar que todo funcione puede reiniciar el equipo con LibreNMS
Paso 1 – Ingresar al aplicativo LibreNMS
1.1 Abrir un navegador Web se sugiere Mozilla Firefox, ingresar la dirección de librenms
b. Ingrese las credenciales del usuario librens librenms / D32fwefwef
Paso 2 - Cambie la contraseña del usuario: librenms a 123456
2.1 Abrir Menú con el usuario
2.2 Seleccionar “MySettings”
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 30 de 34
2.3 Complete el asiste de cambio de contraseña Se sugiere asignar la contraseña librenms
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 31 de 34
Paso 3 – Verificar el asistente de configuración gráfico menú configuración / Validate Config
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 32 de 34
Información adicional Los sistemas de gestión de servicios alternativos a SysV y systemd son:
• Upstart: reemplazo a init escrito en C y creado por Scott James Remmat (trabajador de Canonical en aquella época). Sigue manteniendo un esquema muy similar al clásico, de hecho tiene retrocompatibilidad con sysvinit, solo que con algunos cambios para adaptarlo a los nuevos SSOO.
• OpenRC: creado para FreeBSD y NetBSD, también lo usa Gentoo. Básicamente es un init con mayor portabilidad y no dependiente de D-bus. En muchos aspectos es compatible con SysV, en otros se parece al BSD-style.
• GNU dmd (Sheperd): surgió como un reemplazo para SysV init, pero no es demasiado popular.
• BootScrips: un proyecto usado en GoboLinux. Simplifica mucho la configuración.
• Busybox-init: esquema creado bajo BusyBox iniciado por Bruce Perens. También resulta muy minimalista como el anterior. Se usa en OpenWrt y otros embebdios.
• initg: otro proyecto como reemplazo a init clásico para iniciar proceso de forma asíncrona, aunque no muy popular.
• Runit: capaz de iniciar servicios de forma paralela y escrito por Gerrit Pape. Compatible con Linux, BSD, MacOS y Solaris. Usado por defecto en Void Linux.
Lista de servicios usados en esta guía Todos librenms@librenms:~$ service --status-all
Los que se están ejecutando librenms@librenms:~$ systemctl list-unit-files --state=enabled
Los usados en la guía systemd-networkd
mariadb.service o mysqld.service
nginx.service
php7.2-fpm.service o php7.4-fpm.service
rrdcached.service
snmpd.service
sshd.service o ssh o sshd
systemd-timesyncd.service
Acciones para los servicios
status, stop, start, restart, reload
enable, disable
librenms@librenms:~$ systemctl status servicio
Eliminar un servicio
systemctl stop service-name
systemctl disable service-name
rm /etc/systemd/system/service-name
rm /etc/systemd/system/service-name/[related symlinks]
systemctl daemon-reload
systemctl reset-failed
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 33 de 34
Resumen de comandos cd /opt/librenms
sudo apt clean
sudo apt update
git pull
./daily.sh
sudo mysql
use librenms;
ALTER TABLE `devices` DROP INDEX `sysName`;
ALTER TABLE `entityState` DROP INDEX
ALTER TABLE `entityState` ADD INDEX `entitystate_device_id_index`
(`device_id`);
ALTER TABLE `mefinfo` DROP INDEX `mefID`;
ALTER TABLE `munin_plugins` DROP INDEX `UNIQUE`;
ALTER TABLE `ports` DROP INDEX `device_ifIndex`;
ALTER TABLE `ports_vlans` DROP INDEX `unique`;
ALTER TABLE `syslog` DROP INDEX `device_id-timestamp`;
ALTER TABLE `tnmsneinfo` DROP INDEX `neID`;
ALTER TABLE `vminfo` DROP INDEX `vmwVmVMID`;
exit
sudo apt install python3-pip -y
pip3 install -r /opt/librenms/requirements.txt
./scripts/check_requirements.py -v
sudo apt install python3-dotenv python3-pymysql python3-redis
sudo apt install python3-pip -y
timedatectl
sudo timedatectl set-timezone America/El_Salvador
/usr/share/zoneinfo/tzselect
sudo timedatectl set-ntp true
sudo systemctl restart systemd-timesyncd.service
sudo mcedit /etc/php/7.2/cli/php.ini [Date]
date.timezone = "America/El_Salvador"
sudo mcedit /etc/php/7.2/fpm/php.ini [Date]
date.timezone = "America/El_Salvador"
sudo mysql
ALTER TABLE `notifications` CHANGE `datetime` `datetime` timestamp NOT
NULL DEFAULT '1970-01-02 00:00:00' ;
ALTER TABLE `users` CHANGE `created_at` `created_at` timestamp NOT NULL
DEFAULT '1970-01-02 00:00:01' ;
exit
sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs
/opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo apt-get update
Preparación de MV con LibreNMS – Víctor Cuchillac – Página 34 de 34
sudo apt-get upgrade -y
php –version
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install php7.4-fpm -y
php -v
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-
curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-
mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
sudo mcedit /etc/nginx/conf.d/librenms.conf
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
sudo mcedit /etc/php/7.4/cli/php.ini
[Date]
date.timezone = "America/El_Salvador"
sudo mcedit /etc/php/7.4/fpm/php.ini
[Date]
date.timezone = "America/El_Salvador"
./validate.php
sudo php-fpm7.4 -t
sudo service php7.4-fpm restart
Enlaces de ayuda https://docs.librenms.org/Installation/Install-LibreNMS/ Enlace parasolucionar problemas https://stackoverflow.com/questions/61177995/laravel-packagemanifest-php-undefined-index-name
top related