GLPI (Gestionnaire Libre de Parc Informatique) is an open-source tool for IT asset and service management. It is a comprehensive solution for managing a company's hardware and software resources, as well as incidents, service requests, and changes.
GLPI provides an intuitive, easy-to-use web interface and is highly customizable to meet each organization's specific needs. Its features include hardware and software inventory management, user and group management, help desk and technical support ticket management, contract and warranty management, and report and statistics generation.
The following explains how to install the latest version of GLPI on an Apache2 web server on Debian or a Debian-based distribution with nothing preconfigured. First, it also details the process of installing dependencies and configuring a Let's Encrypt SSL certificate using Certbot.
Installing required packages and dependencies
First, update the repositories and system packages:
# apt update && apt upgrade -yInstall the web server, MySQL, PHP FPM, and the remaining dependencies:
# apt install apache2 php8.2 php8.2-fpm php8.2-curl php8.2-gd php8.2-mbstring php8.2-bcmath php8.2-mysql php8.2-intl php8.2-cli php8.2-ldap php8.2-xml php8.2-xmlrpc php8.2-apcu php8.2-zip php8.2-bz2 mariadb-server -yEnable the module and configure PHP FPM for Apache:
# a2enmod proxy_fcgi setenvif rewrite && a2enconf php8.2-fpmAnd restart the web server:
# systemctl restart apache2Creating a MySQL database and user for GLPI
To create a database for GLPI, run the following:
# mysqladmin create db_glpiAlso create a MySQL user for GLPI (remember to change the example password):
# mysql -u root -e "CREATE USER 'user_glpi'@'localhost' IDENTIFIED BY 'tu_contraseña'"And grant the user permissions on the GLPI database created earlier:
# mysql -u root -e "GRANT ALL ON db_glpi.* TO 'user_glpi'@'localhost'"Preliminary PHP FPM configuration
First, edit the FPM php.ini file to change certain values. You can run this directly:
# sed -i 's/^;*\s*\(session\.cookie_secure\s*=\s*\).*$/\1on/' /etc/php/8.2/fpm/php.iniTo verify the change, you can run the following command:
# grep cookie_secure /etc/php/8.2/fpm/php.iniThe line should show "on"; do the same for cookie_httponly:
# sed -i 's/^;*\s*\(session\.cookie_httponly\s*=\s*\).*$/\1on/' /etc/php/8.2/fpm/php.iniTo verify the change, run:
# grep session.cookie_httponly /etc/php/8.2/fpm/php.iniAlso make the following change:
# sed -i 's/^;*\s*\(session\.cookie_samesite\s*=\s*\).*$/\1Lax/' /etc/php/8.2/fpm/php.iniTo verify it, run:
# grep session.cookie_samesite /etc/php/8.2/fpm/php.iniAdditionally, set the maximum execution time to 600 seconds:
# sed -i 's/^max_execution_time\s*=.*/max_execution_time = 600/' /etc/php/8.2/fpm/php.iniAgain, to verify the change, run:
# grep max_execution_time /etc/php/8.2/fpm/php.iniOnce done, reload the service to apply the changes:
# systemctl reload php8.2-fpm.serviceDownloading and preparing to install GLPI
To download the latest version of GLPI, run the following:
# curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep "browser_download_url" | cut -d : -f 2,3 | tr -d '," ' | xargs curl -sLONext, extract the downloaded archive into the web directory:
# tar -xzf glpi-*.tgz -C /var/www/html --strip-components=1Change the web directory permissions recursively:
# chown -R www-data:www-data /var/www/Once done, edit the website's default configuration file:
# nano /etc/apache2/sites-enabled/000-default.confIn it, uncomment and change the ServerName line to the desired DNS record (example):
ServerName glpi.ejemplo.esAdditionally, if the downloaded version is 10.0.7 or later, change DocumentRoot and Directory to /var/www/html/public:
DocumentRoot /var/www/html/public
# If you want to place GLPI in a subfolder of your site (e.g. your virtual host is serving multiple applications),
# you can use an Alias directive. If you do this, the DocumentRoot directive MUST NOT target the GLPI directory itself.
# Alias "/glpi" "/var/www/html/public"
<Directory /var/www/html/public>
Require all granted
RewriteEngine On
# Redirect all requests to GLPI router, unless file exists.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>Save the changes, exit the editor, and reload Apache:
# systemctl reload apache2.serviceFinally, install Certbot and the Python automation script for Apache:
# apt install python3-certbot-apache -yAnd run it. Remember to replace the example with the DNS record entered in ServerName:
# certbot --apache --redirect -d glpi.ejemplo.esInstalling GLPI
Access GLPI from a web browser using the FQDN you used and select the desired language:
Read and accept the license to continue:
And choose the installation option:
Check that everything is correct, except "Safe path for data directories", which can be ignored (there is an .htaccess denying access to those directories):
Configure the MySQL user created earlier:
And select the database you created:
It will automatically create the tables in the database. Once it finishes, click continue:
You can allow usage statistics to be collected to help GLPI by leaving the default setting and clicking continue:
You will be informed that they offer a support service. Keep this in mind and click continue:
When installation is complete, it will display the default passwords for the users:
Click Utilizar GLPI to open the home page/dashboard (use the user glpi with the password glpi). There you will see warning messages about default passwords and installation files. First, click each user and change the passwords as a precaution:
Next, you can use the following command to delete the installation files:
# rm -R /var/www/html/installOnce you have completed this last step and changed the users' default passwords, GLPI will be ready to use.
We hope this article has been helpful. If you have questions about this or any other issue related to your servers on Clouding, feel free to contact soporte@clouding.io. We're here to help!