30. Instalación de GLPI en Ubuntu 22.04

GLPI (Gestionnaire Libre de Parc Informatique) es un software de gestión de activos de TI gratuito y de código abierto, diseñado para ayudar a las organizaciones a llevar un registro de su parque informático, incluyendo hardware, software, licencias, contratos de mantenimiento y documentación. GLPI también ofrece funciones de seguimiento de incidentes, gestión de problemas y cambios, y generación de informes.

Pasos previos

Primero instalamos actualizaciones al servidor Ubuntu 22.04

sudo apt-get update
sudo apt-get upgrade

Primero instalaremos los repositorios PHP de Ondrej, quien ha sido un mantenedor de PHP para Debian durante más de una década y es ampliamente utilizado entre los servidores y usuarios de Ubuntu.

sudo apt install software-properties-common apt-transport-https -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt upgrade

Instalación de Apache2

  sudo apt-get -y install apache2 libapache2-mod-php8.0

Instalar PHP 8.0 para Apache

sudo apt install php8.0 php8.0-common libapache2-mod-php8.0 php8.0-cli
sudo systemctl restart apache2

A continuación instalaremos PHP-FPM (un acrónimo de FastCGI Process Manager) es una alternativa PHP muy popular (Procesador de hipertexto) Implementación de FastCGI.

sudo apt install php8.0-fpm php8.0-common libapache2-mod-fcgid php8.0-cli
sudo systemctl restart apache2
sudo a2enmod proxy_fcgi setenvif && sudo a2enconf php8.0-fpm
sudo systemctl restart apache2

Una forma elegante de instalar módulos a php.

sudo apt-get -y install php8.0 php8.0-{curl,gd,imagick,intl,apcu,memcache,imap,mysql,ldap,tidy,xmlrpc,pspell,gettext,mbstring,fpm,iconv,xml,gd,xsl}

Por último revisar la versión PHP instalada

php --version

Instalamos GLPI 10.0.1

Descargamos la última versión que por hoy es la 10.0.1

wget https://github.com/glpi-project/glpi/releases/download/10.0.1/glpi-10.0.1.tgz

Desempaquetamos en la ruta /var/www/glpi

sudo mv glpi-10.0.1.tgz /var/www/
cd /var/www/
sudo tar -zxvf glpi-10.0.1.tgz

Como resultado tendremos una carpeta llamada glpi donde encontraremos la instalación de GLPI. A continuación debemos configurar APACHE2 para que funcione en nuestro navegador. Nos vamos a la ruta /etc/apache2/sites-available.

Veremos que hay 1 archivo con el nombre 000-default.conf, debemos hacer una copia por seguridad y luego lo editamos.

sudo mv 000-default.conf 000-default.conf.bkp

Creamos un documento con el nombre glpi.conf

<VirtualHost *:80>
        ServerAdmin israel.glpi.com
        DocumentRoot /var/www/glpi/
        ServerName israel.glpi.com
        ServerAlias israel.glpi.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Una vez teniendo nuestro archivo glpi.conf deberá ser necesario crear un enlace simbólico a la carpeta site-enable.

sudo ln -s /etc/apache2/sites-available/glpi.conf /etc/apache2/sites-enabled/glpi.conf

No olvidar modificar los permisos y derechos sobre el directorio que hemos creado en el /var/www/glpi/

sudo chown -R www-data:www-data /var/www/glpi
sudo chmod -R 755 /var/www/glpi

con esto, lo último es reiniciar Apache2

sudo systemctl restart apache2.service

Instalación de MariaDB

sudo apt install mariadb-server
sudo mysql_secure_installation

Continuación seguimos el proceso de instalación de MariaDB, definiendo la contraseña de root y ciertos parámetros.

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Por último ingresamos a mysql y creamos la BD

mysql -u root -p
CREATE DATABASE glpi;
CREATE USER 'glpi'@'localhost' IDENTIFIED BY 'StrongDBPassword';
GRANT ALL PRIVILEGES ON glpi.* TO 'glpi'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Ingresar a la WEB de GLPI

Hasta este punto sería suficiente abrir un navegador, ingresar la IP de nuestro servidor y se nos abrirá el proceso de instalación WEB de GLPI. Pero para hacerlo un poco mas profesional modificaremos nuestro archivo hosts para que resuelva la dirección que en mi caso seleccioné israel.glpi.com

Esto último es en nuestro equipo cliente donde ingresaremos al navegador.

sudo vim /etc/hosts
___________________________________________________
192.168.122.35 israel.glpi.com

salimos grabando. (No olviden cambiar la IP por la de su instalación y el nombre de su servidor FQDN y dominio).

Algunos errores

Es posible que nos salte algunos errores en el proceso de instalación de GLPI. en mi caso tengo los siguientes:

Lo solucione ingresando al fichero /etc/apache2/apache2.conf y modificando la línea AllowOverride None a All.

sudo vim /etc/apache2/apache2.conf
______________________________________________
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Se soluciona instalando los módulos php faltantes:

sudo apt-get install php8.0-bz2
sudo apt-get install php8.0-zip

sudo systemctl restart apache2.service 

Comentarios