UbuntuUbuntu Based

How To Install GLPI on Ubuntu 24.04 LTS

Install GLPI on Ubuntu 24.04

GLPI (Gestionnaire Libre de Parc Informatique) stands as a powerful open-source IT Service Management (ITSM) platform that offers comprehensive solutions for IT departments of all sizes. With its robust capabilities for inventory management, asset tracking, and help desk functionality, GLPI provides organizations with a cost-effective alternative to expensive proprietary ITSM solutions. When deployed on Ubuntu 24.04 LTS, the latest long-term support release from Canonical, users gain a stable and secure foundation that will receive updates for five years.

This guide walks you through the complete process of installing GLPI on Ubuntu 24.04 LTS, from preparing your system to post-installation configuration. Whether you’re setting up IT asset management for a small business or implementing a full-featured service desk for a large enterprise, this step-by-step tutorial will help you create a robust ITSM solution.

Prerequisites for Installation

Before beginning the GLPI installation process, ensure your environment meets these requirements:

  • A server with Ubuntu 24.04 LTS freshly installed
  • Minimum hardware specifications: 2GB RAM (4GB recommended for production), 2 CPU cores, and at least 20GB storage space
  • A user account with sudo privileges
  • Basic familiarity with Linux command-line operations
  • Active internet connection for downloading packages
  • Properly configured firewall settings (ports 80/443 open for web access)

While not strictly required, having a registered domain name pointed to your server (e.g., glpi.yourdomain.com) enhances usability and prepares your installation for production use. Additionally, implement a backup strategy before making significant system changes to ensure data safety.

Preparing Your Ubuntu System

Start by updating your Ubuntu 24.04 LTS system to ensure all packages are current:

sudo apt update
sudo apt upgrade -y

Install essential utilities that will support the installation process:

sudo apt install -y wget curl nano zip unzip git software-properties-common

Configure your system’s time settings correctly, as accurate time synchronization is crucial for GLPI’s proper operation:

sudo timedatectl set-timezone "Region/City"  # Replace with your timezone
sudo apt install -y ntp
sudo systemctl enable ntp
sudo systemctl start ntp

Set a meaningful hostname that reflects the server’s purpose:

sudo hostnamectl set-hostname glpi-server

Update your hosts file to include this hostname:

sudo nano /etc/hosts

Add or modify the following line:

127.0.1.1   glpi-server

For production environments, consider configuring a static IP address through Netplan to ensure consistent network access to your GLPI instance.

Installing Required Components

GLPI requires several key components to function properly, commonly known as the LAMP stack (Linux, Apache, MySQL/MariaDB, PHP).

Installing Apache Web Server

Install the Apache web server with:

sudo apt install -y apache2

Enable necessary Apache modules for GLPI:

sudo a2enmod rewrite
sudo a2enmod headers
sudo systemctl restart apache2

Verify that Apache is running correctly:

sudo systemctl status apache2

The output should show “active (running)”, confirming Apache is operational.

Installing PHP and Required Extensions

GLPI requires PHP with several specific extensions. Install them using:

sudo apt install -y php php-cli php-common php-json php-mysql \
php-zip php-gd php-mbstring php-curl php-xml php-xmlrpc php-soap \
php-intl php-ldap php-apcu php-bz2 php-redis php-imap \
php-opcache

Verify PHP installation by creating a temporary info file:

echo "" | sudo tee /var/www/html/phpinfo.php

Access this file in your browser at http://your_server_ip/phpinfo.php to confirm PHP is working correctly. For security, remove this file after verification:

sudo rm /var/www/html/phpinfo.php

Installing MariaDB Database Server

Install MariaDB database server:

sudo apt install -y mariadb-server

Start and enable MariaDB:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Verify MariaDB is running properly:

sudo systemctl status mariadb

Database Configuration for GLPI

Secure your MariaDB installation by running the security script:

sudo mysql_secure_installation

Follow the prompts to:

  • Set a root password (if not already set)
  • Remove anonymous users
  • Disallow root login remotely
  • Remove the test database and access to it
  • Reload privilege tables

Now, create a dedicated database and user for GLPI:

sudo mysql -u root -p

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

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

Replace ‘StrongPassword’ with a secure password of your choice. This creates a database named ‘glpidb’ with UTF-8 character encoding and a dedicated user with appropriate permissions.

Optimize MariaDB for GLPI by creating a configuration file:

sudo nano /etc/mysql/mariadb.conf.d/99-glpi.cnf

Add these performance settings:

[mysqld]
innodb_file_per_table = 1
innodb_buffer_pool_size = 512M
max_allowed_packet = 64M
join_buffer_size = 1M
sort_buffer_size = 2M

Restart MariaDB to apply these changes:

sudo systemctl restart mariadb

Downloading and Extracting GLPI

Download the latest stable GLPI version from the official repository. At the time of writing, version 10.0.7 is current, but check for newer releases:

cd /tmp
wget https://github.com/glpi-project/glpi/releases/download/10.0.7/glpi-10.0.7.tgz

Verify the downloaded file’s integrity if checksums are provided:

sha256sum glpi-10.0.7.tgz

Compare this output with the official checksum from the GLPI website or GitHub release page.

Extract the archive to Apache’s document root:

sudo tar -xzf glpi-10.0.7.tgz -C /var/www/html/

Clean up the downloaded archive:

rm glpi-10.0.7.tgz

File Permissions and Ownership

Set the correct ownership for GLPI files:

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

Configure appropriate file permissions:

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

Create and configure specific directories that GLPI requires:

sudo mkdir -p /var/www/html/glpi/files/_dumps
sudo mkdir -p /var/www/html/glpi/files/_sessions
sudo mkdir -p /var/www/html/glpi/files/_cron
sudo mkdir -p /var/www/html/glpi/files/_cache
sudo mkdir -p /var/www/html/glpi/files/_locks
sudo mkdir -p /var/www/html/glpi/files/_plugins
sudo mkdir -p /var/www/html/glpi/files/_tmp

Set specific permissions for these directories:

sudo chmod 775 -R /var/www/html/glpi/files
sudo chown -R www-data:www-data /var/www/html/glpi/files

These permission settings are crucial for GLPI’s functionality, allowing the web server to write necessary files while maintaining security.

Configuring Apache and PHP

Create a dedicated Apache virtual host for GLPI:

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

Add the following configuration:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/glpi
    ServerName glpi.yourdomain.com
    
    <Directory /var/www/html/glpi>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/glpi_error.log
    CustomLog ${APACHE_LOG_DIR}/glpi_access.log combined
</VirtualHost>

Replace glpi.yourdomain.com with your actual domain name or server IP address.

Enable the virtual host:

sudo a2ensite glpi.conf
sudo systemctl reload apache2

Optimize PHP for GLPI by creating a custom configuration:

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

Note: The exact PHP version may vary depending on your Ubuntu 24.04 installation. Adjust the path accordingly.

Add these performance settings:

memory_limit = 256M
file_uploads = on
max_execution_time = 300
post_max_size = 100M
upload_max_filesize = 100M
session.auto_start = 0

Restart Apache to apply these changes:

sudo systemctl restart apache2

Setting Up GLPI Directory Structure

Configure GLPI to use a more standardized directory structure following the Filesystem Hierarchy Standard (FHS):

sudo mkdir -p /etc/glpi
sudo mkdir -p /var/lib/glpi
sudo mkdir -p /var/log/glpi

Create a local configuration file to define these paths:

sudo nano /var/www/html/glpi/inc/local_define.php

Add the following content:

<?php
define('GLPI_CONFIG_DIR', '/etc/glpi');
define('GLPI_VAR_DIR', '/var/lib/glpi');
define('GLPI_LOG_DIR', '/var/log/glpi');

Move the configuration files to their new location:

sudo cp /var/www/html/glpi/config/* /etc/glpi/

Set appropriate permissions:

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

This directory structure improves security and makes maintenance easier by separating configuration files, variable data, and logs according to Linux standards.

Web-based Installation Process

Complete the installation through GLPI’s web interface:

  1. Open your web browser and navigate to http://your_server_ip/glpi or http://glpi.yourdomain.comInstall GLPI on Ubuntu 24.04 LTS
  2. Select your preferred language and click “OK”
  3. Accept the license agreement (GNU General Public License v2+)
  4. The installer will perform a compatibility check to verify all requirements are met. If any issues are found, resolve them before continuing
  5. Choose “Install” for a fresh installation
  6. Configure the database connection with the details you created earlier:
    • Database Host: localhost
    • Database User: glpiuser
    • Database Password: StrongPassword (the one you set)
    • Database Name: glpidb
  7. Click “Continue” to proceed with database initialization
  8. The installer will populate the database with the necessary tables and default data. This may take several minutes depending on your system performance
  9. Once complete, select all options for data to be imported and click “Continue”
  10. Create the database administrator account or retain the default credentials for now
  11. Click “Use GLPI” to access your new installation

If you encounter any errors during this process, the installer will provide specific information about what went wrong, allowing you to address the issue before continuing.

Post-Installation Steps

After successful installation, perform these important security steps:

Remove the installation files to prevent reinstallation and potential security risks:

sudo rm -rf /var/www/html/glpi/install

GLPI comes with several default accounts:

  • glpi/glpi (administrative account)
  • tech/tech (technician account)
  • normal/normal (regular user account)
  • post-only/post-only (limited account)

Log in with the glpi/glpi account and immediately change these default passwords by navigating to Administration > Users, selecting each user, and updating their password.

Configure administration email and notifications:

  1. Go to Setup > General > Assistance
  2. Set up your administrator email and notification preferences

Set up automated tasks through cron jobs:

sudo nano /etc/cron.d/glpi

Add the following line:

*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php

This runs GLPI’s automated tasks every 2 minutes, handling notifications, scheduled backups, and other maintenance activities.

For enhanced security in production environments, consider setting up HTTPS with Let’s Encrypt:

sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d glpi.yourdomain.com

Follow the prompts to complete HTTPS setup, which provides encrypted connections to your GLPI instance.

Troubleshooting Common Issues

Permission Problems

If you encounter permission errors in GLPI’s interface or logs:

sudo find /var/www/html/glpi -type d -exec chmod 755 {} \;
sudo find /var/www/html/glpi -type f -exec chmod 644 {} \;
sudo chmod 775 -R /var/www/html/glpi/files
sudo chown -R www-data:www-data /var/www/html/glpi

For custom directory structure, also check:

sudo chown -R www-data:www-data /etc/glpi
sudo chown -R www-data:www-data /var/lib/glpi
sudo chown -R www-data:www-data /var/log/glpi

Database Connection Issues

If GLPI can’t connect to the database:

  1. Verify database credentials in /etc/glpi/config_db.php
  2. Check that MariaDB is running: sudo systemctl status mariadb
  3. Confirm database permissions:
    sudo mysql -u root -p
    SHOW GRANTS FOR 'glpiuser'@'localhost';

PHP Configuration Errors

If PHP modules are missing or misconfigured:

  1. Verify PHP extensions: php -m | grep -E 'mysql|gd|mbstring|curl|xml|zip'
  2. Install any missing extensions: sudo apt install -y php-missing-extension
  3. Check PHP version compatibility: php -v

Log File Analysis

When troubleshooting, check GLPI logs for detailed error information:

sudo tail -f /var/log/glpi/php-errors.log
sudo tail -f /var/log/apache2/glpi_error.log

These logs often contain specific error messages that can help identify the root cause of issues.

Maintaining and Updating GLPI

Implement regular backup procedures to protect your GLPI data:

sudo mkdir -p /backup/glpi

Create a backup script:

sudo nano /usr/local/bin/backup-glpi.sh

Add the following content:

#!/bin/bash
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_DIR="/backup/glpi"

# Backup database
mysqldump -u glpiuser -p'StrongPassword' glpidb > $BACKUP_DIR/glpidb_$TIMESTAMP.sql

# Backup files
tar -czf $BACKUP_DIR/glpifiles_$TIMESTAMP.tar.gz /var/www/html/glpi /etc/glpi

# Remove backups older than 30 days
find $BACKUP_DIR -name "glpi*" -mtime +30 -delete

Make the script executable and set up a cron job:

sudo chmod +x /usr/local/bin/backup-glpi.sh
sudo nano /etc/cron.d/glpi-backup

Add:

0 2 * * * root /usr/local/bin/backup-glpi.sh > /var/log/glpi-backup.log 2>&1

This performs daily backups at 2 AM.

Keeping GLPI Updated

When a new version is released:

  1. Back up your current installation:
    sudo /usr/local/bin/backup-glpi.sh
  2. Download the new version:
    cd /tmp
    wget https://github.com/glpi-project/glpi/releases/download/new_version/glpi-new_version.tgz
  3. Extract the new version to a temporary location:
    sudo mkdir /tmp/glpi-new
    sudo tar -xzf glpi-new_version.tgz -C /tmp/glpi-new
  4. Put GLPI in maintenance mode through the web interface (Setup > Maintenance) or:
    sudo touch /var/www/html/glpi/OFFLINE
  5. Replace files but preserve configuration:
    sudo cp -a /var/www/html/glpi/files /tmp/glpi-files-backup
    sudo cp -a /etc/glpi /tmp/glpi-config-backup
    sudo rsync -av --exclude='files' --exclude='config' /tmp/glpi-new/glpi/ /var/www/html/glpi/
  6. Restore permissions:
    sudo chown -R www-data:www-data /var/www/html/glpi
  7. Run the update script by accessing your GLPI URL and following the on-screen instructions
  8. Remove maintenance mode:
    sudo rm /var/www/html/glpi/OFFLINE

Regular updates ensure you have the latest features and security patches.

Congratulations! You have successfully installed GLPI. Thanks for using this tutorial for installing GLPI on Ubuntu 24.04 LTS 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