DebianDebian Based

How To Install GLPI on Debian 12

Install GLPI on Debian 12

In this tutorial, we will show you how to install GLPI on Debian 12. GLPI (Gestionnaire Libre de Parc Informatique) is a powerful, open-source IT asset management solution that helps organizations track and manage their IT infrastructure efficiently. Installing GLPI on Debian 12 provides a stable platform for inventory management, helpdesk operations, and IT resource tracking. This comprehensive guide walks you through each step of the installation process, from preparing your system to advanced configuration options.

Understanding GLPI and Its Benefits

GLPI has become a cornerstone tool for IT departments worldwide, offering comprehensive features for managing technical resources. As an open-source solution, it provides organizations with a cost-effective alternative to expensive proprietary systems.

Key Features and Capabilities:

  • Complete inventory management for computers, software, and networks
  • IT asset tracking and documentation
  • Helpdesk ticketing system with SLA management
  • Knowledge base functionality for documenting solutions
  • Project management tools
  • Reporting and statistics features
  • User self-service portal

GLPI excels at centralizing information about IT assets, making it invaluable for organizations of all sizes seeking to streamline their IT operations. The platform works exceptionally well on Debian 12, which provides the stability and security needed for mission-critical asset management systems.

Prerequisites for Installation

Before installing GLPI on your Debian 12 server, ensure you have the following:

  • A Debian 12 server with root or sudo privileges
  • Minimum 2GB RAM (4GB recommended for production environments)
  • At least 10GB of free disk space
  • Basic knowledge of Linux command line operations
  • A domain name pointed to your server (if using web access externally)
  • Server with internet connectivity for downloading packages

These requirements ensure smooth installation and optimal performance for your GLPI implementation. Now, let’s prepare your system for installation.

Step 1: System Preparation

Proper system preparation ensures a smooth installation process and optimal performance for your GLPI instance.

First, update your system packages to ensure you have the latest versions:

sudo apt update && sudo apt upgrade -y

Set your system’s hostname if not already configured:

sudo hostnamectl set-hostname glpi-server

Edit your hosts file to include your hostname:

sudo nano /etc/hosts

Add the following line, replacing YOUR_IP with your server’s IP address:

YOUR_IP   glpi-server

This initial preparation creates a clean foundation for the GLPI installation. A well-prepared system minimizes potential issues during installation and configuration.

Step 2: Installing the LAMP Stack

GLPI requires a LAMP (Linux, Apache, MariaDB, PHP) environment to function. Let’s install and configure each component.

Install Apache web server, MariaDB database server, and PHP with necessary extensions:

sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-gd php-ldap php-xml php-mbstring php-curl php-json php-intl php-zip php-imap -y

The installation will take a few minutes depending on your server’s speed and internet connection. These packages provide the foundation for running GLPI effectively.

Verify that Apache is running with:

sudo systemctl status apache2

You should see output indicating that Apache is active and running. Open your web browser and navigate to your server’s IP address to confirm Apache is serving web pages correctly.

Step 3: Configuring MariaDB

A properly configured database is crucial for GLPI’s functionality and performance.

First, secure your MariaDB installation:

sudo mysql_secure_installation

During this process, you’ll be asked to:

  • Set a root password (if not already set)
  • Remove anonymous users
  • Disallow remote root login
  • Remove test database
  • Reload privilege tables

Answer “Y” to all these questions for enhanced security.

Next, create a dedicated database and user for GLPI:

sudo mysql -u root -p

Enter your MariaDB root password, then execute these SQL commands:

CREATE DATABASE glpidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'glpiuser'@'localhost' IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON glpidb.* TO 'glpiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace ‘YourStrongPassword‘ with a secure password of your choice. This configuration ensures that GLPI has its own dedicated database user with appropriate permissions.

Step 4: Downloading and Extracting GLPI

Now let’s download the latest stable version of GLPI and extract it to the appropriate location.

Navigate to the web directory:

cd /var/www/

Download the latest GLPI package (check the official GLPI website for the most recent version):

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

Extract the archive:

sudo tar -xvzf glpi-10.0.18.tgz

This will create a directory named ‘glpi’ containing all the necessary files for your installation. The extraction process may take a few moments depending on your server’s performance.

Step 5: Setting Proper File Permissions

Setting correct file permissions is crucial for security and proper operation of GLPI.

Change ownership of the GLPI directory to the web server user:

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

Set appropriate permissions for files and directories:

sudo find /var/www/glpi -type d -exec chmod 755 {} \;
sudo find /var/www/glpi -type f -exec chmod 644 {} \;

Create necessary writable directories if they don’t already exist:

sudo mkdir -p /var/www/glpi/files/_cache
sudo mkdir -p /var/www/glpi/files/_sessions
sudo mkdir -p /var/www/glpi/files/_uploads
sudo chmod -R 775 /var/www/glpi/files

These permissions ensure that Apache can read files and write to directories that require modifications during GLPI operation. Proper permissions are critical for both security and functionality.

Step 6: Configuring Apache Virtual Host

Setting up a dedicated virtual host for GLPI improves security and organization.

Create a new virtual host configuration file:

sudo nano /etc/apache2/sites-available/glpi.conf

Add the following configuration, adjusting the ServerName to match your domain:

<VirtualHost *:80>
    ServerName glpi.yourdomain.com
    DocumentRoot /var/www/glpi/public
    
    <Directory /var/www/glpi/public>
        Require all granted
        AllowOverride All
        Options FollowSymLinks
        
        RewriteEngine On
        
        # Ensure authorization headers are passed to PHP
        RewriteCond %{HTTP:Authorization} ^(.+)$
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        
        # Redirect all requests to GLPI router, unless file exists
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
    </Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/glpi_error.log
    CustomLog ${APACHE_LOG_DIR}/glpi_access.log combined
</VirtualHost>

Enable the Apache rewrite module and the new virtual host:

sudo a2enmod rewrite
sudo a2ensite glpi.conf

Check your configuration for errors:

sudo apache2ctl configtest

If the test is successful, restart Apache to apply the changes:

sudo systemctl restart apache2

This configuration ensures that GLPI is properly served by Apache with all necessary features enabled. The virtual host configuration is crucial for proper routing and security.

Step 7: Securing Your Installation with SSL/TLS

For production environments, securing your GLPI installation with SSL/TLS is essential.

Install Certbot for Let’s Encrypt certificates:

sudo apt install certbot python3-certbot-apache -y

Obtain and configure SSL certificates:

sudo certbot --apache -d glpi.yourdomain.com

Follow the prompts to complete the certificate setup. Certbot will modify your Apache configuration to use HTTPS by default.

Set up automatic renewal:

sudo systemctl status certbot.timer

This ensures your certificates remain valid, protecting your data in transit. In today’s security landscape, HTTPS is no longer optional for applications handling sensitive IT asset information.

Step 8: PHP Configuration for GLPI

Optimizing PHP settings is crucial for GLPI’s performance and functionality.

Create a custom PHP configuration file for GLPI:

sudo nano /etc/php/8.2/apache2/conf.d/99-glpi.ini

Add the following settings:

memory_limit = 256M
file_uploads = on
max_execution_time = 300
upload_max_filesize = 32M
post_max_size = 32M
session.cookie_httponly = On
date.timezone = Your/Timezone

Replace “Your/Timezone” with your actual timezone (e.g., “America/New_York” or “Europe/London”).

Restart Apache to apply the PHP configuration:

sudo systemctl restart apache2

These settings provide optimal performance for GLPI while ensuring security of session data. PHP configuration directly impacts how well GLPI performs under load.

Step 9: Web-Based GLPI Installation Process

With all components configured, it’s time to complete the installation through GLPI’s web interface.

Open your web browser and navigate to your GLPI domain (http://glpi.yourdomain.com or https://glpi.yourdomain.com if SSL is configured).

Install GLPI on Debian 12

Follow these steps in the web installer:

  1. Select your preferred language and click “OK”
  2. Accept the license agreement by clicking “Continue”
  3. Click “Install” to begin the installation process
  4. The system will check for prerequisites – all should be green; click “Continue”
  5. Enter your database connection information:
    • Database Host: localhost
    • Database User: glpiuser
    • Database Password: YourStrongPassword
    • Database Name: glpidb
  6. Click “Continue” to proceed with database configuration
  7. Select the database and click “Continue”
  8. GLPI will initialize the database; click “Continue” when done
  9. Configure data collection preferences according to your needs and click “Continue”
  10. Review the installation summary and click “Continue”

The web installer provides a user-friendly interface to complete the remaining configuration steps. It ensures that all components are properly integrated.

Step 10: Finalizing Installation

After completing the web installation, a few more steps are needed to secure and finalize your GLPI setup.

The installer will show default login credentials for the following accounts:

  • Administrator: glpi/glpi
  • Technician: tech/tech
  • Normal user: normal/normal
  • Post-only user: post-only/postonly

Click “Use GLPI” to proceed to the login screen. Log in with the administrator account (glpi/glpi) and immediately change the default password.

For security purposes, remove the installation files:

sudo rm -rf /var/www/glpi/install/install.php

This prevents unauthorized reinstallation of your GLPI instance. Removing installation files is a standard security practice for web applications.

Post-Installation Tasks

After installation, perform these important tasks to secure and optimize your GLPI instance:

  1. Change all default passwords – Especially for built-in accounts, use strong, unique passwords
  2. Configure scheduled tasks – Set up cron jobs for GLPI maintenance:
    sudo crontab -e

    Add the following line:

    */5 * * * * /usr/bin/php /var/www/glpi/front/cron.php
  3. Configure email notifications – Set up SMTP settings in GLPI’s administration panel to enable email notifications
  4. Perform an initial system check – Go to Setup > Check and verify that all components are properly configured
  5. Set up backups – Implement regular database and file backups with:
    mysqldump -u root -p glpidb > glpi_backup_$(date +%Y%m%d).sql

These post-installation tasks significantly enhance the security and functionality of your GLPI installation. Regular maintenance is essential for long-term stability.

Troubleshooting Common Issues

Even with careful installation, you might encounter some common issues. Here are solutions to frequently encountered problems:

Database Connection Issues:

  • Verify your database credentials in the GLPI configuration
  • Check if MariaDB is running: sudo systemctl status mariadb
  • Test database connection: mysql -u glpiuser -p glpidb

Permission Problems:

  • Incorrect file ownership can cause various issues. Fix with:
    sudo chown -R www-data:www-data /var/www/glpi
  • If you see “Access denied” errors in logs, check directory permissions:
    sudo chmod 755 -R /var/www/glpi
    sudo chmod 775 -R /var/www/glpi/files

PHP Configuration Issues:

  • If you encounter memory limit errors, increase the memory_limit in PHP configuration
  • Missing PHP extensions can be installed with:
    sudo apt install php-<extension_name>

Web Server Configuration Problems:

  • Check Apache error logs: sudo tail -f /var/log/apache2/error.log
  • Verify virtual host configuration: sudo apache2ctl -S
  • Restart Apache if needed: sudo systemctl restart apache2

Addressing these common issues promptly ensures a stable GLPI installation. Most problems can be resolved by checking logs and permissions.

Advanced Configuration Options

Once GLPI is installed and running, consider these advanced configurations to enhance functionality:

Integrating with LDAP/Active Directory:

  • Navigate to Administration > Authentication > LDAP directories
  • Configure server details, search filters, and user mapping
  • This allows for centralized user management and single sign-on capabilities

Setting Up Inventory Management:

  • Install the GLPI-Agent on client machines
  • Configure inventory collection schedules
  • Set up network discovery for automatic asset detection

Implementing Backup Solutions:

  • Create a comprehensive backup strategy including:
    • Database backups
    • File system backups
    • Configuration backups
  • Schedule regular automated backups

Performance Optimization:

  • Enable PHP OpCache for improved performance:
    sudo apt install php-opcache
  • Configure MariaDB for optimal performance:
    sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

    Add performance settings based on your server’s resources

These advanced configurations extend GLPI’s capabilities and ensure optimal performance for your environment. Customizing GLPI to your specific needs maximizes its value to your organization.

Congratulations! You have successfully installed GLPI. Thanks for using this tutorial for installing GLPI on Debian 12 “Bookworm” system. For additional help or useful information, we recommend you check the official GLPI website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button